Class: Battle::Visual

Inherits:
Object show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00205 Info_Bars.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00206 Show_stuff.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00201 Trainer_transition.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00202 Show_player_choice.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00100 RBYWild.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00000 Transition.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00100 RBYTrainer.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00203 Show_skill_or_target_choice.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00204 Show_item_or_pokemon_choice.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00001 Animations/01001 HPAnimation.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00200 Gen6Trainer.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00001 Animations/01002 FakeHPAnimation.rb,
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00001 Animations/01000 IdlePokemonAnimation.rb

Overview

Class that manage all the thing that are visually seen on the screen

Defined Under Namespace

Modules: Transition Classes: FakeHPAnimation, HPAnimation, IdlePokemonAnimation

Constant Summary collapse

BACKGROUND_NAMES =

Name of the background according to their processed zone_type

%w[back_building back_grass back_tall_grass back_taller_grass back_cave
back_mount back_sand back_pond back_sea back_under_water back_ice back_snow]
BAG_PARTY_POSITIONS =

Variable giving the position of the battlers to show from bank 0 in bag UI

0..5

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scene) ⇒ Visual

Create a new visual instance

Parameters:

  • scene (Scene)

    scene that hold the logic object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 25

def initialize(scene)
  @scene = scene
  @screenshot = take_snapshot
  # All the battler by bank
  @battlers = {}
  # All the bars by bank
  @info_bars = {}
  # All the team info bar by bank
  @team_info = {}
  # All the ability bar by bank
  # @type [Hash{ Integer => Array<BattleUI::AbilityBar> }]
  @ability_bars = {}
  # All the item bar by bank
  # @type [Hash{ Integer => Array<BattleUI::ItemBar> }]
  @item_bars = {}
  # All the animation currently being processed (automatically removed)
  @animations = []
  # All the animatable object
  @animatable = []
  # All the parallel animations (manually removed)
  @parallel_animations = {}
  # All the thing to dispose on #dispose
  @to_dispose = []
  # Is the visual locking the update of the battle
  @locking = false
  # Create all the sprites
  create_graphics
  create_battle_animation_handler
  @viewport&.sort_z
end

Instance Attribute Details

#animationsArray (readonly)

Returns List of the animation.

Returns:

  • (Array)

    List of the animation



12
13
14
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 12

def animations
  @animations
end

#parallel_animationsHash (readonly)

Returns List of the parallel animation.

Returns:

  • (Hash)

    List of the parallel animation



9
10
11
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 9

def parallel_animations
  @parallel_animations
end

#to_disposeArray (readonly)

Returns the element to dispose on #dispose.

Returns:

  • (Array)

    the element to dispose on #dispose



21
22
23
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 21

def to_dispose
  @to_dispose
end

#viewportViewport (readonly)

Returns the viewport used to show the sprites.

Returns:

  • (Viewport)

    the viewport used to show the sprites



15
16
17
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 15

def viewport
  @viewport
end

#viewport_subViewport (readonly)

Returns the viewport used to show some UI part.

Returns:

  • (Viewport)

    the viewport used to show some UI part



18
19
20
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 18

def viewport_sub
  @viewport_sub
end

Instance Method Details

#battler_sprite(bank, position) ⇒ BattleUI::PokemonSprite?

Retrieve the sprite of a battler

Parameters:

  • bank (Integer)

    bank where the battler should be

  • position (Integer, Symbol)

    Position of the battler

Returns:



41
42
43
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00201 Trainer_transition.rb', line 41

def battler_sprite(bank, position)
  @battlers.dig(bank, position)
end

#dispose

Dispose the visuals



76
77
78
79
80
81
82
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 76

def dispose
  @to_dispose.each(&:dispose)
  @animations.clear
  @parallel_animations.clear
  @viewport.dispose
  @viewport_sub.dispose
end

#hide_ability(target)

Hide the ability animation (no effect if no_go_out = false)

Parameters:



63
64
65
66
67
68
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00206 Show_stuff.rb', line 63

def hide_ability(target)
  ability_bar = @ability_bars[target.bank][target.position]
  return unless ability_bar || ability_bar.no_go_out

  ability_bar.go_out
end

#hide_info_bar(pokemon)

