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