Fixed additional effect issues with Eerie Spell/Jaw Lock/Thousand Waves

This commit is contained in:
Maruno17
2023-03-09 20:37:26 +00:00
parent e93c3c69ac
commit 5a18f7fd65
7 changed files with 36 additions and 13 deletions

View File

@@ -107,8 +107,8 @@ module Settings
#============================================================================= #=============================================================================
# Whether wild Pokémon with the "Legendary" or "Mythical" flag (as defined in # Whether wild Pokémon with the "Legendary", "Mythical" or "UltraBeast" flag
# pokemon.txt) have a smarter AI. Their skill level is set to 32, which is a # (as defined in pokemon.txt) have a smarter AI. Their skill level is set to
# medium skill level. # 32, which is a medium skill level.
SMARTER_WILD_LEGENDARY_POKEMON = true SMARTER_WILD_LEGENDARY_POKEMON = true
end end

View File

@@ -306,7 +306,8 @@ end
#=============================================================================== #===============================================================================
# Target can no longer switch out or flee, as long as the user remains active. # Target can no longer switch out or flee, as long as the user remains active.
# (Anchor Shot, Block, Mean Look, Spider Web, Spirit Shackle, Thousand Waves) # Trapping is considered an additional effect for damaging moves.
# (Anchor Shot, Block, Mean Look, Spider Web, Spirit Shackle)
#=============================================================================== #===============================================================================
class Battle::Move::TrapTargetInBattle < Battle::Move class Battle::Move::TrapTargetInBattle < Battle::Move
def canMagicCoat?; return true; end def canMagicCoat?; return true; end
@@ -339,6 +340,22 @@ class Battle::Move::TrapTargetInBattle < Battle::Move
end end
end end
#===============================================================================
# Target can no longer switch out or flee, as long as the user remains active.
# Trapping is not considered an additional effect. (Thousand Waves)
#===============================================================================
class Battle::Move::TrapTargetInBattleMainEffect < Battle::Move
def canMagicCoat?; return true; end
def pbEffectAgainstTarget(user, target)
return if target.fainted? || target.damageState.substitute
return if target.effects[PBEffects::MeanLook] >= 0
return if Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST)
target.effects[PBEffects::MeanLook] = user.index
@battle.pbDisplay(_INTL("{1} can no longer escape!", target.pbThis))
end
end
#=============================================================================== #===============================================================================
# The target can no longer switch out or flee, while the user remains in battle. # The target can no longer switch out or flee, while the user remains in battle.
# At the end of each round, the target's Defense and Special Defense are lowered # At the end of each round, the target's Defense and Special Defense are lowered
@@ -370,7 +387,7 @@ end
# fleeing. (Jaw Lock) # fleeing. (Jaw Lock)
#=============================================================================== #===============================================================================
class Battle::Move::TrapUserAndTargetInBattle < Battle::Move class Battle::Move::TrapUserAndTargetInBattle < Battle::Move
def pbAdditionalEffect(user, target) def pbEffectAgainstTarget(user, target)
return if user.fainted? || target.fainted? || target.damageState.substitute return if user.fainted? || target.fainted? || target.damageState.substitute
return if Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST) return if Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST)
return if user.trappedInBattle? || target.trappedInBattle? return if user.trappedInBattle? || target.trappedInBattle?
@@ -660,8 +677,8 @@ end
# Target's last move used loses 3 PP. Damaging move. (Eerie Spell) # Target's last move used loses 3 PP. Damaging move. (Eerie Spell)
#=============================================================================== #===============================================================================
class Battle::Move::LowerPPOfTargetLastMoveBy3 < Battle::Move class Battle::Move::LowerPPOfTargetLastMoveBy3 < Battle::Move
def pbEffectAgainstTarget(user, target) def pbAdditionalEffect(user, target)
return if target.fainted? return if target.fainted? || target.damageState.substitute
last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed) last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed)
return if !last_move || last_move.pp == 0 || last_move.total_pp <= 0 return if !last_move || last_move.pp == 0 || last_move.total_pp <= 0
reduction = [3, last_move.pp].min reduction = [3, last_move.pp].min

View File

@@ -217,6 +217,12 @@ Battle::AI::Handlers::MoveFailureAgainstTargetCheck.add("TrapTargetInBattle",
} }
) )
#===============================================================================
# TODO: Review score modifiers.
#===============================================================================
Battle::AI::Handlers::MoveFailureAgainstTargetCheck.copy("TrapTargetInBattle",
"TrapTargetInBattleMainEffect")
#=============================================================================== #===============================================================================
# TODO: Review score modifiers. # TODO: Review score modifiers.
#=============================================================================== #===============================================================================

View File