Show a specific bar

Parameters:



46
47
48
49
50
51
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00205 Info_Bars.rb', line 46

def hide_info_bar(pokemon)
  # @type [BattleUI::InfoBar]
  bar = @info_bars.dig(pokemon.bank, pokemon.position)
  return log_error("No battle bar at position #{pokemon.bank}, #{pokemon.position}") unless bar
  bar.go_out unless bar.out?
end

#hide_info_bars(no_animation = false, bank: nil)

Hide all the bars

Parameters:

  • no_animation (Boolean) (defaults to: false)

    skip the going out animation

  • bank (Integer, nil) (defaults to: nil)

    bank where the info bar should be hidden



6
7
8
9
10
11
12
13
14
15
16
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00205 Info_Bars.rb', line 6

def hide_info_bars(no_animation = false, bank: nil)
  enum = bank ? [@info_bars[bank]].each : @info_bars.each_value

  enum.each do |info_bars|
    if no_animation
      info_bars.each { |bar| bar.visible = false }
    else
      info_bars.each { |bar| bar.go_out unless bar.out? }
    end
  end
end

#hide_team_info

Hide team info



89
90
91
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00205 Info_Bars.rb', line 89

def hide_team_info
  @team_info.each_value { |info| info.go_out unless info.out? }
end

#lock

Lock the battle scene



95
96
97
98
99
100
101
102
103
104
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 95

def lock
  if block_given?
    raise 'Race condition' if locking?

    @locking = true
    yield
    return @locking = false
  end
  @locking = true
end

#locking?Boolean

Tell if the visual are locking the battle update (for transition purpose)

Returns:

  • (Boolean)


85
86
87
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 85

def locking?
  @locking
end

#refresh_info_bar(pokemon)

Refresh a specific bar (when Pokemon loses HP or change state)

Parameters:



55
56
57
58
59
60
61
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00205 Info_Bars.rb', line 55

def refresh_info_bar(pokemon)
  # @type [BattleUI::InfoBar]
  bar = @info_bars.dig(pokemon.bank, pokemon.position)
  @team_info[pokemon.bank]&.refresh
  return log_error("No battle bar at position #{pokemon.bank}, #{pokemon.position}") unless bar
  bar.refresh
end

#scene_update_proc { ... }

Note:

this function raise if the visual are not locked

Display animation & stuff like that by updating the scene

Yields:

  • yield the given block without argument



109
110
111
112
113
114
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 109

def scene_update_proc
  raise 'Unlocked visual while trying to update scene!' unless @locking
  yield
  @scene.update
  Graphics.update
end

#set_info_state(state, pokemon = nil)

Set the state info

Parameters:

  • state (Symbol)

    kind of state (:choice, :move, :move_animation)

  • pokemon (Array<PFM::PokemonBattler>) (defaults to: nil)

    optional list of Pokemon to show (move)



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00205 Info_Bars.rb', line 66

def set_info_state(state, pokemon = nil)
  if state == :choice
    show_info_bars(bank: 1)
    hide_info_bars(bank: 0)
    show_team_info
  elsif state == :move
    hide_info_bars
    pokemon&.each { |target| show_info_bar(target) }
  elsif state == :move_animation
    hide_info_bars
    hide_team_info
  end
end

#show_ability(target, no_go_out = false)

Show the ability animation

Parameters:

  • target (PFM::PokemonBattler)
  • no_go_out (Boolean) (defaults to: false)

    Set if the out animation should be not played automatically



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00206 Show_stuff.rb', line 47

def show_ability(target, no_go_out = false)
  ability_bar = @ability_bars[target.bank][target.position]
  item_bar = @item_bars[target.bank][target.position]
  return unless ability_bar

  ability_bar.data = target
  ability_bar.go_in_ability(no_go_out)
  if !item_bar || item_bar.done?
    ability_bar.z = 0
  else
    ability_bar.z = item_bar.z + 1
  end
end

#show_catch_animation(target_pokemon, ball, nb_bounce, caught)

Show the catching animation

Parameters:



140
141
142
143
144
145
146
147
148
149
150
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00206 Show_stuff.rb', line 140

