Class: GamePlay::Hall_of_Fame

Inherits:
BaseCleanUpdate show all
Includes:
UI::Hall_of_Fame
Defined in:
scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00006 Inputs.rb,
scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb,
scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00001 Initialize.rb,
scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00003 Animation_Phase_1.rb,
scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00004 Animation_Phase_2.rb,
scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00005 Animation_Phase_3.rb

Constant Summary collapse

DEFAULT_BGM =

The default BGM to play

'audio/bgm/Hall-of-Fame'

Constants inherited from BaseCleanUpdate

BaseCleanUpdate::AIU_KEY2METHOD

Constants inherited from Base

Base::DEFAULT_TRANSITION, Base::DEFAULT_TRANSITION_PARAMETER

Constants included from Input

Input::ALIAS_KEYS, Input::AXIS_MAPPING, Input::AXIS_SENSITIVITY, Input::DEAD_ZONE, Input::Keyboard, Input::Keys, Input::NON_TRIGGER_ZONE, Input::REPEAT_COOLDOWN, Input::REPEAT_SPACE

Constants included from DisplayMessage

DisplayMessage::MESSAGE_ERROR, DisplayMessage::MESSAGE_PROCESS_ERROR

Instance Attribute Summary

Attributes inherited from Base

#__last_scene, #__result_process, #running, #viewport

Attributes included from DisplayMessage

#message_window

Instance Method Summary collapse

Methods inherited from BaseCleanUpdate

#automatic_input_update, #update

Methods inherited from Base

#add_disposable, #call_scene, #dispose, #find_parent, #main, #return_to_scene, #snap_to_bitmap, #update, #visible, #visible=

Methods included from Input

dir4, dir8, get_text, joy_axis_position, press?, register_events, released?, repeat?, swap_states, trigger?

Methods included from DisplayMessage

#can_display_message_be_called?, #close_message_window, #display_message, #display_message_and_wait, #message_class, #message_processing?, #message_visible, #message_visible=

Constructor Details

#initialize(filename_bgm = DEFAULT_BGM, context_of_victory = :league) ⇒ Hall_of_Fame

Initialize the scene

Parameters:

  • filename_bgm (String) (defaults to: DEFAULT_BGM)

    the bgm to play during the Hall of Fame

  • context_of_victory (Symbol) (defaults to: :league)

    the symbol to put as the context of victory



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00001 Initialize.rb', line 8

def initialize(filename_bgm = DEFAULT_BGM, context_of_victory = :league)
  super()
  @filename_bgm = filename_bgm
  @anim_count = 0
  @animation_state = 0
  @graveyard = PFM.game_state.nuzlocke.graveyard
  @nuz_anim = Graveyard_Animation_Stack
  @pkm_sprite_anim = Pokemon_Battler_Stack
  @parallel_update = false
  PFM.game_state.hall_of_fame.register_victory(context_of_victory)
  play_music
  # Do something
end

Instance Method Details

#create_background

Create the background



44
45
46
47
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 44

def create_background
  @background = Sprite.new(@viewport)
  @background.set_bitmap('hall_of_fame/black_background', :interface)
end

#create_congratulation_text_boxes

Create the congratulations boxes that are displayed during phase 1



78
79
80
81
82
83
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 78

def create_congratulation_text_boxes
  @congrats_text_boxes = []
  $actors.each do |pkm|
    @congrats_text_boxes << Congratulation_Text_Box.new(@viewport, pkm)
  end
end

#create_end_stars

Create the final stars animation that is displayed after phase 3



116
117
118
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 116

def create_end_stars
  @end_stars_anim = End_Stars_Animation.new(@viewport)
end

#create_graphics

Create the graphics for the UI



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 7

def create_graphics
  super()
  create_background
  create_type_background
  create_pokemon_battler_stack
  create_pokemon_text_boxes
  create_congratulation_text_boxes
  create_pokemon_stars_animation
  create_graveyard_anim
  create_turning_ball
  create_party_battler_stack
  create_league_champion_text_box
  create_trainer_infos_text_box
  create_end_stars
end

#create_graveyard_anim

Create the stack that contains everything needed for phase 2 animation



86
87
88
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 86

def create_graveyard_anim
  @graveyard_stack = Graveyard_Animation_Stack.new(@viewport)
end

