Class: GamePlay::Party_Menu
- Inherits:
-
BaseCleanUpdate::FrameBalanced
- Object
- Base
- BaseCleanUpdate
- BaseCleanUpdate::FrameBalanced
- GamePlay::Party_Menu
- Includes:
- PartyMenuMixin, Util::GiveTakeItem
- Defined in:
- scripts/01450 Systems/00102 Party/00003 GamePlay/00100 Party_Menu.rb,
scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb,
scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb
Overview
Class that display the Party Menu interface and manage user inputs
This class has several modes
- :map => Used to select a Pokemon in order to perform stuff
- :menu => The normal mode when opening this interface from the menu
- :battle => Select a Pokemon to send to battle
- :item => Select a Pokemon in order to use an item on it (require extend data : hash)
- :hold => Give an item to the Pokemon (requires extend data : item_id)
- :select => Select a number of Pokemon for a temporary team.
(Number defined by $game_variables[6] and possible list of excluded Pokemon requires extend data : array)
This class can also show an other party than the player party, the party paramter is an array of Pokemon upto 6 Pokemon
Constant Summary collapse
- ON_POKEMON_CHOICE_COLOR_MAPPING =
Color mapping for the result of on_creature_choice
{ true => 1, false => 2, nil => 3 }
- ON_POKEMON_CHOICE_MESSAGE_MAPPING =
Message mapping for the result of on_creature_choice in apt detect
{ true => 143, false => 144, nil => 142 }
- SelectorRect =
Selector Rect info
[[0, 0, 132, 52], [0, 64, 132, 52]]
- FRAME_HEIGHT =
Height of the frame Image to actually display (to prevent button from being hidden / shadowed). Set nil to keep the full height
214
- Actions =
Array of actions to do according to the pressed button
%i[action_A action_X action_Y action_B]
- CHOICE_METHODS =
List of all choice method to call according to the current mode
{ menu: :show_menu_mode_choice, choice: :show_choice_mode_choice, battle: :show_battle_mode_choice, item: :show_item_mode_choice, hold: :show_hold_mode_choice, select: :show_select_mode_choice, absofusion: :process_absofusion_mode, separate: :process_separate_mode }
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 included from PartyMenuMixin
#call_skill_process, #return_data
Attributes inherited from Base
#__last_scene, #__result_process, #running, #viewport
Attributes included from DisplayMessage
Instance Method Summary collapse
-
#action_A
Action triggered when A is pressed.
-
#action_A_menu
Action when A is pressed and the mode is menu.
-
#action_B
Action triggered when B is pressed.
-
#action_move_current_pokemon
Select the current pokemon to move with an other pokemon.
-
#action_X
Action triggered when X is pressed.
-
#action_Y
Action triggered when Y is pressed.
-
#check_select_mon_var
Check if the $game_variables's value is between 1 and 6 If not, call action_B to exit to map return Boolean.
-
#current_pokemon_has_no_item ⇒ Boolean
Method telling if the Pokemon has no item or not.
-
#deselect_follower
Action of deselecting the follower.
-
#enough_pokemon?(caller = :validate) ⇒ Boolean
Check if the temporary team contains the right number of Pokemon return Boolean.
-
#get_choice_coordinates(choices) ⇒ Array(Integer, Integer)
Return the choice coordinates according to the current selected Pokemon.
-
#give_item(item2 = -1))
Action of giving an item to the Pokemon.
-
#initialize(party, mode = :map, extend_data = nil, no_leave: false) ⇒ Party_Menu
constructor
Create a new Party_Menu.
-
#launch_reminder(mode = 0)
Action of launching the Pokemon Reminder.
-
#launch_summary(mode = :view, extend_data = nil)
Action of launching the Pokemon Summary.
-
#no_leave_B ⇒ Boolean
Function that detect no_leave and forbit the B action to process.
-
#on_item_give_choice
Event that triggers when the player choose on which pokemon to give the item.
-
#on_item_use_choice
Event that triggers when the player choose on which pokemon to use the item.
-
#on_map_choice
Event that triggers when the player has choosen a Pokemon.
-
#on_select
Event that triggers when a Pokemon is selected in :select mode.
-
#on_send_pokemon
When the player want to send a specific Pokemon to battle.
-
#on_skill_choice
Event that triggers when the player choose on which pokemon to apply the move.
-
#process_absofusion_mode
Process the fusion when the party is in mode :absofusion.
-
#process_item_switch
Process the switch between the items of two pokemon.
-
#process_separate_mode
Process the separation when the party is in mode :separate.
-
#process_switch
Process the switch between two pokemon.
-
#select_follower
Action of selecting the follower.
-
#show_battle_mode_choice
Show the choice when the party is in mode :battle.
-
#show_choice
Show the proper choice.
-
#show_choice_mode_choice
Show the choice when the party is in mode :choice.
-
#show_hold_mode_choice
Show the choice when the party is in mode :hold.
-
#show_item_mode_choice
Show the choice when the party is in mode :item.
-
#show_map_mode_choice
Show the choice when the party is in mode :map.
-
#show_menu_mode_choice
Show the choice when party is in mode :menu.
-
#show_select_mode_choice
Show the choice when the party is in mode :select.
-
#skill_color ⇒ Integer
Return the skill color.
-
#take_item
Action of taking the item from the Pokemon.
-
#update_graphics
(also: #update_during_process)
Update the scene graphics during an animation or something else.
-
#update_inputs
Update the inputs.
-
#update_menu_choice(choices)
Update the scene during a choice.
-
#update_mouse(_moved)
Update the mouse.
-
#update_mouse_ctrl
Update the mouse interaction with the ctrl buttons.
-
#update_mouse_selector_move
Update the movement of the selector with the mouse.
-
#update_selector_coordinates
Update the selector coordinates.
-
#update_selector_move
Update the movement of the Cursor.
-
#use_pokemon_skill(move_index)
Action of using a move of the current Pokemon.
Methods included from Util::GiveTakeItem
#givetake_give_egg_message, #givetake_give_item, #givetake_give_item_message, #givetake_give_item_update_state, #givetake_take_item
Methods included from PartyMenuMixin
#party_selected?, #pokemon_selected?, #selected_pokemons
Methods inherited from BaseCleanUpdate::FrameBalanced
Methods included from Graphics::FPSBalancer::Marker
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(party, mode = :map, extend_data = nil, no_leave: false) ⇒ Party_Menu
Create a new Party_Menu
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00100 Party_Menu.rb', line 37 def initialize(party, mode = :map, extend_data = nil, no_leave: false) super() @move = -1 @return_data = -1 # Scene mode # @type [Symbol] @mode = mode # Displayed party # @type [PFM::ItemDescriptor::Wrapper, Integer, nil] @extend_data = extend_data @no_leave = no_leave @index = 0 # @type [Array<PFM::Pokemon>] @party = party @counter = 0 # Used by the selector @intern_mode = :normal # :normal, :move_pokemon, :move_item, :choose_move_pokemon, :choose_move_item # Array containing the temporary team selected # @type [Array<PFM::Pokemon>] @temp_team = [] # Resetting the affected variable to prevent bugs $game_variables[Yuki::Var::Party_Menu_Sel] = -1 # Telling the B action the user is seeing a choice and make it able to cancel the choice # @type [PFM::Choice_Helper] @choice_object = nil # Running state of the scene # @type [Boolean] @running = true end |
Instance Method Details
#action_A
Action triggered when A is pressed
7 8 9 10 11 12 13 14 15 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb', line 7 def action_A case @mode when :menu else $game_system.se_play($data_system.decision_se) show_choice end end |
#action_A_menu
Action when A is pressed and the mode is menu
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb', line 18 def case @intern_mode when :choose_move_pokemon action_move_current_pokemon when :choose_move_item return $game_system.se_play($data_system.buzzer_se) if @team_buttons[@index].data.item_holding == 0 @team_buttons[@move = @index].selected = true @intern_mode = :move_item @base_ui.show_win_text(text_get(23, 22)) when :move_pokemon process_switch when :move_item process_item_switch else $game_system.se_play($data_system.decision_se) return show_choice end $game_system.se_play($data_system.decision_se) end |
#action_B
Action triggered when B is pressed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb', line 39 def action_B return if no_leave_B # Ensure we don't leave with a call_skill_process @call_skill_process = nil $game_system.se_play($data_system.cancel_se) # Cancel choice attempt return @choice_object.cancel if @choice_object # Returning to normal mode if @intern_mode != :normal @base_ui.hide_win_text hide_item_name @team_buttons[@move].selected = false if @move != -1 @move = -1 return @intern_mode = :normal end # Emptying $game_temp.temp_team if in select mode if @mode == :select $game_temp.temp_team = [] end @running = false end |
#action_move_current_pokemon
Select the current pokemon to move with an other pokemon
142 143 144 145 146 147 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb', line 142 def action_move_current_pokemon return if @party.size <= 1 @team_buttons[@move = @index].selected = true @intern_mode = :move_pokemon @base_ui.show_win_text(text_get(23, 21)) end |
#action_X
Action triggered when X is pressed
74 75 76 77 78 79 80 81 82 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb', line 74 def action_X $game_temp.temp_team = @temp_team if @mode == :select # Check if the number of selected Pokemon is equal to the required number @running = false if @mode == :select && enough_pokemon? == true return if @mode != :menu return $game_system.se_play($data_system.buzzer_se) if @intern_mode != :normal or @party.size <= 1 @base_ui.show_win_text(text_get(23, 19)) @intern_mode = :choose_move_pokemon end |
#action_Y
Action triggered when Y is pressed
85 86 87 88 89 90 91 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb', line 85 def action_Y return if @mode != :menu return $game_system.se_play($data_system.buzzer_se) if @intern_mode != :normal or @party.size <= 1 @base_ui.show_win_text(text_get(23, 20)) @intern_mode = :choose_move_item show_item_name end |
#check_select_mon_var
Check if the $game_variables's value is between 1 and 6 If not, call action_B to exit to map return Boolean
368 369 370 371 372 373 374 375 376 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 368 def check_select_mon_var if $game_variables[6] > 6 || $game_variables[6] < 1 ('Wrong number of Pokemon to select. Number must be between 1 and 6.') action_B true else false end end |
#current_pokemon_has_no_item ⇒ Boolean
Method telling if the Pokemon has no item or not
171 172 173 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 171 def current_pokemon_has_no_item @party[@index].item_holding <= 0 end |
#deselect_follower
Action of deselecting the follower
140 141 142 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 140 def deselect_follower $storage.lets_go_follower = nil end |
#enough_pokemon?(caller = :validate) ⇒ Boolean
Check if the temporary team contains the right number of Pokemon return Boolean
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 348 def enough_pokemon?(caller = :validate) return if check_select_mon_var == true if caller == :button if @temp_team.size + 1 > $game_variables[Yuki::Var::Max_Pokemon_Select] (text_get(23, 115 + $game_variables[Yuki::Var::Max_Pokemon_Select])) return false else return true end elsif @temp_team.size < $game_variables[Yuki::Var::Max_Pokemon_Select] (text_get(23, 109 + $game_variables[Yuki::Var::Max_Pokemon_Select])) return false else return true end end |
#get_choice_coordinates(choices) ⇒ Array(Integer, Integer)
Return the choice coordinates according to the current selected Pokemon
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 75 def get_choice_coordinates(choices) choice_height = 16 height = choices.size * choice_height max_height = 217 but_x = @team_buttons[@index].x + 53 but_y = @team_buttons[@index].y + 32 if but_y + height > max_height but_y -= (height - choice_height) but_y += choice_height while but_y < 0 end return but_x, but_y end |
#give_item(item2 = -1))
if item2 is -1 it'll call the Bag interface to get the item
Action of giving an item to the Pokemon
152 153 154 155 156 157 158 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 152 def give_item(item2 = -1) givetake_give_item(@party[@index], item2) do |pokemon| @team_buttons[@index].data = pokemon @team_buttons[@index].refresh end @base_ui.hide_win_text end |
#launch_reminder(mode = 0)
Action of launching the Pokemon Reminder
133 134 135 136 137 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 133 def launch_reminder(mode = 0) @base_ui.hide_win_text GamePlay.open_move_reminder(@party[@index], mode) { |scene| result = scene.reminded_move? } Graphics.wait(4) { update_during_process } end |
#launch_summary(mode = :view, extend_data = nil)
Action of launching the Pokemon Summary
125 126 127 128 129 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 125 def launch_summary(mode = :view, extend_data = nil) @base_ui.hide_win_text call_scene(Summary, @party[@index], mode, @party, extend_data) Graphics.wait(4) { update_during_process } end |
#no_leave_B ⇒ Boolean
Function that detect no_leave and forbit the B action to process
63 64 65 66 67 68 69 70 71 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb', line 63 def no_leave_B if @no_leave return false if @choice_object return false if @intern_mode != :normal $game_system.se_play($data_system.buzzer_se) return true end return false end |
#on_item_give_choice
Event that triggers when the player choose on which pokemon to give the item
296 297 298 299 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 296 def on_item_give_choice give_item(@extend_data) @running = false end |
#on_item_use_choice
Event that triggers when the player choose on which pokemon to use the item
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 252 def on_item_use_choice # @type [PFM::Pokemon] pokemon = @party[@index] if @extend_data.on_creature_choice(pokemon, self) if @extend_data.open_skill launch_summary(:skill, @extend_data) if @extend_data.skill @return_data = @index @running = false end elsif @extend_data.open_skill_learn GamePlay.open_move_teaching(pokemon, @extend_data.open_skill_learn) do |scene| @return_data = @index if MoveTeaching.from(scene).learnt @running = false end else @extend_data.on_creature_use(pokemon, self) @extend_data.bind(find_parent(Battle::Scene), pokemon) @return_data = @index @running = false end else (parse_text(22, 108)) end end |
#on_map_choice
Event that triggers when the player has choosen a Pokemon
397 398 399 400 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 397 def on_map_choice @return_data = $game_variables[Yuki::Var::Party_Menu_Sel] = @index @running = false end |
#on_select
Event that triggers when a Pokemon is selected in :select mode
330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 330 def on_select pokemon = @party[@index] if !@temp_team.include?(pokemon) && enough_pokemon?(:button) @temp_team << pokemon elsif @temp_team.include?(pokemon) @temp_team[@temp_team.index(pokemon)] = nil @temp_team.compact! else return end @team_buttons[@index].data = pokemon @team_buttons[@index].refresh init_win_text end |
#on_send_pokemon
When the player want to send a specific Pokemon to battle
191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 191 def on_send_pokemon # @type [PFM::Pokemon] pokemon = @party[@index] if pokemon.egg? (parse_text(20, 34)) elsif pokemon.dead? (parse_text(20, 33, ::PFM::Text::PKNICK[1] => pokemon.given_name)) elsif pokemon.position.between?(0, $game_temp.vs_type) (parse_text(20, 32, ::PFM::Text::PKNICK[1] => pokemon.given_name)) else @return_data = @index @running = false end end |
#on_skill_choice
Event that triggers when the player choose on which pokemon to apply the move
224 225 226 227 228 229 230 231 232 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 224 def on_skill_choice # @type [PFM::Pokemon] pokemon = @party[@index] @call_skill_process.call(pokemon, nil) @call_skill_process = nil @mode = :menu @index = @return_data @return_data = -1 end |
#process_absofusion_mode
Process the fusion when the party is in mode :absofusion
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 442 def process_absofusion_mode # @type [PFM::Pokemon] pokemon = @party[@index] extend_data = @extend_data if @temp_team.size == 1 pokemon_selected = @temp_team.first if pokemon_selected == pokemon || !extend_data[1].include?(pokemon.db_symbol) (text_get(22, 151)) elsif pokemon.dead? (text_get(22, 152)) elsif pokemon.egg? (text_get(22, 153)) else pokemon_selected.absofusion(pokemon) (parse_text(22, 157, ::PFM::Text::PKNAME[0] => pokemon_selected.given_name)) @running = false end else return (text_get(18, 70)) if pokemon.db_symbol != extend_data[0] || pokemon.absofusionned? || pokemon.egg? || pokemon.dead? @temp_team << pokemon (text_get(22, 155)) @base_ui.show_win_text(text_get(22, 155)) end end |
#process_item_switch
Process the switch between the items of two pokemon
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 416 def process_item_switch return $game_system.se_play($data_system.buzzer_se) if @move == @index tmp = @team_buttons[@move].data.item_holding # @type [PFM::Pokemon] pokemon = @team_buttons[@move].data pokemon.item_holding = @team_buttons[@index].data.item_holding if pokemon.form_calibrate # Form adjustment @team_buttons[@move].refresh (parse_text(22, 157, ::PFM::Text::PKNAME[0] => pokemon.given_name)) end @team_buttons[@move].refresh pokemon = @team_buttons[@index].data pokemon.item_holding = tmp if pokemon.form_calibrate # Form adjustment @team_buttons[@index].refresh (parse_text(22, 157, ::PFM::Text::PKNAME[0] => pokemon.given_name)) end @team_buttons[@index].refresh @team_buttons[@move].selected = false @move = -1 @base_ui.hide_win_text hide_item_name @intern_mode = :normal end |
#process_separate_mode
Process the separation when the party is in mode :separate
470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 470 def process_separate_mode # @type [PFM::Pokemon] pokemon = @party[@index] extend_data = @extend_data return (text_get(18, 70)) if pokemon.db_symbol != extend_data || !pokemon.absofusionned? || pokemon.egg? || pokemon.dead? return (text_get(22, 154)) if $actors.size >= 6 pokemon.separate @team_buttons.each(&:dispose) (parse_text(22, 157, ::PFM::Text::PKNAME[0] => pokemon.given_name)) @running = false end |
#process_switch
Process the switch between two pokemon
403 404 405 406 407 408 409 410 411 412 413 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 403 def process_switch return $game_system.se_play($data_system.buzzer_se) if @move == @index tmp = @team_buttons[@move].data @team_buttons[@move].selected = false @party[@move] = @team_buttons[@move].data = @team_buttons[@index].data @party[@index] = @team_buttons[@index].data = tmp @move = -1 @base_ui.hide_win_text @intern_mode = :normal $game_player.make_encounter_count end |
#select_follower
Action of selecting the follower
145 146 147 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 145 def select_follower $storage.lets_go_follower = @party[@index] end |
#show_battle_mode_choice
Show the choice when the party is in mode :battle
176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 176 def show_battle_mode_choice show_black_frame # @type [PFM::Pokemon] pokemon = @party[@index] choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999) choices .register_choice(text_get(20, 25), on_validate: method(:on_send_pokemon)) # Send .register_choice(text_get(23, 4), on_validate: method(:launch_summary)) # Summary @base_ui.show_win_text(parse_text(23, 30, ::PFM::Text::PKNICK[0] => pokemon.given_name)) x, y = get_choice_coordinates(choices) choices.display_choice(@viewport, x, y, nil, choices, on_update: method(:update_menu_choice)) hide_black_frame end |
#show_choice
Show the proper choice
16 17 18 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 16 def show_choice send(*(CHOICE_METHODS[@mode] || :show_map_mode_choice)) end |
#show_choice_mode_choice
Show the choice when the party is in mode :choice
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 207 def show_choice_mode_choice show_black_frame # @type [PFM::Pokemon] pokemon = @party[@index] choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999) choices .register_choice(text_get(23, 209), on_validate: method(:on_skill_choice)) # Select .register_choice(text_get(23, 4), on_validate: method(:launch_summary)) # Summary .register_choice(text_get(23, 1), on_validate: @base_ui.method(:hide_win_text)) # Cancel @base_ui.show_win_text(parse_text(23, 30, ::PFM::Text::PKNICK[0] => pokemon.given_name)) x, y = get_choice_coordinates(choices) choice = choices.display_choice(@viewport, x, y, nil, choices, on_update: method(:update_menu_choice)) hide_black_frame @base_ui.show_win_text(text_get(23, 17)) if choice != 0 end |
#show_hold_mode_choice
Show the choice when the party is in mode :hold
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 279 def show_hold_mode_choice show_black_frame # @type [PFM::Pokemon] pokemon = @party[@index] choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999) choices .register_choice(text_get(23, 146), on_validate: method(:on_item_give_choice)) # Select .register_choice(text_get(23, 4), on_validate: method(:launch_summary)) # Summary .register_choice(text_get(23, 1), on_validate: @base_ui.method(:hide_win_text)) # Cancel @base_ui.show_win_text(parse_text(23, 30, ::PFM::Text::PKNICK[0] => pokemon.given_name)) x, y = get_choice_coordinates(choices) choice = choices.display_choice(@viewport, x, y, nil, choices, on_update: method(:update_menu_choice)) hide_black_frame @base_ui.show_win_text(text_get(23, 23)) if choice != 0 end |
#show_item_mode_choice
Show the choice when the party is in mode :item
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 235 def show_item_mode_choice show_black_frame # @type [PFM::Pokemon] pokemon = @party[@index] choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999) choices .register_choice(text_get(23, 209), on_validate: method(:on_item_use_choice)) # Select .register_choice(text_get(23, 4), on_validate: method(:launch_summary)) # Summary .register_choice(text_get(23, 1), on_validate: @base_ui.method(:hide_win_text)) # Cancel @base_ui.show_win_text(parse_text(23, 30, ::PFM::Text::PKNICK[0] => pokemon.given_name)) x, y = get_choice_coordinates(choices) choices.display_choice(@viewport, x, y, nil, choices, on_update: method(:update_menu_choice)) hide_black_frame @base_ui.show_win_text(text_get(23, 24)) end |
#show_map_mode_choice
Show the choice when the party is in mode :map
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 379 def show_map_mode_choice show_black_frame # @type [PFM::Pokemon] pokemon = @party[@index] choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999) # Text missing for choosing a Mon choices .register_choice(text_get(23, 0), on_validate: method(:on_map_choice)) # Select .register_choice(text_get(23, 4), on_validate: method(:launch_summary)) # Summary .register_choice(text_get(23, 1), on_validate: @base_ui.method(:hide_win_text)) # Cancel @base_ui.show_win_text(parse_text(23, 30, ::PFM::Text::PKNICK[0] => pokemon.given_name)) x, y = get_choice_coordinates(choices) choice = choices.display_choice(@viewport, x, y, nil, choices, on_update: method(:update_menu_choice)) hide_black_frame @base_ui.show_win_text(text_get(23, 17)) if choice != 0 end |
#show_menu_mode_choice
Show the choice when party is in mode :menu
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 27 def show_black_frame # @type [PFM::Pokemon] pokemon = @party[@index] choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999) unless pokemon.egg? pokemon.skills_set.each_with_index do |skill, i| if skill && (skill.map_use > 0 || PFM::SKILL_PROCESS[skill.db_symbol]) choices.register_choice(skill.name, i, on_validate: method(:use_pokemon_skill), color: skill_color) end end end choices .register_choice(text_get(23, 4), on_validate: method(:launch_summary)) # Summary .register_choice(text_get(23, 8), on_validate: method(:action_move_current_pokemon), disable_detect: proc { @party.size <= 1 }) # Move unless pokemon.egg? choices.register_choice(ext_text(9009, 0), on_validate: method(:launch_reminder), disable_detect: proc { pokemon.remindable_skills == [] }) if $game_switches[Yuki::Sw::BT_Party_Menu_Reminder] if Yuki::FollowMe.in_lets_go_mode? if $storage.lets_go_follower == pokemon choices.register_choice(text_get(23, 165), on_validate: method(:deselect_follower)) # Unfollow else choices.register_choice(text_get(23, 164), on_validate: method(:select_follower)) # Follow end end choices .register_choice(text_get(23, 146), on_validate: method(:give_item)) # Give .register_choice(text_get(23, 147), on_validate: method(:take_item), disable_detect: method(:current_pokemon_has_no_item)) # Take end @base_ui.show_win_text(parse_text(23, 30, ::PFM::Text::PKNICK[0] => pokemon.given_name)) x, y = get_choice_coordinates(choices) choice = choices.display_choice(@viewport, x, y, nil, choices, on_update: method(:update_menu_choice)) @base_ui.hide_win_text if choice == 999 hide_black_frame end |
#show_select_mode_choice
Show the choice when the party is in mode :select
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 302 def show_select_mode_choice show_black_frame # @type [PFM::Pokemon] pokemon = @party[@index] extend_data = @extend_data choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999) if extend_data.is_a?(Array) if !@temp_team.include?(pokemon) && !extend_data.include?(pokemon.id) choices.register_choice(text_get(23, 140), on_validate: method(:on_select)) # Enter elsif @temp_team.include?(pokemon) && !extend_data.include?(pokemon.id) choices.register_choice(text_get(23, 141), on_validate: method(:on_select)) # Withdraw end elsif @temp_team.include?(pokemon) choices.register_choice(text_get(23, 141), on_validate: method(:on_select)) # Withdraw else choices.register_choice(text_get(23, 140), on_validate: method(:on_select)) # Enter end choices .register_choice(text_get(23, 4), on_validate: method(:launch_summary)) # Summary .register_choice(text_get(23, 1), on_validate: @base_ui.method(:hide_win_text)) # Cancel @base_ui.show_win_text(parse_text(23, 30, ::PFM::Text::PKNICK[0] => pokemon.given_name)) x, y = get_choice_coordinates(choices) choice = choices.display_choice(@viewport, x, y, nil, choices, on_update: method(:update_menu_choice)) hide_black_frame @base_ui.show_win_text(text_get(23, 110)) if choice != 0 end |
#skill_color ⇒ Integer
Return the skill color
22 23 24 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 22 def skill_color return 1 end |
#take_item
Action of taking the item from the Pokemon
161 162 163 164 165 166 167 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 161 def take_item @base_ui.hide_win_text givetake_take_item(@party[@index]) do |pokemon| @team_buttons[@index].data = pokemon @team_buttons[@index].refresh end end |
#update_graphics Also known as: update_during_process
Update the scene graphics during an animation or something else
82 83 84 85 86 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00100 Party_Menu.rb', line 82 def update_graphics update_selector @base_ui.update_background_animation @team_buttons.each(&:update_graphics) end |
#update_inputs
Update the inputs
67 68 69 70 71 72 73 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00100 Party_Menu.rb', line 67 def update_inputs return action_A if Input.trigger?(:A) return action_X if Input.trigger?(:X) return action_Y if Input.trigger?(:Y) return action_B if Input.trigger?(:B) update_selector_move end |
#update_menu_choice(choices)
Update the scene during a choice
65 66 67 68 69 70 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 65 def (choices) @choice_object = choices update_during_process update_mouse_ctrl @choice_object = nil end |
#update_mouse(_moved)
Update the mouse
77 78 79 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00100 Party_Menu.rb', line 77 def update_mouse(_moved) update_mouse_ctrl end |
#update_mouse_ctrl
Update the mouse interaction with the ctrl buttons
94 95 96 97 98 99 100 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb', line 94 def update_mouse_ctrl if @mode != :select (@base_ui.ctrl, Actions, @base_ui.win_text_visible?) else (@base_ui.ctrl, [nil, nil, nil, :action_X], false) end end |
#update_mouse_selector_move
Update the movement of the selector with the mouse
125 126 127 128 129 130 131 132 133 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb', line 125 def update_mouse_selector_move return unless Mouse.moved || Mouse.trigger?(:left) # Safety preventing index conflict @team_buttons.each_with_index do |btn, i| next unless btn.simple_mouse_in? update_selector_coordinates(@index = i) if @index != i action_A if Mouse.trigger?(:left) return true end end |
#update_selector_coordinates
Update the selector coordinates
136 137 138 139 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb', line 136 def update_selector_coordinates(*) btn = @team_buttons[@index] @selector.set_position(btn.x + 3, btn.y + 3) end |
#update_selector_move
Update the movement of the Cursor
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00101 Party_Menu Input.rb', line 103 def update_selector_move party_size = @team_buttons.size index2 = @index % 2 if Input.trigger?(:DOWN) next_index = @index + 2 next_index = index2 if next_index >= party_size update_selector_coordinates(@index = next_index) elsif Input.trigger?(:UP) next_index = @index - 2 if next_index < 0 next_index += 6 next_index -= 2 while next_index >= party_size end update_selector_coordinates(@index = next_index) elsif index_changed(:@index, :LEFT, :RIGHT, party_size - 1) update_selector_coordinates else update_mouse_selector_move end end |
#use_pokemon_skill(move_index)
Action of using a move of the current Pokemon
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'scripts/01450 Systems/00102 Party/00003 GamePlay/00102 Party_Menu Choice & Process.rb', line 90 def use_pokemon_skill(move_index) # @type [PFM::Pokemon] pokemon = @party[@index] # @type [PFM::Skill] skill = pokemon.skills_set[move_index] if (@call_skill_process = PFM::SKILL_PROCESS[skill.db_symbol]) if (type = @call_skill_process.call(pokemon, nil, true)) if type == true @call_skill_process.call(pokemon, skill) @call_skill_process = nil elsif type == :choice @mode = :choice @return_data = @index @base_ui.show_win_text(text_get(23, 17)) return elsif type == :block (parse_text(22, 108)) @base_ui.hide_win_text @call_skill_process = nil return end else @call_skill_process = [@call_skill_process, pokemon, skill] end else $game_temp.common_event_id = skill.map_use end @base_ui.hide_win_text @return_data = $game_variables[Yuki::Var::Party_Menu_Sel] = @index @running = false end |