module POKEMON_S
LISTE_CMSP = [ ["poke", "CODE", "GIRATINA"], ] class CadeauxMysteresSP def initialize(z = 100) @z_level = z end def main Graphics.freeze int = Interpreter.new Audio.bgm_play("Audio/BGM/Cadeau_Mystère", 100, 100) fond = Sprite.new fond.x = 0 fond.y = 0 fond.z = @z_level window_top = Window_Base.new(0, 0, 640, 96) window_top.contents = Bitmap.new(608, 64) window_top.contents.font.name = $fontface window_top.contents.font.size = $fontsize loop do fond.bitmap = RPG::Cache.picture("Fond_base_CM_SP") height = window_top.contents.text_size("Bienvenue dans Cadeau Mystère SP !").height window_top.draw_text(0, (window_top.contents.height - height) / 2, 608, height, "Bienvenue dans Cadeau Mystère SP !", 1, window_top.normal_color, 0) Graphics.transition(40) int.afficher_message("Que voulez-vous faire ?") index = selection(320, 240, @z_level + 100, "Débloquer un Cadeau", "Informations", "Quitter") case index when 0 # Recevoir le Cadeau if $game_variables[5000]["cadeaux"][0][3] != nil or $game_variables[5000]["cadeaux"][1][1] != nil or $game_variables[5000]["cadeaux"][2][1] != nil # Il y a deja un cadeau mystere color en attente int.afficher_message("Le livreur a déjà un objet à vous remettre. Revenez lorsqu'il vous l'aura donné !") else int.afficher_message("Voulez-vous débloquer votre Cadeau Mystère ?") if selection(320, 240, @z_level + 100, "Oui", "Non") == 0 int.afficher_message("Veuillez saisir votre code mystère, s'il vous plait.") # Recevoir le Cadeau Mystere Color fond_cadeau = Sprite.new fond_cadeau.x = 0 fond_cadeau.y = 0 fond_cadeau.z = @z_level + 300 int.password("Mot de passe du cadeau",15) suspense ida = nil for i in LISTE_CMSP if i[1] == $password ida = i break end end $game_variables[34]=$password if ida == nil Graphics.freeze fond_cadeau.bitmap = RPG::Cache.picture("Fond_CM_Orange") Graphics.transition(40) int.afficher_message("Ce code ne correspond à aucun cadeau enregistré. Veuillez vérifier que vous avez bien saisi votre code.") Graphics.freeze fond_cadeau.dispose Graphics.transition(40) elsif $game_variables[5000]["cadeaux"][1][0].include?($password) Graphics.freeze fond_cadeau.bitmap = RPG::Cache.picture("Fond_CM_Orange") Graphics.transition(40) int.afficher_message("Vous avez déjà récupéré ce cadeau. Chaque code n'est utilisable qu'une seule fois.") Graphics.freeze fond_cadeau.dispose Graphics.transition(40) else # Gestion du risque d'erreur (erreur dans la saisie d'un objet # dans la liste LISTE_CMCOLOR errno = nil gain_id = ida[2] case ida[0] when "item" if gain_id.type == String for i in 1...$data_items.size if $data_items[i].name == gain_id gain_id = i break end end end when "poke" gain_id = int.id_conversion(ida[2]) when "oeuf" gain_id = int.id_conversion(ida[2]) end errno = ida[2] if gain_id == 0 print "Erreur dans le script Cadeau Mystère SP, le lot " + ida[2] + ", correspondant au code, " + $password + " ne correspond à aucun objet paramétré." if errno != nil and $DEBUG if errno != nil Graphics.freeze fond_cadeau.bitmap = RPG::Cache.picture("Fond_CM_Rouge") Graphics.transition(40) int.afficher_message("En raison d'un problème technique, aucun objet n'a pu vous être attribué. Veuillez nous excuser de la gêne occasionnée. rtn Vous n'avez pas recu votre Cadeau Mystère.") Graphics.freeze fond_cadeau.dispose Graphics.transition(40) else case ida[0] when "item" Graphics.freeze if ida[3] == nil fond_cadeau.bitmap = RPG::Cache.picture("Fond_CM_Vert_Clair") else fond_cadeau.bitmap = RPG::Cache.picture(ida[3]) end Graphics.transition(40) item = Sprite.new item.bitmap = RPG::Cache.icon($data_items[gain_id].icon_name) item.zoom_x = 2 item.zoom_y = 2 item.x = 320 - item.bitmap.width item.y = 70 - item.bitmap.height item.z = @z_level + 300 for i in 1..32 Graphics.freeze item.y += 8 Graphics.update Graphics.transition(1) end wait(20) $game_variables[5000]["cadeaux"][1][0].push(ida[1]) $game_variables[5000]["cadeaux"][1][1] = [ida[0], gain_id] int.afficher_message("Allez vite récupérer votre lot auprès du livreur !") Graphics.freeze item.dispose fond_cadeau.dispose Graphics.transition(40) when "poke" Graphics.freeze if ida[3] == nil fond_cadeau.bitmap = RPG::Cache.picture("Fond_CM_Bleu_Clair") else fond_cadeau.bitmap = RPG::Cache.picture(ida[3]) end Graphics.transition(40) item = Sprite.new if FileTest.exist?("Graphics/Battlers/Front_Male/" + sprintf("%03d", gain_id) + ".png") item.bitmap = RPG::Cache.battler("Front_Male/" + sprintf("%03d", gain_id) + ".png", 0) else item.bitmap = RPG::Cache.battler("Front_Male/000.png", 0) end item.x = 320 - (item.bitmap.width / 2) item.y = 70 - (item.bitmap.height / 2) item.z = @z_level + 300 for i in 1..32 Graphics.freeze item.y += 8 Graphics.update Graphics.transition(1) end int.cry_pokemon(gain_id) wait(20) $game_variables[5000]["cadeaux"][1][0].push(ida[1]) $game_variables[5000]["cadeaux"][1][1] = [ida[0], gain_id] int.afficher_message("Allez vite récupérer votre lot auprès du livreur !") Graphics.freeze item.dispose fond_cadeau.dispose Graphics.transition(40) when "oeuf" Graphics.freeze if ida[3] == nil fond_cadeau.bitmap = RPG::Cache.picture("Fond_CM_Jaune") else fond_cadeau.bitmap = RPG::Cache.picture(ida[3]) end Graphics.transition(40) item = Sprite.new gain_id = Pokemon.new.new_egg(gain_id).gain_id if FileTest.exist?("Graphics/Battlers/Eggs/" + sprintf("%03d", gain_id) + ".png") item.bitmap = RPG::Cache.battler("Eggs/" + sprintf("%03d", gain_id) + ".png", 0) else item.bitmap = RPG::Cache.battler("Eggs/Egg000.png", 0) end item.x = 320 - (item.bitmap.width / 2) item.y = 70 - (item.bitmap.height / 2) item.z = @z_level + 300 for i in 1..32 Graphics.freeze item.y += 8 Graphics.update Graphics.transition(1) end wait(20) $game_variables[5000]["cadeaux"][1][0].push(ida[1]) $game_variables[5000]["cadeaux"][1][1] = [ida[0], gain_id] int.afficher_message("Allez vite récupérer votre lot auprès du livreur !") Graphics.freeze item.dispose fond_cadeau.dispose Graphics.transition(40) end end end else # Ne pas recevoir le Cadeau Mystere Color int.afficher_message("Vous n'avez pas recu votre Cadeau Mystère.") end end when 1 # Infos Graphics.freeze livreur = Sprite.new livreur.x = 304 livreur.y = 218 livreur.z = @z_level livreur.bitmap = RPG::Cache.picture("sprite_livreur.png") Graphics.transition(40) int.afficher_message("Le Cadeau Myster SP vous permet de recevoir un cadeau au moyen d'un code mystère que vous pourrez obtenir soit au cours de votre aventure, soit sur le site de ce jeu. Une fois que vous aurez saisi votre code mystère, vous pourrez le récupérer auprès du livreur qui se trouve généralement dans les magasins pokémon. rtn Note : Chaque code n'est utilisable qu'une seule fois !") Graphics.freeze livreur.dispose Graphics.transition(40) when 2 # Quitter (selection du choix Quitter break when 3 # Quitter (tche ESC) break end end $scene = Scene_Map.new Graphics.freeze fond.dispose window_top.dispose $game_map.autoplay Graphics.transition(40) end def suspense dummy = Sprite.new dummy.bitmap = RPG::Cache.picture("messagedummy") dummy.x = 0 dummy.y = 336 dummy.z = 9999 texte = Window_Base.new(0, 336, 640, 144) texte.z = 10999 texte.opacity = 0 texte.contents = Bitmap.new(608, 112) texte.contents.font.name = $fontface texte.contents.font.size = $fontsize msg = "" for i in 1..10 Graphics.freeze texte.contents.clear msg += ". " texte.draw_text(9, 24, 610, 32, "Veuillez patienter, votre code est en cours de vérification.", 1, texte.normal_color, 0) texte.draw_text(9, 56, 610, 32, msg[0...msg.size - 1], 1, texte.normal_color, 0) Graphics.transition(1) wait(25) end wait(50) dummy.dispose texte.dispose end def selection(x, y, z, *options) if options.size > 7 and $DEBUG for i in 7...options.size options[i] = nil end options.compact! end options = options[0] while options[0].type == Array window = Window_Command.new(1, options, $fontsize) width = [] for i in 0...options.size width.push(window.contents.text_size(options[i]).width) end width = width.max + 16 window.dispose command = Window_Command.new(width + 32, options, $fontsize) command.x = x - width / 2 command.y = y - (21.5 * options.size).to_i command.z = z index = 0 loop do Graphics.update Input.update command.update if Input.trigger?(Input::C) index = command.index command.dispose command = nil wait_count = 2 break elsif Input.trigger?(Input::B) index = options.size command.dispose command = nil wait_count = 2 break end end return index end def wait(frame) i = 0 loop do i += 1 Graphics.update if i >= frame break end end end end end
class Interpreter def appel_cm_sp unless $game_variables[5000]["compteurs"] == [] or not($game_variables[5000]["compteurs"][0].tourne) bool = $game_variables[5000]["compteurs"][1] $game_variables[5000]["compteurs"][0].arreter $game_variables[5000]["compteurs"][1] = bool end $scene = CadeauxMysteresSP.new end def obtenir_cm_sp(id_event = @event_id) if $game_variables[5000]["cadeaux"][1][1] != nil afficher_message("Bonjour. tu dois être " + Player.name + ". rtn J'ai recu un cadeau pour toi, le voici.") case $game_variables[5000]["cadeaux"][1][1][0] when "item" $pokemon_party.add_item($game_variables[5000]["cadeaux"][1][1][1]) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : " + $data_items[$game_variables[5000]["cadeaux"][1][1][1]].name + ". rtn " + Player.name + " range " + $data_items[$game_variables[5000]["cadeaux"][1][1][1]].name + " dans le sac.") $game_variables[5000]["cadeaux"][1][1] = nil when "poke" if $pokemon_party.size < 6 if $game_variables[34]=="CODE" pokemon=Pokemon.new($game_variables[5000]["cadeaux"][1][1][1], 100) pokemon.base_hp=800 pokemon.hp=999 pokemon.spd=800 pokemon.atk=800 pokemon.ats=800 pokemon.dfe=800 pokemon.dfs=800 pokemon.item_hold=349 pokemon.table_type = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] pokemon.medaille=4 $pokemon_party.add(pokemon) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : " + Pokemon_Info.name($game_variables[5000]["cadeaux"][1][1][1])+ ".") $game_variables[5000]["cadeaux"][1][1] = nil elsif $game_variables[34]=="nom_a_entrer" pokemon=Pokemon.new($game_variables[5000]["cadeaux"][1][1][1], 5) $pokemon_party.add(pokemon) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : " + Pokemon_Info.name($game_variables[5000]["cadeaux"][1][1][1]) + ".") $game_variables[5000]["cadeaux"][1][1] = nil elsif $game_variables[34]=="nom_a_entrer" pokemon=Pokemon.new($game_variables[5000]["cadeaux"][1][1][1], 5) $pokemon_party.add(pokemon) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : " + Pokemon_Info.name($game_variables[5000]["cadeaux"][1][1][1]) + ".") $game_variables[5000]["cadeaux"][1][1] = nil elsif $game_variables[34]=="nom_a_entrer" pokemon=Pokemon.new($game_variables[5000]["cadeaux"][1][1][1], 5) $pokemon_party.add(pokemon) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : " + Pokemon_Info.name($game_variables[5000]["cadeaux"][1][1][1]) + ".") $game_variables[5000]["cadeaux"][1][1] = nil elsif $game_variables[34]=="nom_a_entrer" pokemon=Pokemon.new($game_variables[5000]["cadeaux"][1][1][1], 5) $pokemon_party.add(pokemon) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : " + Pokemon_Info.name($game_variables[5000]["cadeaux"][1][1][1]) + ".") $game_variables[5000]["cadeaux"][1][1] = nil elsif $game_variables[34]=="nom_a_entrer" pokemon=Pokemon.new($game_variables[5000]["cadeaux"][1][1][1], 5) $pokemon_party.add(pokemon) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : " + Pokemon_Info.name($game_variables[5000]["cadeaux"][1][1][1]) + ".") $game_variables[5000]["cadeaux"][1][1] = nil elsif pokemon=Pokemon.new($game_variables[5000]["cadeaux"][1][1][1], 5) $pokemon_party.add(pokemon) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : " + Pokemon_Info.name($game_variables[5000]["cadeaux"][1][1][1]) + ".") $game_variables[5000]["cadeaux"][1][1] = nil f $game_variables[34]=="nom_a_entrer" elsif $game_variables[34]=="nom_a_entrer" pokemon=Pokemon.new($game_variables[5000]["cadeaux"][1][1][1], 5) $pokemon_party.add(pokemon) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : " + Pokemon_Info.name($game_variables[5000]["cadeaux"][1][1][1]) + ".") $game_variables[5000]["cadeaux"][1][1] = nil elsif $game_variables[34]=="nom_a_entrer" pokemon=Pokemon.new($game_variables[5000]["cadeaux"][1][1][1], 5) $pokemon_party.add(pokemon) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : " + Pokemon_Info.name($game_variables[5000]["cadeaux"][1][1][1]) + ".") $game_variables[5000]["cadeaux"][1][1] = nil else $pokemon_party.add(Pokemon.new($game_variables[5000]["cadeaux"][1][1][1], 5)) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : " + Pokemon_Info.name($game_variables[5000]["cadeaux"][1][1][1]) + ".") $game_variables[5000]["cadeaux"][1][1] = nil end else afficher_message("Tu n'as plus de place dans ton équipe. Reviens me voir lorsque tu pourras prendre ce pokémon.") end when "oeuf" if $pokemon_party.size < 6 $pokemon_party.add(Pokemon.new.new_egg($game_variables[5000]["cadeaux"][1][1][1])) Audio.me_play("Audio/ME/PkmRS-Item found.ogg", 100, 100) afficher_message("Obtennu : Un oeuf.") $game_variables[5000]["cadeaux"][1][1] = nil else afficher_message("Tu n'as plus de place dans ton équipe. Reviens me voir lorsque tu pourras prendre cet oeuf.") end end afficher_message("Nous espérons te revoir bientôt.") self_switch($game_map.map_id, id_event, "A", true) self_switch($game_map.map_id, id_event, "B", false) self_switch($game_map.map_id, id_event, "C", false) self_switch($game_map.map_id, id_event, "D", false) else afficher_message("Navré, je n'ai rien pour toi pour le moment. Reviens me voir si tu obtiens un Cadeau Mystère !") end end end
|