def show_catch_animation(target_pokemon, ball, nb_bounce, caught)
  origin = battler_sprite(0, 0)
  target = battler_sprite(target_pokemon.bank, target_pokemon.position)
  sprite = UI::ThrowingBallSprite.new(origin.viewport, ball)
  animation = create_throw_ball_animation(sprite, target, origin)
  create_move_ball_animation(animation, sprite, nb_bounce)
  caught ? create_caught_animation(animation, sprite) : create_break_animation(animation, sprite, target)
  animation.start
  @animations << animation
  wait_for_animation
end

#show_exp_distribution(exp_data)

Show the exp distribution

Parameters:



124
125
126
127
128
129
130
131
132
133
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00206 Show_stuff.rb', line 124

def show_exp_distribution(exp_data)
  lock do
    exp_ui = BattleUI::ExpDistribution.new(@viewport_sub, @scene, exp_data)
    @scene.display_message_and_wait(ext_text(8999, 21))
    exp_ui.start_animation
    scene_update_proc { exp_ui.update } until exp_ui.done?
    exp_ui.dispose
  end
  exp_data.each_key { |pokemon| refresh_info_bar(pokemon) if pokemon.can_fight? }
end

#show_hp_animations(targets, hps, effectiveness = [], &messages)

Show HP animations

Parameters:

  • targets (Array<PFM::PokemonBattler>)
  • hps (Array<Integer>)
  • effectiveness (Array<Integer, nil>) (defaults to: [])
  • messages (Proc)

    messages shown right before the post processing



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00206 Show_stuff.rb', line 8

def show_hp_animations(targets, hps, effectiveness = [], &messages)
  lock do
    animations = targets.map.with_index do |target, index|
      show_info_bar(target)
      if hps[index] && hps[index] == 0
        next Battle::Visual::FakeHPAnimation.new(@scene, target, effectiveness[index])
      elsif hps[index]
        next Battle::Visual::HPAnimation.new(@scene, target, hps[index], effectiveness[index])
      end
    end
    wait_for_animation
    scene_update_proc { animations.each(&:update) } until animations.all?(&:done?)
    messages&.call
    show_kos(targets)
  end
end

#show_info_bar(pokemon)

Show a specific bar

Parameters:



34
35
36
37
38
39
40
41
42
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00205 Info_Bars.rb', line 34

def show_info_bar(pokemon)
  # @type [BattleUI::InfoBar]
  bar = @info_bars.dig(pokemon.bank, pokemon.position)
  return log_error("No battle bar at position #{pokemon.bank}, #{pokemon.position}") unless bar
  bar.pokemon = pokemon
  return if pokemon.dead?

  bar.go_in unless bar.in?
end

#show_info_bars(bank: nil)

Show all the bars

Parameters:

  • bank (Integer, nil) (defaults to: nil)

    bank where the info bar should be hidden



20
21
22
23
24
25
26
27
28
29
30
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00205 Info_Bars.rb', line 20

def show_info_bars(bank: nil)
  enum = bank ? [@info_bars[bank]].each : @info_bars.each_value
  enum.each do |info_bars|
    info_bars.each do |bar|
      bar.pokemon = bar.pokemon
      next bar.visible = false unless bar.pokemon&.alive?

      bar.go_in unless bar.in?
    end
  end
end

#show_item(target)

Show the item user animation

Parameters:



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00206 Show_stuff.rb', line 72

def show_item(target)
  ability_bar = @ability_bars[target.bank][target.position]
  item_bar = @item_bars[target.bank][target.position]
  return unless item_bar

  item_bar.data = target
  item_bar.go_in_ability
  item_bar.z = ability_bar.z + 1 unless !ability_bar || ability_bar.done?
  if !ability_bar || ability_bar.done?
    item_bar.z = 0
  else
    item_bar.z = ability_bar.z + 1
  end
end

#show_item_choicePFM::ItemDescriptor::Wrapper?

Method that show the item choice



7
8
9
10
11
12
13
14
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00204 Show_item_or_pokemon_choice.rb', line 7

def show_item_choice
  data_to_return = nil
  GamePlay.open_battle_bag(retrieve_party) do |battle_bag_scene|
    data_to_return = battle_bag_scene.battle_item_wrapper
  end
  log_debug("show_item_choice returned #{data_to_return}")
  return data_to_return
