Class: Battle::Visual

Inherits:
Object show all
Defined in:
docs/5_Battle_02_Visual.rb

Overview

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

Direct Known Subclasses

Visual3D

Defined Under Namespace

Modules: Transition Classes: FakeHPAnimation, HPAnimation, IdlePokemonAnimation

Constant Summary collapse

BAG_PARTY_POSITIONS =

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

0..5

Instance Attribute Summary collapse

Class Method 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



31
32
# File 'docs/5_Battle_02_Visual.rb', line 31

def initialize(scene)
end

Instance Attribute Details

#animations ⇒ Array (readonly)

Returns List of the animation.

Returns:

  • (Array) —

    List of the animation



18
19
20
# File 'docs/5_Battle_02_Visual.rb', line 18

def animations
  @animations
end

#background ⇒ ShaderedSprite

Returns the background sprite.

Returns:



26
27
28
# File 'docs/5_Battle_02_Visual.rb', line 26

def background
  @background
end

#camera_positionner

Not used in Visual (avoid crash when using MoveAnimation)



28
29
30
# File 'docs/5_Battle_02_Visual.rb', line 28

def camera_positionner
  @camera_positionner
end

#parallel_animations ⇒ Hash (readonly)

Returns List of the parallel animation.

Returns:

  • (Hash) —

    List of the parallel animation



16
17
18
# File 'docs/5_Battle_02_Visual.rb', line 16

def parallel_animations
  @parallel_animations
end

#to_dispose ⇒ Array (readonly)

Returns the element to dispose on #dispose.

Returns:

  • (Array) —

    the element to dispose on #dispose



24
25
26
# File 'docs/5_Battle_02_Visual.rb', line 24

def to_dispose
  @to_dispose
end

#viewport ⇒ Viewport (readonly)

Returns the viewport used to show the sprites.

Returns:

  • (Viewport) —

    the viewport used to show the sprites



20
21
22
# File 'docs/5_Battle_02_Visual.rb', line 20

def viewport
  @viewport
end

#viewport_sub ⇒ Viewport (readonly)

Returns the viewport used to show some UI part.

Returns:

  • (Viewport) —

    the viewport used to show some UI part



22
23
24
# File 'docs/5_Battle_02_Visual.rb', line 22

def viewport_sub
  @viewport_sub
end

Class Method Details

.register_transition_resource(id, resource_type)

Note:

If no resource type was registered, will send the default sprite one

Register the transition resource type for a specific transition

Parameters:

  • id (Integer) —

    id of the transition

  • resource_type (Symbol) —

    the symbol of the resource_type (:sprite, :artwork_full, :artwork_small)



188
189
# File 'docs/5_Battle_02_Visual.rb', line 188

def register_transition_resource(id, resource_type)
end

.transition_resource_hash ⇒ Hash{ Integer => Symbol }

Return the transition resource type hash

Returns:

  • (Hash{ Integer => Symbol })


182
183
# File 'docs/5_Battle_02_Visual.rb', line 182

def transition_resource_hash
end

.transition_resource_type_for(id) ⇒ Symbol

Return the transition resource type for a given transition ID

Parameters:

  • id (Integer) —

    ID of the transition

Returns:

  • (Symbol)


193
194
# File 'docs/5_Battle_02_Visual.rb', line 193

def transition_resource_type_for(id)
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:



172
173
# File 'docs/5_Battle_02_Visual.rb', line 172

def battler_sprite(bank, position)
end

#dark_tone_animation

Not used in classic Visual, feel free to implement it by monkey-patching this function or through a MR



649
650
# File 'docs/5_Battle_02_Visual.rb', line 649

def dark_tone_animation
end

#dispose

Dispose the visuals



41
42
# File 'docs/5_Battle_02_Visual.rb', line 41

def dispose
end

#heal_status_remove_tone(target)

remove the tone animation

Parameters:



398
399
# File 'docs/5_Battle_02_Visual.rb', line 398

def heal_status_remove_tone(target)
end

#hide_ability(target)

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

Parameters:



411
412
# File 'docs/5_Battle_02_Visual.rb', line 411

def hide_ability(target)
end

#hide_info_bar(pokemon)

Show a specific bar

Parameters:



