Class: Battle::Visual

Inherits:
Object show all
Defined in:
docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.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

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



16
17
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_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/01600_Alpha_25_Battle_Engine_00002_Battle_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/01600_Alpha_25_Battle_Engine_00002_Battle_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/01600_Alpha_25_Battle_Engine_00002_Battle_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/01600_Alpha_25_Battle_Engine_00002_Battle_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/01600_Alpha_25_Battle_Engine_00002_Battle_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)



137
138
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 137

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)


142
143
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 142

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:



130
131
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 130

def battler_sprite(bank, position)
end

#dispose

Dispose the visuals



26
27
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 26

def dispose
end

#hide_ability(target)

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

Parameters:



304
305
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 304

def hide_ability(target)
end

#hide_info_bar(pokemon)

Show a specific bar

Parameters:



268
269
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 268

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



256
257
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 256

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

#hide_team_info

Hide team info



283
284
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 283

def hide_team_info
end

#lock

Lock the battle scene



35
36
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_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/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 29

def locking?
end

#refresh_info_bar(pokemon)

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

Parameters:



272
273
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 272

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/01600_Alpha_25_Battle_Engine_00002_Battle_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)



277
278
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 277

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



300
301
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 300

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



334
335
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 334

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



327
328
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 327

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



291
292
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 291

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

#show_info_bar(pokemon)

Show a specific bar

Parameters:



264
265
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 264

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



260
261
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 260

def show_info_bars(bank: nil)
end

#show_item(target)

Show the item user animation

Parameters:



308
309
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 308

def show_item(target)
end

#show_item_choicePFM::ItemDescriptor::Wrapper?

Method that show the item choice



240
241
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 240

def show_item_choice
end

#show_kos(targets)

Show KO animations

Parameters:



295
296
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 295

def show_kos(targets)
end

#show_move_animation(user, targets, move)

Make a move animation

Parameters:



318
319
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 318

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



166
167
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 166

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:



245
246
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 245

def show_pokemon_choice(forced = false)
end

#show_pre_transition

Method that show the pre_transition of the battle



115
116
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 115

def show_pre_transition
end

#show_rmxp_animation(target, id)

Show a dedicated animation

Parameters:



323
324
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 323

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



196
197
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 196

def show_skill_choice(pokemon_index)
end

#show_switch_form_animation(target)

Show the pokemon switch form animation

Parameters:



312
313
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 312

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:



200
201
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 200

def show_target_choice
end

#show_team_info

Show team info



280
281
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 280

def show_team_info
end

#show_transition

Method that show the trainer transition of the battle



118
119
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 118

def show_transition
end

#snap_to_bitmapsArray<Texture>

Snap all viewports to bitmap

Returns:



47
48
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_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)


170
171
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 170

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



124
125
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 124

def store_battler_sprite(bank, position, sprite)
end

#to_s Also known as: inspect

Safe to_s & inspect



19
20
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 19

def to_s
end

#unlock

Unlock the battle scene



32
33
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 32

def unlock
end

#update

Update the visuals



23
24
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 23

def update
end

#wait_for_animation

Wait for all animation to end (non parallel one)



43
44
# File 'docs/01600_Alpha_25_Battle_Engine_00002_Battle_Visual.rb', line 43

def wait_for_animation
end