Class: Battle::Visual::FakeHPAnimation

Inherits:
Yuki::Animation::TimedAnimation
  • Object
show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00001 Animations/01002 FakeHPAnimation.rb

Overview

Waiting animation if 0 HP are dealt

Instance Method Summary collapse

Constructor Details

#initialize(scene, target, effectiveness = nil) ⇒ FakeHPAnimation

Create the HP Animation

Parameters:

  • scene (Battle::Scene)

    scene responsive of holding all the battle information

  • target (PFM::PokemonBattler)

    Pokemon getting its HP down/up

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

    optional param to play the effectiveness sound if that comes from using a move



9
10
11
12
13
14
15
16
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00001 Animations/01002 FakeHPAnimation.rb', line 9

def initialize(scene, target, effectiveness = nil)
  @scene = scene
  @target = target
  time = 1
  super(time)
  start
  effectiveness_sound(effectiveness) if effectiveness
end

Instance Method Details

#done?Boolean

Detect if the animation if done

Returns:

  • (Boolean)


26
27
28
29
30
31
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00001 Animations/01002 FakeHPAnimation.rb', line 26

def done?
  return false unless super

  @scene.visual.refresh_info_bar(@target)
  return true
end

#effectiveness_sound(effectiveness)

Play the effectiveness sound



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

def effectiveness_sound(effectiveness)
  if effectiveness == 1
    Audio.se_play('Audio/SE/hit')
  elsif effectiveness > 1
    Audio.se_play('Audio/SE/hitplus')
  else
    Audio.se_play('Audio/SE/hitlow')
  end
end

#update

Update the animation



19
20
21
22
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00001 Animations/01002 FakeHPAnimation.rb', line 19

def update
  super
  @scene.visual.refresh_info_bar(@target)
end