Implemented GameData::Move

This commit is contained in:
Maruno17
2020-11-19 21:00:29 +00:00
parent 52ffae9e8a
commit 3cd8d59918
71 changed files with 1443 additions and 1584 deletions

View File

@@ -9,7 +9,7 @@ class PokeBattle_Move
attr_reader :category
attr_reader :accuracy
attr_accessor :pp
attr_writer :totalpp
attr_writer :total_pp
attr_reader :addlEffect
attr_reader :target
attr_reader :priority
@@ -23,23 +23,22 @@ class PokeBattle_Move
#=============================================================================
# Creating a move
#=============================================================================
def initialize(battle,move)
def initialize(battle, move)
@battle = battle
@realMove = move
@id = move.id
@name = PBMoves.getName(@id) # Get the move's name
@name = move.name # Get the move's name
# Get data on the move
moveData = pbGetMoveData(@id)
@function = moveData[MoveData::FUNCTION_CODE]
@baseDamage = moveData[MoveData::BASE_DAMAGE]
@type = moveData[MoveData::TYPE]
@category = moveData[MoveData::CATEGORY]
@accuracy = moveData[MoveData::ACCURACY]
@function = move.function_code
@baseDamage = move.base_damage
@type = move.type
@category = move.category
@accuracy = move.accuracy
@pp = move.pp # Can be changed with Mimic/Transform
@addlEffect = moveData[MoveData::EFFECT_CHANCE]
@target = moveData[MoveData::TARGET]
@priority = moveData[MoveData::PRIORITY]
@flags = moveData[MoveData::FLAGS]
@addlEffect = move.effect_chance
@target = move.target
@priority = move.priority
@flags = move.flags
@calcType = -1
@powerBoost = false # For Aerilate, Pixilate, Refrigerate, Galvanize
@snatched = false
@@ -48,14 +47,14 @@ class PokeBattle_Move
# This is the code actually used to generate a PokeBattle_Move object. The
# object generated is a subclass of this one which depends on the move's
# function code (found in the script section PokeBattle_MoveEffect).
def PokeBattle_Move.pbFromPBMove(battle,move)
move = PBMove.new(0) if !move
moveFunction = pbGetMoveData(move.id,MoveData::FUNCTION_CODE) || "000"
className = sprintf("PokeBattle_Move_%s",moveFunction)
def PokeBattle_Move.pbFromPBMove(battle, move)
validate move => PBMove
moveFunction = move.function_code || "000"
className = sprintf("PokeBattle_Move_%s", moveFunction)
if Object.const_defined?(className)
return Object.const_get(className).new(battle,move)
return Object.const_get(className).new(battle, move)
end
return PokeBattle_UnimplementedMove.new(battle,move)
return PokeBattle_UnimplementedMove.new(battle, move)
end
#=============================================================================
@@ -63,9 +62,9 @@ class PokeBattle_Move
#=============================================================================
def pbTarget(_user); return @target; end
def totalpp
return @totalpp if @totalpp && @totalpp>0 # Usually undefined
return @realMove.totalpp if @realMove
def total_pp
return @total_pp if @total_pp && @total_pp>0 # Usually undefined
return @realMove.total_pp if @realMove
return 0
end

View File

@@ -29,7 +29,7 @@ class PokeBattle_Move
# Is false if Power Herb or another effect lets a two turn move charge and
# attack in the same turn.
# user.effects[PBEffects::TwoTurnAttack] is set to the move's ID during the
# charging turn, and is 0 during the attack turn.
# charging turn, and is nil during the attack turn.
def pbIsChargingTurn?(user); return false; end
def pbDamagingMove?; return damagingMove?; end

View File

@@ -54,8 +54,8 @@ class PokeBattle_Struggle < PokeBattle_Move
def initialize(battle,move)
@battle = battle
@realMove = nil # Not associated with a move
@id = (move) ? move.id : -1 # Doesn't work if 0
@name = (move) ? PBMoves.getName(@id) : _INTL("Struggle")
@id = (move) ? move.id : :STRUGGLE
@name = (move) ? move.name : _INTL("Struggle")
@function = "002"
@baseDamage = 50
@type = -1
@@ -410,14 +410,14 @@ class PokeBattle_TwoTurnMove < PokeBattle_Move
def chargingTurnMove?; return true; end
# user.effects[PBEffects::TwoTurnAttack] is set to the move's ID if this
# method returns true, or 0 if false.
# Non-zero means the charging turn. 0 means the attacking turn.
# method returns true, or nil if false.
# Non-nil means the charging turn. nil means the attacking turn.
def pbIsChargingTurn?(user)
@powerHerb = false
@chargingTurn = false # Assume damaging turn by default
@damagingTurn = true
# 0 at start of charging turn, move's ID at start of damaging turn
if user.effects[PBEffects::TwoTurnAttack]==0
if !user.effects[PBEffects::TwoTurnAttack]
@powerHerb = user.hasActiveItem?(:POWERHERB)
@chargingTurn = true
@damagingTurn = @powerHerb
@@ -643,7 +643,7 @@ class PokeBattle_PledgeMove < PokeBattle_Move
user.eachAlly do |b|
next if @battle.choices[b.index][0]!=:UseMove || b.movedThisRound?
move = @battle.choices[b.index][2]
next if !move || move.id<=0
next if !move
@combos.each do |i|
next if i[0]!=move.function
@pledgeSetup = true
@@ -708,7 +708,7 @@ class PokeBattle_PledgeMove < PokeBattle_Move
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
return if @pledgeSetup # No animation for setting up
id = @overrideAnim if @overrideAnim!=nil
id = @overrideAnim if @overrideAnim
return super
end
end

View File

@@ -32,7 +32,7 @@ end
#===============================================================================
class PokeBattle_Move_003 < PokeBattle_SleepMove
def pbMoveFailed?(user,targets)
if NEWEST_BATTLE_MECHANICS && isConst?(@id,PBMoves,:DARKVOID)
if NEWEST_BATTLE_MECHANICS && @id == :DARKVOID
if !user.isSpecies?(:DARKRAI) &&
!isConst?(user.effects[PBEffects::TransformSpecies],PBSpecies,:DARKRAI)
@battle.pbDisplay(_INTL("But {1} can't use the move!",user.pbThis))
@@ -45,7 +45,7 @@ class PokeBattle_Move_003 < PokeBattle_SleepMove
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
return if numHits==0
return if user.fainted? || user.effects[PBEffects::Transform]
return if !isConst?(@id,PBMoves,:RELICSONG)
return if @id != :RELICSONG
return if !user.isSpecies?(:MELOETTA)
return if user.hasActiveAbility?(:SHEERFORCE) && @addlEffect>0
newForm = (oldForm+1)%2
@@ -108,12 +108,12 @@ end
class PokeBattle_Move_007 < PokeBattle_ParalysisMove
def tramplesMinimize?(param=1)
# Perfect accuracy and double damage (for Body Slam only)
return NEWEST_BATTLE_MECHANICS if isConst?(@id,PBMoves,:BODYSLAM)
return NEWEST_BATTLE_MECHANICS if @id == :BODYSLAM
return super
end
def pbFailsAgainstTarget?(user,target)
if isConst?(@id,PBMoves,:THUNDERWAVE) && PBTypes.ineffective?(target.damageState.typeMod)
if @id == :THUNDERWAVE && PBTypes.ineffective?(target.damageState.typeMod)
@battle.pbDisplay(_INTL("It doesn't affect {1}...",target.pbThis(true)))
return true
end
@@ -242,7 +242,7 @@ end
#===============================================================================
class PokeBattle_Move_010 < PokeBattle_FlinchMove
def tramplesMinimize?(param=1)
return super if isConst?(@id,PBMoves,:DRAGONRUSH) && !NEWEST_BATTLE_MECHANICS
return super if @id == :DRAGONRUSH && !NEWEST_BATTLE_MECHANICS
return true if param==1 && NEWEST_BATTLE_MECHANICS # Perfect accuracy
return true if param==2 # Double damage
return super
@@ -492,9 +492,9 @@ class PokeBattle_Move_019 < PokeBattle_Move
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
super
if isConst?(@id,PBMoves,:AROMATHERAPY)
if @id == :AROMATHERAPY
@battle.pbDisplay(_INTL("A soothing aroma wafted through the area!"))
elsif isConst?(@id,PBMoves,:HEALBELL)
elsif @id == :HEALBELL
@battle.pbDisplay(_INTL("A bell chimed!"))
end
end
@@ -1217,7 +1217,7 @@ class PokeBattle_Move_044 < PokeBattle_TargetStatDownMove
end
def pbBaseDamage(baseDmg,user,target)
if isConst?(@id,PBMoves,:BULLDOZE) && @battle.field.terrain==PBBattleTerrains::Grassy
if @id == :BULLDOZE && @battle.field.terrain==PBBattleTerrains::Grassy
baseDmg = (baseDmg/2.0).round
end
return baseDmg
@@ -1406,7 +1406,7 @@ class PokeBattle_Move_04D < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
inc = 2
inc = 1 if isConst?(@id,PBMoves,:STRINGSHOT) && !NEWEST_BATTLE_MECHANICS
inc = 1 if @id == :STRINGSHOT && !NEWEST_BATTLE_MECHANICS
@statDown = [PBStats::SPEED,inc]
end
end
@@ -1705,11 +1705,11 @@ class PokeBattle_Move_05C < PokeBattle_Move
end
def pbFailsAgainstTarget?(user,target)
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
if target.lastRegularMoveUsed<=0 ||
lastMoveData = GameData::Move.try_get(target.lastRegularMoveUsed)
if !lastMoveData ||
user.pbHasMove?(target.lastRegularMoveUsed) ||
@moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
@moveBlacklist.include?(lastMoveData.function_code) ||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1721,8 +1721,7 @@ class PokeBattle_Move_05C < PokeBattle_Move
next if m.id!=@id
newMove = PBMove.new(target.lastRegularMoveUsed)
user.moves[i] = PokeBattle_Move.pbFromPBMove(@battle,newMove)
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,
PBMoves.getName(target.lastRegularMoveUsed)))
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,newMove.name))
user.pbCheckFormOnMovesetChange
break
end
@@ -1756,11 +1755,11 @@ class PokeBattle_Move_05D < PokeBattle_Move
end
def pbFailsAgainstTarget?(user,target)
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
if target.lastRegularMoveUsed<=0 ||
lastMoveData = GameData::Move.try_get(target.lastRegularMoveUsed)
if !lastMoveData ||
user.pbHasMove?(target.lastRegularMoveUsed) ||
@moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
@moveBlacklist.include?(lastMoveData.function_code) ||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1773,8 +1772,7 @@ class PokeBattle_Move_05D < PokeBattle_Move
newMove = PBMove.new(target.lastRegularMoveUsed)
user.pokemon.moves[i] = newMove
user.moves[i] = PokeBattle_Move.pbFromPBMove(@battle,newMove)
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,
PBMoves.getName(target.lastRegularMoveUsed)))
@battle.pbDisplay(_INTL("{1} learned {2}!",user.pbThis,newMove.name))
user.pbCheckFormOnMovesetChange
break
end
@@ -1835,9 +1833,8 @@ class PokeBattle_Move_05F < PokeBattle_Move
end
def pbFailsAgainstTarget?(user,target)
if target.lastMoveUsed<=0 ||
target.lastMoveUsedType<0 ||
PBTypes.isPseudoType?(pbGetMoveData(target.lastMoveUsed,MoveData::TYPE))
if !target.lastMoveUsed || target.lastMoveUsedType < 0 ||
PBTypes.isPseudoType?(GameData::Move.get(target.lastMoveUsed).type)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -2347,7 +2344,7 @@ end
# OHKO. Accuracy increases by difference between levels of user and target.
#===============================================================================
class PokeBattle_Move_070 < PokeBattle_FixedDamageMove
def hitsDiggingTargets?; return isConst?(@id,PBMoves,:FISSURE); end
def hitsDiggingTargets?; return @id == :FISSURE; end
def pbFailsAgainstTarget?(user,target)
if target.level>user.level
@@ -2375,8 +2372,7 @@ class PokeBattle_Move_070 < PokeBattle_FixedDamageMove
def pbAccuracyCheck(user,target)
acc = @accuracy+user.level-target.level
acc -= 10 if NEWEST_BATTLE_MECHANICS && isConst?(@id,PBMoves,:SHEERCOLD) &&
!user.pbHasType?(:ICE)
acc -= 10 if NEWEST_BATTLE_MECHANICS && @id == :SHEERCOLD && !user.pbHasType?(:ICE)
return @battle.pbRandom(100)<acc
end

View File

@@ -714,7 +714,7 @@ end
class PokeBattle_Move_09F < PokeBattle_Move
def initialize(battle,move)
super
if isConst?(@id,PBMoves,:JUDGMENT)
if @id == :JUDGMENT
@itemTypes = {
:FISTPLATE => :FIGHTING,
:SKYPLATE => :FLYING,
@@ -734,14 +734,14 @@ class PokeBattle_Move_09F < PokeBattle_Move
:DREADPLATE => :DARK,
:PIXIEPLATE => :FAIRY
}
elsif isConst?(@id,PBMoves,:TECHNOBLAST)
elsif @id == :TECHNOBLAST
@itemTypes = {
:SHOCKDRIVE => :ELECTRIC,
:BURNDRIVE => :FIRE,
:CHILLDRIVE => :ICE,
:DOUSEDRIVE => :WATER
}
elsif isConst?(@id,PBMoves,:MULTIATTACK)
elsif @id == :MULTIATTACK
@itemTypes = {
:FIGHTINGMEMORY => :FIGHTING,
:FLYINGMEMORY => :FLYING,
@@ -778,7 +778,7 @@ class PokeBattle_Move_09F < PokeBattle_Move
end
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
if isConst?(@id,PBMoves,:TECHNOBLAST) # Type-specific anim
if @id == :TECHNOBLAST # Type-specific anim
t = pbBaseType(user)
hitNum = 0
hitNum = 1 if isConst?(t,PBTypes,:ELECTRIC)
@@ -956,22 +956,22 @@ class PokeBattle_Move_0A4 < PokeBattle_Move
end
def pbShowAnimation(id,user,targets,hitNum=0,showAnimation=true)
id = getConst(PBMoves,:BODYSLAM) # Environment-specific anim
id = :BODYSLAM # Environment-specific anim
case @secretPower
when 1; id = getConst(PBMoves,:THUNDERSHOCK) || id
when 2; id = getConst(PBMoves,:VINEWHIP) || id
when 3; id = getConst(PBMoves,:FAIRYWIND) || id
when 4; id = getConst(PBMoves,:CONFUSION) || id
when 5; id = getConst(PBMoves,:WATERPULSE) || id
when 6; id = getConst(PBMoves,:MUDSHOT) || id
when 7; id = getConst(PBMoves,:ROCKTHROW) || id
when 8; id = getConst(PBMoves,:MUDSLAP) || id
when 9; id = getConst(PBMoves,:ICESHARD) || id
when 10; id = getConst(PBMoves,:INCINERATE) || id
when 11; id = getConst(PBMoves,:SHADOWSNEAK) || id
when 12; id = getConst(PBMoves,:GUST) || id
when 13; id = getConst(PBMoves,:SWIFT) || id
when 14; id = getConst(PBMoves,:PSYWAVE) || id
when 1; id = :THUNDERSHOCK if GameData::Move.exists?(:THUNDERSHOCK)
when 2; id = :VINEWHIP if GameData::Move.exists?(:VINEWHIP)
when 3; id = :FAIRYWIND if GameData::Move.exists?(:FAIRYWIND)
when 4; id = :CONFUSIO if GameData::Move.exists?(:CONFUSION)
when 5; id = :WATERPULSE if GameData::Move.exists?(:WATERPULSE)
when 6; id = :MUDSHOT if GameData::Move.exists?(:MUDSHOT)
when 7; id = :ROCKTHROW if GameData::Move.exists?(:ROCKTHROW)
when 8; id = :MUDSLAP if GameData::Move.exists?(:MUDSLAP)
when 9; id = :ICESHARD if GameData::Move.exists?(:ICESHARD)
when 10; id = :INCINERATE if GameData::Move.exists?(:INCINERATE)
when 11; id = :SHADOWSNEAK if GameData::Move.exists?(:SHADOWSNEAK)
when 12; id = :GUST if GameData::Move.exists?(:GUST)
when 13; id = :SWIFT if GameData::Move.exists?(:SWIFT)
when 14; id = :PSYWAVE if GameData::Move.exists?(:PSYWAVE)
end
super
end
@@ -1116,8 +1116,8 @@ class PokeBattle_Move_0AE < PokeBattle_Move
def callsAnotherMove?; return true; end
def pbFailsAgainstTarget?(user,target)
if target.lastRegularMoveUsed<=0 ||
!pbGetMoveData(target.lastRegularMoveUsed,MoveData::FLAGS)[/e/] # Not copyable by Mirror Move
if !target.lastRegularMoveUsed ||
!GameData::Move.get(target.lastRegularMoveUsed).flags[/e/] # Not copyable by Mirror Move
@battle.pbDisplay(_INTL("The mirror move failed!"))
return true
end
@@ -1207,8 +1207,8 @@ class PokeBattle_Move_0AF < PokeBattle_Move
end
def pbMoveFailed?(user,targets)
if @battle.lastMoveUsed<=0 ||
@moveBlacklist.include?(pbGetMoveData(@battle.lastMoveUsed,MoveData::FUNCTION_CODE))
if !@battle.lastMoveUsed ||
@moveBlacklist.include?(GameData::Move.get(@battle.lastMoveUsed).function_code)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1252,8 +1252,7 @@ class PokeBattle_Move_0B0 < PokeBattle_Move
def pbFailsAgainstTarget?(user,target)
return true if pbMoveFailedTargetAlreadyMoved?(target)
oppMove = @battle.choices[target.index][2]
if !oppMove || oppMove.id<=0 ||
oppMove.statusMove? || @moveBlacklist.include?(oppMove.function)
if !oppMove || oppMove.statusMove? || @moveBlacklist.include?(oppMove.function)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1311,71 +1310,71 @@ class PokeBattle_Move_0B3 < PokeBattle_Move
# NOTE: It's possible in theory to not have the move Nature Power wants to
# turn into, but what self-respecting game wouldn't at least have Tri
# Attack in it?
@npMove = getID(PBMoves,:TRIATTACK)
@npMove = :TRIATTACK
case @battle.field.terrain
when PBBattleTerrains::Electric
@npMove = getConst(PBMoves,:THUNDERBOLT) || @npMove
@npMove = :THUNDERBOLT if GameData::Move.exists?(:THUNDERBOLT)
when PBBattleTerrains::Grassy
@npMove = getConst(PBMoves,:ENERGYBALL) || @npMove
@npMove = :ENERGYBALL if GameData::Move.exists?(:ENERGYBALL)
when PBBattleTerrains::Misty
@npMove = getConst(PBMoves,:MOONBLAST) || @npMove
@npMove = :MOONBLAST if GameData::Move.exists?(:MOONBLAST)
when PBBattleTerrains::Psychic
@npMove = getConst(PBMoves,:PSYCHIC) || @npMove
@npMove = :PSYCHIC if GameData::Move.exists?(:PSYCHIC)
else
case @battle.environment
when PBEnvironment::Grass, PBEnvironment::TallGrass,
PBEnvironment::Forest, PBEnvironment::ForestGrass
if NEWEST_BATTLE_MECHANICS
@npMove = getConst(PBMoves,:ENERGYBALL) || @npMove
@npMove = :ENERGYBALL if GameData::Move.exists?(:ENERGYBALL)
else
@npMove = getConst(PBMoves,:SEEDBOMB) || @npMove
@npMove = :SEEDBOMB if GameData::Move.exists?(:SEEDBOMB)
end
when PBEnvironment::MovingWater, PBEnvironment::StillWater, PBEnvironment::Underwater
@npMove = getConst(PBMoves,:HYDROPUMP) || @npMove
@npMove = :HYDROPUMP if GameData::Move.exists?(:HYDROPUMP)
when PBEnvironment::Puddle
@npMove = getConst(PBMoves,:MUDBOMB) || @npMove
@npMove = :MUDBOMB if GameData::Move.exists?(:MUDBOMB)
when PBEnvironment::Cave
if NEWEST_BATTLE_MECHANICS
@npMove = getConst(PBMoves,:POWERGEM) || @npMove
@npMove = :POWERGEM if GameData::Move.exists?(:POWERGEM)
else
@npMove = getConst(PBMoves,:ROCKSLIDE) || @npMove
@npMove = :ROCKSLIDE if GameData::Move.exists?(:ROCKSLIDE)
end
when PBEnvironment::Rock
if NEWEST_BATTLE_MECHANICS
@npMove = getConst(PBMoves,:EARTHPOWER) || @npMove
@npMove = :EARTHPOWER if GameData::Move.exists?(:EARTHPOWER)
else
@npMove = getConst(PBMoves,:ROCKSLIDE) || @npMove
@npMove = :ROCKSLIDE if GameData::Move.exists?(:ROCKSLIDE)
end
when PBEnvironment::Sand
if NEWEST_BATTLE_MECHANICS
@npMove = getConst(PBMoves,:EARTHPOWER) || @npMove
@npMove = :EARTHPOWER if GameData::Move.exists?(:EARTHPOWER)
else
@npMove = getConst(PBMoves,:EARTHQUAKE) || @npMove
@npMove = :EARTHQUAKE if GameData::Move.exists?(:EARTHQUAKE)
end
# Ice tiles in Gen 6 should be Ice Beam
when PBEnvironment::Snow, PBEnvironment::Ice
if NEWEST_BATTLE_MECHANICS
@npMove = getConst(PBMoves,:FROSTBREATH) || @npMove
@npMove = :FROSTBREATH if GameData::Move.exists?(:FROSTBREATH)
else
@npMove = getConst(PBMoves,:ICEBEAM) || @npMove
@npMove = :ICEBEAM if GameData::Move.exists?(:ICEBEAM)
end
when PBEnvironment::Volcano
@npMove = getConst(PBMoves,:LAVAPLUME) || @npMove
@npMove = :LAVAPLUME if GameData::Move.exists?(:LAVAPLUME)
when PBEnvironment::Graveyard
@npMove = getConst(PBMoves,:SHADOWBALL) || @npMove
@npMove = :SHADOWBALL if GameData::Move.exists?(:SHADOWBALL)
when PBEnvironment::Sky
@npMove = getConst(PBMoves,:AIRSLASH) || @npMove
@npMove = :AIRSLASH if GameData::Move.exists?(:AIRSLASH)
when PBEnvironment::Space
@npMove = getConst(PBMoves,:DRACOMETEOR) || @npMove
@npMove = :DRACOMETEOR if GameData::Move.exists?(:DRACOMETEOR)
when PBEnvironment::UltraSpace
@npMove = getConst(PBMoves,:PSYSHOCK) || @npMove
@npMove = :PSYSHOCK if GameData::Move.exists?(:PSYSHOCK)
end
end
end
def pbEffectAgainstTarget(user,target)
@battle.pbDisplay(_INTL("{1} turned into {2}!",@name,PBMoves.getName(@npMove)))
user.pbUseMoveSimple(@npMove,target.index)
@battle.pbDisplay(_INTL("{1} turned into {2}!", @name, GameData::Move.get(@npMove).name))
user.pbUseMoveSimple(@npMove, target.index)
end
end
@@ -1551,8 +1550,7 @@ class PokeBattle_Move_0B5 < PokeBattle_Move
next if !pkmn || i==user.pokemonIndex
next if NEWEST_BATTLE_MECHANICS && pkmn.egg?
pkmn.moves.each do |move|
next if !move || move.id<=0
next if @moveBlacklist.include?(pbGetMoveData(move.id,MoveData::FUNCTION_CODE))
next if @moveBlacklist.include?(move.function_code)
next if isConst?(move.type,PBTypes,:SHADOW)
@assistMoves.push(move.id)
end
@@ -1663,25 +1661,20 @@ class PokeBattle_Move_0B6 < PokeBattle_Move
end
def pbMoveFailed?(user,targets)
movesData = pbLoadMovesData
@metronomeMove = 0
@metronomeMove = nil
move_keys = GameData::Move::DATA.keys.sort
# NOTE: You could be really unlucky and roll blacklisted moves 1000 times in
# a row. This is too unlikely to care about, though.
1000.times do
move = @battle.pbRandom(PBMoves.maxValue)+1 # Random move
next if !movesData[move]
next if @moveBlacklist.include?(movesData[move][MoveData::FUNCTION_CODE])
blMove = false
@moveBlacklistSignatures.each do |m|
next if !isConst?(move,PBMoves,m)
blMove = true; break
end
next if blMove
next if isConst?(movesData[move][MoveData::TYPE],PBTypes,:SHADOW)
@metronomeMove = move
move_id = move_keys[@battle.pbRandom(move_keys.length)]
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)
@metronomeMove = move_data.id
break
end
if @metronomeMove<=0
if !@metronomeMove
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1746,7 +1739,7 @@ class PokeBattle_Move_0B9 < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def pbFailsAgainstTarget?(user,target)
if target.effects[PBEffects::Disable]>0
if target.effects[PBEffects::Disable]>0 || !target.lastRegularMoveUsed
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1754,7 +1747,7 @@ class PokeBattle_Move_0B9 < PokeBattle_Move
canDisable = false
target.eachMove do |m|
next if m.id!=target.lastRegularMoveUsed
next if m.pp==0 && m.totalpp>0
next if m.pp==0 && m.total_pp>0
canDisable = true
break
end
@@ -1769,7 +1762,7 @@ class PokeBattle_Move_0B9 < PokeBattle_Move
target.effects[PBEffects::Disable] = 5
target.effects[PBEffects::DisableMove] = target.lastRegularMoveUsed
@battle.pbDisplay(_INTL("{1}'s {2} was disabled!",target.pbThis,
PBMoves.getName(target.lastRegularMoveUsed)))
GameData::Move.get(target.lastRegularMoveUsed).name))
target.pbItemStatusCureCheck
end
end
@@ -1872,8 +1865,8 @@ class PokeBattle_Move_0BC < PokeBattle_Move
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
if target.lastRegularMoveUsed<=0 ||
@moveBlacklist.include?(pbGetMoveData(target.lastRegularMoveUsed,MoveData::FUNCTION_CODE))
if !target.lastRegularMoveUsed ||
@moveBlacklist.include?(GameData::Move.get(target.lastRegularMoveUsed).function_code)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1885,7 +1878,7 @@ class PokeBattle_Move_0BC < PokeBattle_Move
canEncore = false
target.eachMove do |m|
next if m.id!=target.lastRegularMoveUsed
next if m.pp==0 && m.totalpp>0
next if m.pp==0 && m.total_pp>0
canEncore = true
break
end
@@ -1958,8 +1951,7 @@ class PokeBattle_Move_0C0 < PokeBattle_Move
def multiHitMove?; return true; end
def pbNumHits(user,targets)
if isConst?(@id,PBMoves,:WATERSHURIKEN) &&
user.isSpecies?(:GRENINJA) && user.form==2
if @id == :WATERSHURIKEN && user.isSpecies?(:GRENINJA) && user.form == 2
return 3
end
hitChances = [2,2,3,3,4,5]
@@ -1969,8 +1961,7 @@ class PokeBattle_Move_0C0 < PokeBattle_Move
end
def pbBaseDamage(baseDmg,user,target)
if isConst?(@id,PBMoves,:WATERSHURIKEN) &&
user.isSpecies?(:GRENINJA) && user.form==2
if @id == :WATERSHURIKEN && user.isSpecies?(:GRENINJA) && user.form == 2
return 20
end
return super
@@ -2044,7 +2035,7 @@ end
class PokeBattle_Move_0C4 < PokeBattle_TwoTurnMove
def pbIsChargingTurn?(user)
ret = super
if user.effects[PBEffects::TwoTurnAttack]==0
if !user.effects[PBEffects::TwoTurnAttack]
w = @battle.pbWeather
if w==PBWeather::Sun || w==PBWeather::HarshSun
@powerHerb = false
@@ -2234,8 +2225,8 @@ class PokeBattle_Move_0CE < PokeBattle_TwoTurnMove
# NOTE: Sky Drop doesn't benefit from Power Herb, probably because it works
# differently (i.e. immobilises the target during use too).
@powerHerb = false
@chargingTurn = (user.effects[PBEffects::TwoTurnAttack]==0)
@damagingTurn = (user.effects[PBEffects::TwoTurnAttack]!=0)
@chargingTurn = (user.effects[PBEffects::TwoTurnAttack].nil?)
@damagingTurn = (!user.effects[PBEffects::TwoTurnAttack].nil?)
return !@damagingTurn
end
@@ -2306,21 +2297,22 @@ class PokeBattle_Move_0CF < PokeBattle_Move
target.effects[PBEffects::TrappingUser] = user.index
# Message
msg = _INTL("{1} was trapped in the vortex!",target.pbThis)
if isConst?(@id,PBMoves,:BIND)
case @id
when :BIND
msg = _INTL("{1} was squeezed by {2}!",target.pbThis,user.pbThis(true))
elsif isConst?(@id,PBMoves,:CLAMP)
when :CLAMP
msg = _INTL("{1} clamped {2}!",user.pbThis,target.pbThis(true))
elsif isConst?(@id,PBMoves,:FIRESPIN)
when :FIRESPIN
msg = _INTL("{1} was trapped in the fiery vortex!",target.pbThis)
elsif isConst?(@id,PBMoves,:INFESTATION)
when :INFESTATION
msg = _INTL("{1} has been afflicted with an infestation by {2}!",target.pbThis,user.pbThis(true))
elsif isConst?(@id,PBMoves,:MAGMASTORM)
when :MAGMASTORM
msg = _INTL("{1} became trapped by Magma Storm!",target.pbThis)
elsif isConst?(@id,PBMoves,:SANDTOMB)
when :SANDTOMB
msg = _INTL("{1} became trapped by Sand Tomb!",target.pbThis)
elsif isConst?(@id,PBMoves,:WHIRLPOOL)
when :WHIRLPOOL
msg = _INTL("{1} became trapped in the vortex!",target.pbThis)
elsif isConst?(@id,PBMoves,:WRAP)
when :WRAP
msg = _INTL("{1} was wrapped by {2}!",target.pbThis,user.pbThis(true))
end
@battle.pbDisplay(msg)
@@ -3282,10 +3274,10 @@ class PokeBattle_Move_0F2 < PokeBattle_Move
oldUserItem = user.item; oldUserItemName = user.itemName
oldTargetItem = target.item; oldTargetItemName = target.itemName
user.item = oldTargetItem
user.effects[PBEffects::ChoiceBand] = -1
user.effects[PBEffects::ChoiceBand] = nil
user.effects[PBEffects::Unburden] = (!user.item && oldUserItem)
target.item = oldUserItem
target.effects[PBEffects::ChoiceBand] = -1
target.effects[PBEffects::ChoiceBand] = nil
target.effects[PBEffects::Unburden] = (!target.item && oldTargetItem)
# Permanently steal the item from wild Pokémon
if @battle.wildBattle? && target.opposes? &&

