Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. module GamePlay
  2. #Liste des ID nationaux des Pokémon ne pouvant être stocké/déplacer/relâché.
  3. #BAN_ID = [id1, id2, id3...]
  4. BAN_ID = [803, 804, 805]
  5. class StorageUtils
  6. def release_pokemon(index)
  7. c = display_message(text_get(33, 101), 1, text_get(33, 83), text_get(33, 84))
  8. return if (c == 1)
  9. if (index >= 31) # Pokémon de l'équipe
  10. pkmn = $actors[index - 31]
  11. unless BAN_ID.include?pkmn.id
  12. $actors[index - 31] = nil
  13. unless check
  14. return $actors[index - 31] = pkmn
  15. end
  16. $actors.compact!
  17. deleted = true
  18. draw_pokemon_team
  19. else
  20. c = display_message("Vous ne pouvez pas relâcher ce Pokémon !")
  21. end
  22. else # Pokémon de la boite
  23. pkmn = $storage.remove(index - 1)
  24. draw_pokemon_box
  25. end
  26. if deleted
  27. display_message(parse_text(33, 102, PFM::Text::PKNICK[0] => pkmn.given_name), 1) # "#{pkmn.given_name} a été relâché.", 1)
  28. display_message(parse_text(33, 103, PFM::Text::PKNICK[0] => pkmn.given_name), 1) # "Bye-bye, #{pkmn.given_name} !", 1)
  29. draw_info_pokemon(index)
  30. deleted = false
  31. end
  32. end
  33. end
  34. class StorageDrop
  35. def update
  36. @utils.update
  37. return if $game_temp.message_text
  38. if (@mode == :selection)
  39. if (Input.trigger?(:B))
  40. c = @utils.display_message(text_get(33, 85), 2, text_get(33, 83), text_get(33, 84))
  41. @running = false if (c == 1)
  42. end
  43. @index = @utils.deplacement_equipe(@index, :drop)
  44. if (Input.trigger?(:A))
  45. return if ($actors[@index - 31] == nil)
  46. choice
  47. end
  48. elsif (@mode == :drop)
  49. if (Input.trigger?(:B))
  50. cancel_drop
  51. end
  52. if (Input.trigger?(:A))
  53. #On vérifie que l'ID du Pokémon déposé n'appartient pas à cette liste
  54. unless BAN_ID.include?@pokemon_drop.id
  55. confirm_drop
  56. else
  57. c = @utils.display_message("Vous ne pouvez pas déposer ce Pokémon.")
  58. cancel_drop
  59. end
  60. end
  61. if (Input.trigger?(:RIGHT))
  62. if ($storage.current_box < (PFM::Storage::MAX_BOXES - 1))
  63. $storage.current_box += 1
  64. else
  65. $storage.current_box = 0
  66. end
  67. @utils.change_box
  68. end
  69. if (Input.trigger?(:LEFT))
  70. if ($storage.current_box < 1)
  71. $storage.current_box = PFM::Storage::MAX_BOXES - 1
  72. else
  73. $storage.current_box -= 1
  74. end
  75. @utils.change_box
  76. end
  77. end
  78. end
  79. end
  80. class StorageMove
  81. def update
  82. @utils.update
  83. return if $game_temp.message_text
  84. if (Input.trigger?(:B) and @pokemon_move == nil)
  85. c = @utils.display_message(text_get(33, 85), 2, text_get(33, 83), text_get(33, 84))
  86. @running = false if (c == 1)
  87. end
  88. if (@index == 0) # Changement de boîte
  89. @index = @utils.changer_boite(@index, @pokemon_move)
  90. elsif (@index > 0 and @index < 31)# Déplacement dans la boîte
  91. @index = @utils.deplacement_boite(@index, :move, @pokemon_move)
  92. if (Input.trigger?(:A))
  93. if (@mode == :move)
  94. unless BAN_ID.include?@pokemon_move.id
  95. if ($storage.isPokemon?(@index - 1)) # Pokémon présent
  96. pokemon = $storage.remove(@index - 1)
  97. $storage.store_box(@pokemon_move, @index - 1)
  98. @pokemon_move = pokemon
  99. @utils.change_box
  100. @utils.draw_selector(@index, @pokemon_move)
  101. else
  102. $storage.store_box(@pokemon_move, @index - 1)
  103. @pokemon_move = nil
  104. @utils.change_box
  105. @utils.draw_selector(@index)
  106. @mode = :selection
  107. end
  108. else
  109. c = @utils.display_message("Ce Pokémon ne peut être déposé.")
  110. cancel_drop
  111. end
  112. else
  113. return if (!$storage.isPokemon?(@index - 1))
  114. choice
  115. end
  116. end
  117. else # Déplacement dans l'équipe
  118. @index = @utils.deplacement_equipe(@index, :move, @pokemon_move)
  119. if (Input.trigger?(:A))
  120. if (@mode == :move)
  121. if ($actors[@index - 31] != nil) # Pokémon présent
  122. pokemon = $actors[@index - 31].clone
  123. $actors[@index - 31] = @pokemon_move
  124. @pokemon_move = pokemon
  125. @utils.draw_pokemon_team
  126. @utils.draw_selector(@index, @pokemon_move)
  127. else
  128. $actors.push(@pokemon_move)
  129. $actors.compact!
  130. @pokemon_move = nil
  131. @utils.draw_pokemon_team
  132. @utils.draw_selector(@index)
  133. @mode = :selection
  134. end
  135. else
  136. return if ($actors[@index - 31] == nil)
  137. choice
  138. end
  139. end
  140. end
  141. end
  142. end
  143. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement