mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-03-10 02:12:01 +00:00
More work on the AI, refactored stat stage multipliers
This commit is contained in:
@@ -101,10 +101,11 @@ class Battle::Move
|
||||
# Check if move can't miss
|
||||
return true if modifiers[:base_accuracy] == 0
|
||||
# Calculation
|
||||
accStage = [[modifiers[:accuracy_stage], -6].max, 6].min + 6
|
||||
evaStage = [[modifiers[:evasion_stage], -6].max, 6].min + 6
|
||||
stageMul = [3, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9]
|
||||
stageDiv = [9, 8, 7, 6, 5, 4, 3, 3, 3, 3, 3, 3, 3]
|
||||
max_stage = Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
accStage = [[modifiers[:accuracy_stage], -max_stage].max, max_stage].min + max_stage
|
||||
evaStage = [[modifiers[:evasion_stage], -max_stage].max, max_stage].min + max_stage
|
||||
stageMul = Battle::Battler::ACC_EVA_STAGE_MULTIPLIERS
|
||||
stageDiv = Battle::Battler::ACC_EVA_STAGE_DIVISORS
|
||||
accuracy = 100.0 * stageMul[accStage] / stageDiv[accStage]
|
||||
evasion = 100.0 * stageMul[evaStage] / stageDiv[evaStage]
|
||||
accuracy = (accuracy * modifiers[:accuracy_multiplier]).round
|
||||
@@ -226,13 +227,13 @@ class Battle::Move
|
||||
def pbModifyDamage(damageMult, user, target); return damageMult; end
|
||||
|
||||
def pbGetAttackStats(user, target)
|
||||
return user.spatk, user.stages[:SPECIAL_ATTACK] + 6 if specialMove?
|
||||
return user.attack, user.stages[:ATTACK] + 6
|
||||
return user.spatk, user.stages[:SPECIAL_ATTACK] + Battle::Battler::STAT_STAGE_MAXIMUM if specialMove?
|
||||
return user.attack, user.stages[:ATTACK] + Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
end
|
||||
|
||||
def pbGetDefenseStats(user, target)
|
||||
return target.spdef, target.stages[:SPECIAL_DEFENSE] + 6 if specialMove?
|
||||
return target.defense, target.stages[:DEFENSE] + 6
|
||||
return target.spdef, target.stages[:SPECIAL_DEFENSE] + Battle::Battler::STAT_STAGE_MAXIMUM if specialMove?
|
||||
return target.defense, target.stages[:DEFENSE] + Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
end
|
||||
|
||||
def pbCalcDamage(user, target, numTargets = 1)
|
||||
@@ -241,8 +242,9 @@ class Battle::Move
|
||||
target.damageState.calcDamage = 1
|
||||
return
|
||||
end
|
||||
stageMul = [2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8]
|
||||
stageDiv = [8, 7, 6, 5, 4, 3, 2, 2, 2, 2, 2, 2, 2]
|
||||
max_stage = Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
stageMul = Battle::Battler::STAT_STAGE_MULTIPLIERS
|
||||
stageDiv = Battle::Battler::STAT_STAGE_DIVISORS
|
||||
# Get the move's type
|
||||
type = @calcType # nil is treated as physical
|
||||
# Calculate whether this hit deals critical damage
|
||||
@@ -252,13 +254,13 @@ class Battle::Move
|
||||
# Calculate user's attack stat
|
||||
atk, atkStage = pbGetAttackStats(user, target)
|
||||
if !target.hasActiveAbility?(:UNAWARE) || @battle.moldBreaker
|
||||
atkStage = 6 if target.damageState.critical && atkStage < 6
|
||||
atkStage = max_stage if target.damageState.critical && atkStage < max_stage
|
||||
atk = (atk.to_f * stageMul[atkStage] / stageDiv[atkStage]).floor
|
||||
end
|
||||
# Calculate target's defense stat
|
||||
defense, defStage = pbGetDefenseStats(user, target)
|
||||
if !user.hasActiveAbility?(:UNAWARE)
|
||||
defStage = 6 if target.damageState.critical && defStage > 6
|
||||
defStage = max_stage if target.damageState.critical && defStage > max_stage
|
||||
defense = (defense.to_f * stageMul[defStage] / stageDiv[defStage]).floor
|
||||
end
|
||||
# Calculate all multiplier effects
|
||||
|
||||
@@ -94,14 +94,14 @@ class Battle::Move::MaxUserAttackLoseHalfOfTotalHP < Battle::Move
|
||||
hpLoss = [user.totalhp / 2, 1].max
|
||||
user.pbReduceHP(hpLoss, false, false)
|
||||
if user.hasActiveAbility?(:CONTRARY)
|
||||
user.stages[@statUp[0]] = -6
|
||||
user.stages[@statUp[0]] = -Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
user.statsLoweredThisRound = true
|
||||
user.statsDropped = true
|
||||
@battle.pbCommonAnimation("StatDown", user)
|
||||
@battle.pbDisplay(_INTL("{1} cut its own HP and minimized its {2}!",
|
||||
user.pbThis, GameData::Stat.get(@statUp[0]).name))
|
||||
else
|
||||
user.stages[@statUp[0]] = 6
|
||||
user.stages[@statUp[0]] = Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
user.statsRaisedThisRound = true
|
||||
@battle.pbCommonAnimation("StatUp", user)
|
||||
@battle.pbDisplay(_INTL("{1} cut its own HP and maximized its {2}!",
|
||||
|
||||
@@ -1121,17 +1121,18 @@ class Battle::Move::CategoryDependsOnHigherDamagePoisonTarget < Battle::Move::Po
|
||||
|
||||
def pbOnStartUse(user, targets)
|
||||
target = targets[0]
|
||||
stageMul = [2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8]
|
||||
stageDiv = [8, 7, 6, 5, 4, 3, 2, 2, 2, 2, 2, 2, 2]
|
||||
max_stage = Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
stageMul = Battle::Battler::STAT_STAGE_MULTIPLIERS
|
||||
stageDiv = Battle::Battler::STAT_STAGE_DIVISORS
|
||||
# Calculate user's effective attacking values
|
||||
attack_stage = user.stages[:ATTACK] + 6
|
||||
attack_stage = user.stages[:ATTACK] + max_stage
|
||||
real_attack = (user.attack.to_f * stageMul[attack_stage] / stageDiv[attack_stage]).floor
|
||||
special_attack_stage = user.stages[:SPECIAL_ATTACK] + 6
|
||||
special_attack_stage = user.stages[:SPECIAL_ATTACK] + max_stage
|
||||
real_special_attack = (user.spatk.to_f * stageMul[special_attack_stage] / stageDiv[special_attack_stage]).floor
|
||||
# Calculate target's effective defending values
|
||||
defense_stage = target.stages[:DEFENSE] + 6
|
||||
defense_stage = target.stages[:DEFENSE] + max_stage
|
||||
real_defense = (target.defense.to_f * stageMul[defense_stage] / stageDiv[defense_stage]).floor
|
||||
special_defense_stage = target.stages[:SPECIAL_DEFENSE] + 6
|
||||
special_defense_stage = target.stages[:SPECIAL_DEFENSE] + max_stage
|
||||
real_special_defense = (target.spdef.to_f * stageMul[special_defense_stage] / stageDiv[special_defense_stage]).floor
|
||||
# Perform simple damage calculation
|
||||
physical_damage = real_attack.to_f / real_defense
|
||||
@@ -1166,13 +1167,14 @@ class Battle::Move::CategoryDependsOnHigherDamageIgnoreTargetAbility < Battle::M
|
||||
|
||||
def pbOnStartUse(user, targets)
|
||||
# Calculate user's effective attacking value
|
||||
stageMul = [2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8]
|
||||
stageDiv = [8, 7, 6, 5, 4, 3, 2, 2, 2, 2, 2, 2, 2]
|
||||
max_stage = Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
stageMul = Battle::Battler::STAT_STAGE_MULTIPLIERS
|
||||
stageDiv = Battle::Battler::STAT_STAGE_DIVISORS
|
||||
atk = user.attack
|
||||
atkStage = user.stages[:ATTACK] + 6
|
||||
atkStage = user.stages[:ATTACK] + max_stage
|
||||
realAtk = (atk.to_f * stageMul[atkStage] / stageDiv[atkStage]).floor
|
||||
spAtk = user.spatk
|
||||
spAtkStage = user.stages[:SPECIAL_ATTACK] + 6
|
||||
spAtkStage = user.stages[:SPECIAL_ATTACK] + max_stage
|
||||
realSpAtk = (spAtk.to_f * stageMul[spAtkStage] / stageDiv[spAtkStage]).floor
|
||||
# Determine move's category
|
||||
@calcCategory = (realAtk > realSpAtk) ? 0 : 1
|
||||
@@ -1187,7 +1189,7 @@ end
|
||||
#===============================================================================
|
||||
class Battle::Move::UseUserDefenseInsteadOfUserAttack < Battle::Move
|
||||
def pbGetAttackStats(user, target)
|
||||
return user.defense, user.stages[:DEFENSE] + 6
|
||||
return user.defense, user.stages[:DEFENSE] + Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1197,8 +1199,8 @@ end
|
||||
#===============================================================================
|
||||
class Battle::Move::UseTargetAttackInsteadOfUserAttack < Battle::Move
|
||||
def pbGetAttackStats(user, target)
|
||||
return target.spatk, target.stages[:SPECIAL_ATTACK] + 6 if specialMove?
|
||||
return target.attack, target.stages[:ATTACK] + 6
|
||||
return target.spatk, target.stages[:SPECIAL_ATTACK] + Battle::Battler::STAT_STAGE_MAXIMUM if specialMove?
|
||||
return target.attack, target.stages[:ATTACK] + Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1208,7 +1210,7 @@ end
|
||||
#===============================================================================
|
||||
class Battle::Move::UseTargetDefenseInsteadOfTargetSpDef < Battle::Move
|
||||
def pbGetDefenseStats(user, target)
|
||||
return target.defense, target.stages[:DEFENSE] + 6
|
||||
return target.defense, target.stages[:DEFENSE] + Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1264,7 +1266,7 @@ class Battle::Move::IgnoreTargetDefSpDefEvaStatStages < Battle::Move
|
||||
|
||||
def pbGetDefenseStats(user, target)
|
||||
ret1, _ret2 = super
|
||||
return ret1, 6 # Def/SpDef stat stage
|
||||
return ret1, Battle::Battler::STAT_STAGE_MAXIMUM # Def/SpDef stat stage
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -139,10 +139,11 @@ class Battle::Move::HealUserByTargetAttackLowerTargetAttack1 < Battle::Move
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
# Calculate target's effective attack value
|
||||
stageMul = [2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6, 7, 8]
|
||||
stageDiv = [8, 7, 6, 5, 4, 3, 2, 2, 2, 2, 2, 2, 2]
|
||||
max_stage = Battle::Battler::STAT_STAGE_MAXIMUM
|
||||
stageMul = Battle::Battler::STAT_STAGE_MULTIPLIERS
|
||||
stageDiv = Battle::Battler::STAT_STAGE_DIVISORS
|
||||
atk = target.attack
|
||||
atkStage = target.stages[@statDown[0]] + 6
|
||||
atkStage = target.stages[@statDown[0]] + max_stage
|
||||
healAmt = (atk.to_f * stageMul[atkStage] / stageDiv[atkStage]).floor
|
||||
# Reduce target's Attack stat
|
||||
if target.pbCanLowerStatStage?(@statDown[0], user, self)
|
||||
|
||||
Reference in New Issue
Block a user