From ca5dcf70ae6c0fb0f1b409033c37a148350ccf67 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sat, 27 Mar 2021 20:11:16 +0000 Subject: [PATCH] =?UTF-8?q?Fixed=20"cannotRun"=20battle=20rule=20not=20app?= =?UTF-8?q?lying=20to=20Roar/Circle=20Throw/Pok=C3=A9=20Dolls,=20commented?= =?UTF-8?q?=20out=20compiler=20code=20that=20edits=20what=20it=20thinks=20?= =?UTF-8?q?are=20supposed=20to=20be=20doors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../002_Move/006_Move_Effects_080-0FF.rb | 12 +++++----- .../015_Items/003_PItem_BattleItemEffects.rb | 4 ++++ .../003_PBattle_OrgBattle.rb | 2 -- .../022_Compiler/003_Compiler_WritePBS.rb | 22 ++++++++++--------- .../004_Compiler_MapsAndEvents.rb | 2 ++ 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb b/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb index b86a5587b..0b7ea9d2c 100644 --- a/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb +++ b/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb @@ -2985,6 +2985,10 @@ class PokeBattle_Move_0EB < PokeBattle_Move @battle.pbDisplay(_INTL("{1} anchored itself with its roots!",target.pbThis)) return true end + if !@battle.canRun + @battle.pbDisplay(_INTL("But it failed!")) + return true + end if @battle.wildBattle? && target.level>user.level @battle.pbDisplay(_INTL("But it failed!")) return true @@ -3041,7 +3045,7 @@ end #=============================================================================== class PokeBattle_Move_0EC < PokeBattle_Move def pbEffectAgainstTarget(user,target) - if @battle.wildBattle? && target.level<=user.level && + if @battle.wildBattle? && target.level<=user.level && @battle.canRun && (target.effects[PBEffects::Substitute]==0 || ignoresSubstitute?(user)) @battle.decision = 3 end @@ -3282,11 +3286,7 @@ class PokeBattle_Move_0F2 < PokeBattle_Move user.setInitialItem(oldTargetItem) end @battle.pbDisplay(_INTL("{1} switched items with its opponent!",user.pbThis)) - if oldUserItem && oldTargetItem - @battle.pbDisplay(_INTL("{1} obtained {2}.",user.pbThis,oldTargetItemName)) - elsif oldTargetItem - @battle.pbDisplay(_INTL("{1} obtained {2}.",user.pbThis,oldTargetItemName)) - end + @battle.pbDisplay(_INTL("{1} obtained {2}.",user.pbThis,oldTargetItemName)) if oldTargetItem @battle.pbDisplay(_INTL("{1} obtained {2}.",target.pbThis,oldUserItemName)) if oldUserItem user.pbHeldItemTriggerCheck target.pbHeldItemTriggerCheck diff --git a/Data/Scripts/015_Items/003_PItem_BattleItemEffects.rb b/Data/Scripts/015_Items/003_PItem_BattleItemEffects.rb index d6a4bdfb1..280dc5f46 100644 --- a/Data/Scripts/015_Items/003_PItem_BattleItemEffects.rb +++ b/Data/Scripts/015_Items/003_PItem_BattleItemEffects.rb @@ -16,6 +16,10 @@ ItemHandlers::CanUseInBattle.add(:POKEDOLL,proc { |item,pokemon,battler,move,fir end next false end + if !battle.canRun + scene.pbDisplay(_INTL("You can't escape!")) if showMessages + next false + end next true }) diff --git a/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb b/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb index 7bba3e483..8a40913f8 100644 --- a/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb +++ b/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb @@ -26,8 +26,6 @@ class PBPokemon @move2 = move2 ? move2 : 0 @move3 = move3 ? move3 : 0 @move4 = move4 ? move4 : 0 - # TODO: Stat changes (what is @ev here? Seems to be a set of bit flags - # indicating each stat that should have EVs put into it. Could change it). @ev = ev end diff --git a/Data/Scripts/022_Compiler/003_Compiler_WritePBS.rb b/Data/Scripts/022_Compiler/003_Compiler_WritePBS.rb index c05c6944b..575ed6028 100644 --- a/Data/Scripts/022_Compiler/003_Compiler_WritePBS.rb +++ b/Data/Scripts/022_Compiler/003_Compiler_WritePBS.rb @@ -698,8 +698,14 @@ module Compiler moves = { 0 => "" } items = { 0 => "" } natures = {} - # TODO: Stat change (rewrite this). - evs = ["HP", "ATK", "DEF", "SPD", "SA", "SD"] + evs = { + :HP => "HP", + :ATTACK => "ATK", + :DEFENSE => "DEF", + :SPECIAL_ATTACK => "SA", + :SPECIAL_DEFENSE => "SD", + :SPEED => "SPD" + } File.open(filename,"wb") { |f| add_PBS_header_to_file(f) f.write("\#-------------------------------\r\n") @@ -709,15 +715,11 @@ module Compiler c1 = (species[pkmn.species]) ? species[pkmn.species] : (species[pkmn.species] = GameData::Species.get(pkmn.species).species.to_s) c2 = (items[pkmn.item]) ? items[pkmn.item] : (items[pkmn.item] = GameData::Item.get(pkmn.item).id.to_s) c3 = (natures[pkmn.nature]) ? natures[pkmn.nature] : (natures[pkmn.nature] = GameData::Nature.get(pkmn.nature).id.to_s) - # TODO: Stat change (rewrite this). evlist = "" - ev = pkmn.ev - for i in 0...evs.length - if (ev & (1 << i)) != 0 - evlist += "," if evlist.length > 0 - evlist += evs[i] - end - end + pkmn.ev.each do |stat| + evlist += "," if evlist.length > 0 + evlist += evs[stat] + } c4 = (moves[pkmn.move1]) ? moves[pkmn.move1] : (moves[pkmn.move1] = GameData::Move.get(pkmn.move1).id.to_s) c5 = (moves[pkmn.move2]) ? moves[pkmn.move2] : (moves[pkmn.move2] = GameData::Move.get(pkmn.move2).id.to_s) c6 = (moves[pkmn.move3]) ? moves[pkmn.move3] : (moves[pkmn.move3] = GameData::Move.get(pkmn.move3).id.to_s) diff --git a/Data/Scripts/022_Compiler/004_Compiler_MapsAndEvents.rb b/Data/Scripts/022_Compiler/004_Compiler_MapsAndEvents.rb index 2d3f071b9..3cbbe10ff 100644 --- a/Data/Scripts/022_Compiler/004_Compiler_MapsAndEvents.rb +++ b/Data/Scripts/022_Compiler/004_Compiler_MapsAndEvents.rb @@ -942,6 +942,7 @@ module Compiler end when 201 # Transfer Player if list.length<=8 +=begin if params[0]==0 # Look for another event just above the position this Transfer # Player command will transfer to - it may be a door, in which case @@ -1075,6 +1076,7 @@ module Compiler end end end +=end # If this is the only event command, convert to a full event if list.length==2 || (list.length==3 && (list[0].code==250 || list[1].code==250)) # Play SE params[5] = 1 # No fade