353
354
# File 'docs/5_Battle_02_Visual.rb', line 353

def hide_info_bar(pokemon)
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



341
342
# File 'docs/5_Battle_02_Visual.rb', line 341

def hide_info_bars(no_animation = false, bank: nil)
end

#hide_team_info

Hide team info



368
369
# File 'docs/5_Battle_02_Visual.rb', line 368

def hide_team_info
end

#lock

Lock the battle scene



50
51
# File 'docs/5_Battle_02_Visual.rb', line 50

def lock
end

#locking? ⇒ Boolean

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

Returns:

  • (Boolean)


44
45
# File 'docs/5_Battle_02_Visual.rb', line 44

def locking?
end

#refresh_info_bar(pokemon)

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

Parameters:



357
358
# File 'docs/5_Battle_02_Visual.rb', line 357

def refresh_info_bar(pokemon)
end

#reset_tone_animation

Not used in classic Visual, feel free to implement it by monkey-patching this function or through a MR



652
653
# File 'docs/5_Battle_02_Visual.rb', line 652

def reset_tone_animation
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



55
56
# File 'docs/5_Battle_02_Visual.rb', line 55

def scene_update_proc
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)



362
363
# File 'docs/5_Battle_02_Visual.rb', line 362

def set_info_state(state, pokemon = nil)
end

#shift_battler_sprite(who, with)

Shift two battler sprites

Parameters:



177
178
# File 'docs/5_Battle_02_Visual.rb', line 177

def shift_battler_sprite(who, with)
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



407
408
# File 'docs/5_Battle_02_Visual.rb', line 407

def show_ability(target, no_go_out = false)
end

#show_bait_mud_animation(target_pokemon, bait_mud)

Show the bait or mud throw animation if Safari Battle

Parameters:

  • target_pokemon (PFM::PokemonBattler) —

    pokemon being thrown something at

  • bait_mud (Symbol) —

    :bait or :mud, depending on the player's choice



549
550
# File 'docs/5_Battle_02_Visual.rb', line 549

def show_bait_mud_animation(target_pokemon, bait_mud)
end

#show_catch_animation(target_pokemon, ball, nb_bounce, caught)

Show the catching animation

Parameters:

  • target_pokemon (PFM::PokemonBattler) —

    pokemon being caught

  • ball (Studio::BallItem) —

    ball used

  • nb_bounce (Integer) —

    number of time the ball move

  • caught (Integer) —

    if the pokemon got caught



445
446
# File 'docs/5_Battle_02_Visual.rb', line 445

def show_catch_animation(target_pokemon, ball, nb_bounce, caught)
end

#show_catch_blocked_animation(target_pokemon, ball)

Show the catch blocked animation (ball thrown then bounces back)

Parameters:



450
451
# File 'docs/5_Battle_02_Visual.rb', line 450

def show_catch_blocked_animation(target_pokemon, ball)
end

#show_exp_distribution(exp_data)

Show the exp distribution

Parameters:

  • exp_data (Hash{ PFM::PokemonBattler => Integer }) —

    info about experience each pokemon should receive



438
439
# File 'docs/5_Battle_02_Visual.rb', line 438

def show_exp_distribution(exp_data)
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



376
377
# File 'docs/5_Battle_02_Visual.rb', line 376

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

#show_info_bar(pokemon)

Show a specific bar

Parameters:



349
350
# File 'docs/5_Battle_02_Visual.rb', line 349

def show_info_bar(pokemon)
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



345
346
# File 'docs/5_Battle_02_Visual.rb', line 345

def show_info_bars(bank: nil)
end

#show_item(target)

Show the item user animation

Parameters:



415
416
# File 'docs/5_Battle_02_Visual.rb', line 415

def show_item(target)
end

#show_item_choice ⇒ PFM::ItemDescriptor::Wrapper?

Method that show the item choice



324
325
# File 'docs/5_Battle_02_Visual.rb', line 324

def show_item_choice
end

#show_kos(targets)

Show KO animations

Parameters:



402
403
# File 'docs/5_Battle_02_Visual.rb', line 402

def show_kos(targets)
end

#show_mega_animation(target)

Show the pokemon mega evolution animation

Parameters:



423
424
# File 'docs/5_Battle_02_Visual.rb', line 423

