diff --git a/Data/Scripts/002_BattleSettings.rb b/Data/Scripts/002_BattleSettings.rb index be9ad65f1..25e2ae97c 100644 --- a/Data/Scripts/002_BattleSettings.rb +++ b/Data/Scripts/002_BattleSettings.rb @@ -107,8 +107,8 @@ module Settings #============================================================================= - # Whether wild Pokémon with the "Legendary" or "Mythical" flag (as defined in - # pokemon.txt) have a smarter AI. Their skill level is set to 32, which is a - # medium skill level. + # Whether wild Pokémon with the "Legendary", "Mythical" or "UltraBeast" flag + # (as defined in pokemon.txt) have a smarter AI. Their skill level is set to + # 32, which is a medium skill level. SMARTER_WILD_LEGENDARY_POKEMON = true end diff --git a/Data/Scripts/011_Battle/003_Move/013_MoveEffects_SwitchingActing.rb b/Data/Scripts/011_Battle/003_Move/013_MoveEffects_SwitchingActing.rb index 8b3c52c02..c916e1b73 100644 --- a/Data/Scripts/011_Battle/003_Move/013_MoveEffects_SwitchingActing.rb +++ b/Data/Scripts/011_Battle/003_Move/013_MoveEffects_SwitchingActing.rb @@ -306,7 +306,8 @@ end #=============================================================================== # 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 def canMagicCoat?; return true; end @@ -339,6 +340,22 @@ class Battle::Move::TrapTargetInBattle < Battle::Move 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. # At the end of each round, the target's Defense and Special Defense are lowered @@ -370,7 +387,7 @@ end # fleeing. (Jaw Lock) #=============================================================================== 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 Settings::MORE_TYPE_EFFECTS && target.pbHasType?(:GHOST) return if user.trappedInBattle? || target.trappedInBattle? @@ -660,8 +677,8 @@ end # Target's last move used loses 3 PP. Damaging move. (Eerie Spell) #=============================================================================== class Battle::Move::LowerPPOfTargetLastMoveBy3 < Battle::Move - def pbEffectAgainstTarget(user, target) - return if target.fainted? + def pbAdditionalEffect(user, target) + return if target.fainted? || target.damageState.substitute last_move = target.pbGetMoveWithID(target.lastRegularMoveUsed) return if !last_move || last_move.pp == 0 || last_move.total_pp <= 0 reduction = [3, last_move.pp].min diff --git a/Data/Scripts/011_Battle/005b_AI move function codes/059_AI_MoveHandlers_SwitchingActing.rb b/Data/Scripts/011_Battle/005b_AI move function codes/059_AI_MoveHandlers_SwitchingActing.rb index e7c97e543..b6d4e5874 100644 --- a/Data/Scripts/011_Battle/005b_AI move function codes/059_AI_MoveHandlers_SwitchingActing.rb +++ b/Data/Scripts/011_Battle/005b_AI move function codes/059_AI_MoveHandlers_SwitchingActing.rb @@ -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. #=============================================================================== diff --git a/PBS/Gen 6/moves.txt b/PBS/Gen 6/moves.txt index 15927b7e2..73791c693 100644 --- a/PBS/Gen 6/moves.txt +++ b/PBS/Gen 6/moves.txt @@ -3224,7 +3224,7 @@ Power = 90 Accuracy = 100 TotalPP = 10 Target = AllNearFoes -FunctionCode = TrapTargetInBattle +FunctionCode = TrapTargetInBattleMainEffect Flags = CanProtect,CanMirrorMove,CannotMetronome Description = The user attacks with a wave that crawls along the ground. Those it hits can't flee from battle. #------------------------------- diff --git a/PBS/Gen 7/moves.txt b/PBS/Gen 7/moves.txt index 26e4ea73b..f2b15979a 100644 --- a/PBS/Gen 7/moves.txt +++ b/PBS/Gen 7/moves.txt @@ -3580,7 +3580,7 @@ Power = 90 Accuracy = 100 TotalPP = 10 Target = AllNearFoes -FunctionCode = TrapTargetInBattle +FunctionCode = TrapTargetInBattleMainEffect Flags = CanProtect,CanMirrorMove,CannotMetronome Description = The user attacks with a wave that crawls along the ground. Those it hits can't flee from battle. #------------------------------- diff --git a/PBS/Gen 8/moves.txt b/PBS/Gen 8/moves.txt index 64417b42e..03b1f612e 100644 --- a/PBS/Gen 8/moves.txt +++ b/PBS/Gen 8/moves.txt @@ -455,7 +455,6 @@ TotalPP = 10 Target = NearOther FunctionCode = TrapUserAndTargetInBattle Flags = Contact,CanProtect,CanMirrorMove -EffectChance = 100 Description = This move prevents the user and the target from switching out until either of them faints. #------------------------------- [THROATCHOP] @@ -4077,7 +4076,7 @@ Power = 90 Accuracy = 100 TotalPP = 10 Target = AllNearFoes -FunctionCode = TrapTargetInBattle +FunctionCode = TrapTargetInBattleMainEffect Flags = CanProtect,CanMirrorMove,CannotMetronome 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 FunctionCode = LowerPPOfTargetLastMoveBy3 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. #------------------------------- [EXPANDINGFORCE] diff --git a/PBS/moves.txt b/PBS/moves.txt index 64417b42e..03b1f612e 100644 --- a/PBS/moves.txt +++ b/PBS/moves.txt @@ -455,7 +455,6 @@ TotalPP = 10 Target = NearOther FunctionCode = TrapUserAndTargetInBattle Flags = Contact,CanProtect,CanMirrorMove -EffectChance = 100 Description = This move prevents the user and the target from switching out until either of them faints. #------------------------------- [THROATCHOP] @@ -4077,7 +4076,7 @@ Power = 90 Accuracy = 100 TotalPP = 10 Target = AllNearFoes -FunctionCode = TrapTargetInBattle +FunctionCode = TrapTargetInBattleMainEffect Flags = CanProtect,CanMirrorMove,CannotMetronome 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 FunctionCode = LowerPPOfTargetLastMoveBy3 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. #------------------------------- [EXPANDINGFORCE]