mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Generalised a species' types to allow any number of types
This commit is contained in:
@@ -59,11 +59,11 @@ module GameData
|
||||
end
|
||||
|
||||
def effectiveness(other_type)
|
||||
return Effectiveness::NORMAL_EFFECTIVE_ONE if !other_type
|
||||
return Effectiveness::SUPER_EFFECTIVE_ONE if @weaknesses.include?(other_type)
|
||||
return Effectiveness::NOT_VERY_EFFECTIVE_ONE if @resistances.include?(other_type)
|
||||
return Effectiveness::NORMAL_EFFECTIVE if !other_type
|
||||
return Effectiveness::SUPER_EFFECTIVE if @weaknesses.include?(other_type)
|
||||
return Effectiveness::NOT_VERY_EFFECTIVE if @resistances.include?(other_type)
|
||||
return Effectiveness::INEFFECTIVE if @immunities.include?(other_type)
|
||||
return Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
return Effectiveness::NORMAL_EFFECTIVE
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -71,73 +71,71 @@ end
|
||||
#===============================================================================
|
||||
|
||||
module Effectiveness
|
||||
INEFFECTIVE = 0
|
||||
NOT_VERY_EFFECTIVE_ONE = 1
|
||||
NORMAL_EFFECTIVE_ONE = 2
|
||||
SUPER_EFFECTIVE_ONE = 4
|
||||
NORMAL_EFFECTIVE = NORMAL_EFFECTIVE_ONE**3
|
||||
INEFFECTIVE = 0
|
||||
NOT_VERY_EFFECTIVE = 1
|
||||
NORMAL_EFFECTIVE = 2
|
||||
SUPER_EFFECTIVE = 4
|
||||
INEFFECTIVE_MULTIPLIER = INEFFECTIVE.to_f / NORMAL_EFFECTIVE
|
||||
NOT_VERY_EFFECTIVE_MULTIPLIER = NOT_VERY_EFFECTIVE.to_f / NORMAL_EFFECTIVE
|
||||
NORMAL_EFFECTIVE_MULTIPLIER = 1.0
|
||||
SUPER_EFFECTIVE_MULTIPLIER = SUPER_EFFECTIVE.to_f / NORMAL_EFFECTIVE
|
||||
|
||||
module_function
|
||||
|
||||
def ineffective?(value)
|
||||
return value == INEFFECTIVE
|
||||
return value == INEFFECTIVE_MULTIPLIER
|
||||
end
|
||||
|
||||
def not_very_effective?(value)
|
||||
return value > INEFFECTIVE && value < NORMAL_EFFECTIVE
|
||||
return value > INEFFECTIVE_MULTIPLIER && value < NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
|
||||
def resistant?(value)
|
||||
return value < NORMAL_EFFECTIVE
|
||||
return value < NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
|
||||
def normal?(value)
|
||||
return value == NORMAL_EFFECTIVE
|
||||
return value == NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
|
||||
def super_effective?(value)
|
||||
return value > NORMAL_EFFECTIVE
|
||||
return value > NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
|
||||
def ineffective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
|
||||
def ineffective_type?(attack_type, *defend_types)
|
||||
value = calculate(attack_type, *defend_types)
|
||||
return ineffective?(value)
|
||||
end
|
||||
|
||||
def not_very_effective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
|
||||
def not_very_effective_type?(attack_type, *defend_types)
|
||||
value = calculate(attack_type, *defend_types)
|
||||
return not_very_effective?(value)
|
||||
end
|
||||
|
||||
def resistant_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
|
||||
def resistant_type?(attack_type, *defend_types)
|
||||
value = calculate(attack_type, *defend_types)
|
||||
return resistant?(value)
|
||||
end
|
||||
|
||||
def normal_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
|
||||
def normal_type?(attack_type, *defend_types)
|
||||
value = calculate(attack_type, *defend_types)
|
||||
return normal?(value)
|
||||
end
|
||||
|
||||
def super_effective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
|
||||
def super_effective_type?(attack_type, *defend_types)
|
||||
value = calculate(attack_type, *defend_types)
|
||||
return super_effective?(value)
|
||||
end
|
||||
|
||||
def calculate_one(attack_type, defend_type)
|
||||
def get_type_effectiveness(attack_type, defend_type)
|
||||
return GameData::Type.get(defend_type).effectiveness(attack_type)
|
||||
end
|
||||
|
||||
def calculate(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
mod1 = (defend_type1) ? calculate_one(attack_type, defend_type1) : NORMAL_EFFECTIVE_ONE
|
||||
mod2 = NORMAL_EFFECTIVE_ONE
|
||||
mod3 = NORMAL_EFFECTIVE_ONE
|
||||
if defend_type2 && defend_type1 != defend_type2
|
||||
mod2 = calculate_one(attack_type, defend_type2)
|
||||
def calculate(attack_type, *defend_types)
|
||||
ret = NORMAL_EFFECTIVE_MULTIPLIER
|
||||
defend_types.each do |type|
|
||||
ret *= get_type_effectiveness(attack_type, type) / NORMAL_EFFECTIVE.to_f
|
||||
end
|
||||
if defend_type3 && defend_type1 != defend_type3 && defend_type2 != defend_type3
|
||||
mod3 = calculate_one(attack_type, defend_type3)
|
||||
end
|
||||
return mod1 * mod2 * mod3
|
||||
return ret
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,7 +65,7 @@ module GameData
|
||||
ret["UnmegaForm"] = [:unmega_form, "u"]
|
||||
ret["MegaMessage"] = [:mega_message, "u"]
|
||||
end
|
||||
ret["Types"] = [:types, "eE", :Type, :Type]
|
||||
ret["Types"] = [:types, "*e", :Type]
|
||||
ret["BaseStats"] = [:base_stats, "vvvvvv"]
|
||||
if !compiling_forms
|
||||
ret["GenderRatio"] = [:gender_ratio, "e", :GenderRatio]
|
||||
@@ -113,7 +113,7 @@ module GameData
|
||||
["ID", ReadOnlyProperty, _INTL("The ID of the Pokémon.")],
|
||||
["Name", LimitStringProperty.new(Pokemon::MAX_NAME_SIZE), _INTL("Name of the Pokémon.")],
|
||||
["FormName", StringProperty, _INTL("Name of this form of the Pokémon.")],
|
||||
["Types", TypesProperty, _INTL("The Pokémon's type(s).")],
|
||||
["Types", GameDataPoolProperty.new(:Type, false), _INTL("The Pokémon's type(s).")],
|
||||
["BaseStats", BaseStatsProperty, _INTL("Base stats of the Pokémon.")],
|
||||
["GenderRatio", GameDataProperty.new(:GenderRatio), _INTL("Proportion of males to females for this species.")],
|
||||
["GrowthRate", GameDataProperty.new(:GrowthRate), _INTL("Pokémon's growth rate.")],
|
||||
|
||||
@@ -427,9 +427,8 @@ class Battle
|
||||
if battler_side.effects[PBEffects::StealthRock] && battler.takesIndirectDamage? &&
|
||||
GameData::Type.exists?(:ROCK) && !battler.hasActiveItem?(:HEAVYDUTYBOOTS)
|
||||
bTypes = battler.pbTypes(true)
|
||||
eff = Effectiveness.calculate(:ROCK, bTypes[0], bTypes[1], bTypes[2])
|
||||
eff = Effectiveness.calculate(:ROCK, *bTypes)
|
||||
if !Effectiveness.ineffective?(eff)
|
||||
eff = eff.to_f / Effectiveness::NORMAL_EFFECTIVE
|
||||
battler.pbReduceHP(battler.totalhp * eff / 8, false)
|
||||
pbDisplay(_INTL("Pointed stones dug into {1}!", battler.pbThis))
|
||||
battler.pbItemHPHealCheck
|
||||
|
||||
@@ -300,7 +300,7 @@ class Battle::Battler
|
||||
|
||||
# Returns the active types of this Pokémon. The array should not include the
|
||||
# same type more than once, and should not include any invalid types.
|
||||
def pbTypes(withType3 = false)
|
||||
def pbTypes(withExtraType = false)
|
||||
ret = @types.uniq
|
||||
# Burn Up erases the Fire-type.
|
||||
ret.delete(:FIRE) if @effects[PBEffects::BurnUp]
|
||||
@@ -311,8 +311,8 @@ class Battle::Battler
|
||||
ret.push(:NORMAL) if ret.length == 0
|
||||
end
|
||||
# Add the third type specially.
|
||||
if withType3 && @effects[PBEffects::Type3] && !ret.include?(@effects[PBEffects::Type3])
|
||||
ret.push(@effects[PBEffects::Type3])
|
||||
if withExtraType && @effects[PBEffects::ExtraType] && !ret.include?(@effects[PBEffects::ExtraType])
|
||||
ret.push(@effects[PBEffects::ExtraType])
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -171,6 +171,7 @@ class Battle::Battler
|
||||
@effects[PBEffects::Encore] = 0
|
||||
@effects[PBEffects::EncoreMove] = nil
|
||||
@effects[PBEffects::Endure] = false
|
||||
@effects[PBEffects::ExtraType] = nil
|
||||
@effects[PBEffects::FirstPledge] = nil
|
||||
@effects[PBEffects::FlashFire] = false
|
||||
@effects[PBEffects::Flinch] = false
|
||||
@@ -270,7 +271,6 @@ class Battle::Battler
|
||||
end
|
||||
@effects[PBEffects::Truant] = false
|
||||
@effects[PBEffects::TwoTurnAttack] = nil
|
||||
@effects[PBEffects::Type3] = nil
|
||||
@effects[PBEffects::Unburden] = false
|
||||
@effects[PBEffects::Uproar] = 0
|
||||
@effects[PBEffects::WaterSport] = false
|
||||
|
||||
@@ -129,14 +129,14 @@ class Battle::Battler
|
||||
if newType.is_a?(Battle::Battler)
|
||||
newTypes = newType.pbTypes
|
||||
newTypes.push(:NORMAL) if newTypes.length == 0
|
||||
newType3 = newType.effects[PBEffects::Type3]
|
||||
newType3 = nil if newTypes.include?(newType3)
|
||||
newExtraType = newType.effects[PBEffects::ExtraType]
|
||||
newExtraType = nil if newTypes.include?(newExtraType)
|
||||
@types = newTypes.clone
|
||||
@effects[PBEffects::Type3] = newType3
|
||||
@effects[PBEffects::ExtraType] = newExtraType
|
||||
else
|
||||
newType = GameData::Type.get(newType).id
|
||||
@types = [newType]
|
||||
@effects[PBEffects::Type3] = nil
|
||||
@effects[PBEffects::ExtraType] = nil
|
||||
end
|
||||
@effects[PBEffects::BurnUp] = false
|
||||
@effects[PBEffects::Roost] = false
|
||||
@@ -144,7 +144,7 @@ class Battle::Battler
|
||||
|
||||
def pbResetTypes
|
||||
@types = @pokemon.types
|
||||
@effects[PBEffects::Type3] = nil
|
||||
@effects[PBEffects::ExtraType] = nil
|
||||
@effects[PBEffects::BurnUp] = false
|
||||
@effects[PBEffects::Roost] = false
|
||||
end
|
||||
|
||||
@@ -30,58 +30,51 @@ class Battle::Move
|
||||
# Type effectiveness calculation
|
||||
#=============================================================================
|
||||
def pbCalcTypeModSingle(moveType, defType, user, target)
|
||||
ret = Effectiveness.calculate_one(moveType, defType)
|
||||
ret = Effectiveness.calculate(moveType, defType)
|
||||
if Effectiveness.ineffective_type?(moveType, defType)
|
||||
# Ring Target
|
||||
if target.hasActiveItem?(:RINGTARGET)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
# Foresight
|
||||
if (user.hasActiveAbility?(:SCRAPPY) || target.effects[PBEffects::Foresight]) &&
|
||||
defType == :GHOST
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
# Miracle Eye
|
||||
if target.effects[PBEffects::MiracleEye] && defType == :DARK
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
elsif Effectiveness.super_effective_type?(moveType, defType)
|
||||
# Delta Stream's weather
|
||||
if target.effectiveWeather == :StrongWinds && defType == :FLYING
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
end
|
||||
# Grounded Flying-type Pokémon become susceptible to Ground moves
|
||||
if !target.airborne? && defType == :FLYING && moveType == :GROUND
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(moveType, user, target)
|
||||
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)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
return ret if !moveType
|
||||
return ret if moveType == :GROUND && target.pbHasType?(:FLYING) && target.hasActiveItem?(:IRONBALL)
|
||||
# Get effectivenesses
|
||||
typeMods = [Effectiveness::NORMAL_EFFECTIVE_ONE] * 3 # 3 types max
|
||||
if moveType == :SHADOW
|
||||
if target.shadowPokemon?
|
||||
typeMods[0] = Effectiveness::NOT_VERY_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NOT_VERY_EFFECTIVE_MULTIPLIER
|
||||
else
|
||||
typeMods[0] = Effectiveness::SUPER_EFFECTIVE_ONE
|
||||
ret = Effectiveness::SUPER_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
else
|
||||
tTypes.each_with_index do |type, i|
|
||||
typeMods[i] = pbCalcTypeModSingle(moveType, type, user, target)
|
||||
target.pbTypes(true).each do |type|
|
||||
ret *= pbCalcTypeModSingle(moveType, type, user, target)
|
||||
end
|
||||
ret *= 2 if target.effects[PBEffects::TarShot] && moveType == :FIRE
|
||||
end
|
||||
# Multiply all effectivenesses together
|
||||
ret = 1
|
||||
typeMods.each { |m| ret *= m }
|
||||
ret *= 2 if target.effects[PBEffects::TarShot] && moveType == :FIRE
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -449,7 +442,7 @@ class Battle::Move
|
||||
end
|
||||
end
|
||||
# Type effectiveness
|
||||
multipliers[:final_damage_multiplier] *= target.damageState.typeMod.to_f / Effectiveness::NORMAL_EFFECTIVE
|
||||
multipliers[:final_damage_multiplier] *= target.damageState.typeMod
|
||||
# Burn
|
||||
if user.status == :BURN && physicalMove? && damageReducedByBurn? &&
|
||||
!user.hasActiveAbility?(:GUTS)
|
||||
|
||||
@@ -280,7 +280,7 @@ end
|
||||
#===============================================================================
|
||||
class Battle::Move::FreezeTargetSuperEffectiveAgainstWater < Battle::Move::FreezeTarget
|
||||
def pbCalcTypeModSingle(moveType, defType, user, target)
|
||||
return Effectiveness::SUPER_EFFECTIVE_ONE if defType == :WATER
|
||||
return Effectiveness::SUPER_EFFECTIVE_MULTIPLIER if defType == :WATER
|
||||
return super
|
||||
end
|
||||
end
|
||||
@@ -786,7 +786,7 @@ class Battle::Move::SetUserTypesToTargetTypes < Battle::Move
|
||||
return true
|
||||
end
|
||||
if user.pbTypes == target.pbTypes &&
|
||||
user.effects[PBEffects::Type3] == target.effects[PBEffects::Type3]
|
||||
user.effects[PBEffects::ExtraType] == target.effects[PBEffects::ExtraType]
|
||||
@battle.pbDisplay(_INTL("But it failed!")) if show_message
|
||||
return true
|
||||
end
|
||||
@@ -895,7 +895,7 @@ class Battle::Move::AddGhostTypeToTarget < Battle::Move
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
target.effects[PBEffects::Type3] = :GHOST
|
||||
target.effects[PBEffects::ExtraType] = :GHOST
|
||||
typeName = GameData::Type.get(:GHOST).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!", target.pbThis, typeName))
|
||||
end
|
||||
@@ -916,7 +916,7 @@ class Battle::Move::AddGrassTypeToTarget < Battle::Move
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user, target)
|
||||
target.effects[PBEffects::Type3] = :GRASS
|
||||
target.effects[PBEffects::ExtraType] = :GRASS
|
||||
typeName = GameData::Type.get(:GRASS).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!", target.pbThis, typeName))
|
||||
end
|
||||
@@ -1278,7 +1278,7 @@ class Battle::Move::HitsTargetInSkyGroundsTarget < Battle::Move
|
||||
def hitsFlyingTargets?; return true; end
|
||||
|
||||
def pbCalcTypeModSingle(moveType, defType, user, target)
|
||||
return Effectiveness::NORMAL_EFFECTIVE_ONE if moveType == :GROUND && defType == :FLYING
|
||||
return Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER if moveType == :GROUND && defType == :FLYING
|
||||
return super
|
||||
end
|
||||
|
||||
|
||||
@@ -1113,8 +1113,7 @@ class Battle::Move::EffectivenessIncludesFlyingType < Battle::Move
|
||||
def pbCalcTypeModSingle(moveType, defType, user, target)
|
||||
ret = super
|
||||
if GameData::Type.exists?(:FLYING)
|
||||
flyingEff = Effectiveness.calculate_one(:FLYING, defType)
|
||||
ret *= flyingEff.to_f / Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
ret *= Effectiveness.calculate(:FLYING, defType)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -444,7 +444,7 @@ class Battle::Move::TwoTurnAttackInvulnerableInSkyTargetCannotAct < Battle::Move
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(movetype, user, target)
|
||||
return Effectiveness::INEFFECTIVE if target.pbHasType?(:FLYING)
|
||||
return Effectiveness::INEFFECTIVE_MULTIPLIER if target.pbHasType?(:FLYING)
|
||||
return super
|
||||
end
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ class Battle::AI
|
||||
if !user.canChangeType? || target.pbTypes(true).length == 0
|
||||
score -= 90
|
||||
elsif user.pbTypes == target.pbTypes &&
|
||||
user.effects[PBEffects::Type3] == target.effects[PBEffects::Type3]
|
||||
user.effects[PBEffects::ExtraType] == target.effects[PBEffects::ExtraType]
|
||||
score -= 90
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -27,70 +27,61 @@ class Battle::AI
|
||||
# Move's type effectiveness
|
||||
#=============================================================================
|
||||
def pbCalcTypeModSingle(moveType, defType, user, target)
|
||||
ret = Effectiveness.calculate_one(moveType, defType)
|
||||
ret = Effectiveness.calculate(moveType, defType)
|
||||
if Effectiveness.ineffective_type?(moveType, defType)
|
||||
# Ring Target
|
||||
if target.hasActiveItem?(:RINGTARGET)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
# Foresight
|
||||
if (user.hasActiveAbility?(:SCRAPPY) || target.effects[PBEffects::Foresight]) &&
|
||||
defType == :GHOST
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
# Miracle Eye
|
||||
if target.effects[PBEffects::MiracleEye] && defType == :DARK
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
elsif Effectiveness.super_effective_type?(moveType, defType)
|
||||
# Delta Stream's weather
|
||||
if target.effectiveWeather == :StrongWinds && defType == :FLYING
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
end
|
||||
# Grounded Flying-type Pokémon become susceptible to Ground moves
|
||||
if !target.airborne? && defType == :FLYING && moveType == :GROUND
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(moveType, user, target)
|
||||
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)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
return ret if !moveType
|
||||
return ret if moveType == :GROUND && target.pbHasType?(:FLYING) && target.hasActiveItem?(:IRONBALL)
|
||||
# Get effectivenesses
|
||||
typeMods = [Effectiveness::NORMAL_EFFECTIVE_ONE] * 3 # 3 types max
|
||||
if moveType == :SHADOW
|
||||
if target.shadowPokemon?
|
||||
typeMods[0] = Effectiveness::NOT_VERY_EFFECTIVE_ONE
|
||||
ret = Effectiveness::NOT_VERY_EFFECTIVE_MULTIPLIER
|
||||
else
|
||||
typeMods[0] = Effectiveness::SUPER_EFFECTIVE_ONE
|
||||
ret = Effectiveness::SUPER_EFFECTIVE_MULTIPLIER
|
||||
end
|
||||
else
|
||||
tTypes.each_with_index do |type, i|
|
||||
typeMods[i] = pbCalcTypeModSingle(moveType, type, user, target)
|
||||
target.pbTypes(true).each do |type|
|
||||
ret *= pbCalcTypeModSingle(moveType, type, user, target)
|
||||
end
|
||||
end
|
||||
# Multiply all effectivenesses together
|
||||
ret = 1
|
||||
typeMods.each { |m| ret *= m }
|
||||
return ret
|
||||
end
|
||||
|
||||
# For switching. Determines the effectiveness of a potential switch-in against
|
||||
# an opposing battler.
|
||||
def pbCalcTypeModPokemon(battlerThis, battlerOther)
|
||||
mod1 = Effectiveness.calculate(battlerThis.types[0], battlerOther.types[0], battlerOther.types[1])
|
||||
mod2 = Effectiveness::NORMAL_EFFECTIVE
|
||||
if battlerThis.types.length > 1
|
||||
mod2 = Effectiveness.calculate(battlerThis.types[1], battlerOther.types[0], battlerOther.types[1])
|
||||
mod2 = mod2.to_f / Effectiveness::NORMAL_EFFECTIVE
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
battlerThis.types.each do |thisType|
|
||||
ret *= Effectiveness.calculate(thisType, *battlerOther.types)
|
||||
end
|
||||
return mod1 * mod2
|
||||
return ret
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -271,15 +262,11 @@ class Battle::AI
|
||||
if GameData::Type.exists?(:FLYING)
|
||||
if skill >= PBTrainerAI.highSkill
|
||||
targetTypes = target.pbTypes(true)
|
||||
mult = Effectiveness.calculate(
|
||||
:FLYING, targetTypes[0], targetTypes[1], targetTypes[2]
|
||||
)
|
||||
mult = Effectiveness.calculate(:FLYING, *targetTypes)
|
||||
else
|
||||
mult = Effectiveness.calculate(
|
||||
:FLYING, target.types[0], target.types[1], target.effects[PBEffects::Type3]
|
||||
)
|
||||
mult = Effectiveness.calculate(:FLYING, target.types[0], target.types[1], target.effects[PBEffects::ExtraType])
|
||||
end
|
||||
baseDmg = (baseDmg.to_f * mult / Effectiveness::NORMAL_EFFECTIVE).round
|
||||
baseDmg *= mult
|
||||
end
|
||||
baseDmg *= 2 if skill >= PBTrainerAI.mediumSkill && target.effects[PBEffects::Minimize]
|
||||
when "DoublePowerIfUserLastMoveFailed" # Stomping Tantrum
|
||||
@@ -500,7 +487,7 @@ class Battle::AI
|
||||
# Type effectiveness
|
||||
if skill >= PBTrainerAI.mediumSkill
|
||||
typemod = pbCalcTypeMod(type, user, target)
|
||||
multipliers[:final_damage_multiplier] *= typemod.to_f / Effectiveness::NORMAL_EFFECTIVE
|
||||
multipliers[:final_damage_multiplier] *= typemod
|
||||
end
|
||||
# Burn
|
||||
if skill >= PBTrainerAI.highSkill && move.physicalMove?(type) &&
|
||||
|
||||
@@ -28,6 +28,7 @@ module PBEffects
|
||||
Encore = 23
|
||||
EncoreMove = 24
|
||||
Endure = 25
|
||||
ExtraType = 111
|
||||
FirstPledge = 26
|
||||
FlashFire = 27
|
||||
Flinch = 28
|
||||
@@ -113,7 +114,6 @@ module PBEffects
|
||||
TrappingUser = 108
|
||||
Truant = 109
|
||||
TwoTurnAttack = 110
|
||||
Type3 = 111
|
||||
Unburden = 112
|
||||
Uproar = 113
|
||||
WaterSport = 114
|
||||
|
||||
@@ -30,7 +30,7 @@ class Battle::DamageState
|
||||
def initialize; reset; end
|
||||
|
||||
def reset
|
||||
@typeMod = Effectiveness::INEFFECTIVE
|
||||
@typeMod = Effectiveness::INEFFECTIVE_MULTIPLIER
|
||||
@unaffected = false
|
||||
@protected = false
|
||||
@missed = false
|
||||
|
||||
@@ -2607,7 +2607,7 @@ Battle::AbilityEffects::OnSwitchIn.add(:ANTICIPATION,
|
||||
if Settings::MECHANICS_GENERATION >= 6 && m.function == "TypeDependsOnUserIVs" # Hidden Power
|
||||
moveType = pbHiddenPower(b.pokemon)[0]
|
||||
end
|
||||
eff = Effectiveness.calculate(moveType, types[0], types[1], types[2])
|
||||
eff = Effectiveness.calculate(moveType, types)
|
||||
next if Effectiveness.ineffective?(eff)
|
||||
next if !Effectiveness.super_effective?(eff) &&
|
||||
!["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(m.function)
|
||||
|
||||
@@ -10,7 +10,7 @@ class Battle::SuccessState
|
||||
def initialize; clear; end
|
||||
|
||||
def clear(full = true)
|
||||
@typeMod = Effectiveness::NORMAL_EFFECTIVE
|
||||
@typeMod = Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER
|
||||
@useState = 0
|
||||
@protected = false
|
||||
@skill = 0 if full
|
||||
|
||||
@@ -25,7 +25,7 @@ class Window_Pokedex < Window_DrawableCommand
|
||||
end
|
||||
|
||||
def species
|
||||
return (@commands.length == 0) ? 0 : @commands[self.index][0]
|
||||
return (@commands.length == 0) ? 0 : @commands[self.index][:species]
|
||||
end
|
||||
|
||||
def itemCount
|
||||
@@ -35,9 +35,9 @@ class Window_Pokedex < Window_DrawableCommand
|
||||
def drawItem(index, _count, rect)
|
||||
return if index >= self.top_row + self.page_item_max
|
||||
rect = Rect.new(rect.x + 16, rect.y, rect.width - 16, rect.height)
|
||||
species = @commands[index][0]
|
||||
indexNumber = @commands[index][4]
|
||||
indexNumber -= 1 if @commands[index][5]
|
||||
species = @commands[index][:species]
|
||||
indexNumber = @commands[index][:number]
|
||||
indexNumber -= 1 if @commands[index][:shift]
|
||||
if $player.seen?(species)
|
||||
if $player.owned?(species)
|
||||
pbCopyBitmap(self.contents, @pokeballOwn.bitmap, rect.x - 6, rect.y + 10)
|
||||
@@ -45,7 +45,7 @@ class Window_Pokedex < Window_DrawableCommand
|
||||
pbCopyBitmap(self.contents, @pokeballSeen.bitmap, rect.x - 6, rect.y + 10)
|
||||
end
|
||||
num_text = sprintf("%03d", indexNumber)
|
||||
name_text = @commands[index][1]
|
||||
name_text = @commands[index][:name]
|
||||
else
|
||||
num_text = sprintf("%03d", indexNumber)
|
||||
name_text = "----------"
|
||||
@@ -362,13 +362,17 @@ class PokemonPokedex_Scene
|
||||
next if !pbCanAddForModeList?($PokemonGlobal.pokedexMode, species)
|
||||
_gender, form, _shiny = $player.pokedex.last_form_seen(species)
|
||||
species_data = GameData::Species.get_species_form(species, form)
|
||||
color = species_data.color
|
||||
type1 = species_data.types[0]
|
||||
type2 = species_data.types[1] || type1
|
||||
shape = species_data.shape
|
||||
height = species_data.height
|
||||
weight = species_data.weight
|
||||
ret.push([species, species_data.name, height, weight, i + 1, shift, type1, type2, color, shape])
|
||||
ret.push({
|
||||
:species => species,
|
||||
:name => species_data.name,
|
||||
:height => species_data.height,
|
||||
:weight => species_data.weight,
|
||||
:number => i + 1,
|
||||
:shift => shift,
|
||||
:types => species_data.types,
|
||||
:color => species_data.color,
|
||||
:shape => species_data.shape
|
||||
})
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -378,27 +382,27 @@ class PokemonPokedex_Scene
|
||||
case $PokemonGlobal.pokedexMode
|
||||
when MODENUMERICAL
|
||||
# Hide the Dex number 0 species if unseen
|
||||
dexlist[0] = nil if dexlist[0][5] && !$player.seen?(dexlist[0][0])
|
||||
dexlist[0] = nil if dexlist[0][:shift] && !$player.seen?(dexlist[0][:species])
|
||||
# Remove unseen species from the end of the list
|
||||
i = dexlist.length - 1
|
||||
loop do
|
||||
break if i < 0 || !dexlist[i] || $player.seen?(dexlist[i][0])
|
||||
break if i < 0 || !dexlist[i] || $player.seen?(dexlist[i][:species])
|
||||
dexlist[i] = nil
|
||||
i -= 1
|
||||
end
|
||||
dexlist.compact!
|
||||
# Sort species in ascending order by Regional Dex number
|
||||
dexlist.sort! { |a, b| a[4] <=> b[4] }
|
||||
dexlist.sort! { |a, b| a[:number] <=> b[:number] }
|
||||
when MODEATOZ
|
||||
dexlist.sort! { |a, b| (a[1] == b[1]) ? a[4] <=> b[4] : a[1] <=> b[1] }
|
||||
dexlist.sort! { |a, b| (a[:name] == b[:name]) ? a[:number] <=> b[:number] : a[:name] <=> b[:name] }
|
||||
when MODEHEAVIEST
|
||||
dexlist.sort! { |a, b| (a[3] == b[3]) ? a[4] <=> b[4] : b[3] <=> a[3] }
|
||||
dexlist.sort! { |a, b| (a[:weight] == b[:weight]) ? a[:number] <=> b[:number] : b[:weight] <=> a[:weight] }
|
||||
when MODELIGHTEST
|
||||
dexlist.sort! { |a, b| (a[3] == b[3]) ? a[4] <=> b[4] : a[3] <=> b[3] }
|
||||
dexlist.sort! { |a, b| (a[:weight] == b[:weight]) ? a[:number] <=> b[:number] : a[:weight] <=> b[:weight] }
|
||||
when MODETALLEST
|
||||
dexlist.sort! { |a, b| (a[2] == b[2]) ? a[4] <=> b[4] : b[2] <=> a[2] }
|
||||
dexlist.sort! { |a, b| (a[:height] == b[:height]) ? a[:number] <=> b[:number] : b[:height] <=> a[:height] }
|
||||
when MODESMALLEST
|
||||
dexlist.sort! { |a, b| (a[2] == b[2]) ? a[4] <=> b[4] : a[2] <=> b[2] }
|
||||
dexlist.sort! { |a, b| (a[:height] == b[:height]) ? a[:number] <=> b[:number] : a[:height] <=> b[:height] }
|
||||
end
|
||||
@dexlist = dexlist
|
||||
@sprites["pokedex"].commands = @dexlist
|
||||
@@ -774,8 +778,8 @@ class PokemonPokedex_Scene
|
||||
if params[1] >= 0
|
||||
scanNameCommand = @nameCommands[params[1]].scan(/./)
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$player.seen?(item[0])
|
||||
firstChar = item[1][0, 1]
|
||||
next false if !$player.seen?(item[:species])
|
||||
firstChar = item[:name][0, 1]
|
||||
next scanNameCommand.any? { |v| v == firstChar }
|
||||
}
|
||||
end
|
||||
@@ -784,18 +788,17 @@ class PokemonPokedex_Scene
|
||||
stype1 = (params[2] >= 0) ? @typeCommands[params[2]].id : nil
|
||||
stype2 = (params[3] >= 0) ? @typeCommands[params[3]].id : nil
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$player.owned?(item[0])
|
||||
type1 = item[6]
|
||||
type2 = item[7]
|
||||
next false if !$player.owned?(item[:species])
|
||||
types = item[:types]
|
||||
if stype1 && stype2
|
||||
# Find species that match both types
|
||||
next (type1 == stype1 && type2 == stype2) || (type1 == stype2 && type2 == stype1)
|
||||
next types.include?(stype1) && types.include?(stype2)
|
||||
elsif stype1
|
||||
# Find species that match first type entered
|
||||
next type1 == stype1 || type2 == stype1
|
||||
next types.include?(stype1)
|
||||
elsif stype2
|
||||
# Find species that match second type entered
|
||||
next type1 == stype2 || type2 == stype2
|
||||
next types.include?(stype2)
|
||||
else
|
||||
next false
|
||||
end
|
||||
@@ -806,8 +809,8 @@ class PokemonPokedex_Scene
|
||||
minh = (params[4] < 0) ? 0 : (params[4] >= @heightCommands.length) ? 999 : @heightCommands[params[4]]
|
||||
maxh = (params[5] < 0) ? 999 : (params[5] >= @heightCommands.length) ? 0 : @heightCommands[params[5]]
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$player.owned?(item[0])
|
||||
height = item[2]
|
||||
next false if !$player.owned?(item[:species])
|
||||
height = item[:height]
|
||||
next height >= minh && height <= maxh
|
||||
}
|
||||
end
|
||||
@@ -816,8 +819,8 @@ class PokemonPokedex_Scene
|
||||
minw = (params[6] < 0) ? 0 : (params[6] >= @weightCommands.length) ? 9999 : @weightCommands[params[6]]
|
||||
maxw = (params[7] < 0) ? 9999 : (params[7] >= @weightCommands.length) ? 0 : @weightCommands[params[7]]
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$player.owned?(item[0])
|
||||
weight = item[3]
|
||||
next false if !$player.owned?(item[:species])
|
||||
weight = item[:weight]
|
||||
next weight >= minw && weight <= maxw
|
||||
}
|
||||
end
|
||||
@@ -825,27 +828,27 @@ class PokemonPokedex_Scene
|
||||
if params[8] >= 0
|
||||
scolor = @colorCommands[params[8]].id
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$player.seen?(item[0])
|
||||
next item[8] == scolor
|
||||
next false if !$player.seen?(item[:species])
|
||||
next item[:color] == scolor
|
||||
}
|
||||
end
|
||||
# Filter by shape
|
||||
if params[9] >= 0
|
||||
sshape = @shapeCommands[params[9]].id
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$player.seen?(item[0])
|
||||
next item[9] == sshape
|
||||
next false if !$player.seen?(item[:species])
|
||||
next item[:shape] == sshape
|
||||
}
|
||||
end
|
||||
# Remove all unseen species from the results
|
||||
dexlist = dexlist.find_all { |item| next $player.seen?(item[0]) }
|
||||
dexlist = dexlist.find_all { |item| next $player.seen?(item[:species]) }
|
||||
case $PokemonGlobal.pokedexMode
|
||||
when MODENUMERICAL then dexlist.sort! { |a, b| a[4] <=> b[4] }
|
||||
when MODEATOZ then dexlist.sort! { |a, b| a[1] <=> b[1] }
|
||||
when MODEHEAVIEST then dexlist.sort! { |a, b| b[3] <=> a[3] }
|
||||
when MODELIGHTEST then dexlist.sort! { |a, b| a[3] <=> b[3] }
|
||||
when MODETALLEST then dexlist.sort! { |a, b| b[2] <=> a[2] }
|
||||
when MODESMALLEST then dexlist.sort! { |a, b| a[2] <=> b[2] }
|
||||
when MODENUMERICAL then dexlist.sort! { |a, b| a[:number] <=> b[:number] }
|
||||
when MODEATOZ then dexlist.sort! { |a, b| a[:name] <=> b[:name] }
|
||||
when MODEHEAVIEST then dexlist.sort! { |a, b| b[:weight] <=> a[:weight] }
|
||||
when MODELIGHTEST then dexlist.sort! { |a, b| a[:weight] <=> b[:weight] }
|
||||
when MODETALLEST then dexlist.sort! { |a, b| b[:height] <=> a[:height] }
|
||||
when MODESMALLEST then dexlist.sort! { |a, b| a[:height] <=> b[:height] }
|
||||
end
|
||||
return dexlist
|
||||
end
|
||||
@@ -858,7 +861,7 @@ class PokemonPokedex_Scene
|
||||
@searchParams = [$PokemonGlobal.pokedexMode, -1, -1, -1, -1, -1, -1, -1, -1, -1]
|
||||
pbRefreshDexList($PokemonGlobal.pokedexIndex[pbGetSavePositionIndex])
|
||||
@dexlist.length.times do |i|
|
||||
next if @dexlist[i][0] != oldspecies
|
||||
next if @dexlist[i][:species] != oldspecies
|
||||
@sprites["pokedex"].index = i
|
||||
pbRefresh
|
||||
break
|
||||
|
||||
@@ -90,8 +90,15 @@ class PokemonPokedexInfo_Scene
|
||||
break
|
||||
end
|
||||
end
|
||||
@dexlist = [[species, "", 0, 0, dexnum, dexnumshift]]
|
||||
@index = 0
|
||||
@dexlist = [{
|
||||
:species => species,
|
||||
:name => "",
|
||||
:height => 0,
|
||||
:weight => 0,
|
||||
:number => dexnum,
|
||||
:shift => dexnumshift
|
||||
}]
|
||||
@index = 0
|
||||
@page = 1
|
||||
@brief = true
|
||||
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/UI/Pokedex/icon_types"))
|
||||
@@ -125,7 +132,7 @@ class PokemonPokedexInfo_Scene
|
||||
end
|
||||
|
||||
def pbUpdateDummyPokemon
|
||||
@species = @dexlist[@index][0]
|
||||
@species = @dexlist[@index][:species]
|
||||
@gender, @form, _shiny = $player.pokedex.last_form_seen(@species)
|
||||
@shiny = false
|
||||
metrics_data = GameData::SpeciesMetrics.get_species_form(@species, @form)
|
||||
@@ -209,9 +216,9 @@ class PokemonPokedexInfo_Scene
|
||||
species_data = GameData::Species.get_species_form(@species, @form)
|
||||
# Write various bits of text
|
||||
indexText = "???"
|
||||
if @dexlist[@index][4] > 0
|
||||
indexNumber = @dexlist[@index][4]
|
||||
indexNumber -= 1 if @dexlist[@index][5]
|
||||
if @dexlist[@index][:number] > 0
|
||||
indexNumber = @dexlist[@index][:number]
|
||||
indexNumber -= 1 if @dexlist[@index][:shift]
|
||||
indexText = sprintf("%03d", indexNumber)
|
||||
end
|
||||
textpos = [
|
||||
@@ -406,7 +413,7 @@ class PokemonPokedexInfo_Scene
|
||||
newindex = @index
|
||||
while newindex > 0
|
||||
newindex -= 1
|
||||
if $player.seen?(@dexlist[newindex][0])
|
||||
if $player.seen?(@dexlist[newindex][:species])
|
||||
@index = newindex
|
||||
break
|
||||
end
|
||||
@@ -417,7 +424,7 @@ class PokemonPokedexInfo_Scene
|
||||
newindex = @index
|
||||
while newindex < @dexlist.length - 1
|
||||
newindex += 1
|
||||
if $player.seen?(@dexlist[newindex][0])
|
||||
if $player.seen?(@dexlist[newindex][:species])
|
||||
@index = newindex
|
||||
break
|
||||
end
|
||||
@@ -581,7 +588,14 @@ class PokemonPokedexInfoScreen
|
||||
end
|
||||
dexnum = pbGetRegionalNumber(region, species)
|
||||
dexnumshift = Settings::DEXES_WITH_OFFSETS.include?(region)
|
||||
dexlist = [[species, GameData::Species.get(species).name, 0, 0, dexnum, dexnumshift]]
|
||||
dexlist = [{
|
||||
:species => species,
|
||||
:name => GameData::Species.get(species).name,
|
||||
:height => 0,
|
||||
:weight => 0,
|
||||
:number => dexnum,
|
||||
:shift => dexnumshift
|
||||
}]
|
||||
@scene.pbStartScene(dexlist, 0, region)
|
||||
@scene.pbScene
|
||||
@scene.pbEndScene
|
||||
|
||||
@@ -141,17 +141,17 @@ class PurifyChamberSet
|
||||
end
|
||||
|
||||
# Purify Chamber treats Normal/Normal matchup as super effective
|
||||
def self.typeAdvantage(p1, p2)
|
||||
return true if p1 == :NORMAL && p2 == :NORMAL
|
||||
return Effectiveness.super_effective_type?(p1, p2)
|
||||
def self.typeAdvantage(type1, type2)
|
||||
return true if type1 == :NORMAL && type2 == :NORMAL
|
||||
return Effectiveness.super_effective_type?(type1, type2)
|
||||
end
|
||||
|
||||
def self.isSuperEffective(p1, p2)
|
||||
return true if typeAdvantage(p1.types[0], p2.types[0])
|
||||
return true if p2.types[1] && typeAdvantage(p1.types[0], p2.types[1])
|
||||
return false if p1.types[1].nil?
|
||||
return true if typeAdvantage(p1.types[1], p2.types[0])
|
||||
return true if p2.types[1] && typeAdvantage(p1.types[1], p2.types[1])
|
||||
def self.isSuperEffective(pkmn1, pkmn2)
|
||||
pkmn1.types.each do |type1|
|
||||
pkmn2.types.each do |type2|
|
||||
return true if typeAdvantage(type1, type2)
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
@@ -952,16 +952,13 @@ class PurifyChamberSetView < Sprite
|
||||
pbSetSmallFont(@info.bitmap)
|
||||
textpos = []
|
||||
if pkmn
|
||||
if pkmn.types.length == 1
|
||||
textpos.push([_INTL("{1} Lv.{2} {3}", pkmn.name, pkmn.level,
|
||||
GameData::Type.get(pkmn.types[0]).name),
|
||||
2, 6, 0, Color.new(248, 248, 248), Color.new(128, 128, 128)])
|
||||
else
|
||||
textpos.push([_INTL("{1} Lv.{2} {3}/{4}", pkmn.name, pkmn.level,
|
||||
GameData::Type.get(pkmn.types[0]).name,
|
||||
GameData::Type.get(pkmn.types[1]).name),
|
||||
2, 6, 0, Color.new(248, 248, 248), Color.new(128, 128, 128)])
|
||||
type_string = ""
|
||||
pkmn.types.each_with_index do |type, i|
|
||||
type_string += "/" if i > 0
|
||||
type_string += GameData::Type.get(type).name
|
||||
end
|
||||
textpos.push([_INTL("{1} Lv.{2} {3}", pkmn.name, pkmn.level, type_string),
|
||||
2, 6, 0, Color.new(248, 248, 248), Color.new(128, 128, 128)])
|
||||
textpos.push([_INTL("FLOW"), 2 + (@info.bitmap.width / 2), 30, 0,
|
||||
Color.new(248, 248, 248), Color.new(128, 128, 128)])
|
||||
# draw heart gauge
|
||||
|
||||
@@ -51,10 +51,13 @@ class TriadCard
|
||||
end
|
||||
|
||||
def bonus(opponent)
|
||||
case Effectiveness.calculate_one(@type, opponent.type)
|
||||
when Effectiveness::INEFFECTIVE then return -2
|
||||
when Effectiveness::NOT_VERY_EFFECTIVE_ONE then return -1
|
||||
when Effectiveness::SUPER_EFFECTIVE_ONE then return 1
|
||||
effectiveness = Effectiveness.calculate(@type, opponent.type)
|
||||
if Effectiveness.ineffective?(effectiveness)
|
||||
return -2
|
||||
elsif Effectiveness.not_very_effective?(effectiveness)
|
||||
return -1
|
||||
elsif Effectiveness.super_effective?(effectiveness)
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
@@ -309,16 +309,17 @@ def pbDecideWinnerEffectiveness(move, otype1, otype2, ability, scores)
|
||||
data = GameData::Move.get(move)
|
||||
return 0 if data.base_damage == 0
|
||||
atype = data.type
|
||||
typemod = Effectiveness::NORMAL_EFFECTIVE_ONE**2
|
||||
typemod = 1.0
|
||||
if ability != :LEVITATE || data.type != :GROUND
|
||||
mod1 = Effectiveness.calculate_one(atype, otype1)
|
||||
mod2 = (otype1 == otype2) ? Effectiveness::NORMAL_EFFECTIVE_ONE : Effectiveness.calculate_one(atype, otype2)
|
||||
mod1 = Effectiveness.calculate(atype, otype1)
|
||||
mod2 = (otype1 == otype2) ? 1.0 : Effectiveness.calculate(atype, otype2)
|
||||
if ability == :WONDERGUARD
|
||||
mod1 = Effectiveness::NORMAL_EFFECTIVE_ONE if mod1 <= Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
mod2 = Effectiveness::NORMAL_EFFECTIVE_ONE if mod2 <= Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
mod1 = 1.0 if !Effectiveness.super_effective?(mod1)
|
||||
mod2 = 1.0 if !Effectiveness.super_effective?(mod2)
|
||||
end
|
||||
typemod = mod1 * mod2
|
||||
end
|
||||
typemod *= 4 # Because dealing with 2 types
|
||||
return scores[0] if typemod == 0 # Ineffective
|
||||
return scores[1] if typemod == 1 # Doubly not very effective
|
||||
return scores[2] if typemod == 2 # Not very effective
|
||||
|
||||
@@ -416,7 +416,7 @@ MenuHandlers.add(:battle_pokemon_debug_menu, :set_types, {
|
||||
"parent" => :main,
|
||||
"usage" => :battler,
|
||||
"effect" => proc { |pkmn, battler, battle|
|
||||
max_main_types = 2 # The most types a Pokémon can have normally
|
||||
max_main_types = 5 # Arbitrary value, could be any number
|
||||
cmd = 0
|
||||
loop do
|
||||
commands = []
|
||||
@@ -427,7 +427,7 @@ MenuHandlers.add(:battle_pokemon_debug_menu, :set_types, {
|
||||
commands.push(_INTL("Type {1}: {2}", i + 1, type_name))
|
||||
types.push(type)
|
||||
end
|
||||
extra_type = battler.effects[PBEffects::Type3]
|
||||
extra_type = battler.effects[PBEffects::ExtraType]
|
||||
extra_type_name = (extra_type) ? GameData::Type.get(extra_type).name : "-"
|
||||
commands.push(_INTL("Extra type: {1}", extra_type_name))
|
||||
types.push(extra_type)
|
||||
@@ -443,14 +443,14 @@ MenuHandlers.add(:battle_pokemon_debug_menu, :set_types, {
|
||||
if cmd < max_main_types
|
||||
battler.types[cmd] = nil
|
||||
else
|
||||
battler.effects[PBEffects::Type3] = nil
|
||||
battler.effects[PBEffects::ExtraType] = nil
|
||||
end
|
||||
battler.types.compact!
|
||||
end
|
||||
elsif cmd < max_main_types
|
||||
battler.types[cmd] = new_type
|
||||
else
|
||||
battler.effects[PBEffects::Type3] = new_type
|
||||
battler.effects[PBEffects::ExtraType] = new_type
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -114,7 +114,7 @@ module Battle::DebugVariables
|
||||
PBEffects::TrappingUser => { name: "Battler trapping self (for Binding Band)", default: -1 }, # Battler index
|
||||
PBEffects::Truant => { name: "Truant will loaf around this round", default: false },
|
||||
# PBEffects::TwoTurnAttack - only applies to use of specific moves, not suitable for setting via debug
|
||||
# PBEffects::Type3 - set elsewhere
|
||||
# PBEffects::ExtraType - set elsewhere
|
||||
PBEffects::Unburden => { name: "Self lost its item (for Unburden)", default: false },
|
||||
PBEffects::Uproar => { name: "Uproar number of rounds remaining", default: 0 },
|
||||
PBEffects::WaterSport => { name: "Used Water Sport (Gen 5 and older)", default: false },
|
||||
|
||||
@@ -312,7 +312,10 @@ module Compiler
|
||||
hash[:evolutions].each { |evo| evo[3] = false }
|
||||
end
|
||||
# Remove duplicate types
|
||||
hash[:types].uniq! if hash[:types].is_a?(Array)
|
||||
if hash[:types].is_a?(Array)
|
||||
hash[:types].uniq!
|
||||
hash[:types].compact!
|
||||
end
|
||||
end
|
||||
|
||||
def validate_all_compiled_pokemon
|
||||
|
||||
Reference in New Issue
Block a user