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
ABILITY_SOUND_EFFECT =
['Audio/SE/In-Battle_Ability_Activate', 100, 100]
ITEM_SOUND_EFFECT =
ABILITY_SOUND_EFFECT

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



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

def initialize(scene)
end

Instance Attribute Details

#animationsArray (readonly)

Returns List of the animation.

Returns:

  • (Array)

    List of the animation



7
8
9
# File 'docs/5_Battle_02_Visual.rb', line 7

def animations
  @animations
end

#parallel_animationsHash (readonly)

Returns List of the parallel animation.

Returns:

  • (Hash)

    List of the parallel animation



5
6
7
# File 'docs/5_Battle_02_Visual.rb', line 5

def parallel_animations
  @parallel_animations
end

#to_disposeArray (readonly)

Returns the element to dispose on #dispose.

Returns:

  • (Array)

    the element to dispose on #dispose



13
14
15
# File 'docs/5_Battle_02_Visual.rb', line 13

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



9
10
11
# File 'docs/5_Battle_02_Visual.rb', line 9

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



11
12
13
# File 'docs/5_Battle_02_Visual.rb', line 11

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)



140
141
# File 'docs/5_Battle_02_Visual.rb', line 140

def register_transition_resource(id, resource_type)
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)


145
146
# File 'docs/5_Battle_02_Visual.rb', line 145

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:



133
134
# File 'docs/5_Battle_02_Visual.rb', line 133

def battler_sprite(bank, position)
end

#dispose

Dispose the visuals



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

def dispose
end

#hide_ability(target)

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

Parameters:



310
311
# File 'docs/5_Battle_02_Visual.rb', line 310

def hide_ability(target)
end

#hide_info_bar(pokemon)

Show a specific bar

Parameters:



272
273
# File 'docs/5_Battle_02_Visual.rb', line 272

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



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

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

#hide_team_info

Hide team info



287
288
# File 'docs/5_Battle_02_Visual.rb', line 287

def hide_team_info
end

#lock

Lock the battle scene



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

def lock
end

#locking?Boolean

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

Returns:

  • (Boolean)


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

def locking?
end

#refresh_info_bar(pokemon)

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

Parameters:



276
277
# File 'docs/5_Battle_02_Visual.rb', line 276

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



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

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)



281
282
# File 'docs/5_Battle_02_Visual.rb', line 281

def set_info_state(state, pokemon = nil)
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



306
307
# File 'docs/5_Battle_02_Visual.rb', line 306

def show_ability(target, no_go_out = false)
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



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

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

#show_exp_distribution(exp_data)

Show the exp distribution

Parameters:

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

    info about experience each pokemon should receive



333
334
# File 'docs/5_Battle_02_Visual.rb', line 333

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



297
298
# File 'docs/5_Battle_02_Visual.rb', line 297

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

#show_info_bar(pokemon)

Show a specific bar

Parameters:



268
269
# File 'docs/5_Battle_02_Visual.rb', line 268

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



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

def show_info_bars(bank: nil)
end

#show_item(target)

Show the item user animation

Parameters:



314
315
# File 'docs/5_Battle_02_Visual.rb', line 314

def show_item(target)
end

#show_item_choicePFM::ItemDescriptor::Wrapper?

Method that show the item choice



244
245
# File 'docs/5_Battle_02_Visual.rb', line 244

def show_item_choice
end

#show_kos(targets)

Show KO animations

Parameters:



301
302
# File 'docs/5_Battle_02_Visual.rb', line 301

def show_kos(targets)
end

#show_move_animation(user, targets, move)

Make a move animation

Parameters:



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

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



170
171
# File 'docs/5_Battle_02_Visual.rb', line 170

def show_player_choice(pokemon_index)
end

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

Method that show the pokemon choice

Parameters:

  • forced (Boolean) (defaults to: false)

Returns:



249
250
# File 'docs/5_Battle_02_Visual.rb', line 249

def show_pokemon_choice(forced = false)
end

#show_pre_transition

Method that show the pre_transition of the battle



115
116
# File 'docs/5_Battle_02_Visual.rb', line 115

def show_pre_transition
end

#show_rmxp_animation(target, id)

Show a dedicated animation

Parameters:



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

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



200
201
# File 'docs/5_Battle_02_Visual.rb', line 200

def show_skill_choice(pokemon_index)
end

#show_switch_form_animation(target)

Show the pokemon switch form animation

Parameters:



318
319
# File 'docs/5_Battle_02_Visual.rb', line 318

def show_switch_form_animation(target)
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:



204
205
# File 'docs/5_Battle_02_Visual.rb', line 204

def show_target_choice
end

#show_team_info

Show team info



284
285
# File 'docs/5_Battle_02_Visual.rb', line 284

def show_team_info
end

#show_transition

Method that show the trainer transition of the battle



118
119
# File 'docs/5_Battle_02_Visual.rb', line 118

def show_transition
end

#show_transition_battle_end

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



121
122
# File 'docs/5_Battle_02_Visual.rb', line 121

def show_transition_battle_end
end

#snap_to_bitmapsArray<Texture>

Snap all viewports to bitmap

Returns:



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

def snap_to_bitmaps
end

#spc_show_message(pokemon_index)

Show the message “What will X do”

Parameters:

  • pokemon_index (Integer)


174
175
# File 'docs/5_Battle_02_Visual.rb', line 174

def spc_show_message(pokemon_index)
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



127
128
# File 'docs/5_Battle_02_Visual.rb', line 127

def store_battler_sprite(bank, position, sprite)
end

#to_s Also known as: inspect

Safe to_s & inspect



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

def to_s
end

#unlock

Unlock the battle scene



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

def unlock
end

#update

Update the visuals



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

def update
end

#wait_for_animation

Wait for all animation to end (non parallel one)



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

def wait_for_animation
end