Rearranged and tidied up game data scripts

This commit is contained in:
Maruno17
2021-03-29 19:01:03 +01:00
parent cd62ba840c
commit 01a066a4d9
55 changed files with 263 additions and 276 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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