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