View File

@@ -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),getConst(PBMoves,:FIREPLEDGE)],
["108",:Swamp,nil,nil]]
@combos = [["107", :SeaOfFire, getConst(PBTypes, :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),getConst(PBMoves,:WATERPLEDGE)],
["106",:SeaOfFire,nil,nil]]
@combos = [["108", :Rainbow, getConst(PBTypes, :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),getConst(PBMoves,:GRASSPLEDGE)],
["107",:Rainbow,nil,nil]]
@combos = [["106", :Swamp, getConst(PBTypes, :GRASS), :GRASSPLEDGE],
["107", :Rainbow, nil, nil]]
end
end
@@ -243,7 +243,7 @@ class PokeBattle_Move_10C < PokeBattle_Move
def pbEffectGeneral(user)
user.effects[PBEffects::Trapping] = 0
user.effects[PBEffects::TrappingMove] = 0
user.effects[PBEffects::TrappingMove] = nil
user.effects[PBEffects::Substitute] = @subLife
@battle.pbDisplay(_INTL("{1} put in a substitute!",user.pbThis))
end
@@ -326,9 +326,11 @@ class PokeBattle_Move_10E < PokeBattle_Move
def pbFailsAgainstTarget?(user,target)
failed = true
target.eachMove do |m|
next if m.id!=target.lastRegularMoveUsed || m.pp==0 || m.totalpp<=0
failed = false; break
if target.lastRegularMoveUsed
target.eachMove do |m|
next if m.id!=target.lastRegularMoveUsed || m.pp==0 || m.total_pp<=0
failed = false; break
end
end
if failed
@battle.pbDisplay(_INTL("But it failed!"))
@@ -379,11 +381,11 @@ class PokeBattle_Move_110 < PokeBattle_Move
def pbEffectAfterAllHits(user,target)
return if user.fainted? || target.damageState.unaffected
if user.effects[PBEffects::Trapping]>0
trapMove = PBMoves.getName(user.effects[PBEffects::TrappingMove])
trapMove = GameData::Move.get(user.effects[PBEffects::TrappingMove]).name
trapUser = @battle.battlers[user.effects[PBEffects::TrappingUser]]
@battle.pbDisplay(_INTL("{1} got free of {2}'s {3}!",user.pbThis,trapUser.pbThis(true),trapMove))
user.effects[PBEffects::Trapping] = 0
user.effects[PBEffects::TrappingMove] = 0
user.effects[PBEffects::TrappingMove] = nil
user.effects[PBEffects::TrappingUser] = -1
end
if user.effects[PBEffects::LeechSeed]>=0
@@ -447,7 +449,7 @@ class PokeBattle_Move_111 < PokeBattle_Move
effects[PBEffects::FutureSightMove] = @id
effects[PBEffects::FutureSightUserIndex] = user.index
effects[PBEffects::FutureSightUserPartyIndex] = user.pokemonIndex
if isConst?(@id,PBMoves,:DOOMDESIRE)
if @id == :DOOMDESIRE
@battle.pbDisplay(_INTL("{1} chose Doom Desire as its destiny!",user.pbThis))
else
@battle.pbDisplay(_INTL("{1} foresaw an attack!",user.pbThis))
@@ -624,7 +626,7 @@ class PokeBattle_Move_116 < PokeBattle_Move
return true
end
oppMove = @battle.choices[target.index][2]
if !oppMove || oppMove.id<=0 ||
if !oppMove ||
(oppMove.function!="0B0" && # Me First
(target.movedThisRound? || oppMove.statusMove?))
@battle.pbDisplay(_INTL("But it failed!"))
@@ -647,7 +649,7 @@ class PokeBattle_Move_117 < PokeBattle_Move
next if b.effects[PBEffects::FollowMe]<user.effects[PBEffects::FollowMe]
user.effects[PBEffects::FollowMe] = b.effects[PBEffects::FollowMe]+1
end
user.effects[PBEffects::RagePowder] = true if isConst?(@id,PBMoves,:RAGEPOWDER)
user.effects[PBEffects::RagePowder] = true if @id == :RAGEPOWDER
@battle.pbDisplay(_INTL("{1} became the center of attention!",user.pbThis))
end
end
@@ -673,7 +675,7 @@ class PokeBattle_Move_118 < PokeBattle_Move
@battle.eachBattler do |b|
showMessage = false
if b.inTwoTurnAttack?("0C9","0CC","0CE") # Fly/Bounce/Sky Drop
b.effects[PBEffects::TwoTurnAttack] = 0
b.effects[PBEffects::TwoTurnAttack] = nil
@battle.pbClearChoice(b.index) if !b.movedThisRound?
showMessage = true
end
@@ -778,7 +780,7 @@ class PokeBattle_Move_11C < PokeBattle_Move
return if !target.airborne? && !target.inTwoTurnAttack?("0C9","0CC") # Fly/Bounce
target.effects[PBEffects::SmackDown] = true
if target.inTwoTurnAttack?("0C9","0CC") # Fly/Bounce. NOTE: Not Sky Drop.
target.effects[PBEffects::TwoTurnAttack] = 0
target.effects[PBEffects::TwoTurnAttack] = nil
@battle.pbClearChoice(target.index) if !target.movedThisRound?
end
target.effects[PBEffects::MagnetRise] = 0
@@ -805,7 +807,7 @@ class PokeBattle_Move_11D < PokeBattle_Move
end
# Target didn't choose to use a move this round
oppMove = @battle.choices[target.index][2]
if !oppMove || oppMove.id<=0
if !oppMove
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -829,7 +831,7 @@ class PokeBattle_Move_11E < PokeBattle_Move
return true if pbMoveFailedTargetAlreadyMoved?(target)
# Target isn't going to use a move
oppMove = @battle.choices[target.index][2]
if !oppMove || oppMove.id<=0
if !oppMove
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1636,7 +1638,7 @@ end
#===============================================================================
class PokeBattle_Move_14E < PokeBattle_TwoTurnMove
def pbMoveFailed?(user,targets)
return false if user.effects[PBEffects::TwoTurnAttack]>0 # Charging turn
return false if user.effects[PBEffects::TwoTurnAttack] # Charging turn
if !user.pbCanRaiseStatStage?(PBStats::SPATK,user,self) &&
!user.pbCanRaiseStatStage?(PBStats::SPDEF,user,self) &&
!user.pbCanRaiseStatStage?(PBStats::SPEED,user,self)
@@ -2327,7 +2329,7 @@ class PokeBattle_Move_16B < PokeBattle_Move
end
def pbFailsAgainstTarget?(user,target)
if target.lastRegularMoveUsed<0 || !target.pbHasMove?(target.lastRegularMoveUsed)
if !target.lastRegularMoveUsed || !target.pbHasMove?(target.lastRegularMoveUsed)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -2342,7 +2344,7 @@ class PokeBattle_Move_16B < PokeBattle_Move
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
if @moveBlacklist.include?(pbGetMoveData(target.lastRegularMoveUsed,MoveData::FUNCTION_CODE))
if @moveBlacklist.include?(GameData::Move.get(target.lastRegularMoveUsed).function_code)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -2350,7 +2352,7 @@ class PokeBattle_Move_16B < PokeBattle_Move
target.eachMoveWithIndex do |m,i|
idxMove = i if m.id==target.lastRegularMoveUsed
end
if target.moves[idxMove].pp==0 && target.moves[idxMove].totalpp>0
if target.moves[idxMove].pp==0 && target.moves[idxMove].total_pp>0
@battle.pbDisplay(_INTL("But it failed!"))
return true
end