mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Merge branch 'dev' into ai
This commit is contained in:
@@ -4,7 +4,7 @@ class Battle::Move
|
||||
attr_accessor :id
|
||||
attr_reader :name
|
||||
attr_reader :function
|
||||
attr_reader :baseDamage
|
||||
attr_reader :power
|
||||
attr_reader :type
|
||||
attr_reader :category
|
||||
attr_reader :accuracy
|
||||
@@ -22,6 +22,12 @@ class Battle::Move
|
||||
|
||||
def to_int; return @id; end
|
||||
|
||||
# @deprecated This method is slated to be removed in v22.
|
||||
def baseDamage
|
||||
Deprecation.warn_method("baseDamage", "v22", "power")
|
||||
return @power
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Creating a move
|
||||
#=============================================================================
|
||||
@@ -32,7 +38,7 @@ class Battle::Move
|
||||
@name = move.name # Get the move's name
|
||||
# Get data on the move
|
||||
@function = move.function_code
|
||||
@baseDamage = move.base_damage
|
||||
@power = move.power
|
||||
@type = move.type
|
||||
@category = move.category
|
||||
@accuracy = move.accuracy
|
||||
@@ -173,7 +179,7 @@ class Battle::Move
|
||||
"PowerHigherWithUserHP", "PowerLowerWithUserHP",
|
||||
"PowerHigherWithUserHappiness", "PowerLowerWithUserHappiness",
|
||||
"PowerHigherWithUserPositiveStatStages", "PowerDependsOnUserStockpile"
|
||||
return pbBaseType(@baseDamage, battler, nil)
|
||||
return pbBaseType(@power, battler, nil)
|
||||
end
|
||||
=end
|
||||
return @realMove.display_damage(battler.pokemon)
|
||||
|
||||
@@ -248,7 +248,7 @@ class Battle::Move
|
||||
# Calculate whether this hit deals critical damage
|
||||
target.damageState.critical = pbIsCritical?(user, target)
|
||||
# Calcuate base power of move
|
||||
baseDmg = pbBaseDamage(@baseDamage, user, target)
|
||||
baseDmg = pbBaseDamage(@power, user, target)
|
||||
# Calculate user's attack stat
|
||||
atk, atkStage = pbGetAttackStats(user, target)
|
||||
if !target.hasActiveAbility?(:UNAWARE) || @battle.moldBreaker
|
||||
@@ -263,14 +263,14 @@ class Battle::Move
|
||||
end
|
||||
# Calculate all multiplier effects
|
||||
multipliers = {
|
||||
:base_damage_multiplier => 1.0,
|
||||
:power_multiplier => 1.0,
|
||||
:attack_multiplier => 1.0,
|
||||
:defense_multiplier => 1.0,
|
||||
:final_damage_multiplier => 1.0
|
||||
}
|
||||
pbCalcDamageMultipliers(user, target, numTargets, type, baseDmg, multipliers)
|
||||
# Main damage calculation
|
||||
baseDmg = [(baseDmg * multipliers[:base_damage_multiplier]).round, 1].max
|
||||
baseDmg = [(baseDmg * multipliers[:power_multiplier]).round, 1].max
|
||||
atk = [(atk * multipliers[:attack_multiplier]).round, 1].max
|
||||
defense = [(defense * multipliers[:defense_multiplier]).round, 1].max
|
||||
damage = ((((2.0 * user.level / 5) + 2).floor * baseDmg * atk / defense).floor / 50).floor + 2
|
||||
@@ -283,9 +283,9 @@ class Battle::Move
|
||||
if (@battle.pbCheckGlobalAbility(:DARKAURA) && type == :DARK) ||
|
||||
(@battle.pbCheckGlobalAbility(:FAIRYAURA) && type == :FAIRY)
|
||||
if @battle.pbCheckGlobalAbility(:AURABREAK)
|
||||
multipliers[:base_damage_multiplier] *= 2 / 3.0
|
||||
multipliers[:power_multiplier] *= 2 / 3.0
|
||||
else
|
||||
multipliers[:base_damage_multiplier] *= 4 / 3.0
|
||||
multipliers[:power_multiplier] *= 4 / 3.0
|
||||
end
|
||||
end
|
||||
# Ability effects that alter damage
|
||||
@@ -336,47 +336,47 @@ class Battle::Move
|
||||
end
|
||||
# Parental Bond's second attack
|
||||
if user.effects[PBEffects::ParentalBond] == 1
|
||||
multipliers[:base_damage_multiplier] /= (Settings::MECHANICS_GENERATION >= 7) ? 4 : 2
|
||||
multipliers[:power_multiplier] /= (Settings::MECHANICS_GENERATION >= 7) ? 4 : 2
|
||||
end
|
||||
# Other
|
||||
if user.effects[PBEffects::MeFirst]
|
||||
multipliers[:base_damage_multiplier] *= 1.5
|
||||
multipliers[:power_multiplier] *= 1.5
|
||||
end
|
||||
if user.effects[PBEffects::HelpingHand] && !self.is_a?(Battle::Move::Confusion)
|
||||
multipliers[:base_damage_multiplier] *= 1.5
|
||||
multipliers[:power_multiplier] *= 1.5
|
||||
end
|
||||
if user.effects[PBEffects::Charge] > 0 && type == :ELECTRIC
|
||||
multipliers[:base_damage_multiplier] *= 2
|
||||
multipliers[:power_multiplier] *= 2
|
||||
end
|
||||
# Mud Sport
|
||||
if type == :ELECTRIC
|
||||
if @battle.allBattlers.any? { |b| b.effects[PBEffects::MudSport] }
|
||||
multipliers[:base_damage_multiplier] /= 3
|
||||
multipliers[:power_multiplier] /= 3
|
||||
end
|
||||
if @battle.field.effects[PBEffects::MudSportField] > 0
|
||||
multipliers[:base_damage_multiplier] /= 3
|
||||
multipliers[:power_multiplier] /= 3
|
||||
end
|
||||
end
|
||||
# Water Sport
|
||||
if type == :FIRE
|
||||
if @battle.allBattlers.any? { |b| b.effects[PBEffects::WaterSport] }
|
||||
multipliers[:base_damage_multiplier] /= 3
|
||||
multipliers[:power_multiplier] /= 3
|
||||
end
|
||||
if @battle.field.effects[PBEffects::WaterSportField] > 0
|
||||
multipliers[:base_damage_multiplier] /= 3
|
||||
multipliers[:power_multiplier] /= 3
|
||||
end
|
||||
end
|
||||
# Terrain moves
|
||||
terrain_multiplier = (Settings::MECHANICS_GENERATION >= 8) ? 1.3 : 1.5
|
||||
case @battle.field.terrain
|
||||
when :Electric
|
||||
multipliers[:base_damage_multiplier] *= terrain_multiplier if type == :ELECTRIC && user.affectedByTerrain?
|
||||
multipliers[:power_multiplier] *= terrain_multiplier if type == :ELECTRIC && user.affectedByTerrain?
|
||||
when :Grassy
|
||||
multipliers[:base_damage_multiplier] *= terrain_multiplier if type == :GRASS && user.affectedByTerrain?
|
||||
multipliers[:power_multiplier] *= terrain_multiplier if type == :GRASS && user.affectedByTerrain?
|
||||
when :Psychic
|
||||
multipliers[:base_damage_multiplier] *= terrain_multiplier if type == :PSYCHIC && user.affectedByTerrain?
|
||||
multipliers[:power_multiplier] *= terrain_multiplier if type == :PSYCHIC && user.affectedByTerrain?
|
||||
when :Misty
|
||||
multipliers[:base_damage_multiplier] /= 2 if type == :DRAGON && target.affectedByTerrain?
|
||||
multipliers[:power_multiplier] /= 2 if type == :DRAGON && target.affectedByTerrain?
|
||||
end
|
||||
# Badge multipliers
|
||||
if @battle.internalBattle
|
||||
@@ -476,7 +476,7 @@ class Battle::Move
|
||||
multipliers[:final_damage_multiplier] *= 2
|
||||
end
|
||||
# Move-specific base damage modifiers
|
||||
multipliers[:base_damage_multiplier] = pbBaseDamageMultiplier(multipliers[:base_damage_multiplier], user, target)
|
||||
multipliers[:power_multiplier] = pbBaseDamageMultiplier(multipliers[:power_multiplier], user, target)
|
||||
# Move-specific final damage modifiers
|
||||
multipliers[:final_damage_multiplier] = pbModifyDamage(multipliers[:final_damage_multiplier], user, target)
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ class Battle::Move::Confusion < Battle::Move
|
||||
@id = :CONFUSEDAMAGE
|
||||
@name = ""
|
||||
@function = "None"
|
||||
@baseDamage = 40
|
||||
@power = 40
|
||||
@type = nil
|
||||
@category = 0
|
||||
@accuracy = 100
|
||||
@@ -56,7 +56,7 @@ class Battle::Move::Struggle < Battle::Move
|
||||
@id = (move) ? move.id : :STRUGGLE
|
||||
@name = (move) ? move.name : _INTL("Struggle")
|
||||
@function = "Struggle"
|
||||
@baseDamage = 50
|
||||
@power = 50
|
||||
@type = nil
|
||||
@category = 0
|
||||
@accuracy = 0
|
||||
|
||||
@@ -331,7 +331,7 @@ class Battle::Move::PowerHigherWithConsecutiveUse < Battle::Move
|
||||
oldVal = user.effects[PBEffects::FuryCutter]
|
||||
super
|
||||
maxMult = 1
|
||||
while (@baseDamage << (maxMult - 1)) < 160
|
||||
while (@power << (maxMult - 1)) < 160
|
||||
maxMult += 1 # 1-4 for base damage of 20, 1-3 for base damage of 40
|
||||
end
|
||||
user.effects[PBEffects::FuryCutter] = (oldVal >= maxMult) ? maxMult : oldVal + 1
|
||||
|
||||
Reference in New Issue
Block a user