mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Rearranged and tidied up game data scripts
This commit is contained in:
@@ -195,17 +195,17 @@ module GameData
|
||||
# A bulk loader method for all data stored in .dat files in the Data folder.
|
||||
#=============================================================================
|
||||
def self.load_all
|
||||
Type.load
|
||||
Ability.load
|
||||
Move.load
|
||||
Item.load
|
||||
BerryPlant.load
|
||||
Species.load
|
||||
Ribbon.load
|
||||
Encounter.load
|
||||
TrainerType.load
|
||||
Trainer.load
|
||||
Metadata.load
|
||||
MapMetadata.load
|
||||
Move.load
|
||||
TrainerType.load
|
||||
Type.load
|
||||
Species.load
|
||||
Trainer.load
|
||||
Encounter.load
|
||||
Ribbon.load
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
module GameData
|
||||
class Type
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :special_type
|
||||
attr_reader :pseudo_type
|
||||
attr_reader :weaknesses
|
||||
attr_reader :resistances
|
||||
attr_reader :immunities
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "types.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Name" => [1, "s"],
|
||||
"InternalName" => [2, "s"],
|
||||
"IsPseudoType" => [3, "b"],
|
||||
"IsSpecialType" => [4, "b"],
|
||||
"Weaknesses" => [5, "*s"],
|
||||
"Resistances" => [6, "*s"],
|
||||
"Immunities" => [7, "*s"]
|
||||
}
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@pseudo_type = hash[:pseudo_type] || false
|
||||
@special_type = hash[:special_type] || false
|
||||
@weaknesses = hash[:weaknesses] || []
|
||||
@weaknesses = [@weaknesses] if !@weaknesses.is_a?(Array)
|
||||
@resistances = hash[:resistances] || []
|
||||
@resistances = [@resistances] if !@resistances.is_a?(Array)
|
||||
@immunities = hash[:immunities] || []
|
||||
@immunities = [@immunities] if !@immunities.is_a?(Array)
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this item
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::Types, @id_number)
|
||||
end
|
||||
|
||||
def physical?; return !@special_type; end
|
||||
def special?; return @special_type; end
|
||||
|
||||
def effectiveness(other_type)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if !other_type
|
||||
return PBTypeEffectiveness::SUPER_EFFECTIVE_ONE if @weaknesses.include?(other_type)
|
||||
return PBTypeEffectiveness::NOT_EFFECTIVE_ONE if @resistances.include?(other_type)
|
||||
return PBTypeEffectiveness::INEFFECTIVE if @immunities.include?(other_type)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -4,10 +4,10 @@
|
||||
class PokemonTemp
|
||||
attr_accessor :townMapData
|
||||
attr_accessor :phoneData
|
||||
attr_accessor :regionalDexes
|
||||
attr_accessor :speciesShadowMovesets
|
||||
attr_accessor :moveToAnim
|
||||
attr_accessor :regionalDexes
|
||||
attr_accessor :battleAnims
|
||||
attr_accessor :moveToAnim
|
||||
attr_accessor :mapInfos
|
||||
end
|
||||
|
||||
@@ -15,10 +15,10 @@ def pbClearData
|
||||
if $PokemonTemp
|
||||
$PokemonTemp.townMapData = nil
|
||||
$PokemonTemp.phoneData = nil
|
||||
$PokemonTemp.regionalDexes = nil
|
||||
$PokemonTemp.speciesShadowMovesets = nil
|
||||
$PokemonTemp.moveToAnim = nil
|
||||
$PokemonTemp.regionalDexes = nil
|
||||
$PokemonTemp.battleAnims = nil
|
||||
$PokemonTemp.moveToAnim = nil
|
||||
$PokemonTemp.mapInfos = nil
|
||||
end
|
||||
MapFactoryHelper.clear
|
||||
@@ -52,17 +52,6 @@ def pbLoadPhoneData
|
||||
return $PokemonTemp.phoneData
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Method to get Regional Dexes data.
|
||||
#===============================================================================
|
||||
def pbLoadRegionalDexes
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.regionalDexes
|
||||
$PokemonTemp.regionalDexes = load_data("Data/regional_dexes.dat")
|
||||
end
|
||||
return $PokemonTemp.regionalDexes
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Method to get Shadow Pokémon moveset data.
|
||||
#===============================================================================
|
||||
@@ -75,16 +64,19 @@ def pbLoadShadowMovesets
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Methods relating to battle animations data.
|
||||
# Method to get Regional Dexes data.
|
||||
#===============================================================================
|
||||
def pbLoadMoveToAnim
|
||||
def pbLoadRegionalDexes
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.moveToAnim
|
||||
$PokemonTemp.moveToAnim = load_data("Data/move2anim.dat") || []
|
||||
if !$PokemonTemp.regionalDexes
|
||||
$PokemonTemp.regionalDexes = load_data("Data/regional_dexes.dat")
|
||||
end
|
||||
return $PokemonTemp.moveToAnim
|
||||
return $PokemonTemp.regionalDexes
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Methods relating to battle animations data.
|
||||
#===============================================================================
|
||||
def pbLoadBattleAnimations
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.battleAnims
|
||||
@@ -95,6 +87,14 @@ def pbLoadBattleAnimations
|
||||
return $PokemonTemp.battleAnims
|
||||
end
|
||||
|
||||
def pbLoadMoveToAnim
|
||||
$PokemonTemp = PokemonTemp.new if !$PokemonTemp
|
||||
if !$PokemonTemp.moveToAnim
|
||||
$PokemonTemp.moveToAnim = load_data("Data/move2anim.dat") || []
|
||||
end
|
||||
return $PokemonTemp.moveToAnim
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Method relating to map infos data.
|
||||
#===============================================================================
|
||||
132
Data/Scripts/011_Data/002_PBS data/003_Type.rb
Normal file
132
Data/Scripts/011_Data/002_PBS data/003_Type.rb
Normal file
@@ -0,0 +1,132 @@
|
||||
module GameData
|
||||
class Type
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :special_type
|
||||
attr_reader :pseudo_type
|
||||
attr_reader :weaknesses
|
||||
attr_reader :resistances
|
||||
attr_reader :immunities
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "types.dat"
|
||||
|
||||
SCHEMA = {
|
||||
"Name" => [1, "s"],
|
||||
"InternalName" => [2, "s"],
|
||||
"IsPseudoType" => [3, "b"],
|
||||
"IsSpecialType" => [4, "b"],
|
||||
"Weaknesses" => [5, "*s"],
|
||||
"Resistances" => [6, "*s"],
|
||||
"Immunities" => [7, "*s"]
|
||||
}
|
||||
|
||||
extend ClassMethods
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@pseudo_type = hash[:pseudo_type] || false
|
||||
@special_type = hash[:special_type] || false
|
||||
@weaknesses = hash[:weaknesses] || []
|
||||
@weaknesses = [@weaknesses] if !@weaknesses.is_a?(Array)
|
||||
@resistances = hash[:resistances] || []
|
||||
@resistances = [@resistances] if !@resistances.is_a?(Array)
|
||||
@immunities = hash[:immunities] || []
|
||||
@immunities = [@immunities] if !@immunities.is_a?(Array)
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this item
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::Types, @id_number)
|
||||
end
|
||||
|
||||
def physical?; return !@special_type; end
|
||||
def special?; return @special_type; 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::INEFFECTIVE if @immunities.include?(other_type)
|
||||
return Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
|
||||
module Effectiveness
|
||||
INEFFECTIVE = 0
|
||||
NOT_VERY_EFFECTIVE_ONE = 1
|
||||
NORMAL_EFFECTIVE_ONE = 2
|
||||
SUPER_EFFECTIVE_ONE = 4
|
||||
NORMAL_EFFECTIVE = NORMAL_EFFECTIVE_ONE ** 3
|
||||
|
||||
module_function
|
||||
|
||||
def ineffective?(value)
|
||||
return value == INEFFECTIVE
|
||||
end
|
||||
|
||||
def not_very_effective?(value)
|
||||
return value > INEFFECTIVE && value < NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def resistant?(value)
|
||||
return value < NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def normal?(value)
|
||||
return value == NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def super_effective?(value)
|
||||
return value > NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def ineffective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, target_type1, target_type2, target_type3)
|
||||
return ineffective?(value)
|
||||
end
|
||||
|
||||
def not_very_effective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, target_type1, target_type2, target_type3)
|
||||
return not_very_effective?(value)
|
||||
end
|
||||
|
||||
def resistant_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, target_type1, target_type2, target_type3)
|
||||
return resistant?(value)
|
||||
end
|
||||
|
||||
def normal_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, target_type1, target_type2, target_type3)
|
||||
return normal?(value)
|
||||
end
|
||||
|
||||
def super_effective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
|
||||
value = calculate(attack_type, target_type1, target_type2, target_type3)
|
||||
return super_effective?(value)
|
||||
end
|
||||
|
||||
def calculate_one(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 = calculate_one(attack_type, defend_type1)
|
||||
mod2 = NORMAL_EFFECTIVE_ONE
|
||||
mod3 = NORMAL_EFFECTIVE_ONE
|
||||
if defend_type2 && defend_type1 != defend_type2
|
||||
mod2 = calculate_one(attack_type, defend_type2)
|
||||
end
|
||||
if defend_type3 && defend_type1 != defend_type3 && defend_type2 != defend_type3
|
||||
mod3 = calculate_one(attack_type, defend_type3)
|
||||
end
|
||||
return mod1 * mod2 * mod3
|
||||
end
|
||||
end
|
||||
@@ -1,83 +0,0 @@
|
||||
module PBTypeEffectiveness
|
||||
INEFFECTIVE = 0
|
||||
NOT_EFFECTIVE_ONE = 1
|
||||
NORMAL_EFFECTIVE_ONE = 2
|
||||
SUPER_EFFECTIVE_ONE = 4
|
||||
NORMAL_EFFECTIVE = NORMAL_EFFECTIVE_ONE ** 3
|
||||
|
||||
def self.ineffective?(value)
|
||||
return value == INEFFECTIVE
|
||||
end
|
||||
|
||||
def self.notVeryEffective?(value)
|
||||
return value > INEFFECTIVE && value < NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def self.resistant?(value)
|
||||
return value < NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def self.normalEffective?(value)
|
||||
return value == NORMAL_EFFECTIVE
|
||||
end
|
||||
|
||||
def self.superEffective?(value)
|
||||
return value > NORMAL_EFFECTIVE
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module PBTypes
|
||||
def self.regularTypesCount
|
||||
ret = 0
|
||||
GameData::Type.each { |t| ret += 1 if !t.pseudo_type && t.id != :SHADOW }
|
||||
return ret
|
||||
end
|
||||
|
||||
def self.isPhysicalType?(type); return GameData::Type.get(type).physical?; end
|
||||
def self.isSpecialType?(type); return GameData::Type.get(type).special?; end
|
||||
def self.isPseudoType?(type); return GameData::Type.get(type).pseudo_type; end
|
||||
|
||||
def self.getEffectiveness(attack_type, target_type)
|
||||
return GameData::Type.get(target_type).effectiveness(attack_type)
|
||||
end
|
||||
|
||||
def self.getCombinedEffectiveness(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
mod1 = self.getEffectiveness(attack_type, target_type1)
|
||||
mod2 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
mod3 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
if target_type2 && target_type1 != target_type2
|
||||
mod2 = self.getEffectiveness(attack_type, target_type2)
|
||||
end
|
||||
if target_type3 && target_type1 != target_type3 && target_type2 != target_type3
|
||||
mod3 = self.getEffectiveness(attack_type, target_type3)
|
||||
end
|
||||
return mod1 * mod2 * mod3
|
||||
end
|
||||
|
||||
def self.ineffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
value = self.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
|
||||
return PBTypeEffectiveness.ineffective?(value)
|
||||
end
|
||||
|
||||
def self.notVeryEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
value = self.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
|
||||
return PBTypeEffectiveness.notVeryEffective?(value)
|
||||
end
|
||||
|
||||
def self.resistant?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
value = self.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
|
||||
return PBTypeEffectiveness.resistant?(value)
|
||||
end
|
||||
|
||||
def self.normalEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
value = self.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
|
||||
return PBTypeEffectiveness.normalEffective?(value)
|
||||
end
|
||||
|
||||
def self.superEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
value = self.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
|
||||
return PBTypeEffectiveness.superEffective?(value)
|
||||
end
|
||||
end
|
||||
@@ -360,7 +360,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Protean
|
||||
if user.hasActiveAbility?(:PROTEAN) && !move.callsAnotherMove? && !move.snatched
|
||||
if user.pbHasOtherType?(move.calcType) && !PBTypes.isPseudoType?(move.calcType)
|
||||
if user.pbHasOtherType?(move.calcType) && !GameData::Type.get(move.calcType).pseudo_type
|
||||
@battle.pbShowAbilitySplash(user)
|
||||
user.pbChangeTypes(move.calcType)
|
||||
typeName = GameData::Type.get(move.calcType).name
|
||||
|
||||
@@ -401,7 +401,7 @@ class PokeBattle_Battler
|
||||
# Immunity because of ability (intentionally before type immunity check)
|
||||
return false if move.pbImmunityByAbility(user,target)
|
||||
# Type immunity
|
||||
if move.pbDamagingMove? && PBTypeEffectiveness.ineffective?(typeMod)
|
||||
if move.pbDamagingMove? && Effectiveness.ineffective?(typeMod)
|
||||
PBDebug.log("[Target immune] #{target.pbThis}'s type immunity")
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
|
||||
return false
|
||||
|
||||
@@ -75,7 +75,7 @@ class PokeBattle_Move
|
||||
thisType ||= @calcType
|
||||
thisType ||= @type
|
||||
return true if !thisType
|
||||
return !PBTypes.isSpecialType?(thisType)
|
||||
return GameData::Type.get(thisType).physical?
|
||||
end
|
||||
|
||||
# NOTE: This method is only ever called while using a move (and also by the
|
||||
@@ -85,7 +85,7 @@ class PokeBattle_Move
|
||||
thisType ||= @calcType
|
||||
thisType ||= @type
|
||||
return false if !thisType
|
||||
return PBTypes.isSpecialType?(thisType)
|
||||
return GameData::Type.get(thisType).special?
|
||||
end
|
||||
|
||||
def damagingMove?; return @category!=2; end
|
||||
|
||||
@@ -234,8 +234,8 @@ class PokeBattle_Move
|
||||
oldHP = b.hp+b.damageState.hpLost
|
||||
PBDebug.log("[Move damage] #{b.pbThis} lost #{b.damageState.hpLost} HP (#{oldHP}=>#{b.hp})")
|
||||
effectiveness = 0
|
||||
if PBTypeEffectiveness.resistant?(b.damageState.typeMod); effectiveness = 1
|
||||
elsif PBTypeEffectiveness.superEffective?(b.damageState.typeMod); effectiveness = 2
|
||||
if Effectiveness.resistant?(b.damageState.typeMod); effectiveness = 1
|
||||
elsif Effectiveness.super_effective?(b.damageState.typeMod); effectiveness = 2
|
||||
end
|
||||
animArray.push([b,oldHP,effectiveness])
|
||||
end
|
||||
@@ -251,13 +251,13 @@ class PokeBattle_Move
|
||||
#=============================================================================
|
||||
def pbEffectivenessMessage(user,target,numTargets=1)
|
||||
return if target.damageState.disguise
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
if numTargets>1
|
||||
@battle.pbDisplay(_INTL("It's super effective on {1}!",target.pbThis(true)))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("It's super effective!"))
|
||||
end
|
||||
elsif PBTypeEffectiveness.notVeryEffective?(target.damageState.typeMod)
|
||||
elsif Effectiveness.not_very_effective?(target.damageState.typeMod)
|
||||
if numTargets>1
|
||||
@battle.pbDisplay(_INTL("It's not very effective on {1}...",target.pbThis(true)))
|
||||
else
|
||||
|
||||
@@ -30,41 +30,41 @@ class PokeBattle_Move
|
||||
# Type effectiveness calculation
|
||||
#=============================================================================
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
ret = PBTypes.getEffectiveness(moveType,defType)
|
||||
ret = Effectiveness.calculate_one(moveType, defType)
|
||||
# Ring Target
|
||||
if target.hasActiveItem?(:RINGTARGET)
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Foresight
|
||||
if user.hasActiveAbility?(:SCRAPPY) || target.effects[PBEffects::Foresight]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
|
||||
Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Miracle Eye
|
||||
if target.effects[PBEffects::MiracleEye]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
|
||||
Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Delta Stream's weather
|
||||
if @battle.pbWeather == :StrongWinds
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
|
||||
PBTypes.superEffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
|
||||
Effectiveness.super_effective_type?(moveType, defType)
|
||||
end
|
||||
# Grounded Flying-type Pokémon become susceptible to Ground moves
|
||||
if !target.airborne?
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(moveType,user,target)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if !moveType
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
|
||||
return Effectiveness::NORMAL_EFFECTIVE if !moveType
|
||||
return Effectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
|
||||
target.pbHasType?(:FLYING) && target.hasActiveItem?(:IRONBALL)
|
||||
# Determine types
|
||||
tTypes = target.pbTypes(true)
|
||||
# Get effectivenesses
|
||||
typeMods = [PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE] * 3 # 3 types max
|
||||
typeMods = [Effectiveness::NORMAL_EFFECTIVE_ONE] * 3 # 3 types max
|
||||
tTypes.each_with_index do |type,i|
|
||||
typeMods[i] = pbCalcTypeModSingle(moveType,type,user,target)
|
||||
end
|
||||
@@ -412,7 +412,7 @@ class PokeBattle_Move
|
||||
end
|
||||
end
|
||||
# Type effectiveness
|
||||
multipliers[:final_damage_multiplier] *= target.damageState.typeMod.to_f / PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
multipliers[:final_damage_multiplier] *= target.damageState.typeMod.to_f / Effectiveness::NORMAL_EFFECTIVE
|
||||
# Burn
|
||||
if user.status == :BURN && physicalMove? && damageReducedByBurn? &&
|
||||
!user.hasActiveAbility?(:GUTS)
|
||||
|
||||
@@ -112,7 +112,7 @@ class PokeBattle_Move_007 < PokeBattle_ParalysisMove
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if @id == :THUNDERWAVE && PBTypeEffectiveness.ineffective?(target.damageState.typeMod)
|
||||
if @id == :THUNDERWAVE && Effectiveness.ineffective?(target.damageState.typeMod)
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
|
||||
return true
|
||||
end
|
||||
@@ -1789,7 +1789,7 @@ class PokeBattle_Move_05E < PokeBattle_Move
|
||||
@newTypes = []
|
||||
user.eachMoveWithIndex do |m,i|
|
||||
break if Settings::MECHANICS_GENERATION >= 6 && i>0
|
||||
next if PBTypes.isPseudoType?(m.type)
|
||||
next if GameData::Type.get(m.type).pseudo_type
|
||||
next if userTypes.include?(m.type)
|
||||
@newTypes.push(m.type) if !@newTypes.include?(m.type)
|
||||
end
|
||||
@@ -1827,14 +1827,14 @@ class PokeBattle_Move_05F < PokeBattle_Move
|
||||
|
||||
def pbFailsAgainstTarget?(user, target)
|
||||
if !target.lastMoveUsed || !target.lastMoveUsedType ||
|
||||
PBTypes.isPseudoType?(target.lastMoveUsedType)
|
||||
GameData::Type.get(target.lastMoveUsedType).pseudo_type
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@newTypes = []
|
||||
GameData::Type.each do |t|
|
||||
next if t.pseudo_type || user.pbHasType?(t.id) ||
|
||||
!PBTypes.resistant?(target.lastMoveUsedType, t.id)
|
||||
!Effectiveness.resistant_type?(target.lastMoveUsedType, t.id)
|
||||
@newTypes.push(t.id)
|
||||
end
|
||||
if @newTypes.length == 0
|
||||
|
||||
@@ -2253,7 +2253,7 @@ class PokeBattle_Move_0CE < PokeBattle_TwoTurnMove
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(movetype,user,target)
|
||||
return PBTypeEffectiveness::INEFFECTIVE if target.pbHasType?(:FLYING)
|
||||
return Effectiveness::INEFFECTIVE if target.pbHasType?(:FLYING)
|
||||
return super
|
||||
end
|
||||
|
||||
|
||||
@@ -768,7 +768,7 @@ class PokeBattle_Move_11C < PokeBattle_Move
|
||||
def hitsFlyingTargets?; return true; end
|
||||
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if moveType == :GROUND && defType == :FLYING
|
||||
return Effectiveness::NORMAL_EFFECTIVE_ONE if moveType == :GROUND && defType == :FLYING
|
||||
return super
|
||||
end
|
||||
|
||||
@@ -1064,7 +1064,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_135 < PokeBattle_FreezeMove
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
return PBTypeEffectiveness::SUPER_EFFECTIVE_ONE if defType == :WATER
|
||||
return Effectiveness::SUPER_EFFECTIVE_ONE if defType == :WATER
|
||||
return super
|
||||
end
|
||||
end
|
||||
@@ -1453,8 +1453,8 @@ class PokeBattle_Move_144 < PokeBattle_Move
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
ret = super
|
||||
if GameData::Type.exists?(:FLYING)
|
||||
flyingEff = PBTypes.getEffectiveness(:FLYING, defType)
|
||||
ret *= flyingEff.to_f / PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
flyingEff = Effectiveness.calculate_one(:FLYING, defType)
|
||||
ret *= flyingEff.to_f / Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
@@ -352,9 +352,9 @@ class PokeBattle_Battle
|
||||
if battler.pbOwnSide.effects[PBEffects::StealthRock] && battler.takesIndirectDamage? &&
|
||||
GameData::Type.exists?(:ROCK)
|
||||
bTypes = battler.pbTypes(true)
|
||||
eff = PBTypes.getCombinedEffectiveness(:ROCK, bTypes[0], bTypes[1], bTypes[2])
|
||||
if !PBTypeEffectiveness.ineffective?(eff)
|
||||
eff = eff.to_f/PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
eff = Effectiveness.calculate(:ROCK, bTypes[0], bTypes[1], bTypes[2])
|
||||
if !Effectiveness.ineffective?(eff)
|
||||
eff = eff.to_f / Effectiveness::NORMAL_EFFECTIVE
|
||||
oldHP = battler.hp
|
||||
battler.pbReduceHP(battler.totalhp*eff/8,false)
|
||||
pbDisplay(_INTL("Pointed stones dug into {1}!",battler.pbThis))
|
||||
|
||||
@@ -22,7 +22,7 @@ class PokeBattle_AI
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
moveType = moveData.type
|
||||
typeMod = pbCalcTypeMod(moveType,target,battler)
|
||||
if PBTypeEffectiveness.superEffective?(typeMod) && moveData.base_damage > 50
|
||||
if Effectiveness.super_effective?(typeMod) && moveData.base_damage > 50
|
||||
switchChance = (moveData.base_damage > 70) ? 30 : 20
|
||||
shouldSwitch = (pbAIRandom(100) < switchChance)
|
||||
end
|
||||
@@ -107,18 +107,18 @@ class PokeBattle_AI
|
||||
end
|
||||
end
|
||||
# moveType is the type of the target's last used move
|
||||
if moveType>=0 && PBTypeEffectiveness.ineffective?(pbCalcTypeMod(moveType,battler,battler))
|
||||
if moveType>=0 && Effectiveness.ineffective?(pbCalcTypeMod(moveType,battler,battler))
|
||||
weight = 65
|
||||
typeMod = pbCalcTypeModPokemon(pkmn,battler.pbDirectOpposing(true))
|
||||
if PBTypeEffectiveness.superEffective?(typeMod.to_f/PBTypeEffectivenesss::NORMAL_EFFECTIVE)
|
||||
if Effectiveness.super_effective?(typeMod)
|
||||
# Greater weight if new Pokemon's type is effective against target
|
||||
weight = 85
|
||||
end
|
||||
list.unshift(i) if pbAIRandom(100)<weight # Put this Pokemon first
|
||||
elsif moveType>=0 && PBTypeEffectiveness.resistant?(pbCalcTypeMod(moveType,battler,battler))
|
||||
elsif moveType>=0 && Effectiveness.resistant?(pbCalcTypeMod(moveType,battler,battler))
|
||||
weight = 40
|
||||
typeMod = pbCalcTypeModPokemon(pkmn,battler.pbDirectOpposing(true))
|
||||
if PBTypeEffectiveness.superEffective?(typeMod.to_f/PBTypeEffectivenesss::NORMAL_EFFECTIVE)
|
||||
if Effectiveness.super_effective?(typeMod)
|
||||
# Greater weight if new Pokemon's type is effective against target
|
||||
weight = 60
|
||||
end
|
||||
@@ -165,7 +165,7 @@ class PokeBattle_AI
|
||||
next if m.base_damage == 0
|
||||
@battle.battlers[idxBattler].eachOpposing do |b|
|
||||
bTypes = b.pbTypes(true)
|
||||
sum += PBTypes.getCombinedEffectiveness(m.type, bTypes[0], bTypes[1], bTypes[2])
|
||||
sum += Effectiveness.calculate(m.type, bTypes[0], bTypes[1], bTypes[2])
|
||||
end
|
||||
end
|
||||
if best==-1 || sum>bestSum
|
||||
|
||||
@@ -71,7 +71,7 @@ class PokeBattle_AI
|
||||
if target.pbCanParalyze?(user,false) &&
|
||||
!(skill>=PBTrainerAI.mediumSkill &&
|
||||
move.id == :THUNDERWAVE &&
|
||||
PBTypeEffectiveness.ineffective?(pbCalcTypeMod(move.type,user,target)))
|
||||
Effectiveness.ineffective?(pbCalcTypeMod(move.type,user,target)))
|
||||
score += 30
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
aspeed = pbRoughStat(user,:SPEED,skill)
|
||||
@@ -1317,7 +1317,7 @@ class PokeBattle_AI
|
||||
types = []
|
||||
user.eachMove do |m|
|
||||
next if m.id==@id
|
||||
next if PBTypes.isPseudoType?(m.type)
|
||||
next if GameData::Type.get(m.type).pseudo_type
|
||||
next if user.pbHasType?(m.type)
|
||||
types.push(m.type) if !types.include?(m.type)
|
||||
end
|
||||
@@ -1342,7 +1342,7 @@ class PokeBattle_AI
|
||||
types = []
|
||||
GameData::Type.each do |t|
|
||||
next if t.pseudo_type || user.pbHasType?(t.id) ||
|
||||
!PBTypes.resistant?(aType, t.id)
|
||||
!Effectiveness.resistant_type?(aType, t.id)
|
||||
types.push(t.id)
|
||||
end
|
||||
score -= 90 if types.length==0
|
||||
@@ -1512,11 +1512,7 @@ class PokeBattle_AI
|
||||
score -= 60
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
if moveData.base_damage > 0 &&
|
||||
(Settings::MOVE_CATEGORY_PER_MOVE && moveData.category == 0) ||
|
||||
(!Settings::MOVE_CATEGORY_PER_MOVE && PBTypes.isPhysicalType?(moveData.type))
|
||||
score -= 60
|
||||
end
|
||||
score += 60 if moveData.physical?
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -1530,11 +1526,7 @@ class PokeBattle_AI
|
||||
score -= 60
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
if moveData.base_damage > 0 &&
|
||||
(Settings::MOVE_CATEGORY_PER_MOVE && moveData.category == 1) ||
|
||||
(!Settings::MOVE_CATEGORY_PER_MOVE && !PBTypes.isSpecialType?(moveData.type))
|
||||
score -= 60
|
||||
end
|
||||
score += 60 if moveData.special?
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -1779,7 +1771,7 @@ class PokeBattle_AI
|
||||
score += 60
|
||||
elsif moveData.category != 2 && # Damaging move
|
||||
moveData.target == :NearOther &&
|
||||
PBTypeEffectiveness.ineffective?(pbCalcTypeMod(moveData.type, target, user))
|
||||
Effectiveness.ineffective?(pbCalcTypeMod(moveData.type, target, user))
|
||||
score += 60
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,41 +25,41 @@ class PokeBattle_AI
|
||||
# Move's type effectiveness
|
||||
#=============================================================================
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
ret = PBTypes.getEffectiveness(moveType,defType)
|
||||
ret = Effectiveness.calculate_one(moveType,defType)
|
||||
# Ring Target
|
||||
if target.hasActiveItem?(:RINGTARGET)
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Foresight
|
||||
if user.hasActiveAbility?(:SCRAPPY) || target.effects[PBEffects::Foresight]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
|
||||
Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Miracle Eye
|
||||
if target.effects[PBEffects::MiracleEye]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
|
||||
Effectiveness.ineffective_type?(moveType, defType)
|
||||
end
|
||||
# Delta Stream's weather
|
||||
if @battle.pbWeather == :StrongWinds
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
|
||||
PBTypes.superEffective?(moveType,defType)
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
|
||||
Effectiveness.super_effective_type?(moveType, defType)
|
||||
end
|
||||
# Grounded Flying-type Pokémon become susceptible to Ground moves
|
||||
if !target.airborne?
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
|
||||
ret = Effectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(moveType,user,target)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if !moveType
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
|
||||
return Effectiveness::NORMAL_EFFECTIVE if !moveType
|
||||
return Effectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
|
||||
target.pbHasType?(:FLYING) && target.hasActiveItem?(:IRONBALL)
|
||||
# Determine types
|
||||
tTypes = target.pbTypes(true)
|
||||
# Get effectivenesses
|
||||
typeMods = [PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE] * 3 # 3 types max
|
||||
typeMods = [Effectiveness::NORMAL_EFFECTIVE_ONE] * 3 # 3 types max
|
||||
tTypes.each_with_index do |type,i|
|
||||
typeMods[i] = pbCalcTypeModSingle(moveType,type,user,target)
|
||||
end
|
||||
@@ -72,12 +72,13 @@ class PokeBattle_AI
|
||||
# For switching. Determines the effectiveness of a potential switch-in against
|
||||
# an opposing battler.
|
||||
def pbCalcTypeModPokemon(battlerThis,_battlerOther)
|
||||
mod1 = PBTypes.getCombinedEffectiveness(battlerThis.type1,target.type1,target.type2)
|
||||
mod2 = PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
mod1 = Effectiveness.calculate(battlerThis.type1,target.type1,target.type2)
|
||||
mod2 = Effectiveness::NORMAL_EFFECTIVE
|
||||
if battlerThis.type1!=battlerThis.type2
|
||||
mod2 = PBTypes.getCombinedEffectiveness(battlerThis.type2,target.type1,target.type2)
|
||||
mod2 = Effectiveness.calculate(battlerThis.type2,target.type1,target.type2)
|
||||
mod2 = mod2.to_f / Effectivenesss::NORMAL_EFFECTIVE
|
||||
end
|
||||
return mod1*mod2 # Normal effectiveness is 64 here
|
||||
return mod1*mod2
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -87,7 +88,7 @@ class PokeBattle_AI
|
||||
type = pbRoughType(move,user,skill)
|
||||
typeMod = pbCalcTypeMod(type,user,target)
|
||||
# Type effectiveness
|
||||
return true if PBTypeEffectiveness.ineffective?(typeMod) || score<=0
|
||||
return true if Effectiveness.ineffective?(typeMod) || score<=0
|
||||
# Immunity due to ability/item/other effects
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
case type
|
||||
@@ -102,7 +103,7 @@ class PokeBattle_AI
|
||||
when :ELECTRIC
|
||||
return true if target.hasActiveAbility?([:LIGHTNINGROD,:MOTORDRIVE,:VOLTABSORB])
|
||||
end
|
||||
return true if PBTypeEffectiveness.notVeryEffective?(typeMod) &&
|
||||
return true if Effectiveness.not_very_effective?(typeMod) &&
|
||||
target.hasActiveAbility?(:WONDERGUARD)
|
||||
return true if move.damagingMove? && user.index!=target.index && !target.opposes?(user) &&
|
||||
target.hasActiveAbility?(:TELEPATHY)
|
||||
@@ -227,13 +228,13 @@ class PokeBattle_AI
|
||||
if GameData::Type.exists?(:FLYING)
|
||||
if skill>=PBTrainerAI.highSkill
|
||||
targetTypes = target.pbTypes(true)
|
||||
mult = PBTypes.getCombinedEffectiveness(:FLYING,
|
||||
mult = Effectiveness.calculate(:FLYING,
|
||||
targetTypes[0],targetTypes[1],targetTypes[2])
|
||||
baseDmg = (baseDmg.to_f*mult/PBTypeEffectiveness::NORMAL_EFFECTIVE).round
|
||||
baseDmg = (baseDmg.to_f*mult/Effectiveness::NORMAL_EFFECTIVE).round
|
||||
else
|
||||
mult = PBTypes.getCombinedEffectiveness(:FLYING,
|
||||
mult = Effectiveness.calculate(:FLYING,
|
||||
target.type1,target.type2,target.effects[PBEffects::Type3])
|
||||
baseDmg = (baseDmg.to_f*mult/PBTypeEffectiveness::NORMAL_EFFECTIVE).round
|
||||
baseDmg = (baseDmg.to_f*mult/Effectiveness::NORMAL_EFFECTIVE).round
|
||||
end
|
||||
end
|
||||
baseDmg *= 2 if skill>=PBTrainerAI.mediumSkill && target.effects[PBEffects::Minimize]
|
||||
@@ -462,7 +463,7 @@ class PokeBattle_AI
|
||||
# Type effectiveness
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
typemod = pbCalcTypeMod(type,user,target)
|
||||
multipliers[:final_damage_multiplier] *= typemod.to_f / PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
multipliers[:final_damage_multiplier] *= typemod.to_f / Effectiveness::NORMAL_EFFECTIVE
|
||||
end
|
||||
# Burn
|
||||
if skill>=PBTrainerAI.highSkill
|
||||
|
||||
@@ -580,7 +580,7 @@ end
|
||||
|
||||
def pbBattleTypeWeakingBerry(type,moveType,target,mults)
|
||||
return if moveType != type
|
||||
return if PBTypeEffectiveness.resistant?(target.damageState.typeMod) && moveType != :NORMAL
|
||||
return if Effectiveness.resistant?(target.damageState.typeMod) && moveType != :NORMAL
|
||||
mults[:final_damage_multiplier] /= 2
|
||||
target.damageState.berryWeakened = true
|
||||
target.battle.pbCommonAnimation("EatBerry",target)
|
||||
|
||||
@@ -695,7 +695,7 @@ BattleHandlers::MoveImmunityTargetAbility.copy(:WATERABSORB,:DRYSKIN)
|
||||
BattleHandlers::MoveImmunityTargetAbility.add(:WONDERGUARD,
|
||||
proc { |ability,user,target,move,type,battle|
|
||||
next false if move.statusMove?
|
||||
next false if !type || PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
next false if !type || Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
battle.pbShowAbilitySplash(target)
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
|
||||
@@ -970,7 +970,7 @@ BattleHandlers::DamageCalcUserAbility.copy(:MINUS,:PLUS)
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:NEUROFORCE,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
mults[:final_damage_multiplier] *= 1.25
|
||||
end
|
||||
}
|
||||
@@ -1076,7 +1076,7 @@ BattleHandlers::DamageCalcUserAbility.add(:TECHNICIAN,
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:TINTEDLENS,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
mults[:final_damage_multiplier] *= 2 if PBTypeEffectiveness.resistant?(target.damageState.typeMod)
|
||||
mults[:final_damage_multiplier] *= 2 if Effectiveness.resistant?(target.damageState.typeMod)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1139,7 +1139,7 @@ BattleHandlers::DamageCalcTargetAbility.add(:DRYSKIN,
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbility.add(:FILTER,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
mults[:final_damage_multiplier] *= 0.75
|
||||
end
|
||||
}
|
||||
@@ -1214,7 +1214,7 @@ BattleHandlers::DamageCalcTargetAbility.add(:WATERBUBBLE,
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbilityNonIgnorable.add(:PRISMARMOR,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
mults[:final_damage_multiplier] *= 0.75
|
||||
end
|
||||
}
|
||||
@@ -1712,7 +1712,7 @@ BattleHandlers::TargetAbilityAfterMoveUse.add(:BERSERK,
|
||||
BattleHandlers::TargetAbilityAfterMoveUse.add(:COLORCHANGE,
|
||||
proc { |ability,target,user,move,switched,battle|
|
||||
next if target.damageState.calcDamage==0 || target.damageState.substitute
|
||||
next if !move.calcType || PBTypes.isPseudoType?(move.calcType)
|
||||
next if !move.calcType || GameData::Type.get(move.calcType).pseudo_type
|
||||
next if target.pbHasType?(move.calcType) && !target.pbHasOtherType?(move.calcType)
|
||||
typeName = GameData::Type.get(move.calcType).name
|
||||
battle.pbShowAbilitySplash(target)
|
||||
@@ -2078,9 +2078,9 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
|
||||
if Settings::MECHANICS_GENERATION >= 6 && m.function == "090" # Hidden Power
|
||||
moveType = pbHiddenPower(b.pokemon)[0]
|
||||
end
|
||||
eff = PBTypes.getCombinedEffectiveness(moveType,type1,type2,type3)
|
||||
next if PBTypeEffectiveness.ineffective?(eff)
|
||||
next if !PBTypeEffectiveness.superEffective?(eff) && m.function != "070" # OHKO
|
||||
eff = Effectiveness.calculate(moveType,type1,type2,type3)
|
||||
next if Effectiveness.ineffective?(eff)
|
||||
next if !Effectiveness.super_effective?(eff) && m.function != "070" # OHKO
|
||||
else
|
||||
next if m.function != "070" # OHKO
|
||||
end
|
||||
|
||||
@@ -528,7 +528,7 @@ BattleHandlers::DamageCalcUserItem.add(:ELECTRICGEM,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:EXPERTBELT,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
mults[:final_damage_multiplier] *= 1.2
|
||||
end
|
||||
}
|
||||
@@ -1022,7 +1022,7 @@ BattleHandlers::TargetItemOnHit.add(:CELLBATTERY,
|
||||
BattleHandlers::TargetItemOnHit.add(:ENIGMABERRY,
|
||||
proc { |item,user,target,move,battle|
|
||||
next if target.damageState.substitute || target.damageState.disguise
|
||||
next if !PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
next if !Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
if BattleHandlers.triggerTargetItemOnHitPositiveBerry(item,target,battle,false)
|
||||
target.pbHeldItemTriggered(item)
|
||||
end
|
||||
@@ -1136,7 +1136,7 @@ BattleHandlers::TargetItemOnHit.add(:STICKYBARB,
|
||||
BattleHandlers::TargetItemOnHit.add(:WEAKNESSPOLICY,
|
||||
proc { |item,user,target,move,battle|
|
||||
next if target.damageState.disguise
|
||||
next if !PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
next if !Effectiveness.super_effective?(target.damageState.typeMod)
|
||||
next if !target.pbCanRaiseStatStage?(:ATTACK,target) &&
|
||||
!target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,target)
|
||||
battle.pbCommonAnimation("UseItem",target)
|
||||
|
||||
@@ -24,7 +24,7 @@ class PokeBattle_DamageState
|
||||
|
||||
def reset
|
||||
@initialHP = 0
|
||||
@typeMod = PBTypeEffectiveness::INEFFECTIVE
|
||||
@typeMod = Effectiveness::INEFFECTIVE
|
||||
@unaffected = false
|
||||
@protected = false
|
||||
@magicCoat = false
|
||||
@@ -63,7 +63,7 @@ class PokeBattle_SuccessState
|
||||
def initialize; clear; end
|
||||
|
||||
def clear(full=true)
|
||||
@typeMod = PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
@typeMod = Effectiveness::NORMAL_EFFECTIVE
|
||||
@useState = 0
|
||||
@protected = false
|
||||
@skill = 0 if full
|
||||
@@ -73,10 +73,10 @@ class PokeBattle_SuccessState
|
||||
if @useState==1
|
||||
@skill = -2 if !@protected
|
||||
elsif @useState==2
|
||||
if PBTypeEffectiveness.superEffective?(@typeMod); @skill = 2
|
||||
elsif PBTypeEffectiveness.normalEffective?(@typeMod); @skill = 1
|
||||
elsif PBTypeEffectiveness.notVeryEffective?(@typeMod); @skill = -1
|
||||
else; @skill = -2 # Ineffective
|
||||
if Effectiveness.super_effective?(@typeMod); @skill = 2
|
||||
elsif Effectiveness.normal?(@typeMod); @skill = 1
|
||||
elsif Effectiveness.not_very_effective?(@typeMod); @skill = -1
|
||||
else; @skill = -2 # Ineffective
|
||||
end
|
||||
end
|
||||
clear(false)
|
||||
|
||||
@@ -835,7 +835,9 @@ class PokemonPokedex_Scene
|
||||
when 0 then @sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search_order")
|
||||
when 1 then @sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search_name")
|
||||
when 2
|
||||
if PBTypes.regularTypesCount==18
|
||||
count = 0
|
||||
GameData::Type.each { |t| count += 1 if !t.pseudo_type && t.id != :SHADOW }
|
||||
if count == 18
|
||||
@sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search_type_18")
|
||||
else
|
||||
@sprites["searchbg"].setBitmap("Graphics/Pictures/Pokedex/bg_search_type")
|
||||
|
||||
@@ -132,7 +132,7 @@ class PurifyChamberSet
|
||||
# Purify Chamber treats Normal/Normal matchup as super effective
|
||||
def self.typeAdvantage(p1,p2)
|
||||
return true if p1 == :NORMAL && p2 == :NORMAL
|
||||
return PBTypes.superEffective?(p1,p2)
|
||||
return Effectiveness.super_effective_type?(p1, p2)
|
||||
end
|
||||
|
||||
def self.isSuperEffective(p1,p2)
|
||||
|
||||
@@ -51,10 +51,10 @@ class TriadCard
|
||||
end
|
||||
|
||||
def bonus(opponent)
|
||||
case PBTypes.getEffectiveness(@type, opponent.type)
|
||||
when PBTypeEffectiveness::INEFFECTIVE then return -2
|
||||
when PBTypeEffectiveness::NOT_EFFECTIVE_ONE then return -1
|
||||
when PBTypeEffectiveness::SUPER_EFFECTIVE_ONE then return 1
|
||||
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
|
||||
end
|
||||
return 0
|
||||
end
|
||||
@@ -726,8 +726,9 @@ class TriadScreen
|
||||
if @elements
|
||||
loop do
|
||||
trial_type = type_keys[rand(type_keys.length)]
|
||||
next if PBTypes.isPseudoType?(trial_type)
|
||||
square.type = GameData::Type.get(trial_type).id
|
||||
type_data = GameData::Type.get(trial_type)
|
||||
next if type_data.pseudo_type
|
||||
square.type = type_data.id
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
@@ -773,13 +773,13 @@ def pbDecideWinnerEffectiveness(move, otype1, otype2, ability, scores)
|
||||
data = GameData::Move.get(move)
|
||||
return 0 if data.base_damage == 0
|
||||
atype = data.type
|
||||
typemod = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE * PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
typemod = Effectiveness::NORMAL_EFFECTIVE_ONE ** 2
|
||||
if ability != :LEVITATE || data.type != :GROUND
|
||||
mod1 = PBTypes.getEffectiveness(atype, otype1)
|
||||
mod2 = (otype1 == otype2) ? PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE : PBTypes.getEffectiveness(atype, otype2)
|
||||
mod1 = Effectiveness.calculate_one(atype, otype1)
|
||||
mod2 = (otype1 == otype2) ? Effectiveness::NORMAL_EFFECTIVE_ONE : Effectiveness.calculate_one(atype, otype2)
|
||||
if ability == :WONDERGUARD
|
||||
mod1 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if mod1 <= PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
mod2 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if mod2 <= PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
mod1 = Effectiveness::NORMAL_EFFECTIVE_ONE if mod1 <= Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
mod2 = Effectiveness::NORMAL_EFFECTIVE_ONE if mod2 <= Effectiveness::NORMAL_EFFECTIVE_ONE
|
||||
end
|
||||
typemod = mod1 * mod2
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user