@@ -3224,7 +3224,7 @@ Power = 90
Accuracy = 100 Accuracy = 100
TotalPP = 10 TotalPP = 10
Target = AllNearFoes Target = AllNearFoes
FunctionCode = TrapTargetInBattle FunctionCode = TrapTargetInBattleMainEffect
Flags = CanProtect,CanMirrorMove,CannotMetronome Flags = CanProtect,CanMirrorMove,CannotMetronome
Description = The user attacks with a wave that crawls along the ground. Those it hits can't flee from battle. Description = The user attacks with a wave that crawls along the ground. Those it hits can't flee from battle.
#------------------------------- #-------------------------------

View File

@@ -3580,7 +3580,7 @@ Power = 90
Accuracy = 100 Accuracy = 100
TotalPP = 10 TotalPP = 10
Target = AllNearFoes Target = AllNearFoes
FunctionCode = TrapTargetInBattle FunctionCode = TrapTargetInBattleMainEffect
Flags = CanProtect,CanMirrorMove,CannotMetronome Flags = CanProtect,CanMirrorMove,CannotMetronome
Description = The user attacks with a wave that crawls along the ground. Those it hits can't flee from battle. Description = The user attacks with a wave that crawls along the ground. Those it hits can't flee from battle.
#------------------------------- #-------------------------------

View File

@@ -455,7 +455,6 @@ TotalPP = 10
Target = NearOther Target = NearOther
FunctionCode = TrapUserAndTargetInBattle FunctionCode = TrapUserAndTargetInBattle
Flags = Contact,CanProtect,CanMirrorMove Flags = Contact,CanProtect,CanMirrorMove
EffectChance = 100
Description = This move prevents the user and the target from switching out until either of them faints. Description = This move prevents the user and the target from switching out until either of them faints.
#------------------------------- #-------------------------------
[THROATCHOP] [THROATCHOP]
@@ -4077,7 +4076,7 @@ Power = 90
Accuracy = 100 Accuracy = 100
TotalPP = 10 TotalPP = 10
Target = AllNearFoes Target = AllNearFoes
FunctionCode = TrapTargetInBattle FunctionCode = TrapTargetInBattleMainEffect
Flags = CanProtect,CanMirrorMove,CannotMetronome Flags = CanProtect,CanMirrorMove,CannotMetronome
Description = The user attacks with a wave that crawls along the ground. Those it hits can't flee from battle. Description = The user attacks with a wave that crawls along the ground. Those it hits can't flee from battle.
#------------------------------- #-------------------------------
@@ -7134,6 +7133,7 @@ TotalPP = 5
Target = NearOther Target = NearOther
FunctionCode = LowerPPOfTargetLastMoveBy3 FunctionCode = LowerPPOfTargetLastMoveBy3
Flags = CanProtect,CanMirrorMove,Sound Flags = CanProtect,CanMirrorMove,Sound
EffectChance = 100
Description = The user attacks with tremendous psychic power. This also removes 3 PP from the target's last move. Description = The user attacks with tremendous psychic power. This also removes 3 PP from the target's last move.
#------------------------------- #-------------------------------
[EXPANDINGFORCE] [EXPANDINGFORCE]

View File

@@ -455,7 +455,6 @@ TotalPP = 10
Target = NearOther Target = NearOther
FunctionCode = TrapUserAndTargetInBattle FunctionCode = TrapUserAndTargetInBattle
Flags = Contact,CanProtect,CanMirrorMove Flags = Contact,CanProtect,CanMirrorMove
EffectChance = 100
Description = This move prevents the user and the target from switching out until either of them faints. Description = This move prevents the user and the target from switching out until either of them faints.
#------------------------------- #-------------------------------
[THROATCHOP] [THROATCHOP]
@@ -4077,7 +4076,7 @@ Power = 90
Accuracy = 100 Accuracy = 100
TotalPP = 10 TotalPP = 10
Target = AllNearFoes Target = AllNearFoes
FunctionCode = TrapTargetInBattle FunctionCode = TrapTargetInBattleMainEffect
Flags = CanProtect,CanMirrorMove,CannotMetronome Flags = CanProtect,CanMirrorMove,CannotMetronome
Description = The user attacks with a wave that crawls along the ground. Those it hits can't flee from battle. Description = The user attacks with a wave that crawls along the ground. Those it hits can't flee from battle.
#------------------------------- #-------------------------------
@@ -7134,6 +7133,7 @@ TotalPP = 5
Target = NearOther Target = NearOther
FunctionCode = LowerPPOfTargetLastMoveBy3 FunctionCode = LowerPPOfTargetLastMoveBy3
Flags = CanProtect,CanMirrorMove,Sound Flags = CanProtect,CanMirrorMove,Sound
EffectChance = 100
Description = The user attacks with tremendous psychic power. This also removes 3 PP from the target's last move. Description = The user attacks with tremendous psychic power. This also removes 3 PP from the target's last move.
#------------------------------- #-------------------------------
[EXPANDINGFORCE] [EXPANDINGFORCE]