Class: BattleUI::TargetSelection

Inherits:
UI::SpriteStack show all
Includes:
TargetSelectionAbstraction
Defined in:
scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00400 TargetSelection.rb

Defined Under Namespace

Classes: Button

Constant Summary collapse

SKIP_NO_CHOICE_SKILL =
true

Constants inherited from UI::SpriteStack

UI::SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary

Attributes included from TargetSelectionAbstraction

#result

Attributes inherited from UI::SpriteStack

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TargetSelectionAbstraction

#validated?

Methods inherited from UI::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_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport, launcher, move, logic) ⇒ TargetSelection

Create a new TargetSelection

Parameters:



10
11
12
13
14
15
16
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00400 TargetSelection.rb', line 10

def initialize(viewport, launcher, move, logic)
  super(viewport)
  initialize_data(launcher, move, logic)
  @animation_handler = Yuki::Animation::Handler.new
  create_sprites
  update_cursor(true) if @allow_selection
end

Class Method Details

.cannot_show?(move, pokemon, logic) ⇒ Boolean

Tell if the UI can be shown or not

Parameters:

Returns:

  • (Boolean)


108
109
110
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00400 TargetSelection.rb', line 108

def cannot_show?(move, pokemon, logic)
  (move.no_choice_skill? && SKIP_NO_CHOICE_SKILL) || move.battler_targets(pokemon, logic).empty?
end

Instance Method Details

#update

Update the Window cursor



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00400 TargetSelection.rb', line 19

def update
  super
  return @animation_handler.update unless @animation_handler.done?
  return if validated?
  return validate if Input.trigger?(:A) || Mouse.trigger?(:LEFT)
  return cancel if Input.trigger?(:B) || Mouse.trigger?(:RIGHT)
  return unless @allow_selection

  last_index = @index
  update_key_index
  update_mouse_index
  update_cursor if last_index != @index && @allow_selection
end