#create_league_champion_text_box

Create the box containing the league champion text displayed during phase 3



106
107
108
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 106

def create_league_champion_text_box
  @league_champ_box = League_Champion_Text_Box.new(@viewport)
end

#create_party_battler_stack

Create the stack containing every battlers displayed during phase 3



101
102
103
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 101

def create_party_battler_stack
  @party_battler = Party_Battler_Stack.new(@viewport)
end

#create_pokemon_battler_stack

Create the stack containing the Pokemon's battler that is displayed during phase 1



55
56
57
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 55

def create_pokemon_battler_stack
  @pkm_battler_stack = Pokemon_Battler_Stack.new(@viewport)
end

#create_pokemon_stars_animation

Create the stars animation that is displayed during phase 1



60
61
62
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 60

def create_pokemon_stars_animation
  @pkm_stars_anim = Pokemon_Stars_Animation.new(@viewport)
end

#create_pokemon_text_boxes

Create the boxes containing the text about the Pokemon that are displayed during phase 1



70
71
72
73
74
75
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 70

def create_pokemon_text_boxes
  @pkm_text_boxes = []
  $actors.each do |pkm|
    @pkm_text_boxes << Pokemon_Text_Box.new(@viewport, pkm)
  end
end

#create_trainer_infos_text_box

Create the box containing the trainer texts displayed during phase 3



111
112
113
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 111

def create_trainer_infos_text_box
  @trainer_infos_box = Trainer_Infos_Text_Box.new(@viewport)
end

#create_turning_ball

Create the turning ball that is displayed during phase 3



91
92
93
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 91

def create_turning_ball
  @ball = Turning_Pokeball.new(@viewport)
end

#create_type_background

Create the type background that is displayed during phase 1



50
51
52
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 50

def create_type_background
  @type_background = Type_Background.new(@viewport)
end

#launch_animation(animation)

Launch the given animation

Parameters:

  • animation (Yuki::Animation)

    the animation to run



127
128
129
130
131
132
133
134
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 127

def launch_animation(animation)
  animation.start
  until animation.done?
    parallel_animating if @parallel_update
    animation.update
    Graphics.update
  end
end

#parallel_animating

Update some parallel animation if the context demand it



137
138
139
140
141
142
143
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 137

def parallel_animating
  if @animation_state == 0
    update_pokemon_stars_animation
  elsif @animation_state == 2
    update_turning_ball
  end
end

#pkm_cry_filenameString

Get the cry's filename of the Pokemon at index equal to @anim_count

Returns:

  • (String)

    the filename of the cry



29
30
31
32
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00001 Initialize.rb', line 29

def pkm_cry_filename
  str = $actors[@anim_count].cry.sub('Audio/SE/', '')
  return str
end

#play_music

Play the music, nothing else



23
24
25
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00001 Initialize.rb', line 23

def play_music
  Audio.bgm_play(@filename_bgm) unless @filename_bgm.empty?
end

#update_end_stars_anim

Update the final stars animation after phase 3



121
122
123
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 121

def update_end_stars_anim
  @end_stars_anim.update
end

#update_graphics

Launch each phase of the animation then update the looping animations



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 24

def update_graphics
  case @animation_state
  when 0
    animation_phase_1
  when 1
    if PFM.game_state.nuzlocke.enabled? && !@graveyard.empty?
      animation_phase_2
    else
      @animation_state += 1
    end
  when 2
    animation_phase_3
  when 3
    # Every animation is finished so there's only two things to update
    update_turning_ball
    update_end_stars_anim
  end
end

#update_inputs

Update the inputs only at the end of the animation



4
5
6
7
8
9
10
11
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00006 Inputs.rb', line 4

def update_inputs
  if @animation_state == 3
    if Input.trigger?(:B) || Input.trigger?(:A)
      Audio.bgm_stop
      @running = false
    end
  end
end

#update_pokemon_stars_animation

Update the stars animation (only during phase 1, updated by launch_animation)



65
66
67
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 65

def update_pokemon_stars_animation
  @pkm_stars_anim.update
end

#update_turning_ball

Update the turning ball animation during phase 3 and after



96
97
98
# File 'scripts/01450 Systems/00300 Hall of fame/00003 GamePlay/00002 Graphics.rb', line 96

def update_turning_ball
  @ball.update_anim
end