Implement TramplesMinimize as a move flag (#175)

* Implement "TramplesMinimize" as a move flag

Implemented `TramplesMinimize` as a move flag. Due to it, removed effect codes `FlinchTargetTrampleMinimize` and `ParalyzeTargetTrampleMinimize` (the second one was exclusive to Body Slam). Moves that had them now have the effect codes `FlinchTarget` and `ParalyzeTarget`, respectively.

The code now does not check if the parameter of `tramplesMinimize?` is 1 or 2, it now checks if it is `true` or `false`. For the effect that causes the moves with this flag to skip accuracy checks, it also checks if `Settings::MECHANICS_GENERATION` is equal to or greater than 6.

Data on which moves are to be treated as able to double damage if Minimized and skip accuracy checks are [here](https://bulbapedia.bulbagarden.net/wiki/Minimize_(move)#Vulnerability_to_moves).

**Remarks:**
- Dragon Rush, Heat Crash and Heavy Slam could not trample Minimize in Gen 5. Dragon Rush and Heat Crash could do so in Gen 6+, but Heavy Slam could not until Gen 7.
- Double Iron Bash could only trample Minimize in Gen 7.

**TL;DR:**
- Implemented `TramplesMinimize` as a move flag.
- Modified the check for this move flag.
- Removed effect codes `FlinchTargetTrampleMinimize` and `ParalyzeTargetTrampleMinimize`. Moves that had them now have the effect codes `FlinchTarget` and `ParalyzeTarget`, respectively.
This commit is contained in:
Keyacom
2022-02-06 20:36:51 +01:00
committed by GitHub
parent e6c877fe06
commit 30c3f472ef
10 changed files with 48 additions and 90 deletions

View File

@@ -401,8 +401,6 @@ module GameData
when "007"
if data[:id] == :THUNDERWAVE
new_code = "ParalyzeTargetIfNotTypeImmune"
elsif data[:id] == :BODYSLAM && Settings::MECHANICS_GENERATION >= 6
new_code = "ParalyzeTargetTrampleMinimize"
else
new_code = "ParalyzeTarget"
end
@@ -413,8 +411,7 @@ module GameData
when "00C" then new_code = "FreezeTarget"
when "00D" then new_code = "FreezeTargetAlwaysHitsInHail"
when "00E" then new_code = "FreezeFlinchTarget"
when "00F" then new_code = "FlinchTarget"
when "010" then new_code = "FlinchTargetTrampleMinimize"
when "00F", "010" then new_code = "FlinchTarget"
when "011" then new_code = "FlinchTargetFailsIfUserNotAsleep"
when "012" then new_code = "FlinchTargetFailsIfNotUserFirstTurn"
when "013", "014" then new_code = "ConfuseTarget"

View File

@@ -132,9 +132,9 @@ class Battle::Move
def pulseMove?; return @flags.any? { |f| f[/^Pulse$/i] }; end
def bombMove?; return @flags.any? { |f| f[/^Bomb$/i] }; end
def danceMove?; return @flags.any? { |f| f[/^Dance$/i] }; end
# Causes perfect accuracy and double damage if target used Minimize. Perfect accuracy only with Gen 6+ mechanics.
def tramplesMinimize?; return @flags.any? { |f| f[/^TramplesMinimize$/i] }; end
# Causes perfect accuracy (param=1) and double damage (param=2).
def tramplesMinimize?(_param = 1); return false; end
def nonLethal?(_user, _target); return false; end # For False Swipe
def ignoresSubstitute?(user) # user is the Pokémon using this move

View File

@@ -94,7 +94,7 @@ class Battle::Move
def pbAccuracyCheck(user, target)
# "Always hit" effects and "always hit" accuracy
return true if target.effects[PBEffects::Telekinesis] > 0
return true if target.effects[PBEffects::Minimize] && tramplesMinimize?(1)
return true if target.effects[PBEffects::Minimize] && tramplesMinimize? && Settings::MECHANICS_GENERATION >= 6
baseAcc = pbBaseAccuracy(user, target)
return true if baseAcc == 0
# Calculate all multiplier effects
@@ -479,7 +479,7 @@ class Battle::Move
end
end
# Minimize
if target.effects[PBEffects::Minimize] && tramplesMinimize?(2)
if target.effects[PBEffects::Minimize] && tramplesMinimize?
multipliers[:final_damage_multiplier] *= 2
end
# Move-specific base damage modifiers

View File

@@ -169,18 +169,6 @@ class Battle::Move::ParalyzeTargetIfNotTypeImmune < Battle::Move::ParalyzeTarget
end
end
#===============================================================================
# Paralyzes the target. Does double damage and has perfect accuracy if target is
# Minimized. (Body Slam (Gen 6+))
#===============================================================================
class Battle::Move::ParalyzeTargetTrampleMinimize < Battle::Move::ParalyzeTarget
def tramplesMinimize?(param = 1)
return true if param == 1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
return true if param == 2 # Double damage
return super
end
end
#===============================================================================
# Paralyzes the target. Accuracy perfect in rain, 50% in sunshine. Hits some
# semi-invulnerable targets. (Thunder)
@@ -548,18 +536,6 @@ class Battle::Move::FlinchTarget < Battle::Move
end
end
#===============================================================================
# Causes the target to flinch. Does double damage and has perfect accuracy if
# the target is Minimized. (Dragon Rush (Gen 6+), Steamroller, Stomp)
#===============================================================================
class Battle::Move::FlinchTargetTrampleMinimize < Battle::Move::FlinchTarget
def tramplesMinimize?(param = 1)
return true if param == 1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
return true if param == 2 # Double damage
return super
end
end
#===============================================================================
# Causes the target to flinch. Fails if the user is not asleep. (Snore)
#===============================================================================

View File

@@ -307,14 +307,8 @@ end
#===============================================================================
# Power increases the heavier the user is than the target. (Heat Crash, Heavy Slam)
# Does double damage and has perfect accuracy if the target is Minimized.
#===============================================================================
class Battle::Move::PowerHigherWithUserHeavierThanTarget < Battle::Move
def tramplesMinimize?(param = 1)
return true if Settings::MECHANICS_GENERATION >= 7 # Perfect accuracy and double damage
return super
end
def pbBaseDamage(baseDmg, user, target)
ret = 40
n = (user.pbWeight / target.pbWeight).floor
@@ -1113,16 +1107,9 @@ end
#===============================================================================
# Type effectiveness is multiplied by the Flying-type's effectiveness against
# the target. Does double damage and has perfect accuracy if the target is
# Minimized. (Flying Press)
# the target. (Flying Press)
#===============================================================================
class Battle::Move::EffectivenessIncludesFlyingType < Battle::Move
def tramplesMinimize?(param = 1)
return true if param == 1 && Settings::MECHANICS_GENERATION >= 6 # Perfect accuracy
return true if param == 2 # Double damage
return super
end
def pbCalcTypeModSingle(moveType, defType, user, target)
ret = super
if GameData::Type.exists?(:FLYING)

View File

@@ -15,13 +15,11 @@ class Battle::Move::HitTwoTimesPoisonTarget < Battle::Move::PoisonTarget
end
#===============================================================================
# Hits twice. Causes the target to flinch. Does double damage and has perfect
# accuracy if the target is Minimized. (Double Iron Bash)
# Hits twice. Causes the target to flinch. (Double Iron Bash)
#===============================================================================
class Battle::Move::HitTwoTimesFlinchTarget < Battle::Move::FlinchTarget
def multiHitMove?; return true; end
def pbNumHits(user, targets); return 2; end
def tramplesMinimize?(param = 1); return Settings::MECHANICS_GENERATION <= 7; end
def multiHitMove?; return true; end
def pbNumHits(user, targets); return 2; end
end
#===============================================================================