Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module GamePlay
- #Liste des ID nationaux des Pokémon ne pouvant être stocké/déplacer/relâché.
- #BAN_ID = [id1, id2, id3...]
- BAN_ID = [803, 804, 805]
- class StorageUtils
- def release_pokemon(index)
- c = display_message(text_get(33, 101), 1, text_get(33, 83), text_get(33, 84))
- return if (c == 1)
- if (index >= 31) # Pokémon de l'équipe
- pkmn = $actors[index - 31]
- unless BAN_ID.include?pkmn.id
- $actors[index - 31] = nil
- unless check
- return $actors[index - 31] = pkmn
- end
- $actors.compact!
- deleted = true
- draw_pokemon_team
- else
- c = display_message("Vous ne pouvez pas relâcher ce Pokémon !")
- end
- else # Pokémon de la boite
- pkmn = $storage.remove(index - 1)
- draw_pokemon_box
- end
- if deleted
- display_message(parse_text(33, 102, PFM::Text::PKNICK[0] => pkmn.given_name), 1) # "#{pkmn.given_name} a été relâché.", 1)
- display_message(parse_text(33, 103, PFM::Text::PKNICK[0] => pkmn.given_name), 1) # "Bye-bye, #{pkmn.given_name} !", 1)
- draw_info_pokemon(index)
- deleted = false
- end
- end
- end
- class StorageDrop
- def update
- @utils.update
- return if $game_temp.message_text
- if (@mode == :selection)
- if (Input.trigger?(:B))
- c = @utils.display_message(text_get(33, 85), 2, text_get(33, 83), text_get(33, 84))
- @running = false if (c == 1)
- end
- @index = @utils.deplacement_equipe(@index, :drop)
- if (Input.trigger?(:A))
- return if ($actors[@index - 31] == nil)
- choice
- end
- elsif (@mode == :drop)
- if (Input.trigger?(:B))
- cancel_drop
- end
- if (Input.trigger?(:A))
- #On vérifie que l'ID du Pokémon déposé n'appartient pas à cette liste
- unless BAN_ID.include?@pokemon_drop.id
- confirm_drop
- else
- c = @utils.display_message("Vous ne pouvez pas déposer ce Pokémon.")
- cancel_drop
- end
- end
- if (Input.trigger?(:RIGHT))
- if ($storage.current_box < (PFM::Storage::MAX_BOXES - 1))
- $storage.current_box += 1
- else
- $storage.current_box = 0
- end
- @utils.change_box
- end
- if (Input.trigger?(:LEFT))
- if ($storage.current_box < 1)
- $storage.current_box = PFM::Storage::MAX_BOXES - 1
- else
- $storage.current_box -= 1
- end
- @utils.change_box
- end
- end
- end
- end
- class StorageMove
- def update
- @utils.update
- return if $game_temp.message_text
- if (Input.trigger?(:B) and @pokemon_move == nil)
- c = @utils.display_message(text_get(33, 85), 2, text_get(33, 83), text_get(33, 84))
- @running = false if (c == 1)
- end
- if (@index == 0) # Changement de boîte
- @index = @utils.changer_boite(@index, @pokemon_move)
- elsif (@index > 0 and @index < 31)# Déplacement dans la boîte
- @index = @utils.deplacement_boite(@index, :move, @pokemon_move)
- if (Input.trigger?(:A))
- if (@mode == :move)
- unless BAN_ID.include?@pokemon_move.id
- if ($storage.isPokemon?(@index - 1)) # Pokémon présent
- pokemon = $storage.remove(@index - 1)
- $storage.store_box(@pokemon_move, @index - 1)
- @pokemon_move = pokemon
- @utils.change_box
- @utils.draw_selector(@index, @pokemon_move)
- else
- $storage.store_box(@pokemon_move, @index - 1)
- @pokemon_move = nil
- @utils.change_box
- @utils.draw_selector(@index)
- @mode = :selection
- end
- else
- c = @utils.display_message("Ce Pokémon ne peut être déposé.")
- cancel_drop
- end
- else
- return if (!$storage.isPokemon?(@index - 1))
- choice
- end
- end
- else # Déplacement dans l'équipe
- @index = @utils.deplacement_equipe(@index, :move, @pokemon_move)
- if (Input.trigger?(:A))
- if (@mode == :move)
- if ($actors[@index - 31] != nil) # Pokémon présent
- pokemon = $actors[@index - 31].clone
- $actors[@index - 31] = @pokemon_move
- @pokemon_move = pokemon
- @utils.draw_pokemon_team
- @utils.draw_selector(@index, @pokemon_move)
- else
- $actors.push(@pokemon_move)
- $actors.compact!
- @pokemon_move = nil
- @utils.draw_pokemon_team
- @utils.draw_selector(@index)
- @mode = :selection
- end
- else
- return if ($actors[@index - 31] == nil)
- choice
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement