Class: UI::Summary_Stat

Inherits:
SpriteStack show all
Defined in:
scripts/01450 Systems/00102 Party/00002 UI/00300 Summary_Stat.rb

Overview

UI part displaying the Stats of a Pokemon in the Summary

Constant Summary collapse

SHOW_IV =

Show the IV ?

true
SHOW_EV =

Show the EV ?

true

Constants inherited from SpriteStack

UI::SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary

Attributes inherited from SpriteStack

#animated, #data, #moving, #stack, #viewport, #x, #y

Instance Method Summary collapse

Methods inherited from SpriteStack

#[], #add_background, #add_line, #add_text, #anime, #anime_delta_set, #dispose, #each, #execute_anime, #move, #move_to, #opacity, #opacity=, #push, #push_sprite, #set_origin, #set_position, #simple_mouse_in?, #size, #stop_animation, #translate_mouse_coords, #update, #update_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport) ⇒ Summary_Stat

Create a new Stat UI for the summary

Parameters:



10
11
12
13
# File 'scripts/01450 Systems/00102 Party/00002 UI/00300 Summary_Stat.rb', line 10

def initialize(viewport)
  super(viewport, 0, 0, default_cache: :interface)
  init_sprite
end

Instance Method Details

#data=(pokemon)

Set the Pokemon shown by the UI

Parameters:



17
18
19
20
21
22
23
24
25
26
27
# File 'scripts/01450 Systems/00102 Party/00002 UI/00300 Summary_Stat.rb', line 17

def data=(pokemon)
  super
  @nature_text.text = PFM::Text.parse(28, pokemon.nature_id)
  # Load the stat color according to the nature
  nature = pokemon.nature.partition.with_index { |nat, i| i != 3}.flatten(1)
  1.upto(5) do |i|
    color = nature[i] < 100 ? 23 : 22
    color = 0 if nature[i] == 100
    @stat_name_texts[i - 1].load_color(color)
  end
end