mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Created and implemented GameData::Type
This commit is contained in:
@@ -13,10 +13,6 @@ def pbGetExceptionMessage(e,_script="")
|
||||
emessage = "File #{filename} not found."
|
||||
end
|
||||
if emessage && !safeExists?("Game.rgssad") && !safeExists?("Game.rgss2a")
|
||||
emessage = emessage.gsub(/uninitialized constant PBTypes\:\:(\S+)/) {
|
||||
"The type '#{$1}' is not valid. Please add the type\r\nto the PBS/types.txt file." }
|
||||
emessage = emessage.gsub(/undefined method `(\S+?)' for PBTypes\:Module/) {
|
||||
"The type '#{$1}' is not valid. Please add the type\r\nto the PBS/types.txt file." }
|
||||
emessage = emessage.gsub(/uninitialized constant PBSpecies\:\:(\S+)$/) {
|
||||
"The Pokemon species '#{$1}' is not valid. Please\r\nadd the species to the PBS/pokemon.txt file.\r\nSee the wiki for more information." }
|
||||
emessage = emessage.gsub(/undefined method `(\S+?)' for PBSpecies\:Module/) {
|
||||
|
||||
62
Data/Scripts/011_Data/001_Game data/009_Type.rb
Normal file
62
Data/Scripts/011_Data/001_Game data/009_Type.rb
Normal file
@@ -0,0 +1,62 @@
|
||||
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
|
||||
|
||||
#===============================================================================
|
||||
# Deprecated methods
|
||||
#===============================================================================
|
||||
@@ -72,7 +72,7 @@ module SpeciesData
|
||||
|
||||
def self.requiredValues(compilingForms = false)
|
||||
ret = {
|
||||
"Type1" => [TYPE1, "e", :PBTypes],
|
||||
"Type1" => [TYPE1, "e", :Type],
|
||||
"BaseStats" => [BASE_STATS, "vvvvvv"],
|
||||
"BaseEXP" => [BASE_EXP, "v"],
|
||||
"EffortPoints" => [EFFORT_POINTS, "uuuuuu"],
|
||||
@@ -99,7 +99,7 @@ module SpeciesData
|
||||
|
||||
def self.optionalValues(compilingForms = false)
|
||||
ret = {
|
||||
"Type2" => [TYPE2, "e", :PBTypes],
|
||||
"Type2" => [TYPE2, "e", :Type],
|
||||
"Abilities" => [ABILITIES, "eE", :Ability, :Ability],
|
||||
"HiddenAbility" => [HIDDEN_ABILITY, "eEEE", :Ability, :Ability,
|
||||
:Ability, :Ability],
|
||||
|
||||
@@ -4,87 +4,84 @@ module PBTypeEffectiveness
|
||||
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
|
||||
|
||||
|
||||
|
||||
class PBTypes
|
||||
@@TypeData = nil
|
||||
|
||||
def PBTypes.loadTypeData
|
||||
if !@@TypeData
|
||||
@@TypeData = load_data("Data/types.dat")
|
||||
@@TypeData[0].freeze
|
||||
@@TypeData[1].freeze
|
||||
@@TypeData[2].freeze
|
||||
@@TypeData.freeze
|
||||
end
|
||||
return @@TypeData
|
||||
end
|
||||
|
||||
def PBTypes.regularTypesCount
|
||||
ret = 0
|
||||
for i in 0..PBTypes.maxValue
|
||||
next if PBTypes.isPseudoType?(i) || isConst?(i,PBTypes,:SHADOW)
|
||||
ret += 1
|
||||
end
|
||||
GameData::Type.each { |t| ret += 1 if !t.pseudo_type && t.id != :SHADOW }
|
||||
return ret
|
||||
end
|
||||
|
||||
def PBTypes.isPseudoType?(type)
|
||||
return PBTypes.loadTypeData[0].include?(type)
|
||||
return GameData::Type.get(type).pseudo_type
|
||||
end
|
||||
|
||||
def PBTypes.isSpecialType?(type)
|
||||
return PBTypes.loadTypeData[1].include?(type)
|
||||
return GameData::Type.get(type).special?
|
||||
end
|
||||
|
||||
def PBTypes.getEffectiveness(attackType,targetType)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if !targetType || targetType<0
|
||||
return PBTypes.loadTypeData[2][attackType*(PBTypes.maxValue+1)+targetType]
|
||||
def PBTypes.getEffectiveness(attack_type, target_type)
|
||||
return GameData::Type.get(target_type).effectiveness(attack_type)
|
||||
end
|
||||
|
||||
def PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2=nil,targetType3=nil)
|
||||
mod1 = PBTypes.getEffectiveness(attackType,targetType1)
|
||||
def PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
mod1 = PBTypes.getEffectiveness(attack_type, target_type1)
|
||||
mod2 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
mod3 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
if targetType2!=nil && targetType2>=0 && targetType1!=targetType2
|
||||
mod2 = PBTypes.getEffectiveness(attackType,targetType2)
|
||||
if target_type2 && target_type1 != target_type2
|
||||
mod2 = PBTypes.getEffectiveness(attack_type, target_type2)
|
||||
end
|
||||
if targetType3!=nil && targetType3>=0 &&
|
||||
targetType1!=targetType3 && targetType2!=targetType3
|
||||
mod3 = PBTypes.getEffectiveness(attackType,targetType3)
|
||||
if target_type3 && target_type1 != target_type3 && target_type2 != target_type3
|
||||
mod3 = PBTypes.getEffectiveness(attack_type, target_type3)
|
||||
end
|
||||
return mod1*mod2*mod3
|
||||
return mod1 * mod2 * mod3
|
||||
end
|
||||
|
||||
def PBTypes.ineffective?(attackType,targetType1=nil,targetType2=nil,targetType3=nil)
|
||||
return attackType==PBTypeEffectiveness::INEFFECTIVE if !targetType1
|
||||
e = PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2,targetType3)
|
||||
return e==PBTypeEffectiveness::INEFFECTIVE
|
||||
def PBTypes.ineffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
value = PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
|
||||
return PBTypeEffectiveness.ineffective?(value)
|
||||
end
|
||||
|
||||
def PBTypes.notVeryEffective?(attackType,targetType1=nil,targetType2=nil,targetType3=nil)
|
||||
return attackType>PBTypeEffectiveness::INEFFECTIVE && attackType<PBTypeEffectiveness::NORMAL_EFFECTIVE if !targetType1
|
||||
e = PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2,targetType3)
|
||||
return e>PBTypeEffectiveness::INEFFECTIVE && e<PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
def PBTypes.notVeryEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
value = PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
|
||||
return PBTypeEffectiveness.notVeryEffective?(value)
|
||||
end
|
||||
|
||||
def PBTypes.resistant?(attackType,targetType1=nil,targetType2=nil,targetType3=nil)
|
||||
return attackType<PBTypeEffectiveness::NORMAL_EFFECTIVE if !targetType1
|
||||
e = PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2,targetType3)
|
||||
return e<PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
def PBTypes.resistant?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
value = PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
|
||||
return PBTypeEffectiveness.resistant?(value)
|
||||
end
|
||||
|
||||
def PBTypes.normalEffective?(attackType,targetType1=nil,targetType2=nil,targetType3=nil)
|
||||
return attackType==PBTypeEffectiveness::NORMAL_EFFECTIVE if !targetType1
|
||||
e = PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2,targetType3)
|
||||
return e==PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
def PBTypes.normalEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
value = PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
|
||||
return PBTypeEffectiveness.normalEffective?(value)
|
||||
end
|
||||
|
||||
def PBTypes.superEffective?(attackType,targetType1=nil,targetType2=nil,targetType3=nil)
|
||||
return attackType>PBTypeEffectiveness::NORMAL_EFFECTIVE if !targetType1
|
||||
e = PBTypes.getCombinedEffectiveness(attackType,targetType1,targetType2,targetType3)
|
||||
return e>PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
def PBTypes.superEffective?(attack_type, target_type1, target_type2 = nil, target_type3 = nil)
|
||||
value = PBTypes.getCombinedEffectiveness(attack_type, target_type1, target_type2, target_type3)
|
||||
return PBTypeEffectiveness.superEffective?(value)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -303,35 +303,31 @@ class PokeBattle_Battler
|
||||
ret = [@type1]
|
||||
ret.push(@type2) if @type2!=@type1
|
||||
# Burn Up erases the Fire-type.
|
||||
if @effects[PBEffects::BurnUp]
|
||||
ret.reject! { |type| isConst?(type,PBTypes,:FIRE) }
|
||||
end
|
||||
ret.delete(:FIRE) if @effects[PBEffects::BurnUp]
|
||||
# Roost erases the Flying-type. If there are no types left, adds the Normal-
|
||||
# type.
|
||||
if @effects[PBEffects::Roost]
|
||||
ret.reject! { |type| isConst?(type,PBTypes,:FLYING) }
|
||||
ret.push(getConst(PBTypes,:NORMAL) || 0) if ret.length==0
|
||||
ret.delete(:FLYING)
|
||||
ret.push(:NORMAL) if ret.length == 0
|
||||
end
|
||||
# Add the third type specially.
|
||||
if withType3 && @effects[PBEffects::Type3]>=0
|
||||
if withType3 && @effects[PBEffects::Type3]
|
||||
ret.push(@effects[PBEffects::Type3]) if !ret.include?(@effects[PBEffects::Type3])
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbHasType?(type)
|
||||
type = getConst(PBTypes,type) if type.is_a?(Symbol) || type.is_a?(String)
|
||||
return false if !type || type<0
|
||||
return false if !type
|
||||
activeTypes = pbTypes(true)
|
||||
return activeTypes.include?(type)
|
||||
return activeTypes.include?(GameData::Type.get(type).id)
|
||||
end
|
||||
|
||||
def pbHasOtherType?(type)
|
||||
type = getConst(PBTypes,type) if type.is_a?(Symbol) || type.is_a?(String)
|
||||
return false if !type || type<0
|
||||
return false if !type
|
||||
activeTypes = pbTypes(true)
|
||||
activeTypes.reject! { |t| t==type }
|
||||
return activeTypes.length>0
|
||||
activeTypes.delete(GameData::Type.get(type).id)
|
||||
return activeTypes.length > 0
|
||||
end
|
||||
|
||||
# NOTE: Do not create any held item which affects whether a Pokémon's ability
|
||||
@@ -444,8 +440,8 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def pbHasMoveType?(check_type)
|
||||
check_type = getConst(PBTypes, check_type)
|
||||
return false if !check_type || check_type < 0
|
||||
return false if !check_type
|
||||
check_type = GameData::Type.get(check_type).id
|
||||
eachMove { |m| return true if m.type == check_type }
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@ class PokeBattle_Battler
|
||||
@form = 0
|
||||
@level = 0
|
||||
@hp = @totalhp = 0
|
||||
@type1 = @type2 = 0
|
||||
@type1 = @type2 = nil
|
||||
@ability_id = nil
|
||||
@item_id = nil
|
||||
@gender = 0
|
||||
@@ -148,7 +148,7 @@ class PokeBattle_Battler
|
||||
@tookDamage = false
|
||||
@tookPhysicalHit = false
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = -1
|
||||
@lastMoveUsedType = nil
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
@lastRoundMoved = -1
|
||||
@@ -270,7 +270,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
@effects[PBEffects::Truant] = false
|
||||
@effects[PBEffects::TwoTurnAttack] = nil
|
||||
@effects[PBEffects::Type3] = -1
|
||||
@effects[PBEffects::Type3] = nil
|
||||
@effects[PBEffects::Unburden] = false
|
||||
@effects[PBEffects::Uproar] = 0
|
||||
@effects[PBEffects::WaterSport] = false
|
||||
|
||||
@@ -111,17 +111,17 @@ class PokeBattle_Battler
|
||||
def pbChangeTypes(newType)
|
||||
if newType.is_a?(PokeBattle_Battler)
|
||||
newTypes = newType.pbTypes
|
||||
newTypes.push(getConst(PBTypes,:NORMAL) || 0) if newTypes.length==0
|
||||
newTypes.push(:NORMAL) if newTypes.length == 0
|
||||
newType3 = newType.effects[PBEffects::Type3]
|
||||
newType3 = -1 if newTypes.include?(newType3)
|
||||
newType3 = nil if newTypes.include?(newType3)
|
||||
@type1 = newTypes[0]
|
||||
@type2 = (newTypes.length==1) ? newTypes[0] : newTypes[1]
|
||||
@type2 = (newTypes.length == 1) ? newTypes[0] : newTypes[1]
|
||||
@effects[PBEffects::Type3] = newType3
|
||||
else
|
||||
newType = getConst(PBTypes,newType) if newType.is_a?(Symbol) || newType.is_a?(String)
|
||||
newType = GameData::Item.get(newType).id
|
||||
@type1 = newType
|
||||
@type2 = newType
|
||||
@effects[PBEffects::Type3] = -1
|
||||
@effects[PBEffects::Type3] = nil
|
||||
end
|
||||
@effects[PBEffects::BurnUp] = false
|
||||
@effects[PBEffects::Roost] = false
|
||||
|
||||
@@ -125,7 +125,7 @@ class PokeBattle_Battler
|
||||
@damageState.reset
|
||||
@damageState.initialHP = @hp
|
||||
confusionMove = PokeBattle_Confusion.new(@battle,nil)
|
||||
confusionMove.calcType = confusionMove.pbCalcType(self) # -1
|
||||
confusionMove.calcType = confusionMove.pbCalcType(self) # nil
|
||||
@damageState.typeMod = confusionMove.pbCalcTypeMod(confusionMove.calcType,self,self) # 8
|
||||
confusionMove.pbCheckDamageAbsorption(self,self)
|
||||
confusionMove.pbCalcDamage(self,self)
|
||||
@@ -189,7 +189,7 @@ class PokeBattle_Battler
|
||||
@lastMoveFailed = false
|
||||
if !pbTryUseMove(choice,move,specialUsage,skipAccuracyCheck)
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = -1
|
||||
@lastMoveUsedType = nil
|
||||
if !specialUsage
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
@@ -207,7 +207,7 @@ class PokeBattle_Battler
|
||||
@battle.pbDisplay(_INTL("{1} used {2}!",pbThis,move.name))
|
||||
@battle.pbDisplay(_INTL("But there was no PP left for the move!"))
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = -1
|
||||
@lastMoveUsedType = nil
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
@lastMoveFailed = true
|
||||
@@ -319,7 +319,7 @@ class PokeBattle_Battler
|
||||
@battle.pbDisplay(_INTL("{1} melted the ice!",user.pbThis))
|
||||
end
|
||||
# Powder
|
||||
if user.effects[PBEffects::Powder] && isConst?(move.calcType,PBTypes,:FIRE)
|
||||
if user.effects[PBEffects::Powder] && move.calcType == :FIRE
|
||||
@battle.pbCommonAnimation("Powder",user)
|
||||
@battle.pbDisplay(_INTL("When the flame touched the powder on the Pokémon, it exploded!"))
|
||||
user.lastMoveFailed = true
|
||||
@@ -342,7 +342,7 @@ class PokeBattle_Battler
|
||||
if move.damagingMove?
|
||||
case @battle.pbWeather
|
||||
when PBWeather::HeavyRain
|
||||
if isConst?(move.calcType,PBTypes,:FIRE)
|
||||
if move.calcType == :FIRE
|
||||
@battle.pbDisplay(_INTL("The Fire-type attack fizzled out in the heavy rain!"))
|
||||
user.lastMoveFailed = true
|
||||
pbCancelMoves
|
||||
@@ -350,7 +350,7 @@ class PokeBattle_Battler
|
||||
return
|
||||
end
|
||||
when PBWeather::HarshSun
|
||||
if isConst?(move.calcType,PBTypes,:WATER)
|
||||
if move.calcType == :WATER
|
||||
@battle.pbDisplay(_INTL("The Water-type attack evaporated in the harsh sunlight!"))
|
||||
user.lastMoveFailed = true
|
||||
pbCancelMoves
|
||||
@@ -364,7 +364,7 @@ class PokeBattle_Battler
|
||||
if user.pbHasOtherType?(move.calcType) && !PBTypes.isPseudoType?(move.calcType)
|
||||
@battle.pbShowAbilitySplash(user)
|
||||
user.pbChangeTypes(move.calcType)
|
||||
typeName = PBTypes.getName(move.calcType)
|
||||
typeName = GameData::Type.get(move.calcType).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typeName))
|
||||
@battle.pbHideAbilitySplash(user)
|
||||
# NOTE: The GF games say that if Curse is used by a non-Ghost-type
|
||||
|
||||
@@ -138,7 +138,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def pbChangeTargetByAbility(drawingAbility,drawnType,move,user,targets,priority,nearOnly)
|
||||
return targets if !isConst?(move.calcType,PBTypes,drawnType)
|
||||
return targets if move.calcType != drawnType
|
||||
return targets if targets[0].hasActiveAbility?(drawingAbility)
|
||||
priority.each do |b|
|
||||
next if b.index==user.index || b.index==targets[0].index
|
||||
|
||||
@@ -402,7 +402,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? && PBTypes.ineffective?(typeMod)
|
||||
if move.pbDamagingMove? && PBTypeEffectiveness.ineffective?(typeMod)
|
||||
PBDebug.log("[Target immune] #{target.pbThis}'s type immunity")
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
|
||||
return false
|
||||
@@ -415,7 +415,7 @@ class PokeBattle_Battler
|
||||
return false
|
||||
end
|
||||
# Airborne-based immunity to Ground moves
|
||||
if move.damagingMove? && isConst?(move.calcType,PBTypes,:GROUND) &&
|
||||
if move.damagingMove? && move.calcType == :GROUND &&
|
||||
target.airborne? && !move.hitsFlyingTargets?
|
||||
if target.hasActiveAbility?(:LEVITATE) && !@battle.moldBreaker
|
||||
@battle.pbShowAbilitySplash(target)
|
||||
|
||||
@@ -72,8 +72,7 @@ class PokeBattle_Battler
|
||||
next if b.status!=PBStatuses::FROZEN
|
||||
# NOTE: Non-Fire-type moves that thaw the user will also thaw the
|
||||
# target (in Gen 6+).
|
||||
if isConst?(move.calcType,PBTypes,:FIRE) ||
|
||||
(NEWEST_BATTLE_MECHANICS && move.thawsUser?)
|
||||
if move.calcType == :FIRE || (NEWEST_BATTLE_MECHANICS && move.thawsUser?)
|
||||
b.pbCureStatus
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,7 +39,7 @@ class PokeBattle_Move
|
||||
@target = move.target
|
||||
@priority = move.priority
|
||||
@flags = move.flags
|
||||
@calcType = -1
|
||||
@calcType = nil
|
||||
@powerBoost = false # For Aerilate, Pixilate, Refrigerate, Galvanize
|
||||
@snatched = false
|
||||
end
|
||||
@@ -72,8 +72,9 @@ class PokeBattle_Move
|
||||
# AI), so using @calcType here is acceptable.
|
||||
def physicalMove?(thisType=nil)
|
||||
return (@category==0) if MOVE_CATEGORY_PER_MOVE
|
||||
thisType ||= @calcType if @calcType>=0
|
||||
thisType = @type if !thisType
|
||||
thisType ||= @calcType
|
||||
thisType ||= @type
|
||||
return true if !thisType
|
||||
return !PBTypes.isSpecialType?(thisType)
|
||||
end
|
||||
|
||||
@@ -81,8 +82,9 @@ class PokeBattle_Move
|
||||
# AI), so using @calcType here is acceptable.
|
||||
def specialMove?(thisType=nil)
|
||||
return (@category==1) if MOVE_CATEGORY_PER_MOVE
|
||||
thisType ||= @calcType if @calcType>=0
|
||||
thisType = @type if !thisType
|
||||
thisType ||= @calcType
|
||||
thisType ||= @type
|
||||
return false if !thisType
|
||||
return PBTypes.isSpecialType?(thisType)
|
||||
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 PBTypes.resistant?(b.damageState.typeMod); effectiveness = 1
|
||||
elsif PBTypes.superEffective?(b.damageState.typeMod); effectiveness = 2
|
||||
if PBTypeEffectiveness.resistant?(b.damageState.typeMod); effectiveness = 1
|
||||
elsif PBTypeEffectiveness.superEffective?(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 PBTypes.superEffective?(target.damageState.typeMod)
|
||||
if PBTypeEffectiveness.superEffective?(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 PBTypes.notVeryEffective?(target.damageState.typeMod)
|
||||
elsif PBTypeEffectiveness.notVeryEffective?(target.damageState.typeMod)
|
||||
if numTargets>1
|
||||
@battle.pbDisplay(_INTL("It's not very effective on {1}...",target.pbThis(true)))
|
||||
else
|
||||
@@ -326,7 +326,7 @@ class PokeBattle_Move
|
||||
# regardless of its calculated type. Hence the following two lines of
|
||||
# code.
|
||||
moveType = nil
|
||||
moveType = getID(PBTypes,:NORMAL) if @function=="090" # Hidden Power
|
||||
moveType = :NORMAL if @function=="090" # Hidden Power
|
||||
if physicalMove?(moveType)
|
||||
target.effects[PBEffects::Counter] = damage
|
||||
target.effects[PBEffects::CounterTarget] = user.index
|
||||
|
||||
@@ -4,8 +4,7 @@ class PokeBattle_Move
|
||||
#=============================================================================
|
||||
def pbBaseType(user)
|
||||
ret = @type
|
||||
return ret if !ret || ret<0
|
||||
if user.abilityActive?
|
||||
if ret && user.abilityActive?
|
||||
ret = BattleHandlers.triggerMoveBaseTypeModifierAbility(user.ability,user,self,ret)
|
||||
end
|
||||
return ret
|
||||
@@ -14,14 +13,13 @@ class PokeBattle_Move
|
||||
def pbCalcType(user)
|
||||
@powerBoost = false
|
||||
ret = pbBaseType(user)
|
||||
return ret if !ret || ret<0
|
||||
if hasConst?(PBTypes,:ELECTRIC)
|
||||
if @battle.field.effects[PBEffects::IonDeluge] && isConst?(ret,PBTypes,:NORMAL)
|
||||
ret = getConst(PBTypes,:ELECTRIC)
|
||||
if ret && GameData::Type.exists?(:ELECTRIC)
|
||||
if @battle.field.effects[PBEffects::IonDeluge] && ret == :NORMAL
|
||||
ret = :ELECTRIC
|
||||
@powerBoost = false
|
||||
end
|
||||
if user.effects[PBEffects::Electrify]
|
||||
ret = getConst(PBTypes,:ELECTRIC)
|
||||
ret = :ELECTRIC
|
||||
@powerBoost = false
|
||||
end
|
||||
end
|
||||
@@ -39,30 +37,29 @@ class PokeBattle_Move
|
||||
end
|
||||
# Foresight
|
||||
if user.hasActiveAbility?(:SCRAPPY) || target.effects[PBEffects::Foresight]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:GHOST) &&
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
end
|
||||
# Miracle Eye
|
||||
if target.effects[PBEffects::MiracleEye]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:DARK) &&
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
end
|
||||
# Delta Stream's weather
|
||||
if @battle.pbWeather==PBWeather::StrongWinds
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:FLYING) &&
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
|
||||
PBTypes.superEffective?(moveType,defType)
|
||||
end
|
||||
# Grounded Flying-type Pokémon become susceptible to Ground moves
|
||||
if !target.airborne?
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:FLYING) &&
|
||||
isConst?(moveType,PBTypes,:GROUND)
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(moveType,user,target)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType<0
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if isConst?(moveType,PBTypes,:GROUND) &&
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if !moveType
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
|
||||
target.pbHasType?(:FLYING) && target.hasActiveItem?(:IRONBALL)
|
||||
# Determine types
|
||||
tTypes = target.pbTypes(true)
|
||||
@@ -190,7 +187,7 @@ class PokeBattle_Move
|
||||
return true if user.effects[PBEffects::LaserFocus]>0
|
||||
c += 1 if highCriticalRate?
|
||||
c += user.effects[PBEffects::FocusEnergy]
|
||||
c += 1 if user.inHyperMode? && isConst?(@type,PBTypes,:SHADOW)
|
||||
c += 1 if user.inHyperMode? && @type == :SHADOW
|
||||
c = ratios.length-1 if c>=ratios.length
|
||||
# Calculation
|
||||
return @battle.pbRandom(ratios[c])==0
|
||||
@@ -226,7 +223,7 @@ class PokeBattle_Move
|
||||
stageMul = [2,2,2,2,2,2, 2, 3,4,5,6,7,8]
|
||||
stageDiv = [8,7,6,5,4,3, 2, 2,2,2,2,2,2]
|
||||
# Get the move's type
|
||||
type = @calcType # -1 is treated as physical
|
||||
type = @calcType # nil is treated as physical
|
||||
# Calculate whether this hit deals critical damage
|
||||
target.damageState.critical = pbIsCritical?(user,target)
|
||||
# Calcuate base power of move
|
||||
@@ -257,8 +254,8 @@ class PokeBattle_Move
|
||||
|
||||
def pbCalcDamageMultipliers(user,target,numTargets,type,baseDmg,multipliers)
|
||||
# Global abilities
|
||||
if (@battle.pbCheckGlobalAbility(:DARKAURA) && isConst?(type,PBTypes,:DARK)) ||
|
||||
(@battle.pbCheckGlobalAbility(:FAIRYAURA) && isConst?(type,PBTypes,:FAIRY))
|
||||
if (@battle.pbCheckGlobalAbility(:DARKAURA) && type == :DARK) ||
|
||||
(@battle.pbCheckGlobalAbility(:FAIRYAURA) && type == :FAIRY)
|
||||
if @battle.pbCheckGlobalAbility(:AURABREAK)
|
||||
multipliers[BASE_DMG_MULT] *= 2/3.0
|
||||
else
|
||||
@@ -311,11 +308,11 @@ class PokeBattle_Move
|
||||
if user.effects[PBEffects::HelpingHand] && !self.is_a?(PokeBattle_Confusion)
|
||||
multipliers[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
if user.effects[PBEffects::Charge]>0 && isConst?(type,PBTypes,:ELECTRIC)
|
||||
if user.effects[PBEffects::Charge]>0 && type == :ELECTRIC
|
||||
multipliers[BASE_DMG_MULT] *= 2
|
||||
end
|
||||
# Mud Sport
|
||||
if isConst?(type,PBTypes,:ELECTRIC)
|
||||
if type == :ELECTRIC
|
||||
@battle.eachBattler do |b|
|
||||
next if !b.effects[PBEffects::MudSport]
|
||||
multipliers[BASE_DMG_MULT] /= 3
|
||||
@@ -326,7 +323,7 @@ class PokeBattle_Move
|
||||
end
|
||||
end
|
||||
# Water Sport
|
||||
if isConst?(type,PBTypes,:FIRE)
|
||||
if type == :FIRE
|
||||
@battle.eachBattler do |b|
|
||||
next if !b.effects[PBEffects::WaterSport]
|
||||
multipliers[BASE_DMG_MULT] /= 3
|
||||
@@ -340,21 +337,15 @@ class PokeBattle_Move
|
||||
if user.affectedByTerrain?
|
||||
case @battle.field.terrain
|
||||
when PBBattleTerrains::Electric
|
||||
if isConst?(type,PBTypes,:ELECTRIC)
|
||||
multipliers[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
multipliers[BASE_DMG_MULT] *= 1.5 if type == :ELECTRIC
|
||||
when PBBattleTerrains::Grassy
|
||||
if isConst?(type,PBTypes,:GRASS)
|
||||
multipliers[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
multipliers[BASE_DMG_MULT] *= 1.5 if type == :GRASS
|
||||
when PBBattleTerrains::Psychic
|
||||
if isConst?(type,PBTypes,:PSYCHIC)
|
||||
multipliers[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
multipliers[BASE_DMG_MULT] *= 1.5 if type == :PSYCHIC
|
||||
end
|
||||
end
|
||||
if @battle.field.terrain==PBBattleTerrains::Misty && target.affectedByTerrain? &&
|
||||
isConst?(type,PBTypes,:DRAGON)
|
||||
type == :DRAGON
|
||||
multipliers[BASE_DMG_MULT] /= 2
|
||||
end
|
||||
# Badge multipliers
|
||||
@@ -381,15 +372,15 @@ class PokeBattle_Move
|
||||
# Weather
|
||||
case @battle.pbWeather
|
||||
when PBWeather::Sun, PBWeather::HarshSun
|
||||
if isConst?(type,PBTypes,:FIRE)
|
||||
if type == :FIRE
|
||||
multipliers[FINAL_DMG_MULT] *= 1.5
|
||||
elsif isConst?(type,PBTypes,:WATER)
|
||||
elsif type == :WATER
|
||||
multipliers[FINAL_DMG_MULT] /= 2
|
||||
end
|
||||
when PBWeather::Rain, PBWeather::HeavyRain
|
||||
if isConst?(type,PBTypes,:FIRE)
|
||||
if type == :FIRE
|
||||
multipliers[FINAL_DMG_MULT] /= 2
|
||||
elsif isConst?(type,PBTypes,:WATER)
|
||||
elsif type == :WATER
|
||||
multipliers[FINAL_DMG_MULT] *= 1.5
|
||||
end
|
||||
when PBWeather::Sandstorm
|
||||
@@ -411,7 +402,7 @@ class PokeBattle_Move
|
||||
multipliers[FINAL_DMG_MULT] *= random/100.0
|
||||
end
|
||||
# STAB
|
||||
if type>=0 && user.pbHasType?(type)
|
||||
if type && user.pbHasType?(type)
|
||||
if user.hasActiveAbility?(:ADAPTABILITY)
|
||||
multipliers[FINAL_DMG_MULT] *= 2
|
||||
else
|
||||
|
||||
@@ -34,7 +34,7 @@ class PokeBattle_Confusion < PokeBattle_Move
|
||||
@priority = 0
|
||||
@flags = ""
|
||||
@addlEffect = 0
|
||||
@calcType = -1
|
||||
@calcType = nil
|
||||
@powerBoost = false
|
||||
@snatched = false
|
||||
end
|
||||
@@ -66,7 +66,7 @@ class PokeBattle_Struggle < PokeBattle_Move
|
||||
@priority = 0
|
||||
@flags = ""
|
||||
@addlEffect = 0
|
||||
@calcType = -1
|
||||
@calcType = nil
|
||||
@powerBoost = false
|
||||
@snatched = false
|
||||
end
|
||||
@@ -636,6 +636,7 @@ class PokeBattle_PledgeMove < PokeBattle_Move
|
||||
@battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
|
||||
@pledgeCombo = true
|
||||
@comboEffect = i[1]; @overrideType = i[2]; @overrideAnim = i[3]
|
||||
@overrideType = nil if !GameData::Type.exists?(@overrideType)
|
||||
break
|
||||
end
|
||||
return if @pledgeCombo
|
||||
|
||||
@@ -113,7 +113,7 @@ class PokeBattle_Move_007 < PokeBattle_ParalysisMove
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if @id == :THUNDERWAVE && PBTypes.ineffective?(target.damageState.typeMod)
|
||||
if @id == :THUNDERWAVE && PBTypeEffectiveness.ineffective?(target.damageState.typeMod)
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
|
||||
return true
|
||||
end
|
||||
@@ -1709,7 +1709,7 @@ class PokeBattle_Move_05C < PokeBattle_Move
|
||||
if !lastMoveData ||
|
||||
user.pbHasMove?(target.lastRegularMoveUsed) ||
|
||||
@moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
lastMoveData.type == :SHADOW
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1759,7 +1759,7 @@ class PokeBattle_Move_05D < PokeBattle_Move
|
||||
if !lastMoveData ||
|
||||
user.pbHasMove?(target.lastRegularMoveUsed) ||
|
||||
@moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
lastMoveData.type = :SHADOW
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1810,7 +1810,7 @@ class PokeBattle_Move_05E < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
|
||||
user.pbChangeTypes(newType)
|
||||
typeName = PBTypes.getName(newType)
|
||||
typeName = GameData::Item.get(newType).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typeName))
|
||||
end
|
||||
end
|
||||
@@ -1824,7 +1824,7 @@ end
|
||||
class PokeBattle_Move_05F < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
def pbMoveFailed?(user, targets)
|
||||
if !user.canChangeType?
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
@@ -1832,20 +1832,19 @@ class PokeBattle_Move_05F < PokeBattle_Move
|
||||
return false
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if !target.lastMoveUsed || target.lastMoveUsedType < 0 ||
|
||||
PBTypes.isPseudoType?(GameData::Move.get(target.lastMoveUsed).type)
|
||||
def pbFailsAgainstTarget?(user, target)
|
||||
if !target.lastMoveUsed || !target.lastMoveUsedType ||
|
||||
PBTypes.isPseudoType?(target.lastMoveUsedType)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@newTypes = []
|
||||
for i in 0..PBTypes.maxValue
|
||||
next if PBTypes.isPseudoType?(i)
|
||||
next if user.pbHasType?(i)
|
||||
next if !PBTypes.resistant?(target.lastMoveUsedType,i)
|
||||
@newTypes.push(i)
|
||||
GameData::Type.each do |t|
|
||||
next if t.pseudo_type || user.pbHasType?(t.id) ||
|
||||
!PBTypes.resistant?(target.lastMoveUsedType, t.id)
|
||||
@newTypes.push(t.id)
|
||||
end
|
||||
if @newTypes.length==0
|
||||
if @newTypes.length == 0
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1855,8 +1854,8 @@ class PokeBattle_Move_05F < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
|
||||
user.pbChangeTypes(newType)
|
||||
typeName = PBTypes.getName(newType)
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typeName))
|
||||
typeName = GameData::Type.get(newType).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!", user.pbThis, typeName))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1871,49 +1870,59 @@ class PokeBattle_Move_060 < PokeBattle_Move
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@newType = getID(PBTypes,:NORMAL)
|
||||
@newType = :NORMAL
|
||||
checkedTerrain = false
|
||||
case @battle.field.terrain
|
||||
when PBBattleTerrains::Electric
|
||||
if hasConst?(PBTypes,:ELECTRIC)
|
||||
@newType = getID(PBTypes,:ELECTRIC); checkedTerrain = true
|
||||
if GameData::Type.exists?(:ELECTRIC)
|
||||
@newType = :ELECTRIC
|
||||
checkedTerrain = true
|
||||
end
|
||||
when PBBattleTerrains::Grassy
|
||||
if hasConst?(PBTypes,:GRASS)
|
||||
@newType = getID(PBTypes,:GRASS); checkedTerrain = true
|
||||
if GameData::Type.exists?(:GRASS)
|
||||
@newType = :GRASS
|
||||
checkedTerrain = true
|
||||
end
|
||||
when PBBattleTerrains::Misty
|
||||
if hasConst?(PBTypes,:FAIRY)
|
||||
@newType = getID(PBTypes,:FAIRY); checkedTerrain = true
|
||||
if GameData::Type.exists?(:FAIRY)
|
||||
@newType = :FAIRY
|
||||
checkedTerrain = true
|
||||
end
|
||||
when PBBattleTerrains::Psychic
|
||||
if hasConst?(PBTypes,:PSYCHIC)
|
||||
@newType = getID(PBTypes,:PSYCHIC); checkedTerrain = true
|
||||
if GameData::Type.exists?(:PSYCHIC)
|
||||
@newType = :PSYCHIC
|
||||
checkedTerrain = true
|
||||
end
|
||||
end
|
||||
if !checkedTerrain
|
||||
case @battle.environment
|
||||
when PBEnvironment::Grass then @newType = getID(PBTypes,:GRASS)
|
||||
when PBEnvironment::TallGrass then @newType = getID(PBTypes,:GRASS)
|
||||
when PBEnvironment::MovingWater then @newType = getID(PBTypes,:WATER)
|
||||
when PBEnvironment::StillWater then @newType = getID(PBTypes,:WATER)
|
||||
when PBEnvironment::Puddle then @newType = getID(PBTypes,:WATER)
|
||||
when PBEnvironment::Underwater then @newType = getID(PBTypes,:WATER)
|
||||
when PBEnvironment::Cave then @newType = getID(PBTypes,:ROCK)
|
||||
when PBEnvironment::Rock then @newType = getID(PBTypes,:GROUND)
|
||||
when PBEnvironment::Sand then @newType = getID(PBTypes,:GROUND)
|
||||
when PBEnvironment::Forest then @newType = getID(PBTypes,:BUG)
|
||||
when PBEnvironment::ForestGrass then @newType = getID(PBTypes,:BUG)
|
||||
when PBEnvironment::Snow then @newType = getID(PBTypes,:ICE)
|
||||
when PBEnvironment::Ice then @newType = getID(PBTypes,:ICE)
|
||||
when PBEnvironment::Volcano then @newType = getID(PBTypes,:FIRE)
|
||||
when PBEnvironment::Graveyard then @newType = getID(PBTypes,:GHOST)
|
||||
when PBEnvironment::Sky then @newType = getID(PBTypes,:FLYING)
|
||||
when PBEnvironment::Space then @newType = getID(PBTypes,:DRAGON)
|
||||
when PBEnvironment::UltraSpace then @newType = getID(PBTypes,:PSYCHIC)
|
||||
when PBEnvironment::Grass, PBEnvironment::TallGrass
|
||||
@newType = :GRASS
|
||||
when PBEnvironment::MovingWater, PBEnvironment::StillWater,
|
||||
PBEnvironment::Puddle, PBEnvironment::Underwater
|
||||
@newType = :WATER
|
||||
when PBEnvironment::Cave
|
||||
@newType = :ROCK
|
||||
when PBEnvironment::Rock, PBEnvironment::Sand
|
||||
@newType = :GROUND
|
||||
when PBEnvironment::Forest, PBEnvironment::ForestGrass
|
||||
@newType = :BUG
|
||||
when PBEnvironment::Snow, PBEnvironment::Ice
|
||||
@newType = :ICE
|
||||
when PBEnvironment::Volcano
|
||||
@newType = :FIRE
|
||||
when PBEnvironment::Graveyard
|
||||
@newType = :GHOST
|
||||
when PBEnvironment::Sky
|
||||
@newType = :FLYING
|
||||
when PBEnvironment::Space
|
||||
@newType = :DRAGON
|
||||
when PBEnvironment::UltraSpace
|
||||
@newType = :PSYCHIC
|
||||
end
|
||||
end
|
||||
if !user.pbHasOtherType?(@newType)
|
||||
@newType = :NORMAL if !GameData::Type.exists?(@newType)
|
||||
if !GameData::Type.exists?(@newType) || !user.pbHasOtherType?(@newType)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1922,7 +1931,7 @@ class PokeBattle_Move_060 < PokeBattle_Move
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.pbChangeTypes(@newType)
|
||||
typeName = PBTypes.getName(@newType)
|
||||
typeName = GameData::Type.get(@newType).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typeName))
|
||||
end
|
||||
end
|
||||
@@ -1934,8 +1943,8 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_061 < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if !target.canChangeType? ||
|
||||
!target.pbHasOtherType?(getConst(PBTypes,:WATER))
|
||||
if !target.canChangeType? || !GameData::Type.exists?(:WATER) ||
|
||||
!target.pbHasOtherType?(:WATER)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1943,9 +1952,8 @@ class PokeBattle_Move_061 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
newType = getConst(PBTypes,:WATER)
|
||||
target.pbChangeTypes(newType)
|
||||
typeName = PBTypes.getName(newType)
|
||||
target.pbChangeTypes(:WATER)
|
||||
typeName = GameData::Type.get(:WATER).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",target.pbThis,typeName))
|
||||
end
|
||||
end
|
||||
@@ -2362,8 +2370,7 @@ class PokeBattle_Move_070 < PokeBattle_FixedDamageMove
|
||||
@battle.pbHideAbilitySplash(target)
|
||||
return true
|
||||
end
|
||||
if NEWEST_BATTLE_MECHANICS &&
|
||||
isConst?(target.damageState.typeMod,PBTypes,:ICE) && target.pbHasType?(:ICE)
|
||||
if NEWEST_BATTLE_MECHANICS && @id == :SHEERCOLD && target.pbHasType?(:ICE)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -110,26 +110,26 @@ class PokeBattle_Move_087 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbBaseType(user)
|
||||
ret = getID(PBTypes,:NORMAL)
|
||||
ret = :NORMAL
|
||||
case @battle.pbWeather
|
||||
when PBWeather::Sun, PBWeather::HarshSun
|
||||
ret = getConst(PBTypes,:FIRE) || ret
|
||||
ret = :FIRE if GameData::Type.exists?(:FIRE)
|
||||
when PBWeather::Rain, PBWeather::HeavyRain
|
||||
ret = getConst(PBTypes,:WATER) || ret
|
||||
ret = :WATER if GameData::Type.exists?(:WATER)
|
||||
when PBWeather::Sandstorm
|
||||
ret = getConst(PBTypes,:ROCK) || ret
|
||||
ret = :ROCK if GameData::Type.exists?(:ROCK)
|
||||
when PBWeather::Hail
|
||||
ret = getConst(PBTypes,:ICE) || ret
|
||||
ret = :ICE if GameData::Type.exists?(:ICE)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
||||
t = pbBaseType(user)
|
||||
hitNum = 1 if isConst?(t,PBTypes,:FIRE) # Type-specific anims
|
||||
hitNum = 2 if isConst?(t,PBTypes,:WATER)
|
||||
hitNum = 3 if isConst?(t,PBTypes,:ROCK)
|
||||
hitNum = 4 if isConst?(t,PBTypes,:ICE)
|
||||
hitNum = 1 if t == :FIRE # Type-specific anims
|
||||
hitNum = 2 if t == :WATER
|
||||
hitNum = 3 if t == :ROCK
|
||||
hitNum = 4 if t == :ICE
|
||||
super
|
||||
end
|
||||
end
|
||||
@@ -262,11 +262,8 @@ def pbHiddenPower(pkmn)
|
||||
iv = pkmn.iv
|
||||
idxType = 0; power = 60
|
||||
types = []
|
||||
for i in 0..PBTypes.maxValue
|
||||
next if PBTypes.isPseudoType?(i)
|
||||
next if isConst?(i,PBTypes,:NORMAL) || isConst?(i,PBTypes,:SHADOW)
|
||||
types.push(i)
|
||||
end
|
||||
GameData::Type.each { |t| types.push(t.id) if !t.pseudo_type && ![:NORMAL, :SHADOW].include?(t.id)}
|
||||
types.sort! { |a, b| GameData::Type.get(a).id_number <=> GameData::Type.get(b).id_number }
|
||||
idxType |= (iv[PBStats::HP]&1)
|
||||
idxType |= (iv[PBStats::ATTACK]&1)<<1
|
||||
idxType |= (iv[PBStats::DEFENSE]&1)<<2
|
||||
@@ -491,10 +488,10 @@ class PokeBattle_Move_096 < PokeBattle_Move
|
||||
# the AI won't want to use it if the user has no item anyway, and
|
||||
# complex item movement is unlikely, perhaps this is good enough.
|
||||
def pbBaseType(user)
|
||||
ret = getID(PBTypes,:NORMAL)
|
||||
ret = :NORMAL
|
||||
@typeArray.each do |type, items|
|
||||
next if !items.include?(@berry.id)
|
||||
ret = getConst(PBTypes,type) || ret
|
||||
ret = type if GameData::Type.exists?(type)
|
||||
break
|
||||
end
|
||||
return ret
|
||||
@@ -765,12 +762,11 @@ class PokeBattle_Move_09F < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbBaseType(user)
|
||||
ret = getID(PBTypes,:NORMAL)
|
||||
ret = :NORMAL
|
||||
if user.itemActive?
|
||||
@itemTypes.each do |item, itemType|
|
||||
next if user.item != item
|
||||
t = getConst(PBTypes,itemType)
|
||||
ret = t || ret
|
||||
ret = itemType if GameData::Type.exists?(itemType)
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -781,10 +777,10 @@ class PokeBattle_Move_09F < PokeBattle_Move
|
||||
if @id == :TECHNOBLAST # Type-specific anim
|
||||
t = pbBaseType(user)
|
||||
hitNum = 0
|
||||
hitNum = 1 if isConst?(t,PBTypes,:ELECTRIC)
|
||||
hitNum = 2 if isConst?(t,PBTypes,:FIRE)
|
||||
hitNum = 3 if isConst?(t,PBTypes,:ICE)
|
||||
hitNum = 4 if isConst?(t,PBTypes,:WATER)
|
||||
hitNum = 1 if t == :ELECTRIC
|
||||
hitNum = 2 if t == :FIRE
|
||||
hitNum = 3 if t == :ICE
|
||||
hitNum = 4 if t == :WATER
|
||||
end
|
||||
super
|
||||
end
|
||||
@@ -1551,7 +1547,7 @@ class PokeBattle_Move_0B5 < PokeBattle_Move
|
||||
next if NEWEST_BATTLE_MECHANICS && pkmn.egg?
|
||||
pkmn.moves.each do |move|
|
||||
next if @moveBlacklist.include?(move.function_code)
|
||||
next if isConst?(move.type,PBTypes,:SHADOW)
|
||||
next if move.type == :SHADOW
|
||||
@assistMoves.push(move.id)
|
||||
end
|
||||
end
|
||||
@@ -1670,7 +1666,7 @@ class PokeBattle_Move_0B6 < PokeBattle_Move
|
||||
move_data = GameData::Move.get(move_id)
|
||||
next if @moveBlacklist.include?(move_data.function_code)
|
||||
next if @moveBlacklistSignatures.include?(move_data.id)
|
||||
next if isConst?(move_data.type, PBTypes, :SHADOW)
|
||||
next if move_data.type == :SHADOW
|
||||
@metronomeMove = move_data.id
|
||||
break
|
||||
end
|
||||
|
||||
@@ -107,8 +107,8 @@ class PokeBattle_Move_106 < PokeBattle_PledgeMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
# [Function code to combo with, effect, override type, override animation]
|
||||
@combos = [["107", :SeaOfFire, getConst(PBTypes, :FIRE), :FIREPLEDGE],
|
||||
["108", :Swamp, nil, nil]]
|
||||
@combos = [["107", :SeaOfFire, :FIRE, :FIREPLEDGE],
|
||||
["108", :Swamp, nil, nil]]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -123,8 +123,8 @@ class PokeBattle_Move_107 < PokeBattle_PledgeMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
# [Function code to combo with, effect, override type, override animation]
|
||||
@combos = [["108", :Rainbow, getConst(PBTypes, :WATER), :WATERPLEDGE],
|
||||
["106", :SeaOfFire, nil, nil]]
|
||||
@combos = [["108", :Rainbow, :WATER, :WATERPLEDGE],
|
||||
["106", :SeaOfFire, nil, nil]]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -139,8 +139,8 @@ class PokeBattle_Move_108 < PokeBattle_PledgeMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
# [Function code to combo with, effect, override type, override animation]
|
||||
@combos = [["106", :Swamp, getConst(PBTypes, :GRASS), :GRASSPLEDGE],
|
||||
["107", :Rainbow, nil, nil]]
|
||||
@combos = [["106", :Swamp, :GRASS, :GRASSPLEDGE],
|
||||
["107", :Rainbow, nil, nil]]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -768,8 +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 isConst?(moveType,PBTypes,:GROUND) &&
|
||||
isConst?(defType,PBTypes,:FLYING)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if moveType == :GROUND && defType == :FLYING
|
||||
return super
|
||||
end
|
||||
|
||||
@@ -1065,7 +1064,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_135 < PokeBattle_FreezeMove
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
return PBTypeEffectiveness::SUPER_EFFECTIVE_ONE if isConst?(defType,PBTypes,:WATER)
|
||||
return PBTypeEffectiveness::SUPER_EFFECTIVE_ONE if defType == :WATER
|
||||
return super
|
||||
end
|
||||
end
|
||||
@@ -1402,7 +1401,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_142 < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if !hasConst?(PBTypes,:GHOST) || target.pbHasType?(:GHOST) || !target.canChangeType?
|
||||
if !GameData::Type.exists?(:GHOST) || target.pbHasType?(:GHOST) || !target.canChangeType?
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1410,9 +1409,8 @@ class PokeBattle_Move_142 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
ghostType = getConst(PBTypes,:GHOST)
|
||||
target.effects[PBEffects::Type3] = ghostType
|
||||
typeName = PBTypes.getName(ghostType)
|
||||
target.effects[PBEffects::Type3] = :GHOST
|
||||
typeName = GameData::Type.get(:GHOST).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",target.pbThis,typeName))
|
||||
end
|
||||
end
|
||||
@@ -1424,7 +1422,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_143 < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if !hasConst?(PBTypes,:GRASS) || target.pbHasType?(:GRASS) || !target.canChangeType?
|
||||
if !GameData::Type.exists?(:GRASS) || target.pbHasType?(:GRASS) || !target.canChangeType?
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1432,9 +1430,8 @@ class PokeBattle_Move_143 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
grassType = getConst(PBTypes,:GRASS)
|
||||
target.effects[PBEffects::Type3] = grassType
|
||||
typeName = PBTypes.getName(grassType)
|
||||
target.effects[PBEffects::Type3] = :GRASS
|
||||
typeName = GameData::Type.get(:GRASS).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",target.pbThis,typeName))
|
||||
end
|
||||
end
|
||||
@@ -1455,9 +1452,9 @@ class PokeBattle_Move_144 < PokeBattle_Move
|
||||
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
ret = super
|
||||
if hasConst?(PBTypes,:FLYING)
|
||||
flyingEff = PBTypes.getEffectiveness(getConst(PBTypes,:FLYING),defType)
|
||||
ret *= flyingEff.to_f/PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
if GameData::Type.exists?(:FLYING)
|
||||
flyingEff = PBTypes.getEffectiveness(:FLYING, defType)
|
||||
ret *= flyingEff.to_f / PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -2254,7 +2251,7 @@ end
|
||||
class PokeBattle_Move_169 < PokeBattle_Move
|
||||
def pbBaseType(user)
|
||||
userTypes = user.pbTypes(true)
|
||||
return (userTypes.length==0) ? -1 : userTypes[0]
|
||||
return userTypes[0]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -347,11 +347,11 @@ class PokeBattle_Battle
|
||||
end
|
||||
# Entry hazards
|
||||
# Stealth Rock
|
||||
if battler.pbOwnSide.effects[PBEffects::StealthRock] && battler.takesIndirectDamage?
|
||||
aType = getConst(PBTypes,:ROCK) || 0
|
||||
if battler.pbOwnSide.effects[PBEffects::StealthRock] && battler.takesIndirectDamage? &&
|
||||
GameData::Type.exists?(:ROCK)
|
||||
bTypes = battler.pbTypes(true)
|
||||
eff = PBTypes.getCombinedEffectiveness(aType,bTypes[0],bTypes[1],bTypes[2])
|
||||
if !PBTypes.ineffective?(eff)
|
||||
eff = PBTypes.getCombinedEffectiveness(:ROCK, bTypes[0], bTypes[1], bTypes[2])
|
||||
if !PBTypeEffectiveness.ineffective?(eff)
|
||||
eff = eff.to_f/PBTypeEffectiveness::NORMAL_EFFECTIVE
|
||||
oldHP = battler.hp
|
||||
battler.pbReduceHP(battler.totalhp*eff/8,false)
|
||||
|
||||
@@ -22,7 +22,7 @@ class PokeBattle_AI
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
moveType = moveData.type
|
||||
typeMod = pbCalcTypeMod(moveType,target,battler)
|
||||
if PBTypes.superEffective?(typeMod) && moveData.base_damage > 50
|
||||
if PBTypeEffectiveness.superEffective?(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 && PBTypes.ineffective?(pbCalcTypeMod(moveType,battler,battler))
|
||||
if moveType>=0 && PBTypeEffectiveness.ineffective?(pbCalcTypeMod(moveType,battler,battler))
|
||||
weight = 65
|
||||
typeMod = pbCalcTypeModPokemon(pkmn,battler.pbDirectOpposing(true))
|
||||
if PBTypes.superEffective?(typeMod.to_f/PBTypeEffectivenesss::NORMAL_EFFECTIVE)
|
||||
if PBTypeEffectiveness.superEffective?(typeMod.to_f/PBTypeEffectivenesss::NORMAL_EFFECTIVE)
|
||||
# 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 && PBTypes.resistant?(pbCalcTypeMod(moveType,battler,battler))
|
||||
elsif moveType>=0 && PBTypeEffectiveness.resistant?(pbCalcTypeMod(moveType,battler,battler))
|
||||
weight = 40
|
||||
typeMod = pbCalcTypeModPokemon(pkmn,battler.pbDirectOpposing(true))
|
||||
if PBTypes.superEffective?(typeMod.to_f/PBTypeEffectivenesss::NORMAL_EFFECTIVE)
|
||||
if PBTypeEffectiveness.superEffective?(typeMod.to_f/PBTypeEffectivenesss::NORMAL_EFFECTIVE)
|
||||
# Greater weight if new Pokemon's type is effective against target
|
||||
weight = 60
|
||||
end
|
||||
|
||||
@@ -71,7 +71,7 @@ class PokeBattle_AI
|
||||
if target.pbCanParalyze?(user,false) &&
|
||||
!(skill>=PBTrainerAI.mediumSkill &&
|
||||
move.id == :THUNDERWAVE &&
|
||||
PBTypes.ineffective?(pbCalcTypeMod(move.type,user,target)))
|
||||
PBTypeEffectiveness.ineffective?(pbCalcTypeMod(move.type,user,target)))
|
||||
score += 30
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
aspeed = pbRoughStat(user,PBStats::SPEED,skill)
|
||||
@@ -323,7 +323,7 @@ class PokeBattle_AI
|
||||
when "021"
|
||||
foundMove = false
|
||||
user.eachMove do |m|
|
||||
next if !isConst?(m.type,PBTypes,:ELECTRIC) || !m.damagingMove?
|
||||
next if m.type != :ELECTRIC || !m.damagingMove?
|
||||
foundMove = true
|
||||
break
|
||||
end
|
||||
@@ -1280,7 +1280,7 @@ class PokeBattle_AI
|
||||
else
|
||||
lastMoveData = GameData::Move.get(target.lastRegularMoveUsed)
|
||||
if moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
lastMoveData.type == :SHADOW
|
||||
score -= 90
|
||||
end
|
||||
user.eachMove do |m|
|
||||
@@ -1301,7 +1301,7 @@ class PokeBattle_AI
|
||||
else
|
||||
lastMoveData = GameData::Move.get(target.lastRegularMoveUsed)
|
||||
if moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
lastMoveData.type == :SHADOW
|
||||
score -= 90
|
||||
end
|
||||
user.eachMove do |m|
|
||||
@@ -1328,23 +1328,23 @@ class PokeBattle_AI
|
||||
when "05F"
|
||||
if user.ability == :MULTITYPE || user.ability == :RKSSYSTEM
|
||||
score -= 90
|
||||
elsif !target.lastMoveUsed ||
|
||||
PBTypes.isPseudoType?(GameData::Move.get(target.lastMoveUsed).type)
|
||||
elsif !target.lastMoveUsed || GameData::Move.get(target.lastMoveUsed).pseudo_type
|
||||
score -= 90
|
||||
else
|
||||
aType = -1
|
||||
aType = nil
|
||||
target.eachMove do |m|
|
||||
next if m.id!=target.lastMoveUsed
|
||||
aType = m.pbCalcType(user)
|
||||
break
|
||||
end
|
||||
if aType<0
|
||||
if !aType
|
||||
score -= 90
|
||||
else
|
||||
types = []
|
||||
for i in 0..PBTypes.maxValue
|
||||
next if user.pbHasType?(i)
|
||||
types.push(i) if PBTypes.resistant?(aType,i)
|
||||
GameData::Type.each do |t|
|
||||
next if t.pseudo_type || user.pbHasType?(t.id) ||
|
||||
!PBTypes.resistant?(aType, t.id)
|
||||
types.push(t.id)
|
||||
end
|
||||
score -= 90 if types.length==0
|
||||
end
|
||||
@@ -1532,7 +1532,7 @@ class PokeBattle_AI
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
if moveData.base_damage > 0 &&
|
||||
(MOVE_CATEGORY_PER_MOVE && moveData.caegory == 1) ||
|
||||
(MOVE_CATEGORY_PER_MOVE && moveData.category == 1) ||
|
||||
(!MOVE_CATEGORY_PER_MOVE && !PBTypes.isSpecialType?(moveData.type))
|
||||
score -= 60
|
||||
end
|
||||
@@ -1780,7 +1780,7 @@ class PokeBattle_AI
|
||||
score += 60
|
||||
elsif moveData.category != 2 && # Damaging move
|
||||
moveData.target == PBTargets::NearOther &&
|
||||
PBTypes.ineffective?(pbCalcTypeMod(moveData.type, target, user))
|
||||
PBTypeEffectiveness.ineffective?(pbCalcTypeMod(moveData.type, target, user))
|
||||
score += 60
|
||||
end
|
||||
end
|
||||
@@ -2147,7 +2147,7 @@ class PokeBattle_AI
|
||||
score -= 90
|
||||
else
|
||||
user.eachMove do |m|
|
||||
next if !m.damagingMove? || !isConst?(m.type,PBTypes,:FIRE)
|
||||
next if !m.damagingMove? || m.type != :FIRE
|
||||
score += 20
|
||||
end
|
||||
end
|
||||
@@ -2160,7 +2160,7 @@ class PokeBattle_AI
|
||||
score -= 90
|
||||
else
|
||||
user.eachMove do |m|
|
||||
next if !m.damagingMove? || !isConst?(m.type,PBTypes,:WATER)
|
||||
next if !m.damagingMove? || m.type != :WATER
|
||||
score += 20
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,30 +35,29 @@ class PokeBattle_AI
|
||||
end
|
||||
# Foresight
|
||||
if user.hasActiveAbility?(:SCRAPPY) || target.effects[PBEffects::Foresight]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:GHOST) &&
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
end
|
||||
# Miracle Eye
|
||||
if target.effects[PBEffects::MiracleEye]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:DARK) &&
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
end
|
||||
# Delta Stream's weather
|
||||
if @battle.pbWeather==PBWeather::StrongWinds
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:FLYING) &&
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
|
||||
PBTypes.superEffective?(moveType,defType)
|
||||
end
|
||||
# Grounded Flying-type Pokémon become susceptible to Ground moves
|
||||
if !target.airborne?
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:FLYING) &&
|
||||
isConst?(moveType,PBTypes,:GROUND)
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(moveType,user,target)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType<0
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if isConst?(moveType,PBTypes,:GROUND) &&
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
|
||||
target.pbHasType?(:FLYING) && target.hasActiveItem?(:IRONBALL)
|
||||
# Determine types
|
||||
tTypes = target.pbTypes(true)
|
||||
@@ -91,21 +90,22 @@ class PokeBattle_AI
|
||||
type = pbRoughType(move,user,skill)
|
||||
typeMod = pbCalcTypeMod(type,user,target)
|
||||
# Type effectiveness
|
||||
return true if PBTypes.ineffective?(typeMod) || score<=0
|
||||
return true if PBTypeEffectiveness.ineffective?(typeMod) || score<=0
|
||||
# Immunity due to ability/item/other effects
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
if isConst?(move.type,PBTypes,:GROUND)
|
||||
case move.type
|
||||
when :GROUND
|
||||
return true if target.airborne? && !move.hitsFlyingTargets?
|
||||
elsif isConst?(move.type,PBTypes,:FIRE)
|
||||
when :FIRE
|
||||
return true if target.hasActiveAbility?(:FLASHFIRE)
|
||||
elsif isConst?(move.type,PBTypes,:WATER)
|
||||
when :WATER
|
||||
return true if target.hasActiveAbility?([:DRYSKIN,:STORMDRAIN,:WATERABSORB])
|
||||
elsif isConst?(move.type,PBTypes,:GRASS)
|
||||
when :GRASS
|
||||
return true if target.hasActiveAbility?(:SAPSIPPER)
|
||||
elsif isConst?(move.type,PBTypes,:ELECTRIC)
|
||||
when :ELECTRIC
|
||||
return true if target.hasActiveAbility?([:LIGHTNINGROD,:MOTORDRIVE,:VOLTABSORB])
|
||||
end
|
||||
return true if PBTypes.notVeryEffective?(typeMod) &&
|
||||
return true if PBTypeEffectiveness.notVeryEffective?(typeMod) &&
|
||||
target.hasActiveAbility?(:WONDERGUARD)
|
||||
return true if move.damagingMove? && user.index!=target.index && !target.opposes?(user) &&
|
||||
target.hasActiveAbility?(:TELEPATHY)
|
||||
@@ -227,15 +227,14 @@ class PokeBattle_AI
|
||||
when "0E1" # Final Gambit
|
||||
baseDmg = user.hp
|
||||
when "144" # Flying Press
|
||||
type = getConst(PBTypes,:FLYING) || -1
|
||||
if type>=0
|
||||
if GameData::Type.exists?(:FLYING)
|
||||
if skill>=PBTrainerAI.highSkill
|
||||
targetTypes = target.pbTypes(true)
|
||||
mult = PBTypes.getCombinedEffectiveness(type,
|
||||
mult = PBTypes.getCombinedEffectiveness(:FLYING,
|
||||
targetTypes[0],targetTypes[1],targetTypes[2])
|
||||
baseDmg = (baseDmg.to_f*mult/PBTypeEffectiveness::NORMAL_EFFECTIVE).round
|
||||
else
|
||||
mult = PBTypes.getCombinedEffectiveness(type,
|
||||
mult = PBTypes.getCombinedEffectiveness(:FLYING,
|
||||
target.type1,target.type2,target.effects[PBEffects::Type3])
|
||||
baseDmg = (baseDmg.to_f*mult/PBTypeEffectiveness::NORMAL_EFFECTIVE).round
|
||||
end
|
||||
@@ -347,8 +346,8 @@ class PokeBattle_AI
|
||||
end
|
||||
# Global abilities
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
if (@battle.pbCheckGlobalAbility(:DARKAURA) && isConst?(type,PBTypes,:DARK)) ||
|
||||
(@battle.pbCheckGlobalAbility(:FAIRYAURA) && isConst?(type,PBTypes,:FAIRY))
|
||||
if (@battle.pbCheckGlobalAbility(:DARKAURA) && type == :DARK) ||
|
||||
(@battle.pbCheckGlobalAbility(:FAIRYAURA) && type == :FAIRY)
|
||||
if @battle.pbCheckGlobalAbility(:AURABREAK)
|
||||
multipliers[BASE_DMG_MULT] *= 2/3
|
||||
else
|
||||
@@ -365,13 +364,13 @@ class PokeBattle_AI
|
||||
# Helping Hand - n/a
|
||||
# Charge
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
if user.effects[PBEffects::Charge]>0 && isConst?(type,PBTypes,:ELECTRIC)
|
||||
if user.effects[PBEffects::Charge]>0 && type == :ELECTRIC
|
||||
multipliers[BASE_DMG_MULT] *= 2
|
||||
end
|
||||
end
|
||||
# Mud Sport and Water Sport
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
if isConst?(type,PBTypes,:ELECTRIC)
|
||||
if type == :ELECTRIC
|
||||
@battle.eachBattler do |b|
|
||||
next if !b.effects[PBEffects::MudSport]
|
||||
multipliers[BASE_DMG_MULT] /= 3
|
||||
@@ -381,7 +380,7 @@ class PokeBattle_AI
|
||||
multipliers[BASE_DMG_MULT] /= 3
|
||||
end
|
||||
end
|
||||
if isConst?(type,PBTypes,:FIRE)
|
||||
if type == :FIRE
|
||||
@battle.eachBattler do |b|
|
||||
next if !b.effects[PBEffects::WaterSport]
|
||||
multipliers[BASE_DMG_MULT] /= 3
|
||||
@@ -396,21 +395,15 @@ class PokeBattle_AI
|
||||
if user.affectedByTerrain? && skill>=PBTrainerAI.mediumSkill
|
||||
case @battle.field.terrain
|
||||
when PBBattleTerrains::Electric
|
||||
if isConst?(type,PBTypes,:ELECTRIC)
|
||||
multipliers[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
multipliers[BASE_DMG_MULT] *= 1.5 if type == :ELECTRIC
|
||||
when PBBattleTerrains::Grassy
|
||||
if isConst?(type,PBTypes,:GRASS)
|
||||
multipliers[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
multipliers[BASE_DMG_MULT] *= 1.5 if type == :GRASS
|
||||
when PBBattleTerrains::Psychic
|
||||
if isConst?(type,PBTypes,:PSYCHIC)
|
||||
multipliers[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
multipliers[BASE_DMG_MULT] *= 1.5 if type == :PSYCHIC
|
||||
end
|
||||
end
|
||||
if target.affectedByTerrain? && skill>=PBTrainerAI.mediumSkill
|
||||
if @battle.field.terrain==PBBattleTerrains::Misty && isConst?(type,PBTypes,:DRAGON)
|
||||
if @battle.field.terrain==PBBattleTerrains::Misty && type == :DRAGON
|
||||
multipliers[BASE_DMG_MULT] /= 2
|
||||
end
|
||||
end
|
||||
@@ -438,15 +431,15 @@ class PokeBattle_AI
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
case @battle.pbWeather
|
||||
when PBWeather::Sun, PBWeather::HarshSun
|
||||
if isConst?(type,PBTypes,:FIRE)
|
||||
if type == :FIRE
|
||||
multipliers[FINAL_DMG_MULT] *= 1.5
|
||||
elsif isConst?(type,PBTypes,:WATER)
|
||||
elsif type == :WATER
|
||||
multipliers[FINAL_DMG_MULT] /= 2
|
||||
end
|
||||
when PBWeather::Rain, PBWeather::HeavyRain
|
||||
if isConst?(type,PBTypes,:FIRE)
|
||||
if type == :FIRE
|
||||
multipliers[FINAL_DMG_MULT] /= 2
|
||||
elsif isConst?(type,PBTypes,:WATER)
|
||||
elsif type == :WATER
|
||||
multipliers[FINAL_DMG_MULT] *= 1.5
|
||||
end
|
||||
when PBWeather::Sandstorm
|
||||
@@ -459,7 +452,7 @@ class PokeBattle_AI
|
||||
# Random variance - n/a
|
||||
# STAB
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
if type>=0 && user.pbHasType?(type)
|
||||
if type && user.pbHasType?(type)
|
||||
if user.hasActiveAbility?(:ADAPTABILITY)
|
||||
multipliers[FINAL_DMG_MULT] *= 2
|
||||
else
|
||||
@@ -547,7 +540,7 @@ class PokeBattle_AI
|
||||
if c>=0
|
||||
c += 1 if move.highCriticalRate?
|
||||
c += user.effects[PBEffects::FocusEnergy]
|
||||
c += 1 if user.inHyperMode? && isConst?(move.type,PBTypes,:SHADOW)
|
||||
c += 1 if user.inHyperMode? && move.type == :SHADOW
|
||||
end
|
||||
if c>=0
|
||||
c = 4 if c>4
|
||||
|
||||
@@ -384,7 +384,7 @@ class FightMenuDisplay < BattleMenuBase
|
||||
def refreshMoveData(move)
|
||||
# Write PP and type of the selected move
|
||||
if !USE_GRAPHICS
|
||||
moveType = PBTypes.getName(move.type)
|
||||
moveType = GameData::Type.get(move.type).name
|
||||
if move.total_pp<=0
|
||||
@msgBox.text = _INTL("PP: ---<br>TYPE/{1}",moveType)
|
||||
else
|
||||
@@ -400,7 +400,8 @@ class FightMenuDisplay < BattleMenuBase
|
||||
end
|
||||
@visibility["typeIcon"] = true
|
||||
# Type icon
|
||||
@typeIcon.src_rect.y = move.type*TYPE_ICON_HEIGHT
|
||||
type_number = GameData::Type.get(move.type).id_number
|
||||
@typeIcon.src_rect.y = type_number * TYPE_ICON_HEIGHT
|
||||
# PP text
|
||||
if move.total_pp>0
|
||||
ppFraction = [(4.0*move.pp/move.total_pp).ceil,3].min
|
||||
|
||||
@@ -4,7 +4,7 @@ class PokeBattle_Scene
|
||||
# Return values: -1=Cancel, 0=Fight, 1=Bag, 2=Pokémon, 3=Run, 4=Call
|
||||
#=============================================================================
|
||||
def pbCommandMenu(idxBattler,firstAction)
|
||||
shadowTrainer = (hasConst?(PBTypes,:SHADOW) && @battle.trainerBattle?)
|
||||
shadowTrainer = (GameData::Type.exists?(:SHADOW) && @battle.trainerBattle?)
|
||||
cmds = [
|
||||
_INTL("What will\n{1} do?",@battle.battlers[idxBattler].name),
|
||||
_INTL("Fight"),
|
||||
|
||||
@@ -437,20 +437,17 @@ class PokeBattle_Scene
|
||||
:DARK => [:PURSUIT, :DARKPULSE, :HONECLAWS, nil, :SNARL, :EMBARGO],
|
||||
:FAIRY => [:TACKLE, :FAIRYWIND, :MOONLIGHT, nil, :SWIFT, :SWEETKISS]
|
||||
}
|
||||
typeDefaultAnim.each do |type, anims|
|
||||
next if !isConst?(moveType, PBTypes, type)
|
||||
if typeDefaultAnim[moveType]
|
||||
anims = typeDefaultAnim[moveType]
|
||||
if GameData::Move.exists?(anims[moveKind])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind], idxUser)
|
||||
end
|
||||
break if anim
|
||||
if moveKind >= 3 && GameData::Move.exists?(anims[moveKind - 3])
|
||||
if !anim && moveKind >= 3 && GameData::Move.exists?(anims[moveKind - 3])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind - 3], idxUser)
|
||||
end
|
||||
break if anim
|
||||
if GameData::Move.exists?(anims[2])
|
||||
if !anim && GameData::Move.exists?(anims[2])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[2], idxUser)
|
||||
end
|
||||
break
|
||||
end
|
||||
return anim if anim
|
||||
# Default animation for the move's type not found, use Tackle's animation
|
||||
|
||||
@@ -528,7 +528,7 @@ end
|
||||
# one of the ability's bearer's stats instead.
|
||||
def pbBattleMoveImmunityStatAbility(user,target,move,moveType,immuneType,stat,increment,battle)
|
||||
return false if user.index==target.index
|
||||
return false if !isConst?(moveType,PBTypes,immuneType)
|
||||
return false if moveType != immuneType
|
||||
battle.pbShowAbilitySplash(target)
|
||||
if target.pbCanRaiseStatStage?(stat,target)
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
@@ -552,7 +552,7 @@ end
|
||||
# ability's bearer by 1/4 of its total HP instead.
|
||||
def pbBattleMoveImmunityHealAbility(user,target,move,moveType,immuneType,battle)
|
||||
return false if user.index==target.index
|
||||
return false if !isConst?(moveType,PBTypes,immuneType)
|
||||
return false if moveType != immuneType
|
||||
battle.pbShowAbilitySplash(target)
|
||||
if target.canHeal? && target.pbRecoverHP(target.totalhp/4)>0
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
@@ -575,7 +575,7 @@ end
|
||||
def pbBattleGem(user,type,move,mults,moveType)
|
||||
# Pledge moves never consume Gems
|
||||
return if move.is_a?(PokeBattle_PledgeMove)
|
||||
return if !isConst?(moveType,PBTypes,type)
|
||||
return if moveType != type
|
||||
user.effects[PBEffects::GemConsumed] = user.item_id
|
||||
if NEWEST_BATTLE_MECHANICS
|
||||
mults[BASE_DMG_MULT] *= 1.3
|
||||
@@ -585,8 +585,8 @@ def pbBattleGem(user,type,move,mults,moveType)
|
||||
end
|
||||
|
||||
def pbBattleTypeWeakingBerry(type,moveType,target,mults)
|
||||
return if !isConst?(moveType,PBTypes,type)
|
||||
return if PBTypes.resistant?(target.damageState.typeMod) && !isConst?(moveType,PBTypes,:NORMAL)
|
||||
return if moveType != type
|
||||
return if PBTypeEffectiveness.resistant?(target.damageState.typeMod) && moveType != :NORMAL
|
||||
mults[FINAL_DMG_MULT] /= 2
|
||||
target.damageState.berryWeakened = true
|
||||
target.battle.pbCommonAnimation("EatBerry",target)
|
||||
|
||||
@@ -519,7 +519,7 @@ BattleHandlers::AbilityOnStatLoss.add(:DEFIANT,
|
||||
|
||||
BattleHandlers::PriorityChangeAbility.add(:GALEWINGS,
|
||||
proc { |ability,battler,move,pri|
|
||||
next pri+1 if battler.hp==battler.totalhp && isConst?(move.type,PBTypes,:FLYING)
|
||||
next pri+1 if battler.hp==battler.totalhp && move.type == :FLYING
|
||||
}
|
||||
)
|
||||
|
||||
@@ -605,7 +605,7 @@ BattleHandlers::MoveImmunityTargetAbility.add(:BULLETPROOF,
|
||||
BattleHandlers::MoveImmunityTargetAbility.add(:FLASHFIRE,
|
||||
proc { |ability,user,target,move,type,battle|
|
||||
next false if user.index==target.index
|
||||
next false if !isConst?(type,PBTypes,:FIRE)
|
||||
next false if type != :FIRE
|
||||
battle.pbShowAbilitySplash(target)
|
||||
if !target.effects[PBEffects::FlashFire]
|
||||
target.effects[PBEffects::FlashFire] = true
|
||||
@@ -700,7 +700,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<0 || PBTypes.superEffective?(target.damageState.typeMod)
|
||||
next false if !type || PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
battle.pbShowAbilitySplash(target)
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
|
||||
@@ -718,47 +718,47 @@ BattleHandlers::MoveImmunityTargetAbility.add(:WONDERGUARD,
|
||||
|
||||
BattleHandlers::MoveBaseTypeModifierAbility.add(:AERILATE,
|
||||
proc { |ability,user,move,type|
|
||||
next if !isConst?(type,PBTypes,:NORMAL) || !hasConst?(PBTypes,:FLYING)
|
||||
next if type != :NORMAL || !GameData::Type.exists?(:FLYING)
|
||||
move.powerBoost = true
|
||||
next getConst(PBTypes,:FLYING)
|
||||
next :FLYING
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::MoveBaseTypeModifierAbility.add(:GALVANIZE,
|
||||
proc { |ability,user,move,type|
|
||||
next if !isConst?(type,PBTypes,:NORMAL) || !hasConst?(PBTypes,:ELECTRIC)
|
||||
next if type != :NORMAL || !GameData::Type.exists?(:ELECTRIC)
|
||||
move.powerBoost = true
|
||||
next getConst(PBTypes,:ELECTRIC)
|
||||
next :ELECTRIC
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::MoveBaseTypeModifierAbility.add(:LIQUIDVOICE,
|
||||
proc { |ability,user,move,type|
|
||||
next getConst(PBTypes,:WATER) if hasConst?(PBTypes,:WATER) && move.soundMove?
|
||||
next :WATER if GameData::Type.exists?(:WATER) && move.soundMove?
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::MoveBaseTypeModifierAbility.add(:NORMALIZE,
|
||||
proc { |ability,user,move,type|
|
||||
next if !hasConst?(PBTypes,:NORMAL)
|
||||
next if !GameData::Type.exists?(:NORMAL)
|
||||
move.powerBoost = true if NEWEST_BATTLE_MECHANICS
|
||||
next getConst(PBTypes,:NORMAL)
|
||||
next :NORMAL
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::MoveBaseTypeModifierAbility.add(:PIXILATE,
|
||||
proc { |ability,user,move,type|
|
||||
next if !isConst?(type,PBTypes,:NORMAL) || !hasConst?(PBTypes,:FAIRY)
|
||||
next if type != :NORMAL || !GameData::Type.exists?(:FAIRY)
|
||||
move.powerBoost = true
|
||||
next getConst(PBTypes,:FAIRY)
|
||||
next :FAIRY
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::MoveBaseTypeModifierAbility.add(:REFRIGERATE,
|
||||
proc { |ability,user,move,type|
|
||||
next if !isConst?(type,PBTypes,:NORMAL) || !hasConst?(PBTypes,:ICE)
|
||||
next if type != :NORMAL || !GameData::Type.exists?(:ICE)
|
||||
move.powerBoost = true
|
||||
next getConst(PBTypes,:ICE)
|
||||
next :ICE
|
||||
}
|
||||
)
|
||||
|
||||
@@ -818,7 +818,7 @@ BattleHandlers::AccuracyCalcUserAllyAbility.add(:VICTORYSTAR,
|
||||
|
||||
BattleHandlers::AccuracyCalcTargetAbility.add(:LIGHTNINGROD,
|
||||
proc { |ability,mods,user,target,move,type|
|
||||
mods[BASE_ACC] = 0 if isConst?(type,PBTypes,:ELECTRIC)
|
||||
mods[BASE_ACC] = 0 if type == :ELECTRIC
|
||||
}
|
||||
)
|
||||
|
||||
@@ -846,7 +846,7 @@ BattleHandlers::AccuracyCalcTargetAbility.add(:SNOWCLOAK,
|
||||
|
||||
BattleHandlers::AccuracyCalcTargetAbility.add(:STORMDRAIN,
|
||||
proc { |ability,mods,user,target,move,type|
|
||||
mods[BASE_ACC] = 0 if isConst?(type,PBTypes,:WATER)
|
||||
mods[BASE_ACC] = 0 if type == :WATER
|
||||
}
|
||||
)
|
||||
|
||||
@@ -894,7 +894,7 @@ BattleHandlers::DamageCalcUserAbility.add(:ANALYTIC,
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:BLAZE,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if user.hp<=user.totalhp/3 && isConst?(type,PBTypes,:FIRE)
|
||||
if user.hp<=user.totalhp/3 && type == :FIRE
|
||||
mults[ATK_MULT] *= 1.5
|
||||
end
|
||||
}
|
||||
@@ -916,7 +916,7 @@ BattleHandlers::DamageCalcUserAbility.add(:FLAREBOOST,
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:FLASHFIRE,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if user.effects[PBEffects::FlashFire] && isConst?(type,PBTypes,:FIRE)
|
||||
if user.effects[PBEffects::FlashFire] && type == :FIRE
|
||||
mults[ATK_MULT] *= 1.5
|
||||
end
|
||||
}
|
||||
@@ -980,7 +980,7 @@ BattleHandlers::DamageCalcUserAbility.copy(:MINUS,:PLUS)
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:NEUROFORCE,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if PBTypes.superEffective?(target.damageState.typeMod)
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
mults[FINAL_DMG_MULT] *= 1.25
|
||||
end
|
||||
}
|
||||
@@ -988,7 +988,7 @@ BattleHandlers::DamageCalcUserAbility.add(:NEUROFORCE,
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:OVERGROW,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if user.hp<=user.totalhp/3 && isConst?(type,PBTypes,:GRASS)
|
||||
if user.hp<=user.totalhp/3 && type == :GRASS
|
||||
mults[ATK_MULT] *= 1.5
|
||||
end
|
||||
}
|
||||
@@ -1015,9 +1015,7 @@ BattleHandlers::DamageCalcUserAbility.add(:RIVALRY,
|
||||
BattleHandlers::DamageCalcUserAbility.add(:SANDFORCE,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if user.battle.pbWeather==PBWeather::Sandstorm &&
|
||||
(isConst?(type,PBTypes,:ROCK) ||
|
||||
isConst?(type,PBTypes,:GROUND) ||
|
||||
isConst?(type,PBTypes,:STEEL))
|
||||
[:ROCK, :GROUND, :STEEL].include?(type)
|
||||
mults[BASE_DMG_MULT] *= 1.3
|
||||
end
|
||||
}
|
||||
@@ -1060,7 +1058,7 @@ BattleHandlers::DamageCalcUserAbility.add(:STAKEOUT,
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:STEELWORKER,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
mults[ATK_MULT] *= 1.5 if isConst?(type,PBTypes,:STEEL)
|
||||
mults[ATK_MULT] *= 1.5 if type == :STEEL
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1072,7 +1070,7 @@ BattleHandlers::DamageCalcUserAbility.add(:STRONGJAW,
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:SWARM,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if user.hp<=user.totalhp/3 && isConst?(type,PBTypes,:BUG)
|
||||
if user.hp<=user.totalhp/3 && type == :BUG
|
||||
mults[ATK_MULT] *= 1.5
|
||||
end
|
||||
}
|
||||
@@ -1089,13 +1087,13 @@ BattleHandlers::DamageCalcUserAbility.add(:TECHNICIAN,
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:TINTEDLENS,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
mults[FINAL_DMG_MULT] *= 2 if PBTypes.resistant?(target.damageState.typeMod)
|
||||
mults[FINAL_DMG_MULT] *= 2 if PBTypeEffectiveness.resistant?(target.damageState.typeMod)
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:TORRENT,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if user.hp<=user.totalhp/3 && isConst?(type,PBTypes,:WATER)
|
||||
if user.hp<=user.totalhp/3 && type == :WATER
|
||||
mults[ATK_MULT] *= 1.5
|
||||
end
|
||||
}
|
||||
@@ -1117,7 +1115,7 @@ BattleHandlers::DamageCalcUserAbility.add(:TOXICBOOST,
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:WATERBUBBLE,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
mults[ATK_MULT] *= 2 if isConst?(type,PBTypes,:WATER)
|
||||
mults[ATK_MULT] *= 2 if type == :WATER
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1147,15 +1145,13 @@ BattleHandlers::DamageCalcUserAllyAbility.add(:FLOWERGIFT,
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbility.add(:DRYSKIN,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if isConst?(type,PBTypes,:FIRE)
|
||||
mults[BASE_DMG_MULT] *= 1.25
|
||||
end
|
||||
mults[BASE_DMG_MULT] *= 1.25 if type == :FIRE
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbility.add(:FILTER,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if PBTypes.superEffective?(target.damageState.typeMod)
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
mults[FINAL_DMG_MULT] *= 0.75
|
||||
end
|
||||
}
|
||||
@@ -1174,7 +1170,7 @@ BattleHandlers::DamageCalcTargetAbility.add(:FLOWERGIFT,
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbility.add(:FLUFFY,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
mults[FINAL_DMG_MULT] *= 2 if isConst?(move.calcType,PBTypes,:FIRE)
|
||||
mults[FINAL_DMG_MULT] *= 2 if move.calcType == :FIRE
|
||||
mults[FINAL_DMG_MULT] /= 2 if move.contactMove?
|
||||
}
|
||||
)
|
||||
@@ -1195,7 +1191,7 @@ BattleHandlers::DamageCalcTargetAbility.add(:GRASSPELT,
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbility.add(:HEATPROOF,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] /= 2 if isConst?(type,PBTypes,:FIRE)
|
||||
mults[BASE_DMG_MULT] /= 2 if type == :FIRE
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1209,25 +1205,19 @@ BattleHandlers::DamageCalcTargetAbility.add(:MARVELSCALE,
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbility.add(:MULTISCALE,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if target.hp==target.totalhp
|
||||
mults[FINAL_DMG_MULT] /= 2
|
||||
end
|
||||
mults[FINAL_DMG_MULT] /= 2 if target.hp==target.totalhp
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbility.add(:THICKFAT,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if isConst?(type,PBTypes,:FIRE) || isConst?(type,PBTypes,:ICE)
|
||||
mults[BASE_DMG_MULT] /= 2
|
||||
end
|
||||
mults[BASE_DMG_MULT] /= 2 if type == :FIRE || type == :ICE
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbility.add(:WATERBUBBLE,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if isConst?(type,PBTypes,:FIRE)
|
||||
mults[FINAL_DMG_MULT] /= 2
|
||||
end
|
||||
mults[FINAL_DMG_MULT] /= 2 if type == :FIRE
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1237,7 +1227,7 @@ BattleHandlers::DamageCalcTargetAbility.add(:WATERBUBBLE,
|
||||
|
||||
BattleHandlers::DamageCalcTargetAbilityNonIgnorable.add(:PRISMARMOR,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if PBTypes.superEffective?(target.damageState.typeMod)
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
mults[FINAL_DMG_MULT] *= 0.75
|
||||
end
|
||||
}
|
||||
@@ -1523,7 +1513,7 @@ BattleHandlers::TargetAbilityOnHit.copy(:IRONBARBS,:ROUGHSKIN)
|
||||
|
||||
BattleHandlers::TargetAbilityOnHit.add(:JUSTIFIED,
|
||||
proc { |ability,user,target,move,battle|
|
||||
next if !isConst?(move.calcType,PBTypes,:DARK)
|
||||
next if move.calcType != :DARK
|
||||
target.pbRaiseStatStageByAbility(PBStats::ATTACK,1,target)
|
||||
}
|
||||
)
|
||||
@@ -1572,9 +1562,7 @@ BattleHandlers::TargetAbilityOnHit.add(:POISONPOINT,
|
||||
|
||||
BattleHandlers::TargetAbilityOnHit.add(:RATTLED,
|
||||
proc { |ability,user,target,move,battle|
|
||||
next if !isConst?(move.calcType,PBTypes,:BUG) &&
|
||||
!isConst?(move.calcType,PBTypes,:DARK) &&
|
||||
!isConst?(move.calcType,PBTypes,:GHOST)
|
||||
next if ![:BUG, :DARK, :GHOST].include?(move.calcType)
|
||||
target.pbRaiseStatStageByAbility(PBStats::SPEED,1,target)
|
||||
}
|
||||
)
|
||||
@@ -1605,7 +1593,7 @@ BattleHandlers::TargetAbilityOnHit.add(:STATIC,
|
||||
|
||||
BattleHandlers::TargetAbilityOnHit.add(:WATERCOMPACTION,
|
||||
proc { |ability,user,target,move,battle|
|
||||
next if !isConst?(move.calcType,PBTypes,:WATER)
|
||||
next if move.calcType != :WATER
|
||||
target.pbRaiseStatStageByAbility(PBStats::DEFENSE,2,target)
|
||||
}
|
||||
)
|
||||
@@ -1737,9 +1725,9 @@ 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<0 || PBTypes.isPseudoType?(move.calcType)
|
||||
next if !move.calcType || PBTypes.isPseudoType?(move.calcType)
|
||||
next if target.pbHasType?(move.calcType) && !target.pbHasOtherType?(move.calcType)
|
||||
typeName = PBTypes.getName(move.calcType)
|
||||
typeName = GameData::Type.get(move.calcType).name
|
||||
battle.pbShowAbilitySplash(target)
|
||||
target.pbChangeTypes(move.calcType)
|
||||
battle.pbDisplay(_INTL("{1}'s {2} made it the {3} type!",target.pbThis,
|
||||
@@ -2092,9 +2080,9 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
|
||||
proc { |ability,battler,battle|
|
||||
next if !battler.pbOwnedByPlayer?
|
||||
battlerTypes = battler.pbTypes(true)
|
||||
type1 = (battlerTypes.length>0) ? battlerTypes[0] : nil
|
||||
type2 = (battlerTypes.length>1) ? battlerTypes[1] : type1
|
||||
type3 = (battlerTypes.length>2) ? battlerTypes[2] : type2
|
||||
type1 = battlerTypes[0]
|
||||
type2 = battlerTypes[1] || type1
|
||||
type3 = battlerTypes[2] || type2
|
||||
found = false
|
||||
battle.eachOtherSideBattler(battler.index) do |b|
|
||||
b.eachMove do |m|
|
||||
@@ -2105,8 +2093,8 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
|
||||
moveType = pbHiddenPower(b.pokemon)[0]
|
||||
end
|
||||
eff = PBTypes.getCombinedEffectiveness(moveType,type1,type2,type3)
|
||||
next if PBTypes.ineffective?(eff)
|
||||
next if !PBTypes.superEffective?(eff) && m.function != "070" # OHKO
|
||||
next if PBTypeEffectiveness.ineffective?(eff)
|
||||
next if !PBTypeEffectiveness.superEffective?(eff) && m.function != "070" # OHKO
|
||||
else
|
||||
next if m.function != "070" # OHKO
|
||||
end
|
||||
|
||||
@@ -446,8 +446,7 @@ BattleHandlers::AccuracyCalcTargetItem.copy(:BRIGHTPOWDER,:LAXINCENSE)
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:ADAMANTORB,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
if user.isSpecies?(:DIALGA) &&
|
||||
(isConst?(type,PBTypes,:DRAGON) || isConst?(type,PBTypes,:STEEL))
|
||||
if user.isSpecies?(:DIALGA) && (type == :DRAGON || type == :STEEL)
|
||||
mults[BASE_DMG_MULT] *= 1.2
|
||||
end
|
||||
}
|
||||
@@ -455,7 +454,7 @@ BattleHandlers::DamageCalcUserItem.add(:ADAMANTORB,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:BLACKBELT,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:FIGHTING)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :FIGHTING
|
||||
}
|
||||
)
|
||||
|
||||
@@ -463,7 +462,7 @@ BattleHandlers::DamageCalcUserItem.copy(:BLACKBELT,:FISTPLATE)
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:BLACKGLASSES,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:DARK)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :DARK
|
||||
}
|
||||
)
|
||||
|
||||
@@ -477,7 +476,7 @@ BattleHandlers::DamageCalcUserItem.add(:BUGGEM,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:CHARCOAL,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:FIRE)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :FIRE
|
||||
}
|
||||
)
|
||||
|
||||
@@ -511,7 +510,7 @@ BattleHandlers::DamageCalcUserItem.add(:DEEPSEATOOTH,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:DRAGONFANG,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:DRAGON)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :DRAGON
|
||||
}
|
||||
)
|
||||
|
||||
@@ -531,7 +530,7 @@ BattleHandlers::DamageCalcUserItem.add(:ELECTRICGEM,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:EXPERTBELT,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
if PBTypes.superEffective?(target.damageState.typeMod)
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
mults[FINAL_DMG_MULT] *= 1.2
|
||||
end
|
||||
}
|
||||
@@ -575,8 +574,7 @@ BattleHandlers::DamageCalcUserItem.add(:GRASSGEM,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:GRISEOUSORB,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
if user.isSpecies?(:GIRATINA) &&
|
||||
(isConst?(type,PBTypes,:DRAGON) || isConst?(type,PBTypes,:GHOST))
|
||||
if user.isSpecies?(:GIRATINA) && (type == :DRAGON || type == :GHOST)
|
||||
mults[BASE_DMG_MULT] *= 1.2
|
||||
end
|
||||
}
|
||||
@@ -590,7 +588,7 @@ BattleHandlers::DamageCalcUserItem.add(:GROUNDGEM,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:HARDSTONE,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:ROCK)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :ROCK
|
||||
}
|
||||
)
|
||||
|
||||
@@ -620,8 +618,7 @@ BattleHandlers::DamageCalcUserItem.add(:LIGHTBALL,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:LUSTROUSORB,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
if user.isSpecies?(:PALKIA) &&
|
||||
(isConst?(type,PBTypes,:DRAGON) || isConst?(type,PBTypes,:WATER))
|
||||
if user.isSpecies?(:PALKIA) && (type == :DRAGON || type == :WATER)
|
||||
mults[BASE_DMG_MULT] *= 1.2
|
||||
end
|
||||
}
|
||||
@@ -629,7 +626,7 @@ BattleHandlers::DamageCalcUserItem.add(:LUSTROUSORB,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:MAGNET,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:ELECTRIC)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :ELECTRIC
|
||||
}
|
||||
)
|
||||
|
||||
@@ -637,7 +634,7 @@ BattleHandlers::DamageCalcUserItem.copy(:MAGNET,:ZAPPLATE)
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:METALCOAT,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:STEEL)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :STEEL
|
||||
}
|
||||
)
|
||||
|
||||
@@ -652,7 +649,7 @@ BattleHandlers::DamageCalcUserItem.add(:METRONOME,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:MIRACLESEED,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:GRASS)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :GRASS
|
||||
}
|
||||
)
|
||||
|
||||
@@ -666,7 +663,7 @@ BattleHandlers::DamageCalcUserItem.add(:MUSCLEBAND,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:MYSTICWATER,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:WATER)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :WATER
|
||||
}
|
||||
)
|
||||
|
||||
@@ -674,7 +671,7 @@ BattleHandlers::DamageCalcUserItem.copy(:MYSTICWATER,:SPLASHPLATE,:SEAINCENSE,:W
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:NEVERMELTICE,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:ICE)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :ICE
|
||||
}
|
||||
)
|
||||
|
||||
@@ -688,13 +685,13 @@ BattleHandlers::DamageCalcUserItem.add(:NORMALGEM,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:PIXIEPLATE,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:FAIRY)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :FAIRY
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:POISONBARB,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:POISON)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :POISON
|
||||
}
|
||||
)
|
||||
|
||||
@@ -720,7 +717,7 @@ BattleHandlers::DamageCalcUserItem.add(:ROCKGEM,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:SHARPBEAK,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:FLYING)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :FLYING
|
||||
}
|
||||
)
|
||||
|
||||
@@ -728,13 +725,13 @@ BattleHandlers::DamageCalcUserItem.copy(:SHARPBEAK,:SKYPLATE)
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:SILKSCARF,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:NORMAL)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :NORMAL
|
||||
}
|
||||
)
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:SILVERPOWDER,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:BUG)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :BUG
|
||||
}
|
||||
)
|
||||
|
||||
@@ -742,7 +739,7 @@ BattleHandlers::DamageCalcUserItem.copy(:SILVERPOWDER,:INSECTPLATE)
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:SOFTSAND,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:GROUND)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :GROUND
|
||||
}
|
||||
)
|
||||
|
||||
@@ -752,9 +749,7 @@ BattleHandlers::DamageCalcUserItem.add(:SOULDEW,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
next if !user.isSpecies?(:LATIAS) && !user.isSpecies?(:LATIOS)
|
||||
if NEWEST_BATTLE_MECHANICS
|
||||
if isConst?(type,PBTypes,:PSYCHIC) || isConst?(type,PBTypes,:DRAGON)
|
||||
mults[FINAL_DMG_MULT] *= 1.2
|
||||
end
|
||||
mults[FINAL_DMG_MULT] *= 1.2 if type == :PSYCHIC || type == :DRAGON
|
||||
else
|
||||
if move.specialMove? && !user.battle.rules["souldewclause"]
|
||||
mults[ATK_MULT] *= 1.5
|
||||
@@ -765,7 +760,7 @@ BattleHandlers::DamageCalcUserItem.add(:SOULDEW,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:SPELLTAG,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:GHOST)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :GHOST
|
||||
}
|
||||
)
|
||||
|
||||
@@ -787,7 +782,7 @@ BattleHandlers::DamageCalcUserItem.add(:THICKCLUB,
|
||||
|
||||
BattleHandlers::DamageCalcUserItem.add(:TWISTEDSPOON,
|
||||
proc { |item,user,target,move,mults,baseDmg,type|
|
||||
mults[BASE_DMG_MULT] *= 1.2 if isConst?(type,PBTypes,:PSYCHIC)
|
||||
mults[BASE_DMG_MULT] *= 1.2 if type == :PSYCHIC
|
||||
}
|
||||
)
|
||||
|
||||
@@ -999,7 +994,7 @@ BattleHandlers::CriticalCalcUserItem.add(:STICK,
|
||||
|
||||
BattleHandlers::TargetItemOnHit.add(:ABSORBBULB,
|
||||
proc { |item,user,target,move,battle|
|
||||
next if !isConst?(move.calcType,PBTypes,:WATER)
|
||||
next if move.calcType != :WATER
|
||||
next if !target.pbCanRaiseStatStage?(PBStats::SPATK,target)
|
||||
battle.pbCommonAnimation("UseItem",target)
|
||||
target.pbRaiseStatStageByCause(PBStats::SPATK,1,target,target.itemName)
|
||||
@@ -1017,7 +1012,7 @@ BattleHandlers::TargetItemOnHit.add(:AIRBALLOON,
|
||||
|
||||
BattleHandlers::TargetItemOnHit.add(:CELLBATTERY,
|
||||
proc { |item,user,target,move,battle|
|
||||
next if !isConst?(move.calcType,PBTypes,:ELECTRIC)
|
||||
next if move.calcType != :ELECTRIC
|
||||
next if !target.pbCanRaiseStatStage?(PBStats::ATTACK,target)
|
||||
battle.pbCommonAnimation("UseItem",target)
|
||||
target.pbRaiseStatStageByCause(PBStats::ATTACK,1,target,target.itemName)
|
||||
@@ -1028,7 +1023,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 !PBTypes.superEffective?(target.damageState.typeMod)
|
||||
next if !PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if BattleHandlers.triggerTargetItemOnHitPositiveBerry(item,target,battle,false)
|
||||
target.pbHeldItemTriggered(item)
|
||||
end
|
||||
@@ -1065,7 +1060,7 @@ BattleHandlers::TargetItemOnHit.add(:KEEBERRY,
|
||||
|
||||
BattleHandlers::TargetItemOnHit.add(:LUMINOUSMOSS,
|
||||
proc { |item,user,target,move,battle|
|
||||
next if !isConst?(move.calcType,PBTypes,:WATER)
|
||||
next if move.calcType != :WATER
|
||||
next if !target.pbCanRaiseStatStage?(PBStats::SPDEF,target)
|
||||
battle.pbCommonAnimation("UseItem",target)
|
||||
target.pbRaiseStatStageByCause(PBStats::SPDEF,1,target,target.itemName)
|
||||
@@ -1113,7 +1108,7 @@ BattleHandlers::TargetItemOnHit.add(:ROWAPBERRY,
|
||||
|
||||
BattleHandlers::TargetItemOnHit.add(:SNOWBALL,
|
||||
proc { |item,user,target,move,battle|
|
||||
next if !isConst?(move.calcType,PBTypes,:ICE)
|
||||
next if move.calcType != :ICE
|
||||
next if !target.pbCanRaiseStatStage?(PBStats::ATTACK,target)
|
||||
battle.pbCommonAnimation("UseItem",target)
|
||||
target.pbRaiseStatStageByCause(PBStats::ATTACK,1,target,target.itemName)
|
||||
@@ -1142,7 +1137,7 @@ BattleHandlers::TargetItemOnHit.add(:STICKYBARB,
|
||||
BattleHandlers::TargetItemOnHit.add(:WEAKNESSPOLICY,
|
||||
proc { |item,user,target,move,battle|
|
||||
next if target.damageState.disguise
|
||||
next if !PBTypes.superEffective?(target.damageState.typeMod)
|
||||
next if !PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
next if !target.pbCanRaiseStatStage?(PBStats::ATTACK,target) &&
|
||||
!target.pbCanRaiseStatStage?(PBStats::SPATK,target)
|
||||
battle.pbCommonAnimation("UseItem",target)
|
||||
|
||||
@@ -24,7 +24,7 @@ class PokeBattle_DamageState
|
||||
|
||||
def reset
|
||||
@initialHP = 0
|
||||
@typeMod = 0
|
||||
@typeMod = PBTypeEffectiveness::INEFFECTIVE
|
||||
@unaffected = false
|
||||
@protected = false
|
||||
@magicCoat = false
|
||||
@@ -73,10 +73,10 @@ class PokeBattle_SuccessState
|
||||
if @useState==1
|
||||
@skill = -2 if !@protected
|
||||
elsif @useState==2
|
||||
if PBTypes.superEffective?(@typeMod); @skill = 2
|
||||
elsif PBTypes.normalEffective?(@typeMod); @skill = 1
|
||||
elsif PBTypes.notVeryEffective?(@typeMod); @skill = -1
|
||||
else; @skill = -2 # Ineffective
|
||||
if PBTypeEffectiveness.superEffective?(@typeMod); @skill = 2
|
||||
elsif PBTypeEffectiveness.normalEffective?(@typeMod); @skill = 1
|
||||
elsif PBTypeEffectiveness.notVeryEffective?(@typeMod); @skill = -1
|
||||
else; @skill = -2 # Ineffective
|
||||
end
|
||||
end
|
||||
clear(false)
|
||||
|
||||
@@ -242,13 +242,13 @@ class PokemonEncounters
|
||||
# not have the type they favor. If none have that type, nothing is changed.
|
||||
firstPkmn = $Trainer.firstPokemon
|
||||
if firstPkmn && rand(100)<50 # 50% chance of happening
|
||||
favoredType = -1
|
||||
if firstPkmn.hasAbility?(:STATIC) && hasConst?(PBTypes,:ELECTRIC)
|
||||
favoredType = getConst(PBTypes,:ELECTRIC)
|
||||
elsif firstPkmn.hasAbility?(:MAGNETPULL) && hasConst?(PBTypes,:STEEL)
|
||||
favoredType = getConst(PBTypes,:STEEL)
|
||||
favoredType = nil
|
||||
if firstPkmn.hasAbility?(:STATIC) && GameData::Type.exists?(:ELECTRIC)
|
||||
favoredType = :ELECTRIC
|
||||
elsif firstPkmn.hasAbility?(:MAGNETPULL) && GameData::Type.exists?(:STEEL)
|
||||
favoredType = :STEEL
|
||||
end
|
||||
if favoredType>=0
|
||||
if favoredType
|
||||
newEncList = []
|
||||
newChances = []
|
||||
speciesData = pbLoadSpeciesData
|
||||
|
||||
@@ -481,14 +481,11 @@ class Pokemon
|
||||
return ret
|
||||
end
|
||||
|
||||
# @param type [Integer, Symbol, String] type to check (from PBTypes)
|
||||
# @param type [Integer, Symbol, String] type to check
|
||||
# @return [Boolean] whether this Pokémon has the specified type
|
||||
def hasType?(type)
|
||||
t = self.types
|
||||
if !type.is_a?(Integer)
|
||||
return t.any? { |tp| isConst?(tp, PBTypes, type) }
|
||||
end
|
||||
return t.any? { |tp| tp == type }
|
||||
type = GameData::Type.get(type).id
|
||||
return self.types.include?(type)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
|
||||
@@ -373,9 +373,9 @@ class PokeBattle_Battler
|
||||
__shadow__pbInitPokemon(*arg)
|
||||
# Called into battle
|
||||
if shadowPokemon?
|
||||
if hasConst?(PBTypes,:SHADOW)
|
||||
self.type1 = getID(PBTypes,:SHADOW)
|
||||
self.type2 = getID(PBTypes,:SHADOW)
|
||||
if GameData::Type.exists?(:SHADOW)
|
||||
self.type1 = :SHADOW
|
||||
self.type2 = :SHADOW
|
||||
end
|
||||
self.pokemon.adjustHeart(-30) if pbOwnedByPlayer?
|
||||
end
|
||||
@@ -404,7 +404,7 @@ class PokeBattle_Battler
|
||||
|
||||
def pbHyperModeObedience(move)
|
||||
return true if !inHyperMode?
|
||||
return true if !move || isConst?(move.type,PBTypes,:SHADOW)
|
||||
return true if !move || move.type == :SHADOW
|
||||
return rand(100)<20
|
||||
end
|
||||
end
|
||||
|
||||
@@ -503,7 +503,7 @@ PBEvolution.register(:HappinessMove, {
|
||||
|
||||
PBEvolution.register(:HappinessMoveType, {
|
||||
"minimumLevel" => 1, # Needs any level up
|
||||
"parameterType" => :PBTypes,
|
||||
"parameterType" => :Type,
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
if pkmn.happiness >= 220
|
||||
next pkmn.moves.any? { |m| m && m.id > 0 && m.type == parameter }
|
||||
@@ -627,7 +627,7 @@ PBEvolution.register(:HasMove, {
|
||||
|
||||
PBEvolution.register(:HasMoveType, {
|
||||
"minimumLevel" => 1, # Needs any level up
|
||||
"parameterType" => :PBTypes,
|
||||
"parameterType" => :Type,
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
next pkmn.moves.any? { |m| m && m.type == parameter }
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ class PokemonPokedex_Scene
|
||||
form = $Trainer.formlastseen[nationalSpecies][1] || 0
|
||||
fspecies = pbGetFSpeciesFromForm(nationalSpecies,form)
|
||||
color = speciesData[fspecies][SpeciesData::COLOR] || 0
|
||||
type1 = speciesData[fspecies][SpeciesData::TYPE1] || 0
|
||||
type1 = speciesData[fspecies][SpeciesData::TYPE1]
|
||||
type2 = speciesData[fspecies][SpeciesData::TYPE2] || type1
|
||||
shape = speciesData[fspecies][SpeciesData::SHAPE] || 0
|
||||
height = speciesData[fspecies][SpeciesData::HEIGHT] || 1
|
||||
@@ -466,13 +466,15 @@ class PokemonPokedex_Scene
|
||||
textpos.push([(params[8]<0) ? "----" : @colorCommands[params[8]],444,118,2,base,shadow,1])
|
||||
# Draw type icons
|
||||
if params[2]>=0
|
||||
typerect = Rect.new(0,@typeCommands[params[2]]*32,96,32)
|
||||
type_number = @typeCommands[params[2]].id_number
|
||||
typerect = Rect.new(0,type_number*32,96,32)
|
||||
overlay.blt(128,168,@typebitmap.bitmap,typerect)
|
||||
else
|
||||
textpos.push(["----",176,170,2,base,shadow,1])
|
||||
end
|
||||
if params[3]>=0
|
||||
typerect = Rect.new(0,@typeCommands[params[3]]*32,96,32)
|
||||
type_number = @typeCommands[params[3]].id_number
|
||||
typerect = Rect.new(0,type_number*32,96,32)
|
||||
overlay.blt(256,168,@typebitmap.bitmap,typerect)
|
||||
else
|
||||
textpos.push(["----",304,170,2,base,shadow,1])
|
||||
@@ -562,7 +564,8 @@ class PokemonPokedex_Scene
|
||||
if !sel[i] || sel[i]<0
|
||||
textpos.push(["----",298+128*i,58,2,base,shadow,1])
|
||||
else
|
||||
typerect = Rect.new(0,@typeCommands[sel[i]]*32,96,32)
|
||||
type_number = @typeCommands[sel[i]].id_number
|
||||
typerect = Rect.new(0,type_number*32,96,32)
|
||||
overlay.blt(250+128*i,58,@typebitmap.bitmap,typerect)
|
||||
end
|
||||
end
|
||||
@@ -658,7 +661,7 @@ class PokemonPokedex_Scene
|
||||
when 2 # Type
|
||||
typerect = Rect.new(0,0,96,32)
|
||||
for i in 0...cmds.length
|
||||
typerect.y = @typeCommands[i]*32
|
||||
typerect.y = @typeCommands[i].id_number*32
|
||||
overlay.blt(xstart+14+(i%cols)*xgap,ystart+6+(i/cols).floor*ygap,@typebitmap.bitmap,typerect)
|
||||
end
|
||||
textpos.push(["----",
|
||||
@@ -694,19 +697,19 @@ class PokemonPokedex_Scene
|
||||
end
|
||||
# Filter by type
|
||||
if params[2]>=0 || params[3]>=0
|
||||
stype1 = (params[2]>=0) ? @typeCommands[params[2]] : -1
|
||||
stype2 = (params[3]>=0) ? @typeCommands[params[3]] : -1
|
||||
stype1 = (params[2]>=0) ? @typeCommands[params[2]].id : nil
|
||||
stype2 = (params[3]>=0) ? @typeCommands[params[3]].id : nil
|
||||
dexlist = dexlist.find_all { |item|
|
||||
next false if !$Trainer.owned[item[0]]
|
||||
type1 = item[6]
|
||||
type2 = item[7]
|
||||
if stype1>=0 && stype2>=0
|
||||
if stype1 && stype2
|
||||
# Find species that match both types
|
||||
next (type1==stype1 && type2==stype2) || (type1==stype2 && type2==stype1)
|
||||
elsif stype1>=0
|
||||
elsif stype1
|
||||
# Find species that match first type entered
|
||||
next type1==stype1 || type2==stype1
|
||||
elsif stype2>=0
|
||||
elsif stype2
|
||||
# Find species that match second type entered
|
||||
next type1==stype2 || type2==stype2
|
||||
else
|
||||
@@ -1000,9 +1003,8 @@ class PokemonPokedex_Scene
|
||||
_INTL("U"),_INTL("V"),_INTL("W"),_INTL("X"),_INTL("Y"),
|
||||
_INTL("Z")]
|
||||
@typeCommands = []
|
||||
for i in 0..PBTypes.maxValue
|
||||
@typeCommands.push(i) if !PBTypes.isPseudoType?(i)
|
||||
end
|
||||
GameData::Type.each { |t| @typeCommands.push(t) if !t.pseudo_type }
|
||||
@typeCommands.sort! { |a, b| a.id_number <=> b.id_number }
|
||||
@heightCommands = [1,2,3,4,5,6,7,8,9,10,
|
||||
11,12,13,14,15,16,17,18,19,20,
|
||||
21,22,23,24,25,30,35,40,45,50,
|
||||
|
||||
@@ -273,10 +273,12 @@ class PokemonPokedexInfo_Scene
|
||||
# Show the owned icon
|
||||
imagepos.push(["Graphics/Pictures/Pokedex/icon_own",212,44])
|
||||
# Draw the type icon(s)
|
||||
type1 = speciesData[SpeciesData::TYPE1] || 0
|
||||
type1 = speciesData[SpeciesData::TYPE1]
|
||||
type2 = speciesData[SpeciesData::TYPE2] || type1
|
||||
type1rect = Rect.new(0,type1*32,96,32)
|
||||
type2rect = Rect.new(0,type2*32,96,32)
|
||||
type1_number = GameData::Type.get(type1).id_number
|
||||
type2_number = GameData::Type.get(type2).id_number
|
||||
type1rect = Rect.new(0,type1_number*32,96,32)
|
||||
type2rect = Rect.new(0,type2_number*32,96,32)
|
||||
overlay.blt(296,120,@typebitmap.bitmap,type1rect)
|
||||
overlay.blt(396,120,@typebitmap.bitmap,type2rect) if type1!=type2
|
||||
else
|
||||
|
||||
@@ -440,8 +440,10 @@ class PokemonSummary_Scene
|
||||
# Draw all text
|
||||
pbDrawTextPositions(overlay,textpos)
|
||||
# Draw Pokémon type(s)
|
||||
type1rect = Rect.new(0,@pokemon.type1*28,64,28)
|
||||
type2rect = Rect.new(0,@pokemon.type2*28,64,28)
|
||||
type1_number = GameData::Type.get(@pokemon.type1).id_number
|
||||
type2_number = GameData::Type.get(@pokemon.type2).id_number
|
||||
type1rect = Rect.new(0, type1_number * 28, 64, 28)
|
||||
type2rect = Rect.new(0, type2_number * 28, 64, 28)
|
||||
if @pokemon.type1==@pokemon.type2
|
||||
overlay.blt(402,146,@typebitmap.bitmap,type1rect)
|
||||
else
|
||||
@@ -686,7 +688,8 @@ class PokemonSummary_Scene
|
||||
for i in 0...Pokemon::MAX_MOVES
|
||||
move=@pokemon.moves[i]
|
||||
if move
|
||||
imagepos.push(["Graphics/Pictures/types",248,yPos+2,0,move.type*28,64,28])
|
||||
type_number = GameData::Type.get(move.type).id_number
|
||||
imagepos.push(["Graphics/Pictures/types", 248, yPos + 2, 0, type_number * 28, 64, 28])
|
||||
textpos.push([move.name,316,yPos,0,moveBase,moveShadow])
|
||||
if move.total_pp>0
|
||||
textpos.push([_INTL("PP"),342,yPos+32,0,moveBase,moveShadow])
|
||||
@@ -748,7 +751,8 @@ class PokemonSummary_Scene
|
||||
yPos += 20
|
||||
end
|
||||
if move
|
||||
imagepos.push(["Graphics/Pictures/types",248,yPos+2,0,move.type*28,64,28])
|
||||
type_number = GameData::Type.get(move.type).id_number
|
||||
imagepos.push(["Graphics/Pictures/types", 248, yPos + 2, 0, type_number * 28, 64, 28])
|
||||
textpos.push([move.name,316,yPos,0,moveBase,moveShadow])
|
||||
if move.total_pp>0
|
||||
textpos.push([_INTL("PP"),342,yPos+32,0,moveBase,moveShadow])
|
||||
@@ -769,8 +773,10 @@ class PokemonSummary_Scene
|
||||
pbDrawTextPositions(overlay,textpos)
|
||||
pbDrawImagePositions(overlay,imagepos)
|
||||
# Draw Pokémon's type icon(s)
|
||||
type1rect = Rect.new(0,@pokemon.type1*28,64,28)
|
||||
type2rect = Rect.new(0,@pokemon.type2*28,64,28)
|
||||
type1_number = GameData::Type.get(@pokemon.type1).id_number
|
||||
type2_number = GameData::Type.get(@pokemon.type2).id_number
|
||||
type1rect = Rect.new(0, type1_number * 28, 64, 28)
|
||||
type2rect = Rect.new(0, type2_number * 28, 64, 28)
|
||||
if @pokemon.type1==@pokemon.type2
|
||||
overlay.blt(130,78,@typebitmap.bitmap,type1rect)
|
||||
else
|
||||
|
||||
@@ -1430,8 +1430,10 @@ class PokemonStorageScene
|
||||
imagepos.push(["Graphics/Pictures/shiny",156,198])
|
||||
end
|
||||
typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
|
||||
type1rect = Rect.new(0,pokemon.type1*28,64,28)
|
||||
type2rect = Rect.new(0,pokemon.type2*28,64,28)
|
||||
type1_number = GameData::Type.get(pokemon.type1).id_number
|
||||
type2_number = GameData::Type.get(pokemon.type2).id_number
|
||||
type1rect = Rect.new(0, type1_number * 28, 64, 28)
|
||||
type2rect = Rect.new(0, type2_number * 28, 64, 28)
|
||||
if pokemon.type1==pokemon.type2
|
||||
overlay.blt(52,272,typebitmap.bitmap,type1rect)
|
||||
else
|
||||
|
||||
@@ -83,8 +83,10 @@ class MoveRelearner_Scene
|
||||
def pbDrawMoveList
|
||||
overlay=@sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
type1rect=Rect.new(0,@pokemon.type1*28,64,28)
|
||||
type2rect=Rect.new(0,@pokemon.type2*28,64,28)
|
||||
type1_number = GameData::Type.get(@pokemon.type1).id_number
|
||||
type2_number = GameData::Type.get(@pokemon.type2).id_number
|
||||
type1rect=Rect.new(0, type1_number * 28, 64, 28)
|
||||
type2rect=Rect.new(0, type2_number * 28, 64, 28)
|
||||
if @pokemon.type1==@pokemon.type2
|
||||
overlay.blt(400,70,@typebitmap.bitmap,type1rect)
|
||||
else
|
||||
@@ -100,7 +102,8 @@ class MoveRelearner_Scene
|
||||
moveobject=@moves[@sprites["commands"].top_item+i]
|
||||
if moveobject
|
||||
moveData=GameData::Move.get(moveobject)
|
||||
imagepos.push(["Graphics/Pictures/types",12,yPos+2,0,moveData.type*28,64,28])
|
||||
type_number = GameData::Type.get(moveData.type).id_number
|
||||
imagepos.push(["Graphics/Pictures/types", 12, yPos + 2, 0, type_number * 28, 64, 28])
|
||||
textpos.push([moveData.name,80,yPos,0,Color.new(248,248,248),Color.new(0,0,0)])
|
||||
if moveData.total_pp>0
|
||||
textpos.push([_INTL("PP"),112,yPos+32,0,Color.new(64,64,64),Color.new(176,176,176)])
|
||||
|
||||
@@ -94,7 +94,7 @@ Boosted based on number of best circles
|
||||
|
||||
# Purify Chamber treats Normal/Normal matchup as super effective
|
||||
def self.typeAdvantage(p1,p2)
|
||||
return true if isConst?(p1,PBTypes,:NORMAL) && isConst?(p2,PBTypes,:NORMAL)
|
||||
return true if p1 == :NORMAL && p2 == :NORMAL
|
||||
return PBTypes.superEffective?(p1,p2)
|
||||
end
|
||||
|
||||
@@ -125,7 +125,7 @@ class PurifyChamber # German: der Kryptorbis
|
||||
@currentSet=value if value>=0 && value<NUMSETS
|
||||
end
|
||||
|
||||
# Number of regular Pokemon in a set
|
||||
# Number of regular Pokemon in a set
|
||||
def setCount(set)
|
||||
return @sets[set].length
|
||||
end
|
||||
@@ -954,11 +954,11 @@ class PurifyChamberSetView < SpriteWrapper
|
||||
textpos=[]
|
||||
if pkmn
|
||||
if pkmn.type1==pkmn.type2
|
||||
textpos.push([_INTL("{1} Lv.{2} {3}",pkmn.name,pkmn.level,PBTypes.getName(pkmn.type1)),2,0,0,
|
||||
textpos.push([_INTL("{1} Lv.{2} {3}",pkmn.name,pkmn.level,GameData::Type.get(pkmn.type1).name),2,0,0,
|
||||
Color.new(248,248,248),Color.new(128,128,128)])
|
||||
else
|
||||
textpos.push([_INTL("{1} Lv.{2} {3}/{4}",pkmn.name,pkmn.level,PBTypes.getName(pkmn.type1),
|
||||
PBTypes.getName(pkmn.type2)),2,0,0,
|
||||
textpos.push([_INTL("{1} Lv.{2} {3}/{4}",pkmn.name,pkmn.level,GameData::Type.get(pkmn.type1).name,
|
||||
GameData::Type.get(pkmn.type2).name),2,0,0,
|
||||
Color.new(248,248,248),Color.new(128,128,128)])
|
||||
end
|
||||
textpos.push([_INTL("FLOW"),2+@info.bitmap.width/2,24,0,
|
||||
@@ -1089,17 +1089,6 @@ end
|
||||
|
||||
|
||||
|
||||
def pbPurifyChamber
|
||||
$PokemonGlobal.seenPurifyChamber = true
|
||||
pbFadeOutIn {
|
||||
scene = PurifyChamberScene.new
|
||||
screen = PurifyChamberScreen.new(scene)
|
||||
screen.pbStartPurify
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
|
||||
class PurifyChamberScene
|
||||
def pbUpdate()
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
@@ -1309,3 +1298,14 @@ class PurifyChamberScene
|
||||
return pos
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbPurifyChamber
|
||||
$PokemonGlobal.seenPurifyChamber = true
|
||||
pbFadeOutIn {
|
||||
scene = PurifyChamberScene.new
|
||||
screen = PurifyChamberScreen.new(scene)
|
||||
screen.pbStartPurify
|
||||
}
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ class TriadCard
|
||||
spDef = baseStats[PBStats::SPDEF]
|
||||
speed = baseStats[PBStats::SPEED]
|
||||
@type = pbGetSpeciesData(species,form,SpeciesData::TYPE1)
|
||||
if isConst?(@type,PBTypes,:NORMAL)
|
||||
if @type == :NORMAL
|
||||
type2 = pbGetSpeciesData(species,form,SpeciesData::TYPE2)
|
||||
@type = type2 if type2
|
||||
end
|
||||
@@ -80,16 +80,17 @@ class TriadCard
|
||||
return ret
|
||||
end
|
||||
|
||||
def self.createBack(type=-1,noback=false)
|
||||
def self.createBack(type = nil, noback = false)
|
||||
bitmap = BitmapWrapper.new(80,96)
|
||||
if !noback
|
||||
cardbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/triad_card_opponent"))
|
||||
bitmap.blt(0,0,cardbitmap.bitmap,Rect.new(0,0,cardbitmap.width,cardbitmap.height))
|
||||
cardbitmap.dispose
|
||||
end
|
||||
if type>=0
|
||||
if type
|
||||
typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
|
||||
typerect = Rect.new(0,type*28,64,28)
|
||||
type_number = GameData::Type.get(type).id_number
|
||||
typerect = Rect.new(0, type_number * 28, 64, 28)
|
||||
bitmap.blt(8,50,typebitmap.bitmap,typerect,192)
|
||||
typebitmap.dispose
|
||||
end
|
||||
@@ -111,7 +112,8 @@ class TriadCard
|
||||
# Draw card background
|
||||
bitmap.blt(0,0,cardbitmap.bitmap,Rect.new(0,0,cardbitmap.width,cardbitmap.height))
|
||||
# Draw type icon
|
||||
typerect = Rect.new(0,@type*28,64,28)
|
||||
type_number = GameData::Type.get(@type).id_number
|
||||
typerect = Rect.new(0,type_number*28,64,28)
|
||||
bitmap.blt(8,50,typebitmap.bitmap,typerect,192)
|
||||
# Draw Pokémon icon
|
||||
bitmap.blt(8,24,iconbitmap.bitmap,Rect.new(0,0,64,64))
|
||||
@@ -139,7 +141,7 @@ class TriadSquare
|
||||
def initialize
|
||||
@owner = 0
|
||||
@card = nil
|
||||
@type = -1
|
||||
@type = nil
|
||||
end
|
||||
|
||||
def attack(panel)
|
||||
@@ -355,7 +357,7 @@ class TriadScene
|
||||
@sprites["opponent#{i}"].x = 12
|
||||
@sprites["opponent#{i}"].y = 44+44*i
|
||||
@sprites["opponent#{i}"].z = 2
|
||||
@sprites["opponent#{i}"].bitmap = @battle.openHand ? TriadCard.new(cards[i]).createBitmap(2) : TriadCard.createBack(-1)
|
||||
@sprites["opponent#{i}"].bitmap = @battle.openHand ? TriadCard.new(cards[i]).createBitmap(2) : TriadCard.createBack
|
||||
@opponentCardBitmaps.push(@sprites["opponent#{i}"].bitmap)
|
||||
@opponentCardIndexes.push(i)
|
||||
end
|
||||
@@ -728,12 +730,14 @@ class TriadScreen
|
||||
@board = []
|
||||
@playerName = $Trainer ? $Trainer.name : "Trainer"
|
||||
@opponentName = opponentName
|
||||
type_keys = GameData::Type::DATA.keys
|
||||
for i in 0...@width*@height
|
||||
square = TriadSquare.new
|
||||
if @elements
|
||||
loop do
|
||||
square.type = rand(PBTypes.maxValue+1)
|
||||
break if !PBTypes.isPseudoType?(square.type)
|
||||
trial_type = type_keys[rand(type_keys.length)]
|
||||
break if !PBTypes.isPseudoType?(trial_type)
|
||||
square.type = GameData::Type.get(trial_type).id
|
||||
end
|
||||
end
|
||||
@board.push(square)
|
||||
@@ -831,8 +835,8 @@ class TriadScreen
|
||||
square.card = TriadCard.new(opponentCards[cardIndex])
|
||||
square.owner = 2
|
||||
for i in 0...@width*@height
|
||||
x = i%@width
|
||||
y = i/@width
|
||||
x = i % @width
|
||||
y = i / @width
|
||||
square.type = @board[i].type
|
||||
flips = flipBoard(x,y,square)
|
||||
if flips!=nil
|
||||
|
||||
@@ -25,10 +25,10 @@ def addMove(moves,move,base)
|
||||
[:REFLECT, :LIGHTSCREEN, :SAFEGUARD, :SUBSTITUTE, :FAKEOUT].include?(data.id)
|
||||
count=base+2
|
||||
end
|
||||
if data.base_damage>=80 && isConst?(data.type,PBTypes,:NORMAL)
|
||||
if data.base_damage >= 80 && data.type == :NORMAL
|
||||
count=base+5
|
||||
end
|
||||
if data.base_damage>=80 && isConst?(data.type,PBTypes,:NORMAL)
|
||||
if data.base_damage >= 80 && data.type == :NORMAL
|
||||
count=base+3
|
||||
end
|
||||
if [:PROTECT, :DETECT, :TOXIC, :AERIALACE, :WILLOWISP, :SPORE, :THUNDERWAVE,
|
||||
@@ -423,7 +423,7 @@ def pbRandomPokemonFromRule(rule,trainer)
|
||||
d=GameData::Move.get(move)
|
||||
totalbasedamage+=d.base_damage
|
||||
if d.base_damage>=1
|
||||
hasNormal=true if isConst?(d.type,PBTypes,:NORMAL)
|
||||
hasNormal=true if d.type == :NORMAL
|
||||
hasPhysical=true if d.category==0
|
||||
hasSpecial=true if d.category==1
|
||||
end
|
||||
@@ -461,9 +461,7 @@ def pbRandomPokemonFromRule(rule,trainer)
|
||||
if item == :BLACKSLUDGE
|
||||
type1 = pbGetSpeciesData(species,0,SpeciesData::TYPE1)
|
||||
type2 = pbGetSpeciesData(species,0,SpeciesData::TYPE2) || type1
|
||||
if !isConst?(type1,PBTypes,:POISON) && !isConst?(type2,PBTypes,:POISON)
|
||||
item = :LEFTOVERS
|
||||
end
|
||||
item = :LEFTOVERS if type1 != :POISON && type2 != :POISON
|
||||
end
|
||||
if item == :HEATROCK && !moves.any? { |m| m == :SUNNYDAY }
|
||||
item = :LEFTOVERS
|
||||
@@ -789,26 +787,26 @@ end
|
||||
|
||||
|
||||
|
||||
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
|
||||
if ability != :LEVITATE || !isConst?(data.type,PBTypes,:GROUND)
|
||||
mod1=PBTypes.getEffectiveness(atype,otype1)
|
||||
mod2=(otype1==otype2) ? PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE : PBTypes.getEffectiveness(atype,otype2)
|
||||
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
|
||||
if ability != :LEVITATE || data.type != :GROUND
|
||||
mod1 = PBTypes.getEffectiveness(atype, otype1)
|
||||
mod2 = (otype1 == otype2) ? PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE : PBTypes.getEffectiveness(atype, otype2)
|
||||
if ability == :WONDERGUARD
|
||||
mod1=PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if !PBTypes.superEffective?(mod1)
|
||||
mod2=PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if !PBTypes.superEffective?(mod2)
|
||||
mod1 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if mod1 <= PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
mod2 = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if mod2 <= PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
end
|
||||
typemod=mod1*mod2
|
||||
typemod = mod1 * mod2
|
||||
end
|
||||
return scores[0] if typemod==0 # Ineffective
|
||||
return scores[1] if typemod==1 # Doubly not very effective
|
||||
return scores[2] if typemod==2 # Not very effective
|
||||
return scores[3] if typemod==4 # Normal effective
|
||||
return scores[4] if typemod==8 # Super effective
|
||||
return scores[5] if typemod==16 # Doubly super effective
|
||||
return scores[0] if typemod == 0 # Ineffective
|
||||
return scores[1] if typemod == 1 # Doubly not very effective
|
||||
return scores[2] if typemod == 2 # Not very effective
|
||||
return scores[3] if typemod == 4 # Normal effective
|
||||
return scores[4] if typemod == 8 # Super effective
|
||||
return scores[5] if typemod == 16 # Doubly super effective
|
||||
return 0
|
||||
end
|
||||
|
||||
@@ -964,9 +962,9 @@ def pbTrainerInfo(pokemonlist,trfile,rules)
|
||||
trainerdata=bttrainers[btt]
|
||||
pokemonnumbers=trainerdata[5] || []
|
||||
species=[]
|
||||
types=[]
|
||||
types={}
|
||||
#p trainerdata[1]
|
||||
(PBTypes.maxValue+1).times { |typ| types[typ]=0 }
|
||||
GameData::Type.each { |t| types[t.id] = 0 }
|
||||
for pn in pokemonnumbers
|
||||
pkmn=btpokemon[pn]
|
||||
species.push(pkmn.species)
|
||||
@@ -975,18 +973,18 @@ def pbTrainerInfo(pokemonlist,trfile,rules)
|
||||
end
|
||||
species|=[] # remove duplicates
|
||||
count=0
|
||||
(PBTypes.maxValue+1).times { |typ|
|
||||
if types[typ]>=5
|
||||
types[typ]/=4
|
||||
types[typ]=10 if types[typ]>10
|
||||
GameData::Type.each do |t|
|
||||
if types[t.id] >= 5
|
||||
types[t.id] /= 4
|
||||
types[t.id] = 10 if types[t.id] > 10
|
||||
else
|
||||
types[typ]=0
|
||||
types[t.id] = 0
|
||||
end
|
||||
count+=types[typ]
|
||||
}
|
||||
types[0]=1 if count==0
|
||||
count += types[t.id]
|
||||
end
|
||||
types[:NORMAL] = 1 if count == 0
|
||||
if pokemonnumbers.length==0
|
||||
(PBTypes.maxValue+1).times { |typ| types[typ]=1 }
|
||||
GameData::Type.each { |t| types[t.id] = 1 }
|
||||
end
|
||||
numbers=[]
|
||||
if pokemonlist
|
||||
|
||||
@@ -271,7 +271,7 @@ def pbItemIconFile(item)
|
||||
if !pbResolveBitmap(bitmapFileName) && itm.is_machine?
|
||||
move = itm.move
|
||||
type = GameData::Move.get(move).type
|
||||
bitmapFileName = sprintf("Graphics/Icons/itemMachine%s",getConstantName(PBTypes,type)) rescue nil
|
||||
bitmapFileName = sprintf("Graphics/Icons/itemMachine%s",type.to_s) rescue nil
|
||||
if !pbResolveBitmap(bitmapFileName)
|
||||
bitmapFileName = sprintf("Graphics/Icons/itemMachine%03d",type)
|
||||
end
|
||||
|
||||
@@ -358,7 +358,7 @@ end
|
||||
|
||||
# Returns true if there is a Pokémon with the given type in the player's party.
|
||||
def pbHasType?(type)
|
||||
type = getID(PBTypes,type)
|
||||
type = GameData::Type.get(type).id
|
||||
for pokemon in $Trainer.pokemonParty
|
||||
return true if pokemon.hasType?(type)
|
||||
end
|
||||
|
||||
@@ -273,7 +273,7 @@ module PokemonDebugMixin
|
||||
totaliv += pkmn.iv[i]
|
||||
end
|
||||
msg = _INTL("Change which IV?\nHidden Power:\n{1}, power {2}\nTotal: {3}/{4} ({5}%)",
|
||||
PBTypes.getName(hiddenpower[0]),hiddenpower[1],totaliv,numstats*31,
|
||||
GameData::Type.get(hiddenpower[0]).name,hiddenpower[1],totaliv,numstats*31,
|
||||
100*totaliv/(numstats*31))
|
||||
ivcommands.push(_INTL("Randomise all"))
|
||||
cmd2 = pbShowCommands(msg,ivcommands,cmd2)
|
||||
|
||||
@@ -895,7 +895,7 @@ def pbPokemonEditor
|
||||
habitat = speciesData[SpeciesData::HABITAT]
|
||||
type1 = speciesData[SpeciesData::TYPE1]
|
||||
type2 = speciesData[SpeciesData::TYPE2]
|
||||
type2 = nil if type2==type1
|
||||
type2 = nil if type2 == type1
|
||||
baseStats = speciesData[SpeciesData::BASE_STATS].clone if speciesData[SpeciesData::BASE_STATS]
|
||||
rareness = speciesData[SpeciesData::RARENESS]
|
||||
shape = speciesData[SpeciesData::SHAPE]
|
||||
@@ -993,7 +993,7 @@ def pbPokemonEditor
|
||||
save = pbPropertyList(data[0],data,species,true)
|
||||
if save
|
||||
# Make sure both Type1 and Type2 are recorded correctly
|
||||
data[2] = (data[3] || 0) if !data[2]
|
||||
data[2] = data[3] if !data[2]
|
||||
data[3] = data[2] if !data[3]
|
||||
# Make sure both Compatibilities are recorded correctly
|
||||
data[19] = (data[20] && data[20]!=0) ? data[20] : PBEggGroups::Undiscovered if !data[19] || data[19]==0
|
||||
|
||||
@@ -2,41 +2,22 @@
|
||||
# Save type data to PBS file
|
||||
#===============================================================================
|
||||
def pbSaveTypes
|
||||
return if (PBTypes.maxValue rescue 0)==0
|
||||
File.open("PBS/types.txt","wb") { |f|
|
||||
File.open("PBS/types.txt", "wb") { |f|
|
||||
f.write(0xEF.chr)
|
||||
f.write(0xBB.chr)
|
||||
f.write(0xBF.chr)
|
||||
f.write("\# " + _INTL("See the documentation on the wiki to learn how to edit this file.") + "\r\n")
|
||||
for i in 0..(PBTypes.maxValue rescue 25)
|
||||
name = PBTypes.getName(i) rescue nil
|
||||
next if !name || name==""
|
||||
# Write each type in turn
|
||||
GameData::Type.each do |type|
|
||||
f.write("\#-------------------------------\r\n")
|
||||
constname = getConstantName(PBTypes,i) rescue pbGetTypeConst(i)
|
||||
f.write(sprintf("[%d]\r\n",i))
|
||||
f.write(sprintf("Name = %s\r\n",name))
|
||||
f.write(sprintf("InternalName = %s\r\n",constname))
|
||||
if (PBTypes.isPseudoType?(i) rescue isConst?(i,PBTypes,QMARKS))
|
||||
f.write("IsPseudoType = true\r\n")
|
||||
end
|
||||
if (PBTypes.isSpecialType?(i) rescue pbIsOldSpecialType?(i))
|
||||
f.write("IsSpecialType = true\r\n")
|
||||
end
|
||||
weak = []
|
||||
resist = []
|
||||
immune = []
|
||||
for j in 0..(PBTypes.maxValue rescue 25)
|
||||
cname = getConstantName(PBTypes,j) rescue pbGetTypeConst(j)
|
||||
next if !cname || cname==""
|
||||
case PBTypes.getEffectiveness(j,i)
|
||||
when PBTypeEffectiveness::SUPER_EFFECTIVE_ONE then weak.push(cname)
|
||||
when PBTypeEffectiveness::NOT_EFFECTIVE_ONE then resist.push(cname)
|
||||
when PBTypeEffectiveness::INEFFECTIVE then immune.push(cname)
|
||||
end
|
||||
end
|
||||
f.write("Weaknesses = "+weak.join(",")+"\r\n") if weak.length>0
|
||||
f.write("Resistances = "+resist.join(",")+"\r\n") if resist.length>0
|
||||
f.write("Immunities = "+immune.join(",")+"\r\n") if immune.length>0
|
||||
f.write("[#{type.id_number}]\r\n")
|
||||
f.write("Name = #{type.real_name}\r\n")
|
||||
f.write("InternalName = #{type.id.to_s}\r\n")
|
||||
f.write("IsPseudoType = true\r\n") if type.pseudo_type
|
||||
f.write("IsSpecialType = true\r\n") if type.special?
|
||||
f.write("Weaknesses = #{type.weaknesses.join(",")}\r\n") if type.weaknesses.length > 0
|
||||
f.write("Resistances = #{type.resistances.join(",")}\r\n") if type.resistances.length > 0
|
||||
f.write("Immunities = #{type.immunities.join(",")}\r\n") if type.immunities.length > 0
|
||||
end
|
||||
}
|
||||
end
|
||||
@@ -87,12 +68,12 @@ def pbSaveMoveData
|
||||
csvQuote(m.real_name),
|
||||
csvQuote(m.function_code),
|
||||
m.base_damage,
|
||||
(getConstantName(PBTypes, m.type) rescue pbGetTypeConst(m.type) rescue ""),
|
||||
m.type.to_s,
|
||||
["Physical", "Special", "Status"][m.category],
|
||||
m.accuracy,
|
||||
m.total_pp,
|
||||
m.effect_chance,
|
||||
(getConstantName(PBTargets, m.target) rescue sprintf("%02X", m.target)),
|
||||
(getConstantName(PBTargets, m.target) rescue sprintf("%d", m.target)),
|
||||
m.priority,
|
||||
csvQuote(m.flags),
|
||||
csvQuoteAlways(m.real_description)
|
||||
@@ -616,7 +597,7 @@ def pbSavePokemonData
|
||||
end
|
||||
color = speciesData[i][SpeciesData::COLOR] || 0
|
||||
habitat = speciesData[i][SpeciesData::HABITAT] || 0
|
||||
type1 = speciesData[i][SpeciesData::TYPE1] || 0
|
||||
type1 = speciesData[i][SpeciesData::TYPE1]
|
||||
type2 = speciesData[i][SpeciesData::TYPE2] || type1
|
||||
if speciesData[i][SpeciesData::BASE_STATS]
|
||||
basestats = speciesData[i][SpeciesData::BASE_STATS].clone
|
||||
@@ -664,11 +645,11 @@ def pbSavePokemonData
|
||||
pokedata.write("\#-------------------------------\r\n")
|
||||
pokedata.write("[#{i}]\r\nName = #{speciesname}\r\n")
|
||||
pokedata.write("InternalName = #{cname}\r\n")
|
||||
ctype1 = getConstantName(PBTypes,type1) rescue pbGetTypeConst(type1) || pbGetTypeConst(0) || "NORMAL"
|
||||
pokedata.write("Type1 = #{ctype1}\r\n")
|
||||
if type1!=type2
|
||||
ctype2 = getConstantName(PBTypes,type2) rescue pbGetTypeConst(type2) || pbGetTypeConst(0) || "NORMAL"
|
||||
pokedata.write("Type2 = #{ctype2}\r\n")
|
||||
if type1
|
||||
pokedata.write("Type1 = #{type1.to_s}\r\n")
|
||||
end
|
||||
if type2 && type2 != type1
|
||||
pokedata.write("Type2 = #{type2.to_s}\r\n")
|
||||
end
|
||||
pokedata.write("BaseStats = #{basestats[0]},#{basestats[1]},#{basestats[2]},#{basestats[3]},#{basestats[4]},#{basestats[5]}\r\n")
|
||||
gendername = getConstantName(PBGenderRates,gender) rescue pbGetGenderConst(gender)
|
||||
@@ -680,36 +661,30 @@ def pbSavePokemonData
|
||||
pokedata.write("Happiness = #{happiness}\r\n")
|
||||
pokedata.write("Abilities = ")
|
||||
if ability1
|
||||
cability1 = GameData::Ability.get(ability1).id.to_s
|
||||
pokedata.write("#{cability1}")
|
||||
pokedata.write("#{ability1.to_s}")
|
||||
pokedata.write(",") if ability2
|
||||
end
|
||||
if ability2
|
||||
cability2 = GameData::Ability.get(ability2).id.to_s
|
||||
pokedata.write("#{cability2}")
|
||||
pokedata.write("#{ability2.to_s}")
|
||||
end
|
||||
pokedata.write("\r\n")
|
||||
if hiddenability1 || hiddenability2 || hiddenability3 || hiddenability4
|
||||
pokedata.write("HiddenAbility = ")
|
||||
needcomma = false
|
||||
if hiddenability1
|
||||
cabilityh = GameData::Ability.get(hiddenability1).id.to_s
|
||||
pokedata.write("#{cabilityh}"); needcomma = true
|
||||
pokedata.write("#{hiddenability1.to_s}"); needcomma = true
|
||||
end
|
||||
if hiddenability2
|
||||
pokedata.write(",") if needcomma
|
||||
cabilityh = GameData::Ability.get(hiddenability2).id.to_s
|
||||
pokedata.write("#{cabilityh}"); needcomma = true
|
||||
pokedata.write("#{hiddenability2.to_s}"); needcomma = true
|
||||
end
|
||||
if hiddenability3
|
||||
pokedata.write(",") if needcomma
|
||||
cabilityh = GameData::Ability.get(hiddenability3).id.to_s
|
||||
pokedata.write("#{cabilityh}"); needcomma = true
|
||||
pokedata.write("#{hiddenability3.to_s}"); needcomma = true
|
||||
end
|
||||
if hiddenability4
|
||||
pokedata.write(",") if needcomma
|
||||
cabilityh = GameData::Ability.get(hiddenability4).id.to_s
|
||||
pokedata.write("#{cabilityh}")
|
||||
pokedata.write("#{hiddenability4.to_s}")
|
||||
end
|
||||
pokedata.write("\r\n")
|
||||
end
|
||||
@@ -724,8 +699,7 @@ def pbSavePokemonData
|
||||
level = m[0]
|
||||
move = m[1]
|
||||
pokedata.write(",") if !first
|
||||
cmove = GameData::Move.get(move).id.to_s
|
||||
pokedata.write(sprintf("%d,%s",level,cmove))
|
||||
pokedata.write(sprintf("%d,%s",level,move.to_s))
|
||||
first = false
|
||||
end
|
||||
pokedata.write("\r\n")
|
||||
@@ -734,10 +708,9 @@ def pbSavePokemonData
|
||||
pokedata.write("EggMoves = ")
|
||||
first = true
|
||||
eggMoves[i].each do |m|
|
||||
next if !m || m==0
|
||||
next if !m
|
||||
pokedata.write(",") if !first
|
||||
cmove = GameData::Move.get(m).id.to_s
|
||||
pokedata.write("#{cmove}")
|
||||
pokedata.write("#{m.to_s}")
|
||||
first = false
|
||||
end
|
||||
pokedata.write("\r\n")
|
||||
@@ -782,16 +755,13 @@ def pbSavePokemonData
|
||||
pokedata.write("FormName = #{formname}\r\n")
|
||||
end
|
||||
if item1
|
||||
citem1 = GameData::Item.get(item1).id.to_s
|
||||
pokedata.write("WildItemCommon = #{citem1}\r\n")
|
||||
pokedata.write("WildItemCommon = #{item1.to_s}\r\n")
|
||||
end
|
||||
if item2
|
||||
citem2 = GameData::Item.get(item2).id.to_s
|
||||
pokedata.write("WildItemUncommon = #{citem2}\r\n")
|
||||
pokedata.write("WildItemUncommon = #{item2.to_s}\r\n")
|
||||
end
|
||||
if item3
|
||||
citem3 = GameData::Item.get(item3).id.to_s
|
||||
pokedata.write("WildItemRare = #{citem3}\r\n")
|
||||
pokedata.write("WildItemRare = #{item3.to_s}\r\n")
|
||||
end
|
||||
if metrics && metrics.length>0
|
||||
pokedata.write("BattlerPlayerX = #{metrics[SpeciesData::METRIC_PLAYER_X][i] || 0}\r\n")
|
||||
@@ -818,7 +788,7 @@ def pbSavePokemonData
|
||||
has_param = !PBEvolution.hasFunction?(method, "parameterType") || param_type != nil
|
||||
if has_param
|
||||
if param_type
|
||||
if [:Ability, :Item].include?(param_type)
|
||||
if [:Ability, :Item, :Move, :TrainerType, :Type].include?(param_type)
|
||||
pokedata.write("#{parameter.to_s}")
|
||||
else
|
||||
cparameter = (getConstantName(param_type, parameter) rescue parameter)
|
||||
@@ -832,8 +802,7 @@ def pbSavePokemonData
|
||||
end
|
||||
pokedata.write("\r\n")
|
||||
if incense
|
||||
initem = GameData::Item.get(incense).id.to_s
|
||||
pokedata.write("Incense = #{initem}\r\n")
|
||||
pokedata.write("Incense = #{incense.to_s}\r\n")
|
||||
end
|
||||
if i%20==0
|
||||
Graphics.update
|
||||
@@ -885,7 +854,7 @@ def pbSavePokemonFormsData
|
||||
end
|
||||
origdata["color"] = speciesData[species][SpeciesData::COLOR] || 0
|
||||
origdata["habitat"] = speciesData[species][SpeciesData::HABITAT] || 0
|
||||
origdata["type1"] = speciesData[species][SpeciesData::TYPE1] || 0
|
||||
origdata["type1"] = speciesData[species][SpeciesData::TYPE1]
|
||||
origdata["type2"] = speciesData[species][SpeciesData::TYPE2] || type1
|
||||
if speciesData[species][SpeciesData::BASE_STATS]
|
||||
origdata["basestats"] = speciesData[species][SpeciesData::BASE_STATS].clone
|
||||
@@ -945,7 +914,7 @@ def pbSavePokemonFormsData
|
||||
color = nil if color==origdata["color"]
|
||||
habitat = speciesData[i][SpeciesData::HABITAT] || 0
|
||||
habitat = nil if habitat==origdata["habitat"]
|
||||
type1 = speciesData[i][SpeciesData::TYPE1] || 0
|
||||
type1 = speciesData[i][SpeciesData::TYPE1]
|
||||
type2 = speciesData[i][SpeciesData::TYPE2] || type1
|
||||
if type1==origdata["type1"] && type2==origdata["type2"]
|
||||
type1 = type2 = nil
|
||||
@@ -1037,22 +1006,18 @@ def pbSavePokemonFormsData
|
||||
pokedata.write("FormName = #{formname}\r\n") if formname && formname!=""
|
||||
pokedata.write("PokedexForm = #{pokedexform}\r\n") if pokedexform>0
|
||||
if megastone
|
||||
citem = GameData::Item.get(megastone).id.to_s
|
||||
pokedata.write("MegaStone = #{citem}\r\n")
|
||||
pokedata.write("MegaStone = #{megastone.to_s}\r\n")
|
||||
end
|
||||
if megamove
|
||||
cmove = GameData::Move.get(megamove).id.to_s
|
||||
pokedata.write("MegaMove = #{cmove}\r\n")
|
||||
pokedata.write("MegaMove = #{megamove.to_s}\r\n")
|
||||
end
|
||||
pokedata.write("UnmegaForm = #{unmega}\r\n") if unmega>0
|
||||
pokedata.write("MegaMessage = #{megamessage}\r\n") if megamessage>0
|
||||
if type1!=nil && type2!=nil
|
||||
ctype1 = getConstantName(PBTypes,type1) rescue pbGetTypeConst(type1) || pbGetTypeConst(0) || "NORMAL"
|
||||
pokedata.write("Type1 = #{ctype1}\r\n")
|
||||
if type1!=type2
|
||||
ctype2 = getConstantName(PBTypes,type2) rescue pbGetTypeConst(type2) || pbGetTypeConst(0) || "NORMAL"
|
||||
pokedata.write("Type2 = #{ctype2}\r\n")
|
||||
end
|
||||
if type1
|
||||
pokedata.write("Type1 = #{type1.to_s}\r\n")
|
||||
end
|
||||
if type2 && type2 != type1
|
||||
pokedata.write("Type2 = #{type2.to_s}\r\n")
|
||||
end
|
||||
if basestats!=nil
|
||||
pokedata.write("BaseStats = #{basestats[0]},#{basestats[1]},#{basestats[2]},#{basestats[3]},#{basestats[4]},#{basestats[5]}\r\n")
|
||||
@@ -1079,13 +1044,11 @@ def pbSavePokemonFormsData
|
||||
if ability1 || ability2
|
||||
pokedata.write("Abilities = ")
|
||||
if ability1
|
||||
cability1 = GameData::Ability.get(ability1).id.to_s
|
||||
pokedata.write("#{cability1}")
|
||||
pokedata.write("#{ability1.to_s}")
|
||||
pokedata.write(",") if ability2
|
||||
end
|
||||
if ability2
|
||||
cability2 = GameData::Ability.get(ability2).id.to_s
|
||||
pokedata.write("#{cability2}")
|
||||
pokedata.write("#{ability2.to_s}")
|
||||
end
|
||||
pokedata.write("\r\n")
|
||||
end
|
||||
@@ -1094,23 +1057,19 @@ def pbSavePokemonFormsData
|
||||
pokedata.write("HiddenAbility = ")
|
||||
needcomma = false
|
||||
if hiddenability1
|
||||
cabilityh = GameData::Ability.get(hiddenability1).id.to_s
|
||||
pokedata.write("#{cabilityh}"); needcomma=true
|
||||
pokedata.write("#{hiddenability1.to_s}"); needcomma=true
|
||||
end
|
||||
if hiddenability2
|
||||
pokedata.write(",") if needcomma
|
||||
cabilityh = GameData::Ability.get(hiddenability2).id.to_s
|
||||
pokedata.write("#{cabilityh}"); needcomma=true
|
||||
pokedata.write("#{hiddenability2.to_s}"); needcomma=true
|
||||
end
|
||||
if hiddenability3
|
||||
pokedata.write(",") if needcomma
|
||||
cabilityh = GameData::Ability.get(hiddenability3).id.to_s
|
||||
pokedata.write("#{cabilityh}"); needcomma=true
|
||||
pokedata.write("#{hiddenability3.to_s}"); needcomma=true
|
||||
end
|
||||
if hiddenability4
|
||||
pokedata.write(",") if needcomma
|
||||
cabilityh = GameData::Ability.get(hiddenability4).id.to_s
|
||||
pokedata.write("#{cabilityh}")
|
||||
pokedata.write("#{hiddenability4.to_s}")
|
||||
end
|
||||
pokedata.write("\r\n")
|
||||
end
|
||||
@@ -1139,8 +1098,7 @@ def pbSavePokemonFormsData
|
||||
level = m[0]
|
||||
move = m[1]
|
||||
pokedata.write(",") if !first
|
||||
cmove = GameData::Move.get(move).id.to_s
|
||||
pokedata.write(sprintf("%d,%s",level,cmove))
|
||||
pokedata.write(sprintf("%d,%s",level,move.to_s))
|
||||
first = false
|
||||
end
|
||||
pokedata.write("\r\n")
|
||||
@@ -1165,8 +1123,7 @@ def pbSavePokemonFormsData
|
||||
eggList.each do |m|
|
||||
next if !m || m==0
|
||||
pokedata.write(",") if !first
|
||||
cmove = GameData::Move.get(m).id.to_s
|
||||
pokedata.write("#{cmove}")
|
||||
pokedata.write("#{m.to_s}")
|
||||
first = false
|
||||
end
|
||||
pokedata.write("\r\n")
|
||||
@@ -1211,16 +1168,13 @@ def pbSavePokemonFormsData
|
||||
pokedata.write("Pokedex = #{entry}\r\n")
|
||||
end
|
||||
if item1
|
||||
citem1 = GameData::Item.get(item1).id.to_s
|
||||
pokedata.write("WildItemCommon = #{citem1}\r\n")
|
||||
pokedata.write("WildItemCommon = #{item1.to_s}\r\n")
|
||||
end
|
||||
if item2
|
||||
citem1 = GameData::Item.get(item2).id.to_s
|
||||
pokedata.write("WildItemUncommon = #{citem2}\r\n")
|
||||
pokedata.write("WildItemUncommon = #{item2.to_s}\r\n")
|
||||
end
|
||||
if item3
|
||||
citem1 = GameData::Item.get(item3).id.to_s
|
||||
pokedata.write("WildItemRare = #{citem3}\r\n")
|
||||
pokedata.write("WildItemRare = #{item3.to_s}\r\n")
|
||||
end
|
||||
if metrics && metrics.length>0
|
||||
for j in 0...6
|
||||
@@ -1282,8 +1236,12 @@ def pbSavePokemonFormsData
|
||||
has_param = !PBEvolution.hasFunction?(method, "parameterType") || param_type != nil
|
||||
if has_param
|
||||
if param_type
|
||||
cparameter = (getConstantName(param_type, parameter) rescue parameter)
|
||||
pokedata.write("#{cparameter}")
|
||||
if [:Ability, :Item, :Move, :TrainerType, :Type].include?(param_type)
|
||||
pokedata.write("#{parameter.to_s}")
|
||||
else
|
||||
cparameter = (getConstantName(param_type, parameter) rescue parameter)
|
||||
pokedata.write("#{cparameter}")
|
||||
end
|
||||
else
|
||||
pokedata.write("#{parameter}")
|
||||
end
|
||||
@@ -1293,8 +1251,7 @@ def pbSavePokemonFormsData
|
||||
pokedata.write("\r\n")
|
||||
end
|
||||
if incense
|
||||
initem = GameData::Item.get(incense).id.to_s
|
||||
pokedata.write("Incense = #{initem}\r\n")
|
||||
pokedata.write("Incense = #{incense.to_s}\r\n")
|
||||
end
|
||||
if i%20==0
|
||||
Graphics.update
|
||||
|
||||
@@ -279,17 +279,17 @@ end
|
||||
|
||||
|
||||
module TypeProperty
|
||||
def self.set(_settingname,oldsetting)
|
||||
ret = pbChooseTypeList((oldsetting) ? oldsetting : 0)
|
||||
return (ret<0) ? (oldsetting) ? oldsetting : 0 : ret
|
||||
def self.set(_settingname, oldsetting)
|
||||
ret = pbChooseTypeList(oldsetting || nil)
|
||||
return ret || oldsetting
|
||||
end
|
||||
|
||||
def self.defaultValue
|
||||
return 0
|
||||
return nil
|
||||
end
|
||||
|
||||
def self.format(value)
|
||||
return (value) ? PBTypes.getName(value) : "-"
|
||||
return (value && GameData::Type.exists?(value)) ? GameData::Type.get(value).real_name : "-"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1256,8 +1256,7 @@ class EvolutionsProperty
|
||||
newparam = pbChooseMoveList
|
||||
when :PBSpecies
|
||||
newparam = pbChooseSpeciesList
|
||||
when :PBTypes
|
||||
allow_zero = true
|
||||
when :Type
|
||||
newparam = pbChooseTypeList
|
||||
when :Ability
|
||||
newparam = pbChooseAbilityList
|
||||
@@ -1345,8 +1344,7 @@ class EvolutionsProperty
|
||||
newparam = pbChooseMoveList(entry[1])
|
||||
when :PBSpecies
|
||||
newparam = pbChooseSpeciesList(entry[1])
|
||||
when :PBTypes
|
||||
allow_zero = true
|
||||
when :Type
|
||||
newparam = pbChooseTypeList(entry[1])
|
||||
when :Ability
|
||||
newparam = pbChooseAbilityList(entry[1])
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
def pbIsOldSpecialType?(type)
|
||||
return isConst?(type,PBTypes,:FIRE) ||
|
||||
isConst?(type,PBTypes,:WATER) ||
|
||||
isConst?(type,PBTypes,:ICE) ||
|
||||
isConst?(type,PBTypes,:GRASS) ||
|
||||
isConst?(type,PBTypes,:ELECTRIC) ||
|
||||
isConst?(type,PBTypes,:PSYCHIC) ||
|
||||
isConst?(type,PBTypes,:DRAGON) ||
|
||||
isConst?(type,PBTypes,:DARK)
|
||||
end
|
||||
|
||||
def pbGetLegalMoves(species)
|
||||
moves = []
|
||||
return moves if !species || species<=0
|
||||
@@ -164,17 +153,6 @@ end
|
||||
|
||||
|
||||
|
||||
def pbGetTypeConst(i)
|
||||
ret = MakeshiftConsts.get(MessageTypes::Types,i,PBTypes)
|
||||
if !ret
|
||||
ret = ["NORMAL","FIGHTING","FLYING","POISON","GROUND",
|
||||
"ROCK","BUG","GHOST","STEEL","QMARKS",
|
||||
"FIRE","WATER","GRASS","ELECTRIC","PSYCHIC",
|
||||
"ICE","DRAGON","DARK"][i]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbGetEvolutionConst(i)
|
||||
ret = MakeshiftConsts.get(50,i,PBEvolution)
|
||||
if !ret
|
||||
@@ -259,10 +237,11 @@ def pbChooseSpeciesList(default=0)
|
||||
return pbChooseList(commands,default,0,-1)
|
||||
end
|
||||
|
||||
# Displays an alphabetically sorted list of all moves, and returns the ID of the
|
||||
# move selected (or -1 if the selection was canceled). "default", if specified,
|
||||
# is the ID of the move to initially select.
|
||||
def pbChooseMoveList(default=0)
|
||||
# Displays a list of all moves, and returns the ID of the move selected (or nil
|
||||
# if the selection was canceled). "default", if specified, is the ID of the move
|
||||
# to initially select. Pressing Input::A will toggle the list sorting between
|
||||
# numerical and alphabetical.
|
||||
def pbChooseMoveList(default = nil)
|
||||
commands = []
|
||||
GameData::Move.each { |i| commands.push([i.id_number, i.name, i.id]) }
|
||||
return pbChooseList(commands, default, nil, -1)
|
||||
@@ -304,19 +283,17 @@ def pbChooseMoveListForSpecies(species, defaultMoveID = nil)
|
||||
return (ret >= 0) ? commands[ret][2] : nil
|
||||
end
|
||||
|
||||
# Displays an alphabetically sorted list of all types, and returns the ID of the
|
||||
# type selected (or -1 if the selection was canceled). "default", if specified,
|
||||
# is the ID of the type to initially select.
|
||||
def pbChooseTypeList(default=-1)
|
||||
# Displays a list of all types, and returns the ID of the type selected (or nil
|
||||
# if the selection was canceled). "default", if specified, is the ID of the type
|
||||
# to initially select. Pressing Input::A will toggle the list sorting between
|
||||
# numerical and alphabetical.
|
||||
def pbChooseTypeList(default = nil)
|
||||
commands = []
|
||||
for i in 0..PBTypes.maxValue
|
||||
cname = getConstantName(PBTypes,i) rescue nil
|
||||
commands.push([i,PBTypes.getName(i)]) if cname && !PBTypes.isPseudoType?(i)
|
||||
end
|
||||
return pbChooseList(commands,default)
|
||||
GameData::Type.each { |t| commands.push([t.id_number, t.name, t.id]) if !t.pseudo_type }
|
||||
return pbChooseList(commands, default, nil, -1)
|
||||
end
|
||||
|
||||
# Displays a list of all items, and returns the ID of the item selected (or -1
|
||||
# Displays a list of all items, and returns the ID of the item selected (or nil
|
||||
# if the selection was canceled). "default", if specified, is the ID of the item
|
||||
# to initially select. Pressing Input::A will toggle the list sorting between
|
||||
# numerical and alphabetical.
|
||||
@@ -327,7 +304,7 @@ def pbChooseItemList(default = nil)
|
||||
end
|
||||
|
||||
# Displays a list of all abilities, and returns the ID of the ability selected
|
||||
# (or -1 if the selection was canceled). "default", if specified, is the ID of
|
||||
# (or nil if the selection was canceled). "default", if specified, is the ID of
|
||||
# the ability to initially select. Pressing Input::A will toggle the list
|
||||
# sorting between numerical and alphabetical.
|
||||
def pbChooseAbilityList(default = nil)
|
||||
|
||||
@@ -311,7 +311,7 @@ module Compiler
|
||||
end
|
||||
return enumer.const_get(ret.to_sym)
|
||||
elsif enumer.is_a?(Symbol) || enumer.is_a?(String)
|
||||
if [:Ability, :Item, :Move, :TrainerType].include?(enumer)
|
||||
if [:Ability, :Item, :Move, :TrainerType, :Type].include?(enumer)
|
||||
enumer = GameData.const_get(enumer.to_sym)
|
||||
begin
|
||||
if ret == "" || !enumer.exists?(ret.to_sym)
|
||||
@@ -353,7 +353,7 @@ module Compiler
|
||||
return nil if ret=="" || !(enumer.const_defined?(ret) rescue false)
|
||||
return enumer.const_get(ret.to_sym)
|
||||
elsif enumer.is_a?(Symbol) || enumer.is_a?(String)
|
||||
if [:Ability, :Item, :Move, :TrainerType].include?(enumer)
|
||||
if [:Ability, :Item, :Move, :TrainerType, :Type].include?(enumer)
|
||||
enumer = GameData.const_get(enumer.to_sym)
|
||||
return nil if ret == "" || !enumer.exists?(ret.to_sym)
|
||||
return ret.to_sym
|
||||
@@ -632,15 +632,15 @@ module Compiler
|
||||
yield(_INTL("Compiling ability data"))
|
||||
compile_abilities # No dependencies
|
||||
yield(_INTL("Compiling move data"))
|
||||
compile_moves # Depends on PBTypes
|
||||
compile_moves # Depends on Type
|
||||
yield(_INTL("Compiling item data"))
|
||||
compile_items # Depends on Move
|
||||
yield(_INTL("Compiling berry plant data"))
|
||||
compile_berry_plants # Depends on Item
|
||||
yield(_INTL("Compiling Pokémon data"))
|
||||
compile_pokemon # Depends on Move, Item, PBTypes, Ability
|
||||
compile_pokemon # Depends on Move, Item, Type, Ability
|
||||
yield(_INTL("Compiling Pokémon forms data"))
|
||||
compile_pokemon_forms # Depends on PBSpecies, Move, Item, PBTypes, Ability
|
||||
compile_pokemon_forms # Depends on PBSpecies, Move, Item, Type, Ability
|
||||
yield(_INTL("Compiling machine data"))
|
||||
compile_move_compatibilities # Depends on PBSpecies, Move
|
||||
yield(_INTL("Compiling Trainer type data"))
|
||||
|
||||
@@ -254,123 +254,73 @@ module Compiler
|
||||
# Compile types
|
||||
#=============================================================================
|
||||
def compile_types
|
||||
typechart = []
|
||||
types = []
|
||||
requiredtypes = {
|
||||
"Name" => [1, "s"],
|
||||
"InternalName" => [2, "s"],
|
||||
}
|
||||
optionaltypes = {
|
||||
"IsPseudoType" => [3, "b"],
|
||||
"IsSpecialType" => [4, "b"],
|
||||
"Weaknesses" => [5, "*s"],
|
||||
"Resistances" => [6, "*s"],
|
||||
"Immunities" => [7, "*s"]
|
||||
}
|
||||
currentmap = -1
|
||||
foundtypes = []
|
||||
pbCompilerEachCommentedLine("PBS/types.txt") { |line,lineno|
|
||||
if line[/^\s*\[\s*(\d+)\s*\]\s*$/]
|
||||
sectionname = $~[1]
|
||||
if currentmap>=0
|
||||
for reqtype in requiredtypes.keys
|
||||
if !foundtypes.include?(reqtype)
|
||||
raise _INTL("Required value '{1}' not given in section [{2}].\r\n{3}",reqtype,currentmap,FileLineData.linereport)
|
||||
GameData::Type::DATA.clear
|
||||
type_names = []
|
||||
# Read from PBS file
|
||||
File.open("PBS/types.txt", "rb") { |f|
|
||||
FileLineData.file = "PBS/types.txt" # For error reporting
|
||||
# Read a whole section's lines at once, then run through this code.
|
||||
# contents is a hash containing all the XXX=YYY lines in that section, where
|
||||
# the keys are the XXX and the values are the YYY (as unprocessed strings).
|
||||
pbEachFileSection(f) { |contents, type_number|
|
||||
schema = GameData::Type::SCHEMA
|
||||
# Go through schema hash of compilable data and compile this section
|
||||
for key in schema.keys
|
||||
FileLineData.setSection(type_number, key, contents[key]) # For error reporting
|
||||
# Skip empty properties, or raise an error if a required property is
|
||||
# empty
|
||||
if contents[key].nil?
|
||||
if ["Name", "InternalName"].include?(key)
|
||||
raise _INTL("The entry {1} is required in PBS/types.txt section {2}.", key, type_id)
|
||||
end
|
||||
next
|
||||
end
|
||||
# Compile value for key
|
||||
value = pbGetCsvRecord(contents[key], key, schema[key])
|
||||
value = nil if value.is_a?(Array) && value.length == 0
|
||||
contents[key] = value
|
||||
# Ensure weaknesses/resistances/immunities are in arrays and are symbols
|
||||
if value && ["Weaknesses", "Resistances", "Immunities"].include?(key)
|
||||
contents[key] = [contents[key]] if !contents[key].is_a?(Array)
|
||||
contents[key].map! { |x| x.to_sym }
|
||||
contents[key].uniq!
|
||||
end
|
||||
foundtypes.clear
|
||||
end
|
||||
currentmap = sectionname.to_i
|
||||
types[currentmap] = [currentmap,nil,nil,false,false,[],[],[]]
|
||||
else
|
||||
if currentmap<0
|
||||
raise _INTL("Expected a section at the beginning of the file.\r\n{1}",FileLineData.linereport)
|
||||
end
|
||||
if !line[/^\s*(\w+)\s*=\s*(.*)$/]
|
||||
raise _INTL("Bad line syntax (expected syntax like XXX=YYY).\r\n{1}",FileLineData.linereport)
|
||||
end
|
||||
matchData = $~
|
||||
schema = nil
|
||||
FileLineData.setSection(currentmap,matchData[1],matchData[2])
|
||||
if requiredtypes.keys.include?(matchData[1])
|
||||
schema = requiredtypes[matchData[1]]
|
||||
foundtypes.push(matchData[1])
|
||||
else
|
||||
schema = optionaltypes[matchData[1]]
|
||||
end
|
||||
if schema
|
||||
record = pbGetCsvRecord(matchData[2],lineno,schema)
|
||||
types[currentmap][schema[0]] = record
|
||||
end
|
||||
end
|
||||
# Construct type hash
|
||||
type_symbol = contents["InternalName"].to_sym
|
||||
type_hash = {
|
||||
:id => type_symbol,
|
||||
:id_number => type_number,
|
||||
:name => contents["Name"],
|
||||
:pseudo_type => contents["IsPseudoType"],
|
||||
:special_type => contents["IsSpecialType"],
|
||||
:weaknesses => contents["Weaknesses"],
|
||||
:resistances => contents["Resistances"],
|
||||
:immunities => contents["Immunities"]
|
||||
}
|
||||
# Add type's data to records
|
||||
GameData::Type::DATA[type_number] = GameData::Type::DATA[type_symbol] = GameData::Type.new(type_hash)
|
||||
type_names[type_number] = type_hash[:name]
|
||||
}
|
||||
}
|
||||
types.compact!
|
||||
maxValue = 0
|
||||
for type in types; maxValue = [maxValue,type[0]].max; end
|
||||
pseudotypes = []
|
||||
specialtypes = []
|
||||
typenames = []
|
||||
typeinames = []
|
||||
typehash = {}
|
||||
for type in types
|
||||
pseudotypes.push(type[0]) if type[3]
|
||||
typenames[type[0]] = type[1]
|
||||
typeinames[type[0]] = type[2]
|
||||
typehash[type[0]] = type
|
||||
end
|
||||
for type in types
|
||||
n = type[1]
|
||||
for w in type[5]
|
||||
if !typeinames.include?(w)
|
||||
raise _INTL("'{1}' is not a defined type (PBS/types.txt, {2}, Weaknesses).",w,n)
|
||||
end
|
||||
# Ensure all weaknesses/resistances/immunities are valid types
|
||||
GameData::Type.each do |type|
|
||||
type.weaknesses.each do |other_type|
|
||||
next if GameData::Type.exists?(other_type)
|
||||
raise _INTL("'{1}' is not a defined type (PBS/types.txt, section {2}, Weaknesses).", other_type.to_s, type.id_number)
|
||||
end
|
||||
for w in type[6]
|
||||
if !typeinames.include?(w)
|
||||
raise _INTL("'{1}' is not a defined type (PBS/types.txt, {2}, Resistances).",w,n)
|
||||
end
|
||||
type.resistances.each do |other_type|
|
||||
next if GameData::Type.exists?(other_type)
|
||||
raise _INTL("'{1}' is not a defined type (PBS/types.txt, section {2}, Resistances).", other_type.to_s, type.id_number)
|
||||
end
|
||||
for w in type[7]
|
||||
if !typeinames.include?(w)
|
||||
raise _INTL("'{1}' is not a defined type (PBS/types.txt, {2}, Immunities).",w,n)
|
||||
end
|
||||
type.immunities.each do |other_type|
|
||||
next if GameData::Type.exists?(other_type)
|
||||
raise _INTL("'{1}' is not a defined type (PBS/types.txt, section {2}, Immunities).", other_type.to_s, type.id_number)
|
||||
end
|
||||
end
|
||||
for i in 0..maxValue
|
||||
pseudotypes.push(i) if !typehash[i]
|
||||
end
|
||||
pseudotypes.sort!
|
||||
types.each { |type| specialtypes.push(type[0]) if type[4] }
|
||||
specialtypes.sort!
|
||||
count = maxValue+1
|
||||
for i in 0...count
|
||||
type = typehash[i]
|
||||
j = 0; k = i
|
||||
while j<count
|
||||
typechart[k] = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
atype = typehash[j]
|
||||
if type && atype
|
||||
typechart[k] = PBTypeEffectiveness::SUPER_EFFECTIVE_ONE if type[5].include?(atype[2]) # weakness
|
||||
typechart[k] = PBTypeEffectiveness::NOT_EFFECTIVE_ONE if type[6].include?(atype[2]) # resistance
|
||||
typechart[k] = PBTypeEffectiveness::INEFFECTIVE if type[7].include?(atype[2]) # immune
|
||||
end
|
||||
j += 1; k += count
|
||||
end
|
||||
end
|
||||
MessageTypes.setMessages(MessageTypes::Types,typenames)
|
||||
code = "class PBTypes\r\n"
|
||||
for type in types
|
||||
code += "#{type[2]}=#{type[0]}\r\n"
|
||||
end
|
||||
code += "def self.getName(id)\r\n"
|
||||
code += "id=getID(PBTypes,id)\r\n"
|
||||
code += "return pbGetMessage(MessageTypes::Types,id); end\r\n"
|
||||
code += "def self.getCount; return #{types.length}; end\r\n"
|
||||
code += "def self.maxValue; return #{maxValue}; end\r\n"
|
||||
code += "end\r\n"
|
||||
eval(code, TOPLEVEL_BINDING)
|
||||
save_data([pseudotypes,specialtypes,typechart],"Data/types.dat")
|
||||
pbAddScript(code,"PBTypes")
|
||||
# Save all data
|
||||
GameData::Type.save
|
||||
MessageTypes.setMessages(MessageTypes::Types, type_names)
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -513,7 +463,7 @@ module Compiler
|
||||
# Read each line of moves.txt at a time and compile it into an move
|
||||
pbCompilerEachPreppedLine("PBS/moves.txt") { |line, line_no|
|
||||
line = pbGetCsvRecord(line, line_no, [0, "vnssueeuuuyiss",
|
||||
nil, nil, nil, nil, nil, PBTypes, ["Physical", "Special", "Status"],
|
||||
nil, nil, nil, nil, nil, :Type, ["Physical", "Special", "Status"],
|
||||
nil, nil, nil, PBTargets, nil, nil, nil
|
||||
])
|
||||
move_number = line[0]
|
||||
|
||||
Reference in New Issue
Block a user