mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Rearranged and tidied up game data scripts
This commit is contained in:
@@ -360,7 +360,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Protean
|
||||
if user.hasActiveAbility?(:PROTEAN) && !move.callsAnotherMove? && !move.snatched
|
||||
if user.pbHasOtherType?(move.calcType) && !PBTypes.isPseudoType?(move.calcType)
|
||||
if user.pbHasOtherType?(move.calcType) && !GameData::Type.get(move.calcType).pseudo_type
|
||||
@battle.pbShowAbilitySplash(user)
|
||||
user.pbChangeTypes(move.calcType)
|
||||
typeName = GameData::Type.get(move.calcType).name
|
||||
|
||||
@@ -401,7 +401,7 @@ class PokeBattle_Battler
|
||||
# Immunity because of ability (intentionally before type immunity check)
|
||||
return false if move.pbImmunityByAbility(user,target)
|
||||
# Type immunity
|
||||
if move.pbDamagingMove? && PBTypeEffectiveness.ineffective?(typeMod)
|
||||
if move.pbDamagingMove? && Effectiveness.ineffective?(typeMod)
|
||||
PBDebug.log("[Target immune] #{target.pbThis}'s type immunity")
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
|
||||
return false
|
||||
|
||||
@@ -75,7 +75,7 @@ class PokeBattle_Move
|
||||
thisType ||= @calcType
|
||||
thisType ||= @type
|
||||
return true if !thisType
|
||||
return !PBTypes.isSpecialType?(thisType)
|
||||
return GameData::Type.get(thisType).physical?
|
||||
end
|
||||
|
||||
# NOTE: This method is only ever called while using a move (and also by the
|
||||
@@ -85,7 +85,7 @@ class PokeBattle_Move
|
||||
thisType ||= @calcType
|
||||
thisType ||= @type
|
||||
return false if !thisType
|
||||
return PBTypes.isSpecialType?(thisType)
|
||||
return GameData::Type.get(thisType).special?
|
||||
end
|
||||
|
||||
def damagingMove?; return @category!=2; end
|
||||
|
||||
@@ -234,8 +234,8 @@ class PokeBattle_Move
|
||||
oldHP = b.hp+b.damageState.hpLost
|
||||
PBDebug.log("[Move damage] #{b.pbThis} lost #{b.damageState.hpLost} HP (#{oldHP}=>#{b.hp})")
|
||||
effectiveness = 0
|
||||
if PBTypeEffectiveness.resistant?(b.damageState.typeMod); effectiveness = 1
|
||||
elsif PBTypeEffectiveness.superEffective?(b.damageState.typeMod); effectiveness = 2
|
||||
if Effectiveness.resistant?(b.damageState.typeMod); effectiveness = 1
|
||||
elsif Effectiveness.super_effective?(b.damageState.typeMod); effectiveness = 2
|
||||
end
|
||||
animArray.push([b,oldHP,effectiveness])
|
||||
end
|
||||
@@ -251,13 +251,13 @@ class PokeBattle_Move
|
||||
#=============================================================================
|
||||
def pbEffectivenessMessage(user,target,numTargets=1)
|
||||
return if target.damageState.disguise
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
if numTargets>1
|
||||
@battle.pbDisplay(_INTL("It's super effective on {1}!",target.pbThis(true)))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("It's super effective!"))
|
||||
end
|
||||
elsif PBTypeEffectiveness.notVeryEffective?(target.damageState.typeMod)
|
||||
elsif Effectiveness.not_very_effective?(target.damageState.typeMod)
|
||||
if numTargets>1
|
||||
@battle.pbDisplay(_INTL("It's not very effective on {1}...",target.pbThis(true)))
|
||||
else
|
||||
|
||||
@@ -30,41 +30,41 @@ class PokeBattle_Move
|
||||
# Type effectiveness calculation
|
||||
#=============================================================================
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
ret = PBTypes.getEffectiveness(moveType,defType)
|
||||
ret = Effectiveness.calculate_one(moveType, defType)
|
||||
# Ring Target
|
||||
if target.hasActiveItem?(:RINGTARGET)
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Foresight
|
||||
if user.hasActiveAbility?(:SCRAPPY) || target.effects[PBEffects::Foresight]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
|
||||
Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Miracle Eye
|
||||
if target.effects[PBEffects::MiracleEye]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
|
||||
Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Delta Stream's weather
|
||||
if @battle.pbWeather == :StrongWinds
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
|
||||
PBTypes.superEffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
|
||||
Effectiveness.super_effective_type?(moveType, defType)
|
||||
end
|
||||
# Grounded Flying-type Pokémon become susceptible to Ground moves
|
||||
if !target.airborne?
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(moveType,user,target)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if !moveType
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
|
||||
return Effectiveness::NORMAL_EFFECTIVE if !moveType
|
||||
return Effectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
|
||||
target.pbHasType?(:FLYING) && target.hasActiveItem?(:IRONBALL)
|
||||
# Determine types
|
||||
tTypes = target.pbTypes(true)
|
||||
# Get effectivenesses
|
||||
typeMods = [PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE] * 3 # 3 types max
|
||||
typeMods = [Effectiveness::NORMAL_EFFECTIVE_ONE] * 3 # 3 types max
|
||||
tTypes.each_with_index do |type,i|
|
||||
typeMods[i] = pbCalcTypeModSingle(moveType,type,user,target)
|
||||
end
|
||||
@@ -412,7 +412,7 @@ class PokeBattle_Move
|
||||
end
|
||||
end
|
||||
# Type effectiveness
|
||||
multipliers[:final_damage_multiplier] *= target.damageState.typeMod.to_f / PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
multipliers[:final_damage_multiplier] *= target.damageState.typeMod.to_f / Effectiveness::NORMAL_EFFECTIVE
|
||||
# Burn
|
||||
if user.status == :BURN && physicalMove? && damageReducedByBurn? &&
|
||||
!user.hasActiveAbility?(:GUTS)
|
||||
|
||||
@@ -112,7 +112,7 @@ class PokeBattle_Move_007 < PokeBattle_ParalysisMove
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if @id == :THUNDERWAVE && PBTypeEffectiveness.ineffective?(target.damageState.typeMod)
|
||||
if @id == :THUNDERWAVE && Effectiveness.ineffective?(target.damageState.typeMod)
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
|
||||
return true
|
||||
end
|
||||
@@ -1789,7 +1789,7 @@ class PokeBattle_Move_05E < PokeBattle_Move
|
||||
@newTypes = []
|
||||
user.eachMoveWithIndex do |m,i|
|
||||
break if Settings::MECHANICS_GENERATION >= 6 && i>0
|
||||
next if PBTypes.isPseudoType?(m.type)
|
||||
next if GameData::Type.get(m.type).pseudo_type
|
||||
next if userTypes.include?(m.type)
|
||||
@newTypes.push(m.type) if !@newTypes.include?(m.type)
|
||||
end
|
||||
@@ -1827,14 +1827,14 @@ class PokeBattle_Move_05F < PokeBattle_Move
|
||||
|
||||
def pbFailsAgainstTarget?(user, target)
|
||||
if !target.lastMoveUsed || !target.lastMoveUsedType ||
|
||||
PBTypes.isPseudoType?(target.lastMoveUsedType)
|
||||
GameData::Type.get(target.lastMoveUsedType).pseudo_type
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@newTypes = []
|
||||
GameData::Type.each do |t|
|
||||
next if t.pseudo_type || user.pbHasType?(t.id) ||
|
||||
!PBTypes.resistant?(target.lastMoveUsedType, t.id)
|
||||
!Effectiveness.resistant_type?(target.lastMoveUsedType, t.id)
|
||||
@newTypes.push(t.id)
|
||||
end
|
||||
if @newTypes.length == 0
|
||||
|
||||
@@ -2253,7 +2253,7 @@ class PokeBattle_Move_0CE < PokeBattle_TwoTurnMove
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(movetype,user,target)
|
||||
return PBTypeEffectiveness::INEFFECTIVE if target.pbHasType?(:FLYING)
|
||||
return Effectiveness::INEFFECTIVE if target.pbHasType?(:FLYING)
|
||||
return super
|
||||
end
|
||||
|
||||
|
||||
@@ -768,7 +768,7 @@ class PokeBattle_Move_11C < PokeBattle_Move
|
||||
def hitsFlyingTargets?; return true; end
|
||||
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if moveType == :GROUND && defType == :FLYING
|
||||
return Effectiveness::NORMAL_EFFECTIVE_ONE if moveType == :GROUND && defType == :FLYING
|
||||
return super
|
||||
end
|
||||
|
||||
@@ -1064,7 +1064,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_135 < PokeBattle_FreezeMove
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
return PBTypeEffectiveness::SUPER_EFFECTIVE_ONE if defType == :WATER
|
||||
return Effectiveness::SUPER_EFFECTIVE_ONE if defType == :WATER
|
||||
return super
|
||||
end
|
||||
end
|
||||
@@ -1453,8 +1453,8 @@ class PokeBattle_Move_144 < PokeBattle_Move
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
ret = super
|
||||
if GameData::Type.exists?(:FLYING)
|
||||
flyingEff = PBTypes.getEffectiveness(:FLYING, defType)
|
||||
ret *= flyingEff.to_f / PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
flyingEff = Effectiveness.calculate_one(:FLYING, defType)
|
||||
ret *= flyingEff.to_f / Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -352,9 +352,9 @@ class PokeBattle_Battle
|
||||
if battler.pbOwnSide.effects[PBEffects::StealthRock] && battler.takesIndirectDamage? &&
|
||||
GameData::Type.exists?(:ROCK)
|
||||
bTypes = battler.pbTypes(true)
|
||||
eff = PBTypes.getCombinedEffectiveness(:ROCK, bTypes[0], bTypes[1], bTypes[2])
|
||||
if !PBTypeEffectiveness.ineffective?(eff)
|
||||
eff = eff.to_f/PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
eff = Effectiveness.calculate(:ROCK, bTypes[0], bTypes[1], bTypes[2])
|
||||
if !Effectiveness.ineffective?(eff)
|
||||
eff = eff.to_f / Effectiveness::NORMAL_EFFECTIVE
|
||||
oldHP = battler.hp
|
||||
battler.pbReduceHP(battler.totalhp*eff/8,false)
|
||||
pbDisplay(_INTL("Pointed stones dug into {1}!",battler.pbThis))
|
||||
|
||||
@@ -22,7 +22,7 @@ class PokeBattle_AI
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
moveType = moveData.type
|
||||
typeMod = pbCalcTypeMod(moveType,target,battler)
|
||||
if PBTypeEffectiveness.superEffective?(typeMod) && moveData.base_damage > 50
|
||||
if Effectiveness.super_effective?(typeMod) && moveData.base_damage > 50
|
||||
switchChance = (moveData.base_damage > 70) ? 30 : 20
|
||||
shouldSwitch = (pbAIRandom(100) < switchChance)
|
||||
end
|
||||
@@ -107,18 +107,18 @@ class PokeBattle_AI
|
||||
end
|
||||
end
|
||||
# moveType is the type of the target's last used move
|
||||
if moveType>=0 && PBTypeEffectiveness.ineffective?(pbCalcTypeMod(moveType,battler,battler))
|
||||
if moveType>=0 && Effectiveness.ineffective?(pbCalcTypeMod(moveType,battler,battler))
|
||||
weight = 65
|
||||
typeMod = pbCalcTypeModPokemon(pkmn,battler.pbDirectOpposing(true))
|
||||
if PBTypeEffectiveness.superEffective?(typeMod.to_f/PBTypeEffectivenesss::NORMAL_EFFECTIVE)
|
||||
if Effectiveness.super_effective?(typeMod)
|
||||
# Greater weight if new Pokemon's type is effective against target
|
||||
weight = 85
|
||||
end
|
||||
list.unshift(i) if pbAIRandom(100)<weight # Put this Pokemon first
|
||||
elsif moveType>=0 && PBTypeEffectiveness.resistant?(pbCalcTypeMod(moveType,battler,battler))
|
||||
elsif moveType>=0 && Effectiveness.resistant?(pbCalcTypeMod(moveType,battler,battler))
|
||||
weight = 40
|
||||
typeMod = pbCalcTypeModPokemon(pkmn,battler.pbDirectOpposing(true))
|
||||
if PBTypeEffectiveness.superEffective?(typeMod.to_f/PBTypeEffectivenesss::NORMAL_EFFECTIVE)
|
||||
if Effectiveness.super_effective?(typeMod)
|
||||
# Greater weight if new Pokemon's type is effective against target
|
||||
weight = 60
|
||||
end
|
||||
@@ -165,7 +165,7 @@ class PokeBattle_AI
|
||||
next if m.base_damage == 0
|
||||
@battle.battlers[idxBattler].eachOpposing do |b|
|
||||
bTypes = b.pbTypes(true)
|
||||
sum += PBTypes.getCombinedEffectiveness(m.type, bTypes[0], bTypes[1], bTypes[2])
|
||||
sum += Effectiveness.calculate(m.type, bTypes[0], bTypes[1], bTypes[2])
|
||||
end
|
||||
end
|
||||
if best==-1 || sum>bestSum
|
||||
|
||||
@@ -71,7 +71,7 @@ class PokeBattle_AI
|
||||
if target.pbCanParalyze?(user,false) &&
|
||||
!(skill>=PBTrainerAI.mediumSkill &&
|
||||
move.id == :THUNDERWAVE &&
|
||||
PBTypeEffectiveness.ineffective?(pbCalcTypeMod(move.type,user,target)))
|
||||
Effectiveness.ineffective?(pbCalcTypeMod(move.type,user,target)))
|
||||
score += 30
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
aspeed = pbRoughStat(user,:SPEED,skill)
|
||||
@@ -1317,7 +1317,7 @@ class PokeBattle_AI
|
||||
types = []
|
||||
user.eachMove do |m|
|
||||
next if m.id==@id
|
||||
next if PBTypes.isPseudoType?(m.type)
|
||||
next if GameData::Type.get(m.type).pseudo_type
|
||||
next if user.pbHasType?(m.type)
|
||||
types.push(m.type) if !types.include?(m.type)
|
||||
end
|
||||
@@ -1342,7 +1342,7 @@ class PokeBattle_AI
|
||||
types = []
|
||||
GameData::Type.each do |t|
|
||||
next if t.pseudo_type || user.pbHasType?(t.id) ||
|
||||
!PBTypes.resistant?(aType, t.id)
|
||||
!Effectiveness.resistant_type?(aType, t.id)
|
||||
types.push(t.id)
|
||||
end
|
||||
score -= 90 if types.length==0
|
||||
@@ -1512,11 +1512,7 @@ class PokeBattle_AI
|
||||
score -= 60
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
if moveData.base_damage > 0 &&
|
||||
(Settings::MOVE_CATEGORY_PER_MOVE && moveData.category == 0) ||
|
||||
(!Settings::MOVE_CATEGORY_PER_MOVE && PBTypes.isPhysicalType?(moveData.type))
|
||||
score -= 60
|
||||
end
|
||||
score += 60 if moveData.physical?
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -1530,11 +1526,7 @@ class PokeBattle_AI
|
||||
score -= 60
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
if moveData.base_damage > 0 &&
|
||||
(Settings::MOVE_CATEGORY_PER_MOVE && moveData.category == 1) ||
|
||||
(!Settings::MOVE_CATEGORY_PER_MOVE && !PBTypes.isSpecialType?(moveData.type))
|
||||
score -= 60
|
||||
end
|
||||
score += 60 if moveData.special?
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -1779,7 +1771,7 @@ class PokeBattle_AI
|
||||
score += 60
|
||||
elsif moveData.category != 2 && # Damaging move
|
||||
moveData.target == :NearOther &&
|
||||
PBTypeEffectiveness.ineffective?(pbCalcTypeMod(moveData.type, target, user))
|
||||
Effectiveness.ineffective?(pbCalcTypeMod(moveData.type, target, user))
|
||||
score += 60
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,41 +25,41 @@ class PokeBattle_AI
|
||||
# Move's type effectiveness
|
||||
#=============================================================================
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
ret = PBTypes.getEffectiveness(moveType,defType)
|
||||
ret = Effectiveness.calculate_one(moveType,defType)
|
||||
# Ring Target
|
||||
if target.hasActiveItem?(:RINGTARGET)
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Foresight
|
||||
if user.hasActiveAbility?(:SCRAPPY) || target.effects[PBEffects::Foresight]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
|
||||
Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Miracle Eye
|
||||
if target.effects[PBEffects::MiracleEye]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
|
||||
Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Delta Stream's weather
|
||||
if @battle.pbWeather == :StrongWinds
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
|
||||
PBTypes.superEffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
|
||||
Effectiveness.super_effective_type?(moveType, defType)
|
||||
end
|
||||
# Grounded Flying-type Pokémon become susceptible to Ground moves
|
||||
if !target.airborne?
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(moveType,user,target)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if !moveType
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
|
||||
return Effectiveness::NORMAL_EFFECTIVE if !moveType
|
||||
return Effectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
|
||||
target.pbHasType?(:FLYING) && target.hasActiveItem?(:IRONBALL)
|
||||
# Determine types
|
||||
tTypes = target.pbTypes(true)
|
||||
# Get effectivenesses
|
||||
typeMods = [PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE] * 3 # 3 types max
|
||||
typeMods = [Effectiveness::NORMAL_EFFECTIVE_ONE] * 3 # 3 types max
|
||||
tTypes.each_with_index do |type,i|
|
||||
typeMods[i] = pbCalcTypeModSingle(moveType,type,user,target)
|
||||
end
|
||||
@@ -72,12 +72,13 @@ class PokeBattle_AI
|
||||
# For switching. Determines the effectiveness of a potential switch-in against
|
||||
# an opposing battler.
|
||||
def pbCalcTypeModPokemon(battlerThis,_battlerOther)
|
||||
mod1 = PBTypes.getCombinedEffectiveness(battlerThis.type1,target.type1,target.type2)
|
||||
mod2 = PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
mod1 = Effectiveness.calculate(battlerThis.type1,target.type1,target.type2)
|
||||
mod2 = Effectiveness::NORMAL_EFFECTIVE
|
||||
if battlerThis.type1!=battlerThis.type2
|
||||
mod2 = PBTypes.getCombinedEffectiveness(battlerThis.type2,target.type1,target.type2)
|
||||
mod2 = Effectiveness.calculate(battlerThis.type2,target.type1,target.type2)
|
||||
mod2 = mod2.to_f / Effectivenesss::NORMAL_EFFECTIVE
|
||||
end
|
||||
return mod1*mod2 # Normal effectiveness is 64 here
|
||||
return mod1*mod2
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -87,7 +88,7 @@ class PokeBattle_AI
|
||||
type = pbRoughType(move,user,skill)
|
||||
typeMod = pbCalcTypeMod(type,user,target)
|
||||
# Type effectiveness
|
||||
return true if PBTypeEffectiveness.ineffective?(typeMod) || score<=0
|
||||
return true if Effectiveness.ineffective?(typeMod) || score<=0
|
||||
# Immunity due to ability/item/other effects
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
case type
|
||||
@@ -102,7 +103,7 @@ class PokeBattle_AI
|
||||
when :ELECTRIC
|
||||
return true if target.hasActiveAbility?([:LIGHTNINGROD,:MOTORDRIVE,:VOLTABSORB])
|
||||
end
|
||||
return true if PBTypeEffectiveness.notVeryEffective?(typeMod) &&
|
||||
return true if Effectiveness.not_very_effective?(typeMod) &&
|
||||
target.hasActiveAbility?(:WONDERGUARD)
|
||||
return true if move.damagingMove? && user.index!=target.index && !target.opposes?(user) &&
|
||||
target.hasActiveAbility?(:TELEPATHY)
|
||||
@@ -227,13 +228,13 @@ class PokeBattle_AI
|
||||
if GameData::Type.exists?(:FLYING)
|
||||
if skill>=PBTrainerAI.highSkill
|
||||
targetTypes = target.pbTypes(true)
|
||||
mult = PBTypes.getCombinedEffectiveness(:FLYING,
|
||||
mult = Effectiveness.calculate(:FLYING,
|
||||
targetTypes[0],targetTypes[1],targetTypes[2])
|
||||
baseDmg = (baseDmg.to_f*mult/PBTypeEffectiveness::NORMAL_EFFECTIVE).round
|
||||
baseDmg = (baseDmg.to_f*mult/Effectiveness::NORMAL_EFFECTIVE).round
|
||||
else
|
||||
mult = PBTypes.getCombinedEffectiveness(:FLYING,
|
||||
mult = Effectiveness.calculate(:FLYING,
|
||||
target.type1,target.type2,target.effects[PBEffects::Type3])
|
||||
baseDmg = (baseDmg.to_f*mult/PBTypeEffectiveness::NORMAL_EFFECTIVE).round
|
||||
baseDmg = (baseDmg.to_f*mult/Effectiveness::NORMAL_EFFECTIVE).round
|
||||
end
|
||||
end
|
||||
baseDmg *= 2 if skill>=PBTrainerAI.mediumSkill && target.effects[PBEffects::Minimize]
|
||||
@@ -462,7 +463,7 @@ class PokeBattle_AI
|
||||
# Type effectiveness
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
typemod = pbCalcTypeMod(type,user,target)
|
||||
multipliers[:final_damage_multiplier] *= typemod.to_f / PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
multipliers[:final_damage_multiplier] *= typemod.to_f / Effectiveness::NORMAL_EFFECTIVE
|
||||
end
|
||||
# Burn
|
||||
if skill>=PBTrainerAI.highSkill
|
||||
|
||||
@@ -580,7 +580,7 @@ end
|
||||
|
||||
def pbBattleTypeWeakingBerry(type,moveType,target,mults)
|
||||
return if moveType != type
|
||||
return if PBTypeEffectiveness.resistant?(target.damageState.typeMod) && moveType != :NORMAL
|
||||
return if Effectiveness.resistant?(target.damageState.typeMod) && moveType != :NORMAL
|
||||
mults[:final_damage_multiplier] /= 2
|
||||
target.damageState.berryWeakened = true
|
||||
target.battle.pbCommonAnimation("EatBerry",target)
|
||||
|
||||
@@ -695,7 +695,7 @@ BattleHandlers::MoveImmunityTargetAbility.copy(:WATERABSORB,:DRYSKIN)
|
||||
BattleHandlers::MoveImmunityTargetAbility.add(:WONDERGUARD,
|
||||
proc { |ability,user,target,move,type,battle|
|
||||
next false if move.statusMove?
|
||||
next false if !type || PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
next false if !type || Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
battle.pbShowAbilitySplash(target)
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
|
||||
@@ -970,7 +970,7 @@ BattleHandlers::DamageCalcUserAbility.copy(:MINUS,:PLUS)
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:NEUROFORCE,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
mults[:final_damage_multiplier] *= 1.25
|
||||
end
|
||||
}
|
||||
@@ -1076,7 +1076,7 @@ BattleHandlers::DamageCalcUserAbility.add(:TECHNICIAN,
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:TINTEDLENS,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
mults[:final_damage_multiplier] *= 2 if PBTypeEffectiveness.resistant?(target.damageState.typeMod)
|
||||
mults[:final_damage_multiplier] *= 2 if Effectiveness.resistant?(target.damageState.typeMod)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1139,7 +1139,7 @@ BattleHandlers::DamageCalcTargetAbility.add(:DRYSKIN,
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbility.add(:FILTER,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
mults[:final_damage_multiplier] *= 0.75
|
||||
end
|
||||
}
|
||||
@@ -1214,7 +1214,7 @@ BattleHandlers::DamageCalcTargetAbility.add(:WATERBUBBLE,
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbilityNonIgnorable.add(:PRISMARMOR,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
mults[:final_damage_multiplier] *= 0.75
|
||||
end
|
||||
}
|
||||
@@ -1712,7 +1712,7 @@ BattleHandlers::TargetAbilityAfterMoveUse.add(:BERSERK,
|
||||
BattleHandlers::TargetAbilityAfterMoveUse.add(:COLORCHANGE,
|
||||
proc { |ability,target,user,move,switched,battle|
|
||||
next if target.damageState.calcDamage==0 || target.damageState.substitute
|
||||
next if !move.calcType || PBTypes.isPseudoType?(move.calcType)
|
||||
next if !move.calcType || GameData::Type.get(move.calcType).pseudo_type
|
||||
next if target.pbHasType?(move.calcType) && !target.pbHasOtherType?(move.calcType)
|
||||
typeName = GameData::Type.get(move.calcType).name
|
||||
battle.pbShowAbilitySplash(target)
|
||||
@@ -2078,9 +2078,9 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
|
||||
if Settings::MECHANICS_GENERATION >= 6 && m.function == "090" # Hidden Power
|
||||
moveType = pbHiddenPower(b.pokemon)[0]
|
||||
end
|
||||
eff = PBTypes.getCombinedEffectiveness(moveType,type1,type2,type3)
|
||||
next if PBTypeEffectiveness.ineffective?(eff)
|
||||
next if !PBTypeEffectiveness.superEffective?(eff) && m.function != "070" # OHKO
|
||||
eff = Effectiveness.calculate(moveType,type1,type2,type3)
|
||||
next if Effectiveness.ineffective?(eff)
|
||||
next if !Effectiveness.super_effective?(eff) && m.function != "070" # OHKO
|
||||
else
|
||||
next if m.function != "070" # OHKO
|
||||
end
|
||||
|
||||
@@ -528,7 +528,7 @@ BattleHandlers::DamageCalcUserItem.add(:ELECTRICGEM,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:EXPERTBELT,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
mults[:final_damage_multiplier] *= 1.2
|
||||
end
|
||||
}
|
||||
@@ -1022,7 +1022,7 @@ BattleHandlers::TargetItemOnHit.add(:CELLBATTERY,
|
||||
BattleHandlers::TargetItemOnHit.add(:ENIGMABERRY,
|
||||
proc { |item,user,target,move,battle|
|
||||
next if target.damageState.substitute || target.damageState.disguise
|
||||
next if !PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
next if !Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
if BattleHandlers.triggerTargetItemOnHitPositiveBerry(item,target,battle,false)
|
||||
target.pbHeldItemTriggered(item)
|
||||
end
|
||||
@@ -1136,7 +1136,7 @@ BattleHandlers::TargetItemOnHit.add(:STICKYBARB,
|
||||
BattleHandlers::TargetItemOnHit.add(:WEAKNESSPOLICY,
|
||||
proc { |item,user,target,move,battle|
|
||||
next if target.damageState.disguise
|
||||
next if !PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
next if !Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
next if !target.pbCanRaiseStatStage?(:ATTACK,target) &&
|
||||
!target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,target)
|
||||
battle.pbCommonAnimation("UseItem",target)
|
||||
|
||||
@@ -24,7 +24,7 @@ class PokeBattle_DamageState
|
||||
|
||||
def reset
|
||||
@initialHP = 0
|
||||
@typeMod = PBTypeEffectiveness::INEFFECTIVE
|
||||
@typeMod = Effectiveness::INEFFECTIVE
|
||||
@unaffected = false
|
||||
@protected = false
|
||||
@magicCoat = false
|
||||
@@ -63,7 +63,7 @@ class PokeBattle_SuccessState
|
||||
def initialize; clear; end
|
||||
|
||||
def clear(full=true)
|
||||
@typeMod = PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
@typeMod = Effectiveness::NORMAL_EFFECTIVE
|
||||
@useState = 0
|
||||
@protected = false
|
||||
@skill = 0 if full
|
||||
@@ -73,10 +73,10 @@ class PokeBattle_SuccessState
|
||||
if @useState==1
|
||||
@skill = -2 if !@protected
|
||||
elsif @useState==2
|
||||
if PBTypeEffectiveness.superEffective?(@typeMod); @skill = 2
|
||||
elsif PBTypeEffectiveness.normalEffective?(@typeMod); @skill = 1
|
||||
elsif PBTypeEffectiveness.notVeryEffective?(@typeMod); @skill = -1
|
||||
else; @skill = -2 # Ineffective
|
||||
if Effectiveness.super_effective?(@typeMod); @skill = 2
|
||||
elsif Effectiveness.normal?(@typeMod); @skill = 1
|
||||
elsif Effectiveness.not_very_effective?(@typeMod); @skill = -1
|
||||
else; @skill = -2 # Ineffective
|
||||
end
|
||||
end
|
||||
clear(false)
|
||||
|
||||
Reference in New Issue
Block a user