Fixed "cannotRun" battle rule not applying to Roar/Circle Throw/Poké Dolls, commented out compiler code that edits what it thinks are supposed to be doors

This commit is contained in:
Maruno17
2021-03-27 20:11:16 +00:00
parent b5c8c6ba26
commit ca5dcf70ae
5 changed files with 24 additions and 18 deletions

View File

@@ -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

View File

@@ -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
})

View File

@@ -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

View File

@@ -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)

View File

@@ -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