end

#show_kos(targets)

Show KO animations

Parameters:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00206 Show_stuff.rb', line 27

def show_kos(targets)
  targets = targets.select(&:dead?)
  return if targets.empty?

  play_ko_se
  # Start all animations
  targets.each do |target|
    battler_sprite(target.bank, target.position).go_out
    hide_info_bar(target)
  end
  # Show messages
  targets.each do |target|
    @scene.display_message_and_wait(parse_text_with_pokemon(19, 0, target, PFM::Text::PKNICK[0] => target.given_name))
    target.status = 0
  end
end

#show_move_animation(user, targets, move)

Make a move animation

Parameters:



98
99
100
101
102
103
104
105
106
107
108
109
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00206 Show_stuff.rb', line 98

def show_move_animation(user, targets, move)
  return unless $options.show_animation

  $data_animations ||= load_data('Data/Animations.rxdata')
  id = move.id
  user_sprite = battler_sprite(user.bank, user.position)
  target_sprite = battler_sprite(targets.first.bank, targets.first.position)
  original_rect = @viewport.rect.clone
  @viewport.rect.height = Viewport::CONFIGS[:main][:height]
  lock { @move_animator.move_animation(user_sprite, target_sprite, id, user.bank != 0) }
  @viewport.rect = original_rect
end

#show_player_choice(pokemon_index) ⇒ Symbol, ...

Method that shows the trainer choice

Parameters:

  • pokemon_index (Integer)

    Index of the Pokemon in the party

Returns:

  • (Symbol, Array(Symbol, Hash), nil)

    :attack, :bag, :pokemon, :flee, :cancel, :try_next



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00202 Show_player_choice.rb', line 6

def show_player_choice(pokemon_index)
  if (pokemon = @scene.logic.battler(0, pokemon_index)).effects.has?(&:force_next_move?)
    # @type [Effects::ForceNextMove]
    effect = pokemon.effects.get(&:force_next_move?)
    return :action, effect.make_action
  end

  # return :try_next if spc_cannot_use_this_pokemon?(pokemon_index)
  show_player_choice_begin(pokemon_index)
  show_player_choice_loop
  show_player_choice_end(pokemon_index)
  return @player_choice_ui.result, @player_choice_ui.action
end

#show_pokemon_choice(forced = false) ⇒ PFM::PokemonBattler?

Method that show the pokemon choice

Parameters:

  • forced (Boolean) (defaults to: false)

Returns:



19
20
21
22
23
24
25
26
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00204 Show_item_or_pokemon_choice.rb', line 19

def show_pokemon_choice(forced = false)
  data_to_return = nil
  GamePlay.open_party_menu_to_switch(party = retrieve_party, forced) do |scene|
    data_to_return = party[scene.return_data] if scene.pokemon_selected?
  end
  log_debug("show_pokemon_choice returned #{data_to_return}")
  return data_to_return
end

#show_pre_transition

Method that show the pre_transition of the battle



4
5
6
7
8
9
10
11
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00201 Trainer_transition.rb', line 4

def show_pre_transition
  # return if debug? && ARGV.includes?('skip_battle_transition')
  # @type [Battle::Visual::RBJ_WildTransition]
  @transition = battle_transition.new(@scene, @screenshot)
  @animations << @transition
  @transition.pre_transition
  @locking = true
end

#show_rmxp_animation(target, id)

Show a dedicated animation

Parameters:



114
115
116
117
118
119
120
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00206 Show_stuff.rb', line 114

def show_rmxp_animation(target, id)
  return unless $options.show_animation

  wait_for_animation
  $data_animations ||= load_data('Data/Animations.rxdata')
  lock { @move_animator.animation(battler_sprite(target.bank, target.position), id, target.bank != 0) }
end

#show_skill_choice(pokemon_index) ⇒ Boolean

Method that show the skill choice and store it inside an instance variable

Parameters:

  • pokemon_index (Integer)

    Index of the Pokemon in the party

Returns:

  • (Boolean)

    if the player has choose a skill



6
7
8
9
10
11
12
13
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00203 Show_skill_or_target_choice.rb', line 6

