Module: Battle::Message
- Includes:
- PFM::Text
- Defined in:
- scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb
Overview
Module holding all the message function used by the battle engine
Constant Summary
Constants included from PFM::Text
PFM::Text::ABILITY, PFM::Text::BELL_Reg, PFM::Text::BERRY, PFM::Text::COLOR, PFM::Text::Dot, PFM::Text::GENDBR_Reg, PFM::Text::GameKeys, PFM::Text::ITEM2, PFM::Text::ITEMPLUR1, PFM::Text::KAPHOTICS_Clean, PFM::Text::LOCATION, PFM::Text::MOVE, PFM::Text::Money, PFM::Text::NBSP_B, PFM::Text::NBSP_R, PFM::Text::NUM2, PFM::Text::NUM3, PFM::Text::NUM7R, PFM::Text::NUMB, PFM::Text::NUMBRNCH_Reg, PFM::Text::NUMXR, PFM::Text::PKNAME, PFM::Text::PKNICK, PFM::Text::S_000, PFM::Text::S_Empty, PFM::Text::TRNAME
Class Method Summary collapse
-
.player_sending_pokemon_start ⇒ String
Player sending out its Pokemon.
-
.player_sending_pokemon_start_multi ⇒ String
When there's a friend trainer and we launch the Pokemon.
-
.player_sending_pokemon_start_single ⇒ String
When were' alone and we launch the Pokemon.
-
.setup(logic)
Setup the message system.
-
.trainer_issuing_a_challenge ⇒ String
Trainer issuing a challenge.
-
.trainer_issuing_a_challenge_multi ⇒ String
Trainer issuing a challenge with 2 trainers.
-
.trainer_issuing_a_challenge_single ⇒ String
Trainer issuing a challenge with one trainer.
-
.trainer_sending_pokemon_start ⇒ String
Trainer sending out their Pokemon.
-
.trainer_sending_pokemon_start_class(name, class_name, index) ⇒ String
When the trainer has a class and it sends out its Pokemon.
-
.trainer_sending_pokemon_start_no_class(name, index) ⇒ String
When the trainer has no class and it sends out its Pokemon.
-
.wild_battle_appearance ⇒ String
A Wild Pokemon appeared.
Methods included from PFM::Text
define_const, detect_dialog, enemy_pokemon?, get_key_name, parse, parse_gendbr, parse_numbrnch, parse_rest_of_thing, parse_string_for_messages, parse_with_2pokemon, parse_with_pokemon, parse_with_pokemons, reset_variables, set_ability_name, set_item_name, set_move_name, set_num1, set_num2, set_num3, set_pkname, set_pknick, set_plural, set_variable, unset_variable
Class Method Details
.player_sending_pokemon_start ⇒ String
Player sending out its Pokemon
39 40 41 42 43 |
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb', line 39 def player_sending_pokemon_start @text.reset_variables @text.set_plural(false) @battle_info.names[0].size > 1 ? player_sending_pokemon_start_multi : player_sending_pokemon_start_single end |
.player_sending_pokemon_start_multi ⇒ String
When there's a friend trainer and we launch the Pokemon
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb', line 101 def player_sending_pokemon_start_multi text = [@text.parse(18, 18, PKNICK[1] => @logic.battler(0, 0).name, TRNAME[0] => @battle_info.names[0][0])] if @battle_info.classes[0][1] @text.set_pknick(@logic.battler(0, 1), 2) hash = { TRNAME[1] => @battle_info.names[0][1], '[VAR 010E(0000)]' => @battle_info.classes[0][1] } hash['[VAR 019E(0000)]'] = "#{hash['[VAR 010E(0000)]']} #{hash[TRNAME[1]]}" text << @text.parse(18, 15, hash) else @text.set_pknick(@logic.battler(0, 1), 1) text << @text.parse(18, 18, TRNAME[0] => @battle_info.names[0][0]) end text.join("\n") end |
.player_sending_pokemon_start_single ⇒ String
When were' alone and we launch the Pokemon
120 121 122 123 124 125 126 127 128 129 130 |
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb', line 120 def player_sending_pokemon_start_single (count = @logic.battler_count(0)).times do |i| @text.set_pknick(@logic.battler(0, i), i) end return @text.parse(18, 14) if count == 3 return @text.parse(18, 13) if count == 2 return @text.parse(18, 12) ensure @text.reset_variables end |
.setup(logic)
Setup the message system
14 15 16 17 18 |
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb', line 14 def setup(logic) @battle_info = logic.battle_info @logic = logic @text = PFM::Text end |
.trainer_issuing_a_challenge ⇒ String
Trainer issuing a challenge
31 32 33 34 35 |
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb', line 31 def trainer_issuing_a_challenge @text.reset_variables @text.set_plural(@battle_info.names[1].size > 1) @battle_info.names[1].size > 1 ? trainer_issuing_a_challenge_multi : trainer_issuing_a_challenge_single end |
.trainer_issuing_a_challenge_multi ⇒ String
Trainer issuing a challenge with 2 trainers
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb', line 63 def trainer_issuing_a_challenge_multi text_id = @battle_info.classes[1].empty? ? 11 : 10 if @battle_info.classes[1].empty? hash = { TRNAME[0] => @battle_info.names[1][0], TRNAME[1] => @battle_info.names[1][1] } else hash = { TRNAME[1] => @battle_info.names[1][0], TRNAME[3] => @battle_info.names[1][1], '[VAR 010E(0000)]' => @battle_info.classes[1][0], '[VAR 010E(0002)]' => @battle_info.classes[1][1] || @battle_info.classes[1][0] } hash['[VAR 019E(0000)]'] = "#{hash['[VAR 010E(0000)]']} #{hash[TRNAME[1]]}" hash['[VAR 019E(0002)]'] = "#{hash['[VAR 010E(0002)]']} #{hash[TRNAME[3]]}" end @text.parse(18, text_id, hash) end |
.trainer_issuing_a_challenge_single ⇒ String
Trainer issuing a challenge with one trainer
85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb', line 85 def trainer_issuing_a_challenge_single text_id = @battle_info.classes[1].empty? ? 9 : 8 if @battle_info.classes[1].empty? hash = { TRNAME[0] => @battle_info.names[1][0] } else hash = { TRNAME[1] => @battle_info.names[1][0], '[VAR 010E(0000)]' => @battle_info.classes[1][0] } hash['[VAR 019E(0000)]'] = "#{hash['[VAR 010E(0000)]']} #{hash[TRNAME[1]]}" end @text.parse(18, text_id, hash) end |
.trainer_sending_pokemon_start ⇒ String
Trainer sending out their Pokemon
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb', line 47 def trainer_sending_pokemon_start @text.reset_variables @text.set_plural(@battle_info.trainer_is_couple) text = [] @battle_info.names[1].each_with_index do |name, index| if (class_name = @battle_info.classes[1][index]) text << trainer_sending_pokemon_start_class(name, class_name, index) else text << trainer_sending_pokemon_start_no_class(name, index) end end text.join("\n") end |
.trainer_sending_pokemon_start_class(name, class_name, index) ⇒ String
When the trainer has a class and it sends out its Pokemon
137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb', line 137 def trainer_sending_pokemon_start_class(name, class_name, index) hash = { TRNAME[1] => name, '[VAR 010E(0000)]' => class_name } hash['[VAR 019E(0000)]'] = "#{class_name} #{name}" # Get the pokemon arr = Array.new(@battle_info.vs_type) { |i| @logic.battler(1, i) } arr.select! { |pokemon| pokemon&.party_id == index } arr.each_with_index { |pokemon, i| @text.set_pknick(pokemon, i + 2) } return @text.parse(18, 15 + arr.size - 1, hash) ensure @text.reset_variables end |
.trainer_sending_pokemon_start_no_class(name, index) ⇒ String
When the trainer has no class and it sends out its Pokemon
156 157 158 159 160 161 162 163 164 |
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb', line 156 def trainer_sending_pokemon_start_no_class(name, index) # Get the pokemon arr = Array.new(@battle_info.vs_type) { |i| @logic.battler(1, i) } arr.select! { |pokemon| pokemon&.party_id == index } arr.each_with_index { |pokemon, i| @text.set_pknick(pokemon, i + 2) } return @text.parse(18, 18 + arr.size - 1, TRNAME[0] => name) ensure @text.reset_variables end |
.wild_battle_appearance ⇒ String
A Wild Pokemon appeared
22 23 24 25 26 27 |
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00002 Transition/00001 BattleStart.rb', line 22 def wild_battle_appearance sentence_index = @battle_info.wild_battle_reason.to_i % 7 name = @logic.battler(1, 0)&.name @text.reset_variables @text.parse(18, 1 + sentence_index, PKNAME[0] => name.to_s) end |