diff --git a/Data/Map020.rxdata b/Data/Map020.rxdata index 60eda68e0..7468a23ff 100644 Binary files a/Data/Map020.rxdata and b/Data/Map020.rxdata differ diff --git a/Data/Map562.rxdata b/Data/Map562.rxdata index 2660e30fa..85fc7b19b 100644 Binary files a/Data/Map562.rxdata and b/Data/Map562.rxdata differ diff --git a/Data/MapInfos.rxdata b/Data/MapInfos.rxdata index 59727cf88..2f0bf9605 100644 Binary files a/Data/MapInfos.rxdata and b/Data/MapInfos.rxdata differ diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb index 4f37f0ac0..8916915de 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/004_PokemonStorage.rb @@ -71,6 +71,9 @@ class PokemonStorage for i in 0...allWallpapers.length @unlockedWallpapers[i] = false end + + @fusionMode=false + @fusionItem=nil end def allWallpapers diff --git a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb index 81dc4f012..293ce995e 100644 --- a/Data/Scripts/016_UI/017_UI_PokemonStorage.rb +++ b/Data/Scripts/016_UI/017_UI_PokemonStorage.rb @@ -175,6 +175,7 @@ class PokemonBoxArrow < SpriteWrapper @handsprite.changeBitmap("fist") @spriteX = self.x @spriteY = self.y + @splicerType=0 end def dispose @@ -183,6 +184,28 @@ class PokemonBoxArrow < SpriteWrapper super end + def getSplicerIcon + case @splicerType + when 2 + return AnimatedBitmap.new("Graphics/Pictures/boxinfinitesplicer") + when 1 + return AnimatedBitmap.new("Graphics/Pictures/boxsupersplicer") + end + return AnimatedBitmap.new("Graphics/Pictures/boxsplicer") + end + + def setSplicerType(type) + @splicerType = type + end + + def setFusing(fusing) + @fusing = fusing + end + + def fusing? + return @fusing + end + def heldPokemon @heldpkmn = nil if @heldpkmn && @heldpkmn.disposed? @holding = false if !@heldpkmn @@ -606,6 +629,21 @@ class PokemonStorageScene @command = 1 end + def pbReleaseInstant(selected,heldpoke) + box=selected[0] + index=selected[1] + if heldpoke + sprite=@sprites["arrow"].heldPokemon + elsif box==-1 + sprite=@sprites["boxparty"].getPokemon(index) + else + sprite=@sprites["box"].getPokemon(index) + end + if sprite + sprite.dispose + end + end + def pbStartBox(screen,command) @screen = screen @storage = screen.storage @@ -1493,6 +1531,22 @@ class PokemonStorageScene def update pbUpdateSpriteHash(@sprites) end + + + + + def setFusing(fusing,item=0) + sprite=@sprites["arrow"].setFusing(fusing) + if item == :INFINITESPLICERS + @sprites["arrow"].setSplicerType(2) + elsif item == :SUPERSPLICERS + @sprites["arrow"].setSplicerType(1) + else + @sprites["arrow"].setSplicerType(0) + end + pbRefresh + end + end #=============================================================================== @@ -1509,6 +1563,8 @@ class PokemonStorageScreen @pbHeldPokemon = nil end + + def pbStartScreen(command) @heldpkmn = nil if command==0 # Organise @@ -1545,12 +1601,16 @@ class PokemonStorageScreen pbHold(selected) end else + if @fusionMode + pbFusionCommands(selected) + else commands = [] cmdMove = -1 cmdSummary = -1 cmdWithdraw = -1 cmdItem = -1 - cmdMark = -1 + cmdFuse = -1 + cmdUnfuse = -1 cmdRelease = -1 cmdDebug = -1 cmdCancel = -1 @@ -1562,9 +1622,16 @@ class PokemonStorageScreen commands[cmdMove=commands.length] = _INTL("Move") end commands[cmdSummary=commands.length] = _INTL("Summary") + if pokemon != nil + if dexNum(pokemon.species) > NB_POKEMON + commands[cmdUnfuse=commands.length] = _INTL("Unfuse") + else + commands[cmdFuse=commands.length] = _INTL("Fuse") + end + end commands[cmdWithdraw=commands.length] = (selected[0]==-1) ? _INTL("Store") : _INTL("Withdraw") commands[cmdItem=commands.length] = _INTL("Item") - commands[cmdMark=commands.length] = _INTL("Mark") + commands[cmdRelease=commands.length] = _INTL("Release") commands[cmdDebug=commands.length] = _INTL("Debug") if $DEBUG commands[cmdCancel=commands.length] = _INTL("Cancel") @@ -1581,13 +1648,16 @@ class PokemonStorageScreen (selected[0]==-1) ? pbStore(selected,@heldpkmn) : pbWithdraw(selected,@heldpkmn) elsif cmdItem>=0 && command==cmdItem # Item pbItem(selected,@heldpkmn) - elsif cmdMark>=0 && command==cmdMark # Mark - pbMark(selected,@heldpkmn) + elsif cmdFuse>=0 && command==cmdFuse # fuse + pbFuseFromPC(selected,@heldpkmn) + elsif cmdUnfuse>=0 && command==cmdUnfuse # unfuse + pbUnfuseFromPC(selected) elsif cmdRelease>=0 && command==cmdRelease # Release pbRelease(selected,@heldpkmn) elsif cmdDebug>=0 && command==cmdDebug # Debug pbPokemonDebug((@heldpkmn) ? @heldpkmn : pokemon,selected,heldpoke) end + end end end end @@ -1614,20 +1684,24 @@ class PokemonStorageScreen pbBoxCommands next end + if @fusionMode + pbFusionCommands(selected) + else pokemon = @storage[selected[0],selected[1]] next if !pokemon command = pbShowCommands(_INTL("{1} is selected.",pokemon.name),[ _INTL("Withdraw"), _INTL("Summary"), - _INTL("Mark"), _INTL("Release"), _INTL("Cancel") ]) case command when 0 then pbWithdraw(selected, nil) when 1 then pbSummary(selected, nil) - when 2 then pbMark(selected, nil) - when 3 then pbRelease(selected, nil) + #when 2 then pbMark(selected, nil) + when 2 then pbRelease(selected, nil) + end + end end end @@ -2020,4 +2094,189 @@ class PokemonStorageScreen @scene.pbCloseBox return retval end + + + # + # Fusion stuff + # + + def pbFuseFromPC(selected,heldpoke) + box=selected[0] + index=selected[1] + poke_body = @storage[box,index] + poke_head = heldpoke + if heldpoke + if dexNum(heldpoke.species) > NB_POKEMON + pbDisplay(_INTL("{1} is already fused!",heldpoke.name)) + return + end + end + + + splicerItem = selectSplicer() + if splicerItem == nil + cancelFusion() + return + end + isSuperSplicer = isSuperSplicer?(splicerItem) + + if !heldpoke + @fusionMode = true + @fusionItem = splicerItem + @scene.setFusing(true,@fusionItem) + pbHold(selected) + pbDisplay(_INTL("Select a Pokémon to fuse it with")) + return + end + if !poke_body + pbDisplay(_INTL("Select a Pokémon to fuse it with")) + @fusionMode = true + @fusionItem = splicerItem + @scene.setFusing(true,@fusionItem) + return + end + end + + def deleteHeldPokemon(heldpoke,selected) + @scene.pbReleaseInstant(selected,heldpoke) + @heldpkmn = nil + end + + def cancelFusion + @splicerItem =nil + @scene.setFusing(false) + @fusionMode = false + end + + def canDeleteItem(item) + return item == :SUPERSPLICERS || item == :DNASPLICERS + end + + def isSuperSplicer?(item) + return item == :SUPERSPLICERS || item == :INFINITESPLICERS2 + end + + + def pbFusionCommands(selected) + heldpoke=pbHeldPokemon + pokemon=@storage[selected[0],selected[1]] + + if !pokemon + command=pbShowCommands("Select an action",["Cancel","Stop fusing"]) + case command + when 1 #stop + cancelFusion() + end + else + commands=[ + _INTL("Fuse"), + _INTL("Swap") + ] + commands.push(_INTL("Stop fusing")) + commands.push(_INTL("Cancel")) + + if !heldpoke + pbPlace(selected) + @fusionMode =false + @scene.setFusing(false) + return + end + command=pbShowCommands("Select an action",commands) + case command + when 0 #Fuse + if !pokemon + pbDisplay(_INTL("No Pokémon selected!")) + return + else + if dexNum(pokemon.species) > NB_POKEMON + pbDisplay(_INTL("This Pokémon is already fused!")) + return + end + end + isSuperSplicer = isSuperSplicer?(@fusionItem) + + if pbFuse(pokemon,heldpoke,isSuperSplicer) + if canDeleteItem(@fusionItem) + $PokemonBag.pbDeleteItem(@fusionItem) + end + deleteHeldPokemon(heldpoke,selected) + @scene.setFusing(false) + @fusionMode = false + return + else + # print "fusion cancelled" + # @fusionMode = false + end + when 1 #swap + if pokemon + if dexNum(pokemon.species) <= NB_POKEMON + pbSwap(selected) + else + pbDisplay(_INTL("This Pokémon is already fused!")) + end + else + pbDisplay(_INTL("Select a Pokémon!")) + end + when 2 #cancel + cancelFusion() + return + end + end + end + + def pbUnfuseFromPC(selected) + box=selected[0] + index=selected[1] + pokemon = @storage[box,index] + + if pbConfirm(_INTL("Unfuse {1}?",pokemon.name)) + item = selectSplicer() + return if item == nil + isSuperSplicer = isSuperSplicer?(item) + if pbUnfuse(pokemon,@scene,isSuperSplicer,selected) + if canDeleteItem(item) + $PokemonBag.pbDeleteItem(item) + end + end + @scene.pbHardRefresh + end + end + + + def selectSplicer() + dna_splicers_const = "DNA Splicers" + super_splicers_const = "Super Splicers" + infinite_splicers_const = "Infinite Splicers" + + dnaSplicersQt = $PokemonBag.pbQuantity(:DNASPLICERS) + superSplicersQt = $PokemonBag.pbQuantity(:SUPERSPLICERS) + infiniteSplicersQt = $PokemonBag.pbQuantity(:INFINITESPLICERS) + infiniteSplicers2Qt = $PokemonBag.pbQuantity(:INFINITESPLICERS2) + + options = [] + options.push(_INTL"{1}",infinite_splicers_const)if infiniteSplicers2Qt > 0 || infiniteSplicersQt > 0 + options.push(_INTL("{1} ({2})",super_splicers_const,superSplicersQt))if superSplicersQt > 0 + options.push(_INTL("{1} ({2})",dna_splicers_const,dnaSplicersQt))if dnaSplicersQt > 0 + + if options.length <= 0 + pbDisplay(_INTL("You have no fusion items available.")) + return nil + end + + cmd=pbShowCommands("Use which splicers?",options) + if cmd == -1 + return nil + end + ret = options[cmd] + if ret.start_with?(dna_splicers_const) + return :DNASPLICERS + elsif ret.start_with?(super_splicers_const) + return :SUPERSPLICERS + elsif ret.start_with?(infinite_splicers_const) + return infiniteSplicers2Qt >= 1 ? :INFINITESPLICERS2 : :INFINITESPLICERS + end + return nil + end + + end diff --git a/Data/Scripts/050_AddOns/New Items effects.rb b/Data/Scripts/050_AddOns/New Items effects.rb index 942542561..878c050a8 100644 --- a/Data/Scripts/050_AddOns/New Items effects.rb +++ b/Data/Scripts/050_AddOns/New Items effects.rb @@ -254,7 +254,6 @@ ItemHandlers::UseOnPokemon.add(:TRANSGENDERSTONE, proc { |item, pokemon, scene| end }) - #NOT FULLY IMPLEMENTED ItemHandlers::UseOnPokemon.add(:SECRETCAPSULE, proc { |item, poke, scene| abilityList = poke.getAbilityList @@ -373,7 +372,6 @@ ItemHandlers::UseFromBag.add(:DEBUGGER, proc { |item| end }) - ItemHandlers::UseFromBag.add(:ODDKEYSTONE, proc { |item| TOTAL_SPIRITS_NEEDED = 108 nbSpirits = pbGet(VAR_ODDKEYSTONE_NB) @@ -382,14 +380,14 @@ ItemHandlers::UseFromBag.add(:ODDKEYSTONE, proc { |item| Kernel.pbMessage(_INTL("Voices can be heard whispering from it...")) Kernel.pbMessage(_INTL("Just... one... more...")) elsif nbSpirits < TOTAL_SPIRITS_NEEDED - nbNeeded = TOTAL_SPIRITS_NEEDED-nbSpirits + nbNeeded = TOTAL_SPIRITS_NEEDED - nbSpirits Kernel.pbMessage(_INTL("Voices can be heard whispering from the Odd Keystone...")) - Kernel.pbMessage(_INTL("Bring... us... {1}... spirits",nbNeeded.to_s)) + Kernel.pbMessage(_INTL("Bring... us... {1}... spirits", nbNeeded.to_s)) else Kernel.pbMessage(_INTL("The Odd Keystone appears to be moving on its own.")) Kernel.pbMessage(_INTL("It seems as if some poweful energy is trying to escape from it.")) - if (Kernel.pbMessage("Let it out?", ["No","Yes"], 0)) == 1 - pbWildBattle(:SPIRITOMB,27) + if (Kernel.pbMessage("Let it out?", ["No", "Yes"], 0)) == 1 + pbWildBattle(:SPIRITOMB, 27) pbSet(VAR_ODDKEYSTONE_NB, 0) end next 1 @@ -687,8 +685,6 @@ def drawPokemonType(pokemon_id, x_pos = 192, y_pos = 264) return viewport end - - ItemHandlers::UseOnPokemon.add(:SUPERSPLICERS, proc { |item, pokemon, scene| next true if pbDNASplicing(pokemon, scene, true, true) }) @@ -882,40 +878,40 @@ ItemHandlers::UseOnPokemon.add(:SLOWPOKETAIL, proc { |item, pokemon, scene| # next true # end # }) -ItemHandlers::UseOnPokemon.add(:POISONMUSHROOM,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:POISONMUSHROOM, proc { |item, pkmn, scene| if pkmn.status != :POISON - pkmn.status= :POISON + pkmn.status = :POISON scene.pbRefresh - scene.pbDisplay(_INTL("{1} was poisoned from eating the mushroom.",pkmn.name)) + scene.pbDisplay(_INTL("{1} was poisoned from eating the mushroom.", pkmn.name)) end - next pbHPItem(pkmn,10,scene) + next pbHPItem(pkmn, 10, scene) }) -ItemHandlers::BattleUseOnPokemon.add(:POISONMUSHROOM,proc { |item,pokemon,battler,choices,scene| +ItemHandlers::BattleUseOnPokemon.add(:POISONMUSHROOM, proc { |item, pokemon, battler, choices, scene| if battler.status != :POISON - battler.status= :POISON + battler.status = :POISON scene.pbRefresh - scene.pbDisplay(_INTL("{1} was poisoned from eating the mushroom.",pokemon.name)) + scene.pbDisplay(_INTL("{1} was poisoned from eating the mushroom.", pokemon.name)) end - pbBattleHPItem(pokemon,battler,10,scene) + pbBattleHPItem(pokemon, battler, 10, scene) }) -ItemHandlers::UseOnPokemon.add(:TINYMUSHROOM,proc { |item,pkmn,scene| - next pbHPItem(pkmn,10,scene) +ItemHandlers::UseOnPokemon.add(:TINYMUSHROOM, proc { |item, pkmn, scene| + next pbHPItem(pkmn, 10, scene) }) -ItemHandlers::BattleUseOnPokemon.add(:TINYMUSHROOM,proc { |item,pokemon,battler,choices,scene| - next pbBattleHPItem(pokemon,battler,50,scene) +ItemHandlers::BattleUseOnPokemon.add(:TINYMUSHROOM, proc { |item, pokemon, battler, choices, scene| + next pbBattleHPItem(pokemon, battler, 50, scene) }) -ItemHandlers::UseOnPokemon.add(:BIGMUSHROOM,proc { |item,pkmn,scene| - next pbHPItem(pkmn,10,scene) +ItemHandlers::UseOnPokemon.add(:BIGMUSHROOM, proc { |item, pkmn, scene| + next pbHPItem(pkmn, 10, scene) }) -ItemHandlers::BattleUseOnPokemon.add(:BIGMUSHROOM,proc { |item,pokemon,battler,choices,scene| - next pbBattleHPItem(pokemon,battler,50,scene) +ItemHandlers::BattleUseOnPokemon.add(:BIGMUSHROOM, proc { |item, pokemon, battler, choices, scene| + next pbBattleHPItem(pokemon, battler, 50, scene) }) -ItemHandlers::UseOnPokemon.add(:BALMMUSHROOM,proc { |item,pkmn,scene| - next pbHPItem(pkmn,999,scene) +ItemHandlers::UseOnPokemon.add(:BALMMUSHROOM, proc { |item, pkmn, scene| + next pbHPItem(pkmn, 999, scene) }) -ItemHandlers::BattleUseOnPokemon.add(:BALMMUSHROOM,proc { |item,pokemon,battler,choices,scene| - next pbBattleHPItem(pokemon,battler,999,scene) +ItemHandlers::BattleUseOnPokemon.add(:BALMMUSHROOM, proc { |item, pokemon, battler, choices, scene| + next pbBattleHPItem(pokemon, battler, 999, scene) }) #TRACKER (for roaming legendaries) @@ -1290,7 +1286,7 @@ def pbDNASplicing(pokemon, scene, supersplicers = false, superSplicer = false) scene.pbDisplay(_INTL("A fainted Pokémon cannot be fused!")) return false end - if(pbFuse(pokemon,poke2,superSplicer)) + if (pbFuse(pokemon, poke2, superSplicer)) pbRemovePokemonAt(chosen) scene.pbHardRefresh pbBGMPlay(playingBGM) @@ -1309,11 +1305,11 @@ def pbDNASplicing(pokemon, scene, supersplicers = false, superSplicer = false) end else #UNFUSE - return true if pbUnfuse(pokemon,scene,supersplicers) + return true if pbUnfuse(pokemon, scene, supersplicers) end end -def pbFuse(pokemon,poke2,supersplicers=false) +def pbFuse(pokemon, poke2, supersplicers = false) newid = (pokemon.species_data.id_number) * NB_POKEMON + poke2.species_data.id_number pathCustom = _INTL("Graphics/CustomBattlers/{1}.{2}.png", poke2.species_data.id_number, pokemon.species_data.id_number) @@ -1358,8 +1354,7 @@ def pbFuse(pokemon,poke2,supersplicers=false) end - -def pbUnfuse(pokemon, scene,supersplicers,pcPosition=nil) +def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil) bodyPoke = getBasePokemonID(pokemon.species_data.id_number, true) headPoke = getBasePokemonID(pokemon.species_data.id_number, false) @@ -1375,7 +1370,7 @@ def pbUnfuse(pokemon, scene,supersplicers,pcPosition=nil) end keepInParty = 0 - if $Trainer.party.length >= 6 + if $Trainer.party.length >= 6 && !pcPosition scene.pbDisplay(_INTL("Your party is full! Keep which Pokémon in party?")) choice = Kernel.pbMessage("Select a Pokémon to keep in your party.", [_INTL("{1}", PBSpecies.getName(bodyPoke)), _INTL("{1}", PBSpecies.getName(headPoke)), "Cancel"], 2) if choice == 2 @@ -1407,9 +1402,9 @@ def pbUnfuse(pokemon, scene,supersplicers,pcPosition=nil) body_level = poke1.level head_level = poke2.level - pokemon.exp_gained_since_fused=0 - pokemon.exp_when_fused_head=nil - pokemon.exp_when_fused_body=nil + pokemon.exp_gained_since_fused = 0 + pokemon.exp_when_fused_head = nil + pokemon.exp_when_fused_body = nil if $Trainer.party.length >= 6 if (keepInParty == 0) @@ -1419,11 +1414,27 @@ def pbUnfuse(pokemon, scene,supersplicers,pcPosition=nil) poke2 = Pokemon.new(bodyPoke, body_level) poke1 = Pokemon.new(headPoke, head_level) - $PokemonStorage.pbStoreCaught(poke2) - scene.pbDisplay(_INTL("{1} was sent to the PC.", poke2.name)) + if pcPosition != nil + box = pcPosition[0] + index = pcPosition[1] + #todo: store at next available position from current position + $PokemonStorage.pbStoreCaught(poke2) + else + $PokemonStorage.pbStoreCaught(poke2) + scene.pbDisplay(_INTL("{1} was sent to the PC.", poke2.name)) + end + end else - Kernel.pbAddPokemonSilent(poke2, poke2.level) + if pcPosition != nil + box = pcPosition[0] + index = pcPosition[1] + + #todo: store at next available position from current position + $PokemonStorage.pbStoreCaught(poke2) + else + Kernel.pbAddPokemonSilent(poke2, poke2.level) + end end #On ajoute l'autre dans le pokedex aussi diff --git a/Data/System.rxdata b/Data/System.rxdata index 61b38b694..112d68219 100644 Binary files a/Data/System.rxdata and b/Data/System.rxdata differ