mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Moves fail because of semi-invulnerability instead of other immunities, fixed Pokédex not registering Pokémon in Safari battles, other things
This commit is contained in:
@@ -306,6 +306,12 @@ class Battle::Battler
|
|||||||
target.damageState.typeMod = typeMod
|
target.damageState.typeMod = typeMod
|
||||||
# Two-turn attacks can't fail here in the charging turn
|
# Two-turn attacks can't fail here in the charging turn
|
||||||
return true if user.effects[PBEffects::TwoTurnAttack]
|
return true if user.effects[PBEffects::TwoTurnAttack]
|
||||||
|
# Semi-invulnerable target
|
||||||
|
if !pbSuccessCheckSemiInvulnerable(move, user, target)
|
||||||
|
PBDebug.log("[Move failed] Target is semi-invulnerable")
|
||||||
|
target.damageState.invulnerable = true
|
||||||
|
return true # Succeeds here but fails in def pbSuccessCheckPerHit
|
||||||
|
end
|
||||||
# Move-specific failures
|
# Move-specific failures
|
||||||
if move.pbFailsAgainstTarget?(user, target, show_message)
|
if move.pbFailsAgainstTarget?(user, target, show_message)
|
||||||
PBDebug.log(sprintf("[Move failed] In function code %s's def pbFailsAgainstTarget?", move.function_code))
|
PBDebug.log(sprintf("[Move failed] In function code %s's def pbFailsAgainstTarget?", move.function_code))
|
||||||
@@ -525,6 +531,42 @@ class Battle::Battler
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns true if the target is not semi-invulnerable, or if the user can hit
|
||||||
|
# the target even though the target is semi-invulnerable.
|
||||||
|
def pbSuccessCheckSemiInvulnerable(move, user, target)
|
||||||
|
# Lock-On
|
||||||
|
return true if user.effects[PBEffects::LockOn] > 0 &&
|
||||||
|
user.effects[PBEffects::LockOnPos] == target.index
|
||||||
|
# Toxic
|
||||||
|
return true if move.pbOverrideSuccessCheckPerHit(user, target)
|
||||||
|
# No Guard
|
||||||
|
return true if user.hasActiveAbility?(:NOGUARD) ||
|
||||||
|
target.hasActiveAbility?(:NOGUARD)
|
||||||
|
# Future Sight
|
||||||
|
return true if @battle.futureSight
|
||||||
|
# Helping Hand
|
||||||
|
return true if move.function_code == "PowerUpAllyMove"
|
||||||
|
# Semi-invulnerable moves
|
||||||
|
if target.effects[PBEffects::TwoTurnAttack]
|
||||||
|
if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
|
||||||
|
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
|
||||||
|
"TwoTurnAttackInvulnerableInSkyTargetCannotAct")
|
||||||
|
return move.hitsFlyingTargets?
|
||||||
|
elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderground")
|
||||||
|
return move.hitsDiggingTargets?
|
||||||
|
elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderwater")
|
||||||
|
return move.hitsDivingTargets?
|
||||||
|
elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableRemoveProtections")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if target.effects[PBEffects::SkyDrop] >= 0 &&
|
||||||
|
target.effects[PBEffects::SkyDrop] != user.index && !move.hitsFlyingTargets?
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Per-hit success check against the target.
|
# Per-hit success check against the target.
|
||||||
# Includes semi-invulnerable move use and accuracy calculation.
|
# Includes semi-invulnerable move use and accuracy calculation.
|
||||||
@@ -537,46 +579,13 @@ class Battle::Battler
|
|||||||
user.effects[PBEffects::LockOnPos] == target.index
|
user.effects[PBEffects::LockOnPos] == target.index
|
||||||
# Toxic
|
# Toxic
|
||||||
return true if move.pbOverrideSuccessCheckPerHit(user, target)
|
return true if move.pbOverrideSuccessCheckPerHit(user, target)
|
||||||
miss = false
|
# Semi-invulnerable target
|
||||||
hitsInvul = false
|
return false if target.damageState.invulnerable
|
||||||
# No Guard
|
# Called by another move
|
||||||
hitsInvul = true if user.hasActiveAbility?(:NOGUARD) ||
|
return true if skipAccuracyCheck
|
||||||
target.hasActiveAbility?(:NOGUARD)
|
# Accuracy check
|
||||||
# Future Sight
|
return true if move.pbAccuracyCheck(user, target) # Includes Counter/Mirror Coat
|
||||||
hitsInvul = true if @battle.futureSight
|
PBDebug.log("[Move failed] Failed pbAccuracyCheck")
|
||||||
# Helping Hand
|
|
||||||
hitsInvul = true if move.function_code == "PowerUpAllyMove"
|
|
||||||
if !hitsInvul
|
|
||||||
# Semi-invulnerable moves
|
|
||||||
if target.effects[PBEffects::TwoTurnAttack]
|
|
||||||
if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
|
|
||||||
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
|
|
||||||
"TwoTurnAttackInvulnerableInSkyTargetCannotAct")
|
|
||||||
miss = true if !move.hitsFlyingTargets?
|
|
||||||
elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderground")
|
|
||||||
miss = true if !move.hitsDiggingTargets?
|
|
||||||
elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableUnderwater")
|
|
||||||
miss = true if !move.hitsDivingTargets?
|
|
||||||
elsif target.inTwoTurnAttack?("TwoTurnAttackInvulnerableRemoveProtections")
|
|
||||||
miss = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if target.effects[PBEffects::SkyDrop] >= 0 &&
|
|
||||||
target.effects[PBEffects::SkyDrop] != user.index && !move.hitsFlyingTargets?
|
|
||||||
miss = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if miss
|
|
||||||
target.damageState.invulnerable = true
|
|
||||||
PBDebug.log("[Move failed] Target is semi-invulnerable")
|
|
||||||
else
|
|
||||||
# Called by another move
|
|
||||||
return true if skipAccuracyCheck
|
|
||||||
# Accuracy check
|
|
||||||
return true if move.pbAccuracyCheck(user, target) # Includes Counter/Mirror Coat
|
|
||||||
PBDebug.log("[Move failed] Failed pbAccuracyCheck")
|
|
||||||
end
|
|
||||||
# Missed
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ class SafariBattle
|
|||||||
def pbGetOwnerFromBattlerIndex(idxBattler); return pbPlayer; end
|
def pbGetOwnerFromBattlerIndex(idxBattler); return pbPlayer; end
|
||||||
|
|
||||||
def pbSetSeen(battler)
|
def pbSetSeen(battler)
|
||||||
return if !battler || !@internalBattle
|
return if !battler
|
||||||
if battler.is_a?(Battle::Battler)
|
if battler.is_a?(Battle::Battler)
|
||||||
pbPlayer.pokedex.register(battler.displaySpecies, battler.displayGender,
|
pbPlayer.pokedex.register(battler.displaySpecies, battler.displayGender,
|
||||||
battler.displayForm, battler.shiny?)
|
battler.displayForm, battler.shiny?)
|
||||||
@@ -352,7 +352,7 @@ class SafariBattle
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbSetCaught(battler)
|
def pbSetCaught(battler)
|
||||||
return if !battler || !@internalBattle
|
return if !battler
|
||||||
if battler.is_a?(Battle::Battler)
|
if battler.is_a?(Battle::Battler)
|
||||||
pbPlayer.pokedex.register_caught(battler.displaySpecies)
|
pbPlayer.pokedex.register_caught(battler.displaySpecies)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ class PokemonLoad_Scene
|
|||||||
@sprites["cmdwindow"] = Window_CommandPokemon.new([])
|
@sprites["cmdwindow"] = Window_CommandPokemon.new([])
|
||||||
@sprites["cmdwindow"].viewport = @viewport
|
@sprites["cmdwindow"].viewport = @viewport
|
||||||
@sprites["cmdwindow"].visible = false
|
@sprites["cmdwindow"].visible = false
|
||||||
|
@max_party_index = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbStartScene2
|
def pbStartScene2
|
||||||
@@ -143,7 +144,7 @@ class PokemonLoad_Scene
|
|||||||
@commands.length.times do |i|
|
@commands.length.times do |i|
|
||||||
@sprites["panel#{i}"].y -= 48
|
@sprites["panel#{i}"].y -= 48
|
||||||
end
|
end
|
||||||
6.times do |i|
|
(@max_party_index + 1).times do |i|
|
||||||
break if !@sprites["party#{i}"]
|
break if !@sprites["party#{i}"]
|
||||||
@sprites["party#{i}"].y -= 48
|
@sprites["party#{i}"].y -= 48
|
||||||
end
|
end
|
||||||
@@ -153,7 +154,7 @@ class PokemonLoad_Scene
|
|||||||
@commands.length.times do |i|
|
@commands.length.times do |i|
|
||||||
@sprites["panel#{i}"].y += 48
|
@sprites["panel#{i}"].y += 48
|
||||||
end
|
end
|
||||||
6.times do |i|
|
(@max_party_index + 1).times do |i|
|
||||||
break if !@sprites["party#{i}"]
|
break if !@sprites["party#{i}"]
|
||||||
@sprites["party#{i}"].y += 48
|
@sprites["party#{i}"].y += 48
|
||||||
end
|
end
|
||||||
@@ -183,6 +184,7 @@ class PokemonLoad_Scene
|
|||||||
@sprites["party#{i}"].x = 334 + (66 * (i % 2))
|
@sprites["party#{i}"].x = 334 + (66 * (i % 2))
|
||||||
@sprites["party#{i}"].y = 112 + (50 * (i / 2))
|
@sprites["party#{i}"].y = 112 + (50 * (i / 2))
|
||||||
@sprites["party#{i}"].z = 99999
|
@sprites["party#{i}"].z = 99999
|
||||||
|
@max_party_index = i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -616,5 +616,5 @@ def pbScreenCapture
|
|||||||
capturefile = RTP.getSaveFileName(sprintf("%s.png", filestart))
|
capturefile = RTP.getSaveFileName(sprintf("%s.png", filestart))
|
||||||
Graphics.screenshot(capturefile)
|
Graphics.screenshot(capturefile)
|
||||||
end
|
end
|
||||||
pbSEPlay("Pkmn exp full") if FileTest.audio_exist?("Audio/SE/Pkmn exp full")
|
pbSEPlay("Screenshot") if FileTest.audio_exist?("Audio/SE/Screenshot")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user