mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 21:54:58 +00:00
Created and implemented GameData::Type
This commit is contained in:
@@ -39,7 +39,7 @@ class PokeBattle_Move
|
||||
@target = move.target
|
||||
@priority = move.priority
|
||||
@flags = move.flags
|
||||
@calcType = -1
|
||||
@calcType = nil
|
||||
@powerBoost = false # For Aerilate, Pixilate, Refrigerate, Galvanize
|
||||
@snatched = false
|
||||
end
|
||||
@@ -72,8 +72,9 @@ class PokeBattle_Move
|
||||
# AI), so using @calcType here is acceptable.
|
||||
def physicalMove?(thisType=nil)
|
||||
return (@category==0) if MOVE_CATEGORY_PER_MOVE
|
||||
thisType ||= @calcType if @calcType>=0
|
||||
thisType = @type if !thisType
|
||||
thisType ||= @calcType
|
||||
thisType ||= @type
|
||||
return true if !thisType
|
||||
return !PBTypes.isSpecialType?(thisType)
|
||||
end
|
||||
|
||||
@@ -81,8 +82,9 @@ class PokeBattle_Move
|
||||
# AI), so using @calcType here is acceptable.
|
||||
def specialMove?(thisType=nil)
|
||||
return (@category==1) if MOVE_CATEGORY_PER_MOVE
|
||||
thisType ||= @calcType if @calcType>=0
|
||||
thisType = @type if !thisType
|
||||
thisType ||= @calcType
|
||||
thisType ||= @type
|
||||
return false if !thisType
|
||||
return PBTypes.isSpecialType?(thisType)
|
||||
end
|
||||
|
||||
|
||||
@@ -234,8 +234,8 @@ class PokeBattle_Move
|
||||
oldHP = b.hp+b.damageState.hpLost
|
||||
PBDebug.log("[Move damage] #{b.pbThis} lost #{b.damageState.hpLost} HP (#{oldHP}=>#{b.hp})")
|
||||
effectiveness = 0
|
||||
if PBTypes.resistant?(b.damageState.typeMod); effectiveness = 1
|
||||
elsif PBTypes.superEffective?(b.damageState.typeMod); effectiveness = 2
|
||||
if PBTypeEffectiveness.resistant?(b.damageState.typeMod); effectiveness = 1
|
||||
elsif PBTypeEffectiveness.superEffective?(b.damageState.typeMod); effectiveness = 2
|
||||
end
|
||||
animArray.push([b,oldHP,effectiveness])
|
||||
end
|
||||
@@ -251,13 +251,13 @@ class PokeBattle_Move
|
||||
#=============================================================================
|
||||
def pbEffectivenessMessage(user,target,numTargets=1)
|
||||
return if target.damageState.disguise
|
||||
if PBTypes.superEffective?(target.damageState.typeMod)
|
||||
if PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
|
||||
if numTargets>1
|
||||
@battle.pbDisplay(_INTL("It's super effective on {1}!",target.pbThis(true)))
|
||||
else
|
||||
@battle.pbDisplay(_INTL("It's super effective!"))
|
||||
end
|
||||
elsif PBTypes.notVeryEffective?(target.damageState.typeMod)
|
||||
elsif PBTypeEffectiveness.notVeryEffective?(target.damageState.typeMod)
|
||||
if numTargets>1
|
||||
@battle.pbDisplay(_INTL("It's not very effective on {1}...",target.pbThis(true)))
|
||||
else
|
||||
@@ -326,7 +326,7 @@ class PokeBattle_Move
|
||||
# regardless of its calculated type. Hence the following two lines of
|
||||
# code.
|
||||
moveType = nil
|
||||
moveType = getID(PBTypes,:NORMAL) if @function=="090" # Hidden Power
|
||||
moveType = :NORMAL if @function=="090" # Hidden Power
|
||||
if physicalMove?(moveType)
|
||||
target.effects[PBEffects::Counter] = damage
|
||||
target.effects[PBEffects::CounterTarget] = user.index
|
||||
|
||||
@@ -4,8 +4,7 @@ class PokeBattle_Move
|
||||
#=============================================================================
|
||||
def pbBaseType(user)
|
||||
ret = @type
|
||||
return ret if !ret || ret<0
|
||||
if user.abilityActive?
|
||||
if ret && user.abilityActive?
|
||||
ret = BattleHandlers.triggerMoveBaseTypeModifierAbility(user.ability,user,self,ret)
|
||||
end
|
||||
return ret
|
||||
@@ -14,14 +13,13 @@ class PokeBattle_Move
|
||||
def pbCalcType(user)
|
||||
@powerBoost = false
|
||||
ret = pbBaseType(user)
|
||||
return ret if !ret || ret<0
|
||||
if hasConst?(PBTypes,:ELECTRIC)
|
||||
if @battle.field.effects[PBEffects::IonDeluge] && isConst?(ret,PBTypes,:NORMAL)
|
||||
ret = getConst(PBTypes,:ELECTRIC)
|
||||
if ret && GameData::Type.exists?(:ELECTRIC)
|
||||
if @battle.field.effects[PBEffects::IonDeluge] && ret == :NORMAL
|
||||
ret = :ELECTRIC
|
||||
@powerBoost = false
|
||||
end
|
||||
if user.effects[PBEffects::Electrify]
|
||||
ret = getConst(PBTypes,:ELECTRIC)
|
||||
ret = :ELECTRIC
|
||||
@powerBoost = false
|
||||
end
|
||||
end
|
||||
@@ -39,30 +37,29 @@ class PokeBattle_Move
|
||||
end
|
||||
# Foresight
|
||||
if user.hasActiveAbility?(:SCRAPPY) || target.effects[PBEffects::Foresight]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:GHOST) &&
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :GHOST &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
end
|
||||
# Miracle Eye
|
||||
if target.effects[PBEffects::MiracleEye]
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:DARK) &&
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :DARK &&
|
||||
PBTypes.ineffective?(moveType,defType)
|
||||
end
|
||||
# Delta Stream's weather
|
||||
if @battle.pbWeather==PBWeather::StrongWinds
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:FLYING) &&
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING &&
|
||||
PBTypes.superEffective?(moveType,defType)
|
||||
end
|
||||
# Grounded Flying-type Pokémon become susceptible to Ground moves
|
||||
if !target.airborne?
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(defType,PBTypes,:FLYING) &&
|
||||
isConst?(moveType,PBTypes,:GROUND)
|
||||
ret = PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if defType == :FLYING && moveType == :GROUND
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbCalcTypeMod(moveType,user,target)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType<0
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if isConst?(moveType,PBTypes,:GROUND) &&
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if !moveType
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType == :GROUND &&
|
||||
target.pbHasType?(:FLYING) && target.hasActiveItem?(:IRONBALL)
|
||||
# Determine types
|
||||
tTypes = target.pbTypes(true)
|
||||
@@ -190,7 +187,7 @@ class PokeBattle_Move
|
||||
return true if user.effects[PBEffects::LaserFocus]>0
|
||||
c += 1 if highCriticalRate?
|
||||
c += user.effects[PBEffects::FocusEnergy]
|
||||
c += 1 if user.inHyperMode? && isConst?(@type,PBTypes,:SHADOW)
|
||||
c += 1 if user.inHyperMode? && @type == :SHADOW
|
||||
c = ratios.length-1 if c>=ratios.length
|
||||
# Calculation
|
||||
return @battle.pbRandom(ratios[c])==0
|
||||
@@ -226,7 +223,7 @@ class PokeBattle_Move
|
||||
stageMul = [2,2,2,2,2,2, 2, 3,4,5,6,7,8]
|
||||
stageDiv = [8,7,6,5,4,3, 2, 2,2,2,2,2,2]
|
||||
# Get the move's type
|
||||
type = @calcType # -1 is treated as physical
|
||||
type = @calcType # nil is treated as physical
|
||||
# Calculate whether this hit deals critical damage
|
||||
target.damageState.critical = pbIsCritical?(user,target)
|
||||
# Calcuate base power of move
|
||||
@@ -257,8 +254,8 @@ class PokeBattle_Move
|
||||
|
||||
def pbCalcDamageMultipliers(user,target,numTargets,type,baseDmg,multipliers)
|
||||
# Global abilities
|
||||
if (@battle.pbCheckGlobalAbility(:DARKAURA) && isConst?(type,PBTypes,:DARK)) ||
|
||||
(@battle.pbCheckGlobalAbility(:FAIRYAURA) && isConst?(type,PBTypes,:FAIRY))
|
||||
if (@battle.pbCheckGlobalAbility(:DARKAURA) && type == :DARK) ||
|
||||
(@battle.pbCheckGlobalAbility(:FAIRYAURA) && type == :FAIRY)
|
||||
if @battle.pbCheckGlobalAbility(:AURABREAK)
|
||||
multipliers[BASE_DMG_MULT] *= 2/3.0
|
||||
else
|
||||
@@ -311,11 +308,11 @@ class PokeBattle_Move
|
||||
if user.effects[PBEffects::HelpingHand] && !self.is_a?(PokeBattle_Confusion)
|
||||
multipliers[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
if user.effects[PBEffects::Charge]>0 && isConst?(type,PBTypes,:ELECTRIC)
|
||||
if user.effects[PBEffects::Charge]>0 && type == :ELECTRIC
|
||||
multipliers[BASE_DMG_MULT] *= 2
|
||||
end
|
||||
# Mud Sport
|
||||
if isConst?(type,PBTypes,:ELECTRIC)
|
||||
if type == :ELECTRIC
|
||||
@battle.eachBattler do |b|
|
||||
next if !b.effects[PBEffects::MudSport]
|
||||
multipliers[BASE_DMG_MULT] /= 3
|
||||
@@ -326,7 +323,7 @@ class PokeBattle_Move
|
||||
end
|
||||
end
|
||||
# Water Sport
|
||||
if isConst?(type,PBTypes,:FIRE)
|
||||
if type == :FIRE
|
||||
@battle.eachBattler do |b|
|
||||
next if !b.effects[PBEffects::WaterSport]
|
||||
multipliers[BASE_DMG_MULT] /= 3
|
||||
@@ -340,21 +337,15 @@ class PokeBattle_Move
|
||||
if user.affectedByTerrain?
|
||||
case @battle.field.terrain
|
||||
when PBBattleTerrains::Electric
|
||||
if isConst?(type,PBTypes,:ELECTRIC)
|
||||
multipliers[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
multipliers[BASE_DMG_MULT] *= 1.5 if type == :ELECTRIC
|
||||
when PBBattleTerrains::Grassy
|
||||
if isConst?(type,PBTypes,:GRASS)
|
||||
multipliers[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
multipliers[BASE_DMG_MULT] *= 1.5 if type == :GRASS
|
||||
when PBBattleTerrains::Psychic
|
||||
if isConst?(type,PBTypes,:PSYCHIC)
|
||||
multipliers[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
multipliers[BASE_DMG_MULT] *= 1.5 if type == :PSYCHIC
|
||||
end
|
||||
end
|
||||
if @battle.field.terrain==PBBattleTerrains::Misty && target.affectedByTerrain? &&
|
||||
isConst?(type,PBTypes,:DRAGON)
|
||||
type == :DRAGON
|
||||
multipliers[BASE_DMG_MULT] /= 2
|
||||
end
|
||||
# Badge multipliers
|
||||
@@ -381,15 +372,15 @@ class PokeBattle_Move
|
||||
# Weather
|
||||
case @battle.pbWeather
|
||||
when PBWeather::Sun, PBWeather::HarshSun
|
||||
if isConst?(type,PBTypes,:FIRE)
|
||||
if type == :FIRE
|
||||
multipliers[FINAL_DMG_MULT] *= 1.5
|
||||
elsif isConst?(type,PBTypes,:WATER)
|
||||
elsif type == :WATER
|
||||
multipliers[FINAL_DMG_MULT] /= 2
|
||||
end
|
||||
when PBWeather::Rain, PBWeather::HeavyRain
|
||||
if isConst?(type,PBTypes,:FIRE)
|
||||
if type == :FIRE
|
||||
multipliers[FINAL_DMG_MULT] /= 2
|
||||
elsif isConst?(type,PBTypes,:WATER)
|
||||
elsif type == :WATER
|
||||
multipliers[FINAL_DMG_MULT] *= 1.5
|
||||
end
|
||||
when PBWeather::Sandstorm
|
||||
@@ -411,7 +402,7 @@ class PokeBattle_Move
|
||||
multipliers[FINAL_DMG_MULT] *= random/100.0
|
||||
end
|
||||
# STAB
|
||||
if type>=0 && user.pbHasType?(type)
|
||||
if type && user.pbHasType?(type)
|
||||
if user.hasActiveAbility?(:ADAPTABILITY)
|
||||
multipliers[FINAL_DMG_MULT] *= 2
|
||||
else
|
||||
|
||||
@@ -34,7 +34,7 @@ class PokeBattle_Confusion < PokeBattle_Move
|
||||
@priority = 0
|
||||
@flags = ""
|
||||
@addlEffect = 0
|
||||
@calcType = -1
|
||||
@calcType = nil
|
||||
@powerBoost = false
|
||||
@snatched = false
|
||||
end
|
||||
@@ -66,7 +66,7 @@ class PokeBattle_Struggle < PokeBattle_Move
|
||||
@priority = 0
|
||||
@flags = ""
|
||||
@addlEffect = 0
|
||||
@calcType = -1
|
||||
@calcType = nil
|
||||
@powerBoost = false
|
||||
@snatched = false
|
||||
end
|
||||
@@ -636,6 +636,7 @@ class PokeBattle_PledgeMove < PokeBattle_Move
|
||||
@battle.pbDisplay(_INTL("The two moves have become one! It's a combined move!"))
|
||||
@pledgeCombo = true
|
||||
@comboEffect = i[1]; @overrideType = i[2]; @overrideAnim = i[3]
|
||||
@overrideType = nil if !GameData::Type.exists?(@overrideType)
|
||||
break
|
||||
end
|
||||
return if @pledgeCombo
|
||||
|
||||
@@ -113,7 +113,7 @@ class PokeBattle_Move_007 < PokeBattle_ParalysisMove
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if @id == :THUNDERWAVE && PBTypes.ineffective?(target.damageState.typeMod)
|
||||
if @id == :THUNDERWAVE && PBTypeEffectiveness.ineffective?(target.damageState.typeMod)
|
||||
@battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
|
||||
return true
|
||||
end
|
||||
@@ -1709,7 +1709,7 @@ class PokeBattle_Move_05C < PokeBattle_Move
|
||||
if !lastMoveData ||
|
||||
user.pbHasMove?(target.lastRegularMoveUsed) ||
|
||||
@moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
lastMoveData.type == :SHADOW
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1759,7 +1759,7 @@ class PokeBattle_Move_05D < PokeBattle_Move
|
||||
if !lastMoveData ||
|
||||
user.pbHasMove?(target.lastRegularMoveUsed) ||
|
||||
@moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
lastMoveData.type = :SHADOW
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1810,7 +1810,7 @@ class PokeBattle_Move_05E < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
|
||||
user.pbChangeTypes(newType)
|
||||
typeName = PBTypes.getName(newType)
|
||||
typeName = GameData::Item.get(newType).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typeName))
|
||||
end
|
||||
end
|
||||
@@ -1824,7 +1824,7 @@ end
|
||||
class PokeBattle_Move_05F < PokeBattle_Move
|
||||
def ignoresSubstitute?(user); return true; end
|
||||
|
||||
def pbMoveFailed?(user,targets)
|
||||
def pbMoveFailed?(user, targets)
|
||||
if !user.canChangeType?
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
@@ -1832,20 +1832,19 @@ class PokeBattle_Move_05F < PokeBattle_Move
|
||||
return false
|
||||
end
|
||||
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if !target.lastMoveUsed || target.lastMoveUsedType < 0 ||
|
||||
PBTypes.isPseudoType?(GameData::Move.get(target.lastMoveUsed).type)
|
||||
def pbFailsAgainstTarget?(user, target)
|
||||
if !target.lastMoveUsed || !target.lastMoveUsedType ||
|
||||
PBTypes.isPseudoType?(target.lastMoveUsedType)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@newTypes = []
|
||||
for i in 0..PBTypes.maxValue
|
||||
next if PBTypes.isPseudoType?(i)
|
||||
next if user.pbHasType?(i)
|
||||
next if !PBTypes.resistant?(target.lastMoveUsedType,i)
|
||||
@newTypes.push(i)
|
||||
GameData::Type.each do |t|
|
||||
next if t.pseudo_type || user.pbHasType?(t.id) ||
|
||||
!PBTypes.resistant?(target.lastMoveUsedType, t.id)
|
||||
@newTypes.push(t.id)
|
||||
end
|
||||
if @newTypes.length==0
|
||||
if @newTypes.length == 0
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1855,8 +1854,8 @@ class PokeBattle_Move_05F < PokeBattle_Move
|
||||
def pbEffectGeneral(user)
|
||||
newType = @newTypes[@battle.pbRandom(@newTypes.length)]
|
||||
user.pbChangeTypes(newType)
|
||||
typeName = PBTypes.getName(newType)
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typeName))
|
||||
typeName = GameData::Type.get(newType).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!", user.pbThis, typeName))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1871,49 +1870,59 @@ class PokeBattle_Move_060 < PokeBattle_Move
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@newType = getID(PBTypes,:NORMAL)
|
||||
@newType = :NORMAL
|
||||
checkedTerrain = false
|
||||
case @battle.field.terrain
|
||||
when PBBattleTerrains::Electric
|
||||
if hasConst?(PBTypes,:ELECTRIC)
|
||||
@newType = getID(PBTypes,:ELECTRIC); checkedTerrain = true
|
||||
if GameData::Type.exists?(:ELECTRIC)
|
||||
@newType = :ELECTRIC
|
||||
checkedTerrain = true
|
||||
end
|
||||
when PBBattleTerrains::Grassy
|
||||
if hasConst?(PBTypes,:GRASS)
|
||||
@newType = getID(PBTypes,:GRASS); checkedTerrain = true
|
||||
if GameData::Type.exists?(:GRASS)
|
||||
@newType = :GRASS
|
||||
checkedTerrain = true
|
||||
end
|
||||
when PBBattleTerrains::Misty
|
||||
if hasConst?(PBTypes,:FAIRY)
|
||||
@newType = getID(PBTypes,:FAIRY); checkedTerrain = true
|
||||
if GameData::Type.exists?(:FAIRY)
|
||||
@newType = :FAIRY
|
||||
checkedTerrain = true
|
||||
end
|
||||
when PBBattleTerrains::Psychic
|
||||
if hasConst?(PBTypes,:PSYCHIC)
|
||||
@newType = getID(PBTypes,:PSYCHIC); checkedTerrain = true
|
||||
if GameData::Type.exists?(:PSYCHIC)
|
||||
@newType = :PSYCHIC
|
||||
checkedTerrain = true
|
||||
end
|
||||
end
|
||||
if !checkedTerrain
|
||||
case @battle.environment
|
||||
when PBEnvironment::Grass then @newType = getID(PBTypes,:GRASS)
|
||||
when PBEnvironment::TallGrass then @newType = getID(PBTypes,:GRASS)
|
||||
when PBEnvironment::MovingWater then @newType = getID(PBTypes,:WATER)
|
||||
when PBEnvironment::StillWater then @newType = getID(PBTypes,:WATER)
|
||||
when PBEnvironment::Puddle then @newType = getID(PBTypes,:WATER)
|
||||
when PBEnvironment::Underwater then @newType = getID(PBTypes,:WATER)
|
||||
when PBEnvironment::Cave then @newType = getID(PBTypes,:ROCK)
|
||||
when PBEnvironment::Rock then @newType = getID(PBTypes,:GROUND)
|
||||
when PBEnvironment::Sand then @newType = getID(PBTypes,:GROUND)
|
||||
when PBEnvironment::Forest then @newType = getID(PBTypes,:BUG)
|
||||
when PBEnvironment::ForestGrass then @newType = getID(PBTypes,:BUG)
|
||||
when PBEnvironment::Snow then @newType = getID(PBTypes,:ICE)
|
||||
when PBEnvironment::Ice then @newType = getID(PBTypes,:ICE)
|
||||
when PBEnvironment::Volcano then @newType = getID(PBTypes,:FIRE)
|
||||
when PBEnvironment::Graveyard then @newType = getID(PBTypes,:GHOST)
|
||||
when PBEnvironment::Sky then @newType = getID(PBTypes,:FLYING)
|
||||
when PBEnvironment::Space then @newType = getID(PBTypes,:DRAGON)
|
||||
when PBEnvironment::UltraSpace then @newType = getID(PBTypes,:PSYCHIC)
|
||||
when PBEnvironment::Grass, PBEnvironment::TallGrass
|
||||
@newType = :GRASS
|
||||
when PBEnvironment::MovingWater, PBEnvironment::StillWater,
|
||||
PBEnvironment::Puddle, PBEnvironment::Underwater
|
||||
@newType = :WATER
|
||||
when PBEnvironment::Cave
|
||||
@newType = :ROCK
|
||||
when PBEnvironment::Rock, PBEnvironment::Sand
|
||||
@newType = :GROUND
|
||||
when PBEnvironment::Forest, PBEnvironment::ForestGrass
|
||||
@newType = :BUG
|
||||
when PBEnvironment::Snow, PBEnvironment::Ice
|
||||
@newType = :ICE
|
||||
when PBEnvironment::Volcano
|
||||
@newType = :FIRE
|
||||
when PBEnvironment::Graveyard
|
||||
@newType = :GHOST
|
||||
when PBEnvironment::Sky
|
||||
@newType = :FLYING
|
||||
when PBEnvironment::Space
|
||||
@newType = :DRAGON
|
||||
when PBEnvironment::UltraSpace
|
||||
@newType = :PSYCHIC
|
||||
end
|
||||
end
|
||||
if !user.pbHasOtherType?(@newType)
|
||||
@newType = :NORMAL if !GameData::Type.exists?(@newType)
|
||||
if !GameData::Type.exists?(@newType) || !user.pbHasOtherType?(@newType)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1922,7 +1931,7 @@ class PokeBattle_Move_060 < PokeBattle_Move
|
||||
|
||||
def pbEffectGeneral(user)
|
||||
user.pbChangeTypes(@newType)
|
||||
typeName = PBTypes.getName(@newType)
|
||||
typeName = GameData::Type.get(@newType).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typeName))
|
||||
end
|
||||
end
|
||||
@@ -1934,8 +1943,8 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_061 < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if !target.canChangeType? ||
|
||||
!target.pbHasOtherType?(getConst(PBTypes,:WATER))
|
||||
if !target.canChangeType? || !GameData::Type.exists?(:WATER) ||
|
||||
!target.pbHasOtherType?(:WATER)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1943,9 +1952,8 @@ class PokeBattle_Move_061 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
newType = getConst(PBTypes,:WATER)
|
||||
target.pbChangeTypes(newType)
|
||||
typeName = PBTypes.getName(newType)
|
||||
target.pbChangeTypes(:WATER)
|
||||
typeName = GameData::Type.get(:WATER).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",target.pbThis,typeName))
|
||||
end
|
||||
end
|
||||
@@ -2362,8 +2370,7 @@ class PokeBattle_Move_070 < PokeBattle_FixedDamageMove
|
||||
@battle.pbHideAbilitySplash(target)
|
||||
return true
|
||||
end
|
||||
if NEWEST_BATTLE_MECHANICS &&
|
||||
isConst?(target.damageState.typeMod,PBTypes,:ICE) && target.pbHasType?(:ICE)
|
||||
if NEWEST_BATTLE_MECHANICS && @id == :SHEERCOLD && target.pbHasType?(:ICE)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -110,26 +110,26 @@ class PokeBattle_Move_087 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbBaseType(user)
|
||||
ret = getID(PBTypes,:NORMAL)
|
||||
ret = :NORMAL
|
||||
case @battle.pbWeather
|
||||
when PBWeather::Sun, PBWeather::HarshSun
|
||||
ret = getConst(PBTypes,:FIRE) || ret
|
||||
ret = :FIRE if GameData::Type.exists?(:FIRE)
|
||||
when PBWeather::Rain, PBWeather::HeavyRain
|
||||
ret = getConst(PBTypes,:WATER) || ret
|
||||
ret = :WATER if GameData::Type.exists?(:WATER)
|
||||
when PBWeather::Sandstorm
|
||||
ret = getConst(PBTypes,:ROCK) || ret
|
||||
ret = :ROCK if GameData::Type.exists?(:ROCK)
|
||||
when PBWeather::Hail
|
||||
ret = getConst(PBTypes,:ICE) || ret
|
||||
ret = :ICE if GameData::Type.exists?(:ICE)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
|
||||
t = pbBaseType(user)
|
||||
hitNum = 1 if isConst?(t,PBTypes,:FIRE) # Type-specific anims
|
||||
hitNum = 2 if isConst?(t,PBTypes,:WATER)
|
||||
hitNum = 3 if isConst?(t,PBTypes,:ROCK)
|
||||
hitNum = 4 if isConst?(t,PBTypes,:ICE)
|
||||
hitNum = 1 if t == :FIRE # Type-specific anims
|
||||
hitNum = 2 if t == :WATER
|
||||
hitNum = 3 if t == :ROCK
|
||||
hitNum = 4 if t == :ICE
|
||||
super
|
||||
end
|
||||
end
|
||||
@@ -262,11 +262,8 @@ def pbHiddenPower(pkmn)
|
||||
iv = pkmn.iv
|
||||
idxType = 0; power = 60
|
||||
types = []
|
||||
for i in 0..PBTypes.maxValue
|
||||
next if PBTypes.isPseudoType?(i)
|
||||
next if isConst?(i,PBTypes,:NORMAL) || isConst?(i,PBTypes,:SHADOW)
|
||||
types.push(i)
|
||||
end
|
||||
GameData::Type.each { |t| types.push(t.id) if !t.pseudo_type && ![:NORMAL, :SHADOW].include?(t.id)}
|
||||
types.sort! { |a, b| GameData::Type.get(a).id_number <=> GameData::Type.get(b).id_number }
|
||||
idxType |= (iv[PBStats::HP]&1)
|
||||
idxType |= (iv[PBStats::ATTACK]&1)<<1
|
||||
idxType |= (iv[PBStats::DEFENSE]&1)<<2
|
||||
@@ -491,10 +488,10 @@ class PokeBattle_Move_096 < PokeBattle_Move
|
||||
# the AI won't want to use it if the user has no item anyway, and
|
||||
# complex item movement is unlikely, perhaps this is good enough.
|
||||
def pbBaseType(user)
|
||||
ret = getID(PBTypes,:NORMAL)
|
||||
ret = :NORMAL
|
||||
@typeArray.each do |type, items|
|
||||
next if !items.include?(@berry.id)
|
||||
ret = getConst(PBTypes,type) || ret
|
||||
ret = type if GameData::Type.exists?(type)
|
||||
break
|
||||
end
|
||||
return ret
|
||||
@@ -765,12 +762,11 @@ class PokeBattle_Move_09F < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbBaseType(user)
|
||||
ret = getID(PBTypes,:NORMAL)
|
||||
ret = :NORMAL
|
||||
if user.itemActive?
|
||||
@itemTypes.each do |item, itemType|
|
||||
next if user.item != item
|
||||
t = getConst(PBTypes,itemType)
|
||||
ret = t || ret
|
||||
ret = itemType if GameData::Type.exists?(itemType)
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -781,10 +777,10 @@ class PokeBattle_Move_09F < PokeBattle_Move
|
||||
if @id == :TECHNOBLAST # Type-specific anim
|
||||
t = pbBaseType(user)
|
||||
hitNum = 0
|
||||
hitNum = 1 if isConst?(t,PBTypes,:ELECTRIC)
|
||||
hitNum = 2 if isConst?(t,PBTypes,:FIRE)
|
||||
hitNum = 3 if isConst?(t,PBTypes,:ICE)
|
||||
hitNum = 4 if isConst?(t,PBTypes,:WATER)
|
||||
hitNum = 1 if t == :ELECTRIC
|
||||
hitNum = 2 if t == :FIRE
|
||||
hitNum = 3 if t == :ICE
|
||||
hitNum = 4 if t == :WATER
|
||||
end
|
||||
super
|
||||
end
|
||||
@@ -1551,7 +1547,7 @@ class PokeBattle_Move_0B5 < PokeBattle_Move
|
||||
next if NEWEST_BATTLE_MECHANICS && pkmn.egg?
|
||||
pkmn.moves.each do |move|
|
||||
next if @moveBlacklist.include?(move.function_code)
|
||||
next if isConst?(move.type,PBTypes,:SHADOW)
|
||||
next if move.type == :SHADOW
|
||||
@assistMoves.push(move.id)
|
||||
end
|
||||
end
|
||||
@@ -1670,7 +1666,7 @@ class PokeBattle_Move_0B6 < PokeBattle_Move
|
||||
move_data = GameData::Move.get(move_id)
|
||||
next if @moveBlacklist.include?(move_data.function_code)
|
||||
next if @moveBlacklistSignatures.include?(move_data.id)
|
||||
next if isConst?(move_data.type, PBTypes, :SHADOW)
|
||||
next if move_data.type == :SHADOW
|
||||
@metronomeMove = move_data.id
|
||||
break
|
||||
end
|
||||
|
||||
@@ -107,8 +107,8 @@ class PokeBattle_Move_106 < PokeBattle_PledgeMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
# [Function code to combo with, effect, override type, override animation]
|
||||
@combos = [["107", :SeaOfFire, getConst(PBTypes, :FIRE), :FIREPLEDGE],
|
||||
["108", :Swamp, nil, nil]]
|
||||
@combos = [["107", :SeaOfFire, :FIRE, :FIREPLEDGE],
|
||||
["108", :Swamp, nil, nil]]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -123,8 +123,8 @@ class PokeBattle_Move_107 < PokeBattle_PledgeMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
# [Function code to combo with, effect, override type, override animation]
|
||||
@combos = [["108", :Rainbow, getConst(PBTypes, :WATER), :WATERPLEDGE],
|
||||
["106", :SeaOfFire, nil, nil]]
|
||||
@combos = [["108", :Rainbow, :WATER, :WATERPLEDGE],
|
||||
["106", :SeaOfFire, nil, nil]]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -139,8 +139,8 @@ class PokeBattle_Move_108 < PokeBattle_PledgeMove
|
||||
def initialize(battle,move)
|
||||
super
|
||||
# [Function code to combo with, effect, override type, override animation]
|
||||
@combos = [["106", :Swamp, getConst(PBTypes, :GRASS), :GRASSPLEDGE],
|
||||
["107", :Rainbow, nil, nil]]
|
||||
@combos = [["106", :Swamp, :GRASS, :GRASSPLEDGE],
|
||||
["107", :Rainbow, nil, nil]]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -768,8 +768,7 @@ class PokeBattle_Move_11C < PokeBattle_Move
|
||||
def hitsFlyingTargets?; return true; end
|
||||
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if isConst?(moveType,PBTypes,:GROUND) &&
|
||||
isConst?(defType,PBTypes,:FLYING)
|
||||
return PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE if moveType == :GROUND && defType == :FLYING
|
||||
return super
|
||||
end
|
||||
|
||||
@@ -1065,7 +1064,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_135 < PokeBattle_FreezeMove
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
return PBTypeEffectiveness::SUPER_EFFECTIVE_ONE if isConst?(defType,PBTypes,:WATER)
|
||||
return PBTypeEffectiveness::SUPER_EFFECTIVE_ONE if defType == :WATER
|
||||
return super
|
||||
end
|
||||
end
|
||||
@@ -1402,7 +1401,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_142 < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if !hasConst?(PBTypes,:GHOST) || target.pbHasType?(:GHOST) || !target.canChangeType?
|
||||
if !GameData::Type.exists?(:GHOST) || target.pbHasType?(:GHOST) || !target.canChangeType?
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1410,9 +1409,8 @@ class PokeBattle_Move_142 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
ghostType = getConst(PBTypes,:GHOST)
|
||||
target.effects[PBEffects::Type3] = ghostType
|
||||
typeName = PBTypes.getName(ghostType)
|
||||
target.effects[PBEffects::Type3] = :GHOST
|
||||
typeName = GameData::Type.get(:GHOST).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",target.pbThis,typeName))
|
||||
end
|
||||
end
|
||||
@@ -1424,7 +1422,7 @@ end
|
||||
#===============================================================================
|
||||
class PokeBattle_Move_143 < PokeBattle_Move
|
||||
def pbFailsAgainstTarget?(user,target)
|
||||
if !hasConst?(PBTypes,:GRASS) || target.pbHasType?(:GRASS) || !target.canChangeType?
|
||||
if !GameData::Type.exists?(:GRASS) || target.pbHasType?(:GRASS) || !target.canChangeType?
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
end
|
||||
@@ -1432,9 +1430,8 @@ class PokeBattle_Move_143 < PokeBattle_Move
|
||||
end
|
||||
|
||||
def pbEffectAgainstTarget(user,target)
|
||||
grassType = getConst(PBTypes,:GRASS)
|
||||
target.effects[PBEffects::Type3] = grassType
|
||||
typeName = PBTypes.getName(grassType)
|
||||
target.effects[PBEffects::Type3] = :GRASS
|
||||
typeName = GameData::Type.get(:GRASS).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",target.pbThis,typeName))
|
||||
end
|
||||
end
|
||||
@@ -1455,9 +1452,9 @@ class PokeBattle_Move_144 < PokeBattle_Move
|
||||
|
||||
def pbCalcTypeModSingle(moveType,defType,user,target)
|
||||
ret = super
|
||||
if hasConst?(PBTypes,:FLYING)
|
||||
flyingEff = PBTypes.getEffectiveness(getConst(PBTypes,:FLYING),defType)
|
||||
ret *= flyingEff.to_f/PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
if GameData::Type.exists?(:FLYING)
|
||||
flyingEff = PBTypes.getEffectiveness(:FLYING, defType)
|
||||
ret *= flyingEff.to_f / PBTypeEffectiveness::NORMAL_EFFECTIVE_ONE
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -2254,7 +2251,7 @@ end
|
||||
class PokeBattle_Move_169 < PokeBattle_Move
|
||||
def pbBaseType(user)
|
||||
userTypes = user.pbTypes(true)
|
||||
return (userTypes.length==0) ? -1 : userTypes[0]
|
||||
return userTypes[0]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user