def show_skill_choice(pokemon_index)
  return :try_next if spc_cannot_use_this_pokemon?(pokemon_index)

  show_skill_choice_begin(pokemon_index)
  show_skill_choice_loop
  show_skill_choice_end(pokemon_index)
  return @skill_choice_ui.result != :cancel
end

#show_switch_form_animation(target)

Show the pokemon switch form animation

Parameters:



89
90
91
92
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00206 Show_stuff.rb', line 89

def show_switch_form_animation(target)
  battler_sprite(target.bank, target.position)&.pokemon = target
  # TODO: Implement an animation for that & write the code
end

#show_target_choiceArray<PFM::PokemonBattler, Battle::Move, Integer(bank), Integer(position), Boolean(mega)>?

Method that show the target choice once the skill was choosen

Returns:



17
18
19
20
21
22
23
24
25
26
27
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00203 Show_skill_or_target_choice.rb', line 17

def show_target_choice
  return stc_result if stc_cannot_choose_target?

  show_target_choice_begin
  show_target_choice_loop
  show_target_choice_end
  return stc_result(@target_selection_window.result)
ensure
  @target_selection_window&.dispose
  @target_selection_window = nil
end

#show_team_info

Show team info



81
82
83
84
85
86
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00205 Info_Bars.rb', line 81

def show_team_info
  @team_info.each_value do |info|
    info.refresh
    info.go_in unless info.in?
  end
end

#show_transition

Method that show the trainer transition of the battle



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00201 Trainer_transition.rb', line 14

def show_transition
  # return show_debug_transition if debug? && ARGV.includes?('skip_battle_transition')
  # Load transtion (x/y, dpp, frlg)
  # store the transition loop
  # Show the message "issuing a battle"
  # store the enemy ball animation
  # Show the message "send x & y"
  # store the actor ball animation
  # show the message "send x & y"
  @animations << @transition
  @transition.transition
  @locking = true
end

#snap_to_bitmapsArray<Texture>

Snap all viewports to bitmap

Returns:



128
129
130
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 128

def snap_to_bitmaps
  return [@viewport, @viewport_sub].map(&:snap_to_bitmap)
end

#spc_show_message(pokemon_index)

Show the message “What will X do”

Parameters:



22
23
24
25
26
27
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00202 Show_player_choice.rb', line 22

def spc_show_message(pokemon_index)
  # pokemon = @scene.logic.battler(0, pokemon_index)
  @scene.message_window.wait_input = false
  # text_to_show = parse_text(18, 71, '[VAR 010C(0000)]' => pokemon.given_name)
  # @scene.display_message(text_to_show) if @scene.message_window.last_text != text_to_show
end

#store_battler_sprite(bank, position, sprite)

Function storing a battler sprite in the battler Hash

Parameters:

  • bank (Integer)

    bank where the battler should be

  • position (Integer, Symbol)

    Position of the battler

  • sprite (Sprite)

    battler sprite to set



32
33
34
35
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00201 Trainer_transition.rb', line 32

def store_battler_sprite(bank, position, sprite)
  @battlers[bank] ||= {}
  @battlers[bank][position] = sprite
end

#to_s Also known as: inspect

Safe to_s & inspect



57
58
59
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 57

def to_s
  format('#<%<class>s:%<id>08X>', class: self.class, id: __id__)
end

#unlock

Unlock the battle scene



90
91
92
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 90

def unlock
  @locking = false
end

#update

Update the visuals



63
64
65
66
67
68
69
70
71
72
73
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 63

def update
  @animations.each(&:update)
  @animations.delete_if(&:done?)
  @parallel_animations.each_value(&:update)
  @gif_container&.update(@background.bitmap)
  update_battlers
  update_info_bars
  update_team_info
  update_ability_bars
  update_item_bars
end

#wait_for_animation

Wait for all animation to end (non parallel one)



117
118
119
120
121
122
123
124
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00200 Visual.rb', line 117

def wait_for_animation
  # log_debug('Entring wait_for_animation') # uncomment for deep debug
  was_locked = @locking
  lock unless was_locked
  scene_update_proc { update } until @animations.all?(&:done?) && @animatable.all?(&:done?)
  unlock unless was_locked
  # log_debug('Leaving wait_for_animation') # uncomment for deep debug
end