def show_mega_animation(target)
end

#show_move_animation(user, targets, move)

Make a move animation

Parameters:



429
430
# File 'docs/5_Battle_02_Visual.rb', line 429

def show_move_animation(user, targets, move)
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



231
232
# File 'docs/5_Battle_02_Visual.rb', line 231

def show_player_choice(pokemon_index)
end

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

Method that show the pokemon choice

Parameters:

  • forced (Boolean) (defaults to: false)
  • cannot_switch_index (Integer, nil) (defaults to: nil) —

    Index of the trapped party member if a switch cannot happen

Returns:



330
331
# File 'docs/5_Battle_02_Visual.rb', line 330

def show_pokemon_choice(forced = false, cannot_switch_index: nil)
end

#show_pre_transition

Method that show the pre_transition of the battle



154
155
# File 'docs/5_Battle_02_Visual.rb', line 154

def show_pre_transition
end

#show_rmxp_animation(target, id)

Show a dedicated animation

Parameters:



434
435
# File 'docs/5_Battle_02_Visual.rb', line 434

def show_rmxp_animation(target, id)
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



261
262
# File 'docs/5_Battle_02_Visual.rb', line 261

def show_skill_choice(pokemon_index)
end

#show_stat_animation(target, amount)

Show an animation for stat change

Parameters:



381
382
# File 'docs/5_Battle_02_Visual.rb', line 381

def show_stat_animation(target, amount)
end

#show_status_animation(target, status)

Show an animation for a status

Parameters:



386
387
# File 'docs/5_Battle_02_Visual.rb', line 386

def show_status_animation(target, status)
end

#show_switch_form_animation(target)

Show the pokemon switch form animation

Parameters:



419
420
# File 'docs/5_Battle_02_Visual.rb', line 419

def show_switch_form_animation(target)
end

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

Method that show the target choice once the skill was choosen

Returns:



265
266
# File 'docs/5_Battle_02_Visual.rb', line 265

def show_target_choice
end

#show_team_info

Show team info



365
366
# File 'docs/5_Battle_02_Visual.rb', line 365

def show_team_info
end

#show_transition

Method that show the trainer transition of the battle



157
158
# File 'docs/5_Battle_02_Visual.rb', line 157

def show_transition
end

#show_transition_battle_end

Method that show the enemy sprite transition during the battle end scene



160
161
# File 'docs/5_Battle_02_Visual.rb', line 160

def show_transition_battle_end
end

#show_weather_animation(weather)

Show an animation for a weather

Parameters:

  • weather (Symbol)


390
391
# File 'docs/5_Battle_02_Visual.rb', line 390

def show_weather_animation(weather)
end

#snap_to_bitmaps ⇒ Array<Texture>

Snap all viewports to bitmap

Returns:



62
63
# File 'docs/5_Battle_02_Visual.rb', line 62

def snap_to_bitmaps
end

#spc_show_message(pokemon_index)

Show the message "What will X do"

Parameters:

  • pokemon_index (Integer)


235
236
# File 'docs/5_Battle_02_Visual.rb', line 235

def spc_show_message(pokemon_index)
end

#start_center_animation

Note:

This method is used only in Visual3D

Define the translation to the center of the Screen



454
455
# File 'docs/5_Battle_02_Visual.rb', line 454

def start_center_animation
end

#start_weather_animation(weather)

Start an animation for a weather

Parameters:

  • weather (Symbol)


394
395
# File 'docs/5_Battle_02_Visual.rb', line 394

def start_weather_animation(weather)
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



166
167
# File 'docs/5_Battle_02_Visual.rb', line 166

def store_battler_sprite(bank, position, sprite)
end

#to_s Also known as: inspect

Safe to_s & inspect



34
35
# File 'docs/5_Battle_02_Visual.rb', line 34

def to_s
end

#unlock

Unlock the battle scene



47
48
# File 'docs/5_Battle_02_Visual.rb', line 47

def unlock
end

#update

Update the visuals



38
39
# File 'docs/5_Battle_02_Visual.rb', line 38

def update
end

#wait_for_animation

Wait for all animation to end (non parallel one)



58
59
# File 'docs/5_Battle_02_Visual.rb', line 58

def wait_for_animation
end