mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 21:54:58 +00:00
Implemented GameData::Move
This commit is contained in:
@@ -429,16 +429,15 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def eachMove
|
||||
@moves.each { |m| yield m if m && m.id != 0 }
|
||||
@moves.each { |m| yield m }
|
||||
end
|
||||
|
||||
def eachMoveWithIndex
|
||||
@moves.each_with_index { |m, i| yield m, i if m && m.id != 0 }
|
||||
@moves.each_with_index { |m, i| yield m, i }
|
||||
end
|
||||
|
||||
def pbHasMove?(move_id)
|
||||
move_id = getID(PBMoves, move_id)
|
||||
return false if !move_id || move_id <= 0
|
||||
return false if !move_id
|
||||
eachMove { |m| return true if m.id == move_id }
|
||||
return false
|
||||
end
|
||||
@@ -574,7 +573,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def usingMultiTurnAttack?
|
||||
return true if @effects[PBEffects::TwoTurnAttack]>0
|
||||
return true if @effects[PBEffects::TwoTurnAttack]
|
||||
return true if @effects[PBEffects::HyperBeam]>0
|
||||
return true if @effects[PBEffects::Rollout]>0
|
||||
return true if @effects[PBEffects::Outrage]>0
|
||||
@@ -584,8 +583,8 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def inTwoTurnAttack?(*arg)
|
||||
return false if @effects[PBEffects::TwoTurnAttack]==0
|
||||
ttaFunction = pbGetMoveData(@effects[PBEffects::TwoTurnAttack],MoveData::FUNCTION_CODE)
|
||||
return false if !@effects[PBEffects::TwoTurnAttack]
|
||||
ttaFunction = GameData::Move.get(@effects[PBEffects::TwoTurnAttack]).function_code
|
||||
arg.each { |a| return true if a==ttaFunction }
|
||||
return false
|
||||
end
|
||||
@@ -595,7 +594,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
|
||||
def pbEncoredMoveIndex
|
||||
return -1 if @effects[PBEffects::Encore]==0 || @effects[PBEffects::EncoreMove]==0
|
||||
return -1 if @effects[PBEffects::Encore]==0 || !@effects[PBEffects::EncoreMove]
|
||||
ret = -1
|
||||
eachMoveWithIndex do |m,i|
|
||||
next if m.id!=@effects[PBEffects::EncoreMove]
|
||||
|
||||
@@ -147,9 +147,9 @@ class PokeBattle_Battler
|
||||
@lastHPLostFromFoe = 0
|
||||
@tookDamage = false
|
||||
@tookPhysicalHit = false
|
||||
@lastMoveUsed = -1
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = -1
|
||||
@lastRegularMoveUsed = -1
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
@lastRoundMoved = -1
|
||||
@lastMoveFailed = false
|
||||
@@ -167,7 +167,7 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::BideTarget] = -1
|
||||
@effects[PBEffects::BurnUp] = false
|
||||
@effects[PBEffects::Charge] = 0
|
||||
@effects[PBEffects::ChoiceBand] = -1
|
||||
@effects[PBEffects::ChoiceBand] = nil
|
||||
@effects[PBEffects::Counter] = -1
|
||||
@effects[PBEffects::CounterTarget] = -1
|
||||
@effects[PBEffects::Dancer] = false
|
||||
@@ -176,10 +176,10 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::DestinyBondPrevious] = false
|
||||
@effects[PBEffects::DestinyBondTarget] = -1
|
||||
@effects[PBEffects::Disable] = 0
|
||||
@effects[PBEffects::DisableMove] = 0
|
||||
@effects[PBEffects::DisableMove] = nil
|
||||
@effects[PBEffects::Electrify] = false
|
||||
@effects[PBEffects::Encore] = 0
|
||||
@effects[PBEffects::EncoreMove] = 0
|
||||
@effects[PBEffects::EncoreMove] = nil
|
||||
@effects[PBEffects::Endure] = false
|
||||
@effects[PBEffects::FirstPledge] = 0
|
||||
@effects[PBEffects::FlashFire] = false
|
||||
@@ -240,7 +240,6 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::Quash] = 0
|
||||
@effects[PBEffects::Rage] = false
|
||||
@effects[PBEffects::RagePowder] = false
|
||||
@effects[PBEffects::Revenge] = 0
|
||||
@effects[PBEffects::Rollout] = 0
|
||||
@effects[PBEffects::Roost] = false
|
||||
@effects[PBEffects::SkyDrop] = -1
|
||||
@@ -262,7 +261,7 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::Transform] = false
|
||||
@effects[PBEffects::TransformSpecies] = 0
|
||||
@effects[PBEffects::Trapping] = 0
|
||||
@effects[PBEffects::TrappingMove] = 0
|
||||
@effects[PBEffects::TrappingMove] = nil
|
||||
@effects[PBEffects::TrappingUser] = -1
|
||||
@battle.eachBattler do |b| # Other battlers no longer trapped by self
|
||||
next if b.effects[PBEffects::TrappingUser]!=@index
|
||||
@@ -270,7 +269,7 @@ class PokeBattle_Battler
|
||||
b.effects[PBEffects::TrappingUser] = -1
|
||||
end
|
||||
@effects[PBEffects::Truant] = false
|
||||
@effects[PBEffects::TwoTurnAttack] = 0
|
||||
@effects[PBEffects::TwoTurnAttack] = nil
|
||||
@effects[PBEffects::Type3] = -1
|
||||
@effects[PBEffects::Unburden] = false
|
||||
@effects[PBEffects::Uproar] = 0
|
||||
|
||||
@@ -94,9 +94,9 @@ class PokeBattle_Battler
|
||||
|
||||
def pbReducePP(move)
|
||||
return true if usingMultiTurnAttack?
|
||||
return true if move.pp<0 # Don't reduce PP for special calls of moves
|
||||
return true if move.totalpp<=0 # Infinite PP, can always be used
|
||||
return false if move.pp==0 # Ran out of PP, couldn't reduce
|
||||
return true if move.pp<0 # Don't reduce PP for special calls of moves
|
||||
return true if move.total_pp<=0 # Infinite PP, can always be used
|
||||
return false if move.pp==0 # Ran out of PP, couldn't reduce
|
||||
pbSetPP(move,move.pp-1) if move.pp>0
|
||||
return true
|
||||
end
|
||||
@@ -284,11 +284,11 @@ class PokeBattle_Battler
|
||||
@moves.clear
|
||||
target.moves.each_with_index do |m,i|
|
||||
@moves[i] = PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(m.id))
|
||||
@moves[i].pp = 5
|
||||
@moves[i].totalpp = 5
|
||||
@moves[i].pp = 5
|
||||
@moves[i].total_pp = 5
|
||||
end
|
||||
@effects[PBEffects::Disable] = 0
|
||||
@effects[PBEffects::DisableMove] = 0
|
||||
@effects[PBEffects::DisableMove] = nil
|
||||
@effects[PBEffects::WeightChange] = target.effects[PBEffects::WeightChange]
|
||||
@battle.scene.pbRefreshOne(@index)
|
||||
@battle.pbDisplay(_INTL("{1} transformed into {2}!",pbThis,target.pbThis(true)))
|
||||
|
||||
@@ -261,7 +261,7 @@ class PokeBattle_Battler
|
||||
# disabled/anything else). This behaviour was tested in Gen 5.
|
||||
if @status==PBStatuses::SLEEP && @effects[PBEffects::Outrage]>0
|
||||
@effects[PBEffects::Outrage] = 0
|
||||
@currentMove = 0
|
||||
@currentMove = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ class PokeBattle_Battler
|
||||
# permanent is whether the item is lost even after battle. Is false for Knock
|
||||
# Off.
|
||||
def pbRemoveItem(permanent = true)
|
||||
@effects[PBEffects::ChoiceBand] = -1
|
||||
@effects[PBEffects::ChoiceBand] = nil
|
||||
@effects[PBEffects::Unburden] = true if self.item
|
||||
setInitialItem(nil) if permanent && self.item == self.initialItem
|
||||
self.item = nil
|
||||
|
||||
@@ -80,7 +80,7 @@ class PokeBattle_Battler
|
||||
# Encore's effect ends if the encored move is no longer available
|
||||
if @effects[PBEffects::Encore]>0 && pbEncoredMoveIndex<0
|
||||
@effects[PBEffects::Encore] = 0
|
||||
@effects[PBEffects::EncoreMove] = 0
|
||||
@effects[PBEffects::EncoreMove] = nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -96,23 +96,23 @@ class PokeBattle_Battler
|
||||
pbConfuse(_INTL("{1} became confused due to fatigue!",pbThis))
|
||||
end
|
||||
# Cancel usage of most multi-turn moves
|
||||
@effects[PBEffects::TwoTurnAttack] = 0
|
||||
@effects[PBEffects::TwoTurnAttack] = nil
|
||||
@effects[PBEffects::Rollout] = 0
|
||||
@effects[PBEffects::Outrage] = 0
|
||||
@effects[PBEffects::Uproar] = 0
|
||||
@effects[PBEffects::Bide] = 0
|
||||
@currentMove = 0
|
||||
@currentMove = nil
|
||||
# Reset counters for moves which increase them when used in succession
|
||||
@effects[PBEffects::FuryCutter] = 0
|
||||
end
|
||||
|
||||
def pbEndTurn(_choice)
|
||||
@lastRoundMoved = @battle.turnCount # Done something this round
|
||||
if @effects[PBEffects::ChoiceBand]<0 &&
|
||||
if !@effects[PBEffects::ChoiceBand] &&
|
||||
hasActiveItem?([:CHOICEBAND,:CHOICESPECS,:CHOICESCARF])
|
||||
if @lastMoveUsed>=0 && pbHasMove?(@lastMoveUsed)
|
||||
if @lastMoveUsed && pbHasMove?(@lastMoveUsed)
|
||||
@effects[PBEffects::ChoiceBand] = @lastMoveUsed
|
||||
elsif @lastRegularMoveUsed>=0 && pbHasMove?(@lastRegularMoveUsed)
|
||||
elsif @lastRegularMoveUsed && pbHasMove?(@lastRegularMoveUsed)
|
||||
@effects[PBEffects::ChoiceBand] = @lastRegularMoveUsed
|
||||
end
|
||||
end
|
||||
@@ -184,14 +184,14 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Labels the move being used as "move"
|
||||
move = choice[2]
|
||||
return if !move || move.id==0 # if move was not chosen somehow
|
||||
return if !move # if move was not chosen somehow
|
||||
# Try to use the move (inc. disobedience)
|
||||
@lastMoveFailed = false
|
||||
if !pbTryUseMove(choice,move,specialUsage,skipAccuracyCheck)
|
||||
@lastMoveUsed = -1
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = -1
|
||||
if !specialUsage
|
||||
@lastRegularMoveUsed = -1
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
end
|
||||
@battle.pbGainExp # In case self is KO'd due to confusion
|
||||
@@ -200,15 +200,15 @@ class PokeBattle_Battler
|
||||
return
|
||||
end
|
||||
move = choice[2] # In case disobedience changed the move to be used
|
||||
return if !move || move.id==0 # if move was not chosen somehow
|
||||
return if !move # if move was not chosen somehow
|
||||
# Subtract PP
|
||||
if !specialUsage
|
||||
if !pbReducePP(move)
|
||||
@battle.pbDisplay(_INTL("{1} used {2}!",pbThis,move.name))
|
||||
@battle.pbDisplay(_INTL("But there was no PP left for the move!"))
|
||||
@lastMoveUsed = -1
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = -1
|
||||
@lastRegularMoveUsed = -1
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
@lastMoveFailed = true
|
||||
pbCancelMoves
|
||||
@@ -220,7 +220,7 @@ class PokeBattle_Battler
|
||||
if isSpecies?(:AEGISLASH) && self.ability == :STANCECHANGE
|
||||
if move.damagingMove?
|
||||
pbChangeForm(1,_INTL("{1} changed to Blade Forme!",pbThis))
|
||||
elsif isConst?(move.id,PBMoves,:KINGSSHIELD)
|
||||
elsif move.id == :KINGSSHIELD
|
||||
pbChangeForm(0,_INTL("{1} changed to Shield Forme!",pbThis))
|
||||
end
|
||||
end
|
||||
@@ -234,13 +234,13 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::TwoTurnAttack] = move.id
|
||||
@currentMove = move.id
|
||||
else
|
||||
@effects[PBEffects::TwoTurnAttack] = 0 # Cancel use of two-turn attack
|
||||
@effects[PBEffects::TwoTurnAttack] = nil # Cancel use of two-turn attack
|
||||
end
|
||||
# Add to counters for moves which increase them when used in succession
|
||||
move.pbChangeUsageCounters(self,specialUsage)
|
||||
# Charge up Metronome item
|
||||
if hasActiveItem?(:METRONOME) && !move.callsAnotherMove?
|
||||
if @lastMoveUsed==move.id && !@lastMoveFailed
|
||||
if @lastMoveUsed && @lastMoveUsed==move.id && !@lastMoveFailed
|
||||
@effects[PBEffects::Metronome] += 1
|
||||
else
|
||||
@effects[PBEffects::Metronome] = 0
|
||||
@@ -516,7 +516,7 @@ class PokeBattle_Battler
|
||||
pbEndTurn(choice)
|
||||
# Instruct
|
||||
@battle.eachBattler do |b|
|
||||
next if !b.effects[PBEffects::Instruct]
|
||||
next if !b.effects[PBEffects::Instruct] || !b.lastMoveUsed
|
||||
b.effects[PBEffects::Instruct] = false
|
||||
idxMove = -1
|
||||
b.eachMoveWithIndex { |m,i| idxMove = i if m.id==b.lastMoveUsed }
|
||||
|
||||
@@ -41,19 +41,19 @@ class PokeBattle_Battler
|
||||
return false
|
||||
end
|
||||
# Choice Band
|
||||
if @effects[PBEffects::ChoiceBand]>=0
|
||||
if @effects[PBEffects::ChoiceBand]
|
||||
if hasActiveItem?([:CHOICEBAND,:CHOICESPECS,:CHOICESCARF]) &&
|
||||
pbHasMove?(@effects[PBEffects::ChoiceBand])
|
||||
if move.id!=@effects[PBEffects::ChoiceBand]
|
||||
if showMessages
|
||||
msg = _INTL("{1} allows the use of only {2}!",itemName,
|
||||
PBMoves.getName(@effects[PBEffects::ChoiceBand]))
|
||||
GameData::Move.get(@effects[PBEffects::ChoiceBand]).name)
|
||||
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
|
||||
end
|
||||
return false
|
||||
end
|
||||
else
|
||||
@effects[PBEffects::ChoiceBand] = -1
|
||||
@effects[PBEffects::ChoiceBand] = nil
|
||||
end
|
||||
end
|
||||
# Taunt
|
||||
@@ -66,7 +66,7 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Torment
|
||||
if @effects[PBEffects::Torment] && !@effects[PBEffects::Instructed] &&
|
||||
move.id==@lastMoveUsed && move.id!=@battle.struggle.id
|
||||
@lastMoveUsed && move.id==@lastMoveUsed && move.id!=@battle.struggle.id
|
||||
if showMessages
|
||||
msg = _INTL("{1} can't use the same move twice in a row due to the torment!",pbThis)
|
||||
(commandPhase) ? @battle.pbDisplayPaused(msg) : @battle.pbDisplay(msg)
|
||||
@@ -138,7 +138,7 @@ class PokeBattle_Battler
|
||||
otherMoves = []
|
||||
eachMoveWithIndex do |_m,i|
|
||||
next if i==choice[1]
|
||||
otherMoves[otherMoves.length] = i if @battle.pbCanChooseMove?(@index,i,false)
|
||||
otherMoves.push(i) if @battle.pbCanChooseMove?(@index,i,false)
|
||||
end
|
||||
return false if otherMoves.length==0 # No other move to use; do nothing
|
||||
newChoice = otherMoves[@battle.pbRandom(otherMoves.length)]
|
||||
@@ -291,7 +291,7 @@ class PokeBattle_Battler
|
||||
typeMod = move.pbCalcTypeMod(move.calcType,user,target)
|
||||
target.damageState.typeMod = typeMod
|
||||
# Two-turn attacks can't fail here in the charging turn
|
||||
return true if user.effects[PBEffects::TwoTurnAttack]>0
|
||||
return true if user.effects[PBEffects::TwoTurnAttack]
|
||||
# Move-specific failures
|
||||
return false if move.pbFailsAgainstTarget?(user,target)
|
||||
# Immunity to priority moves because of Psychic Terrain
|
||||
@@ -479,7 +479,7 @@ class PokeBattle_Battler
|
||||
#=============================================================================
|
||||
def pbSuccessCheckPerHit(move,user,target,skipAccuracyCheck)
|
||||
# Two-turn attacks can't fail here in the charging turn
|
||||
return true if user.effects[PBEffects::TwoTurnAttack]>0
|
||||
return true if user.effects[PBEffects::TwoTurnAttack]
|
||||
# Lock-On
|
||||
return true if user.effects[PBEffects::LockOn]>0 &&
|
||||
user.effects[PBEffects::LockOnPos]==target.index
|
||||
@@ -495,7 +495,7 @@ class PokeBattle_Battler
|
||||
hitsInvul = true if move.function=="09C"
|
||||
if !hitsInvul
|
||||
# Semi-invulnerable moves
|
||||
if target.effects[PBEffects::TwoTurnAttack]>0
|
||||
if target.effects[PBEffects::TwoTurnAttack]
|
||||
if target.inTwoTurnAttack?("0C9","0CC","0CE") # Fly, Bounce, Sky Drop
|
||||
miss = true if !move.hitsFlyingTargets?
|
||||
elsif target.inTwoTurnAttack?("0CA") # Dig
|
||||
@@ -529,7 +529,7 @@ class PokeBattle_Battler
|
||||
tar = move.pbTarget(user)
|
||||
if PBTargets.multipleTargets?(tar)
|
||||
@battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis))
|
||||
elsif target.effects[PBEffects::TwoTurnAttack]>0
|
||||
elsif target.effects[PBEffects::TwoTurnAttack]
|
||||
@battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis))
|
||||
elsif !move.pbMissMessage(user,target)
|
||||
@battle.pbDisplay(_INTL("{1}'s attack missed!",user.pbThis))
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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? &&
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -152,7 +152,7 @@ class PokeBattle_Battle
|
||||
@battleBond = [Array.new(@party1.length, false), Array.new(@party2.length, false)]
|
||||
@usedInBattle = [Array.new(@party1.length, false), Array.new(@party2.length, false)]
|
||||
@successStates = []
|
||||
@lastMoveUsed = -1
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUser = -1
|
||||
@switching = false
|
||||
@futureSight = false
|
||||
@@ -160,8 +160,8 @@ class PokeBattle_Battle
|
||||
@moldBreaker = false
|
||||
@runCommand = 0
|
||||
@nextPickupUse = 0
|
||||
if hasConst?(PBMoves,:STRUGGLE)
|
||||
@struggle = PokeBattle_Move.pbFromPBMove(self,PBMove.new(getConst(PBMoves,:STRUGGLE)))
|
||||
if GameData::Move.exists?(:STRUGGLE)
|
||||
@struggle = PokeBattle_Move.pbFromPBMove(self,PBMove.new(:STRUGGLE))
|
||||
else
|
||||
@struggle = PokeBattle_Struggle.new(self,nil)
|
||||
end
|
||||
|
||||
@@ -222,11 +222,11 @@ class PokeBattle_Battle
|
||||
return if !pkmn
|
||||
pkmnName = pkmn.name
|
||||
battler = pbFindBattler(idxParty)
|
||||
moveName = PBMoves.getName(newMove)
|
||||
moveName = GameData::Move.get(newMove).name
|
||||
# Find a space for the new move in pkmn's moveset and learn it
|
||||
pkmn.moves.each_with_index do |m,i|
|
||||
return if m.id==newMove # Already knows the new move
|
||||
next if m.id!=0 # Not a blank move slot
|
||||
for i in 0...Pokemon::MAX_MOVES
|
||||
m = pkmn.moves[i]
|
||||
return if m && m.id==newMove # Already knows the new move
|
||||
pkmn.moves[i] = PBMove.new(newMove)
|
||||
battler.moves[i] = PokeBattle_Move.pbFromPBMove(self,pkmn.moves[i]) if battler
|
||||
pbDisplay(_INTL("{1} learned {2}!",pkmnName,moveName)) { pbSEPlay("Pkmn move learnt") }
|
||||
@@ -240,7 +240,7 @@ class PokeBattle_Battle
|
||||
pbDisplayPaused(_INTL("Which move should be forgotten?"))
|
||||
forgetMove = @scene.pbForgetMove(pkmn,newMove)
|
||||
if forgetMove>=0
|
||||
oldMoveName = PBMoves.getName(pkmn.moves[forgetMove].id)
|
||||
oldMoveName = pkmn.moves[forgetMove].name
|
||||
pkmn.moves[forgetMove] = PBMove.new(newMove) # Replaces current/total PP
|
||||
battler.moves[forgetMove] = PokeBattle_Move.pbFromPBMove(self,pkmn.moves[forgetMove]) if battler
|
||||
pbDisplayPaused(_INTL("1, 2, and... ... ... Ta-da!"))
|
||||
|
||||
@@ -5,8 +5,8 @@ class PokeBattle_Battle
|
||||
def pbCanChooseMove?(idxBattler,idxMove,showMessages,sleepTalk=false)
|
||||
battler = @battlers[idxBattler]
|
||||
move = battler.moves[idxMove]
|
||||
return false unless move && move.id>0
|
||||
if move.pp==0 && move.totalpp>0 && !sleepTalk
|
||||
return false unless move
|
||||
if move.pp==0 && move.total_pp>0 && !sleepTalk
|
||||
pbDisplayPaused(_INTL("There's no PP left for this move!")) if showMessages
|
||||
return false
|
||||
end
|
||||
@@ -20,7 +20,7 @@ class PokeBattle_Battle
|
||||
def pbCanChooseAnyMove?(idxBattler,sleepTalk=false)
|
||||
battler = @battlers[idxBattler]
|
||||
battler.eachMoveWithIndex do |m,i|
|
||||
next if m.pp==0 && m.totalpp>0 && !sleepTalk
|
||||
next if m.pp==0 && m.total_pp>0 && !sleepTalk
|
||||
if battler.effects[PBEffects::Encore]>0
|
||||
idxEncoredMove = battler.pbEncoredMoveIndex
|
||||
next if idxEncoredMove>=0 && i!=idxEncoredMove
|
||||
@@ -80,10 +80,8 @@ class PokeBattle_Battle
|
||||
|
||||
def pbChoseMove?(idxBattler,moveID)
|
||||
return false if !@battlers[idxBattler] || @battlers[idxBattler].fainted?
|
||||
idxMove = @choices[idxBattler][1]
|
||||
if @choices[idxBattler][0]==:UseMove && idxMove>=0
|
||||
chosenMoveID = @battlers[idxBattler].moves[idxMove].id
|
||||
return isConst?(chosenMoveID,PBMoves,moveID)
|
||||
if @choices[idxBattler][0]==:UseMove && @choices[idxBattler][1]
|
||||
return @choices[idxBattler][2].id == moveID
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -91,8 +89,8 @@ class PokeBattle_Battle
|
||||
def pbChoseMoveFunctionCode?(idxBattler,code)
|
||||
return false if @battlers[idxBattler].fainted?
|
||||
idxMove = @choices[idxBattler][1]
|
||||
if @choices[idxBattler][0]==:UseMove && idxMove>=0
|
||||
return @battlers[idxBattler].moves[idxMove].function==code
|
||||
if @choices[idxBattler][0]==:UseMove && @choices[idxBattler][1]
|
||||
return @choices[idxBattler][2].function == code
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -342,7 +342,7 @@ class PokeBattle_Battle
|
||||
pbDisplay(_INTL("{1} became cloaked in mystical moonlight!",battler.pbThis))
|
||||
battler.pbRecoverHP(battler.totalhp)
|
||||
battler.pbCureStatus(false)
|
||||
battler.eachMove { |m| m.pp = m.totalpp }
|
||||
battler.eachMove { |m| m.pp = m.total_pp }
|
||||
@positions[battler.index].effects[PBEffects::LunarDance] = false
|
||||
end
|
||||
# Entry hazards
|
||||
|
||||
@@ -76,7 +76,7 @@ class PokeBattle_Battle
|
||||
ret = true
|
||||
else # Chose a move to use
|
||||
next false if cmd<0 || !@battlers[idxBattler].moves[cmd] ||
|
||||
@battlers[idxBattler].moves[cmd].id<=0
|
||||
!@battlers[idxBattler].moves[cmd].id
|
||||
next false if !pbRegisterMove(idxBattler,cmd)
|
||||
next false if !singleBattle? &&
|
||||
!pbChooseTarget(@battlers[idxBattler],@battlers[idxBattler].moves[cmd])
|
||||
|
||||
@@ -234,7 +234,8 @@ class PokeBattle_Battle
|
||||
end
|
||||
next if !moveUser # User is fainted
|
||||
move = pos.effects[PBEffects::FutureSightMove]
|
||||
pbDisplay(_INTL("{1} took the {2} attack!",@battlers[idxPos].pbThis,PBMoves.getName(move)))
|
||||
pbDisplay(_INTL("{1} took the {2} attack!",@battlers[idxPos].pbThis,
|
||||
GameData::Move.get(move).name))
|
||||
# NOTE: Future Sight failing against the target here doesn't count towards
|
||||
# Stomping Tantrum.
|
||||
userLastMoveFailed = moveUser.lastMoveFailed
|
||||
@@ -244,7 +245,7 @@ class PokeBattle_Battle
|
||||
moveUser.lastMoveFailed = userLastMoveFailed
|
||||
@battlers[idxPos].pbFaint if @battlers[idxPos].fainted?
|
||||
pos.effects[PBEffects::FutureSightCounter] = 0
|
||||
pos.effects[PBEffects::FutureSightMove] = 0
|
||||
pos.effects[PBEffects::FutureSightMove] = nil
|
||||
pos.effects[PBEffects::FutureSightUserIndex] = -1
|
||||
pos.effects[PBEffects::FutureSightUserPartyIndex] = -1
|
||||
end
|
||||
@@ -401,19 +402,19 @@ class PokeBattle_Battle
|
||||
priority.each do |b|
|
||||
next if b.fainted? || b.effects[PBEffects::Trapping]==0
|
||||
b.effects[PBEffects::Trapping] -= 1
|
||||
moveName = PBMoves.getName(b.effects[PBEffects::TrappingMove])
|
||||
moveName = GameData::Move.get(b.effects[PBEffects::TrappingMove]).name
|
||||
if b.effects[PBEffects::Trapping]==0
|
||||
pbDisplay(_INTL("{1} was freed from {2}!",b.pbThis,moveName))
|
||||
else
|
||||
trappingMove = b.effects[PBEffects::TrappingMove]
|
||||
if isConst?(trappingMove,PBMoves,:BIND); pbCommonAnimation("Bind",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:CLAMP); pbCommonAnimation("Clamp",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:FIRESPIN); pbCommonAnimation("FireSpin",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:MAGMASTORM); pbCommonAnimation("MagmaStorm",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:SANDTOMB); pbCommonAnimation("SandTomb",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:WRAP); pbCommonAnimation("Wrap",b)
|
||||
elsif isConst?(trappingMove,PBMoves,:INFESTATION); pbCommonAnimation("Infestation",b)
|
||||
else; pbCommonAnimation("Wrap",b)
|
||||
case b.effects[PBEffects::TrappingMove]
|
||||
when :BIND then pbCommonAnimation("Bind", b)
|
||||
when :CLAMP then pbCommonAnimation("Clamp", b)
|
||||
when :FIRESPIN then pbCommonAnimation("FireSpin", b)
|
||||
when :MAGMASTORM then pbCommonAnimation("MagmaStorm", b)
|
||||
when :SANDTOMB then pbCommonAnimation("SandTomb", b)
|
||||
when :WRAP then pbCommonAnimation("Wrap", b)
|
||||
when :INFESTATION then pbCommonAnimation("Infestation", b)
|
||||
else pbCommonAnimation("Wrap", b)
|
||||
end
|
||||
if b.takesIndirectDamage?
|
||||
hpLoss = (NEWEST_BATTLE_MECHANICS) ? b.totalhp/8 : b.totalhp/16
|
||||
@@ -446,12 +447,12 @@ class PokeBattle_Battle
|
||||
else
|
||||
PBDebug.log("[End of effect] #{b.pbThis}'s encore ended (encored move no longer known)")
|
||||
b.effects[PBEffects::Encore] = 0
|
||||
b.effects[PBEffects::EncoreMove] = 0
|
||||
b.effects[PBEffects::EncoreMove] = nil
|
||||
end
|
||||
end
|
||||
# Disable/Cursed Body
|
||||
pbEORCountDownBattlerEffect(priority,PBEffects::Disable) { |battler|
|
||||
battler.effects[PBEffects::DisableMove] = 0
|
||||
battler.effects[PBEffects::DisableMove] = nil
|
||||
pbDisplay(_INTL("{1} is no longer disabled!",battler.pbThis))
|
||||
}
|
||||
# Magnet Rise
|
||||
|
||||
@@ -17,14 +17,14 @@ class PokeBattle_AI
|
||||
# super-effective and powerful
|
||||
if !shouldSwitch && battler.turnCount>0 && skill>=PBTrainerAI.highSkill
|
||||
target = battler.pbDirectOpposing(true)
|
||||
if !target.fainted? && target.lastMoveUsed>0 &&
|
||||
if !target.fainted? && target.lastMoveUsed &&
|
||||
(target.level-battler.level).abs<=6
|
||||
moveData = pbGetMoveData(target.lastMoveUsed)
|
||||
moveType = moveData[MoveData::TYPE]
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
moveType = moveData.type
|
||||
typeMod = pbCalcTypeMod(moveType,target,battler)
|
||||
if PBTypes.superEffective?(typeMod) && moveData[MoveData::BASE_DAMAGE]>50
|
||||
switchChance = (moveData[MoveData::BASE_DAMAGE]>70) ? 30 : 20
|
||||
shouldSwitch = (pbAIRandom(100)<switchChance)
|
||||
if PBTypes.superEffective?(typeMod) && moveData.base_damage > 50
|
||||
switchChance = (moveData.base_damage > 70) ? 30 : 20
|
||||
shouldSwitch = (pbAIRandom(100) < switchChance)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -158,18 +158,14 @@ class PokeBattle_AI
|
||||
return -1 if !enemies || enemies.length==0
|
||||
best = -1
|
||||
bestSum = 0
|
||||
movesData = pbLoadMovesData
|
||||
enemies.each do |i|
|
||||
pkmn = party[i]
|
||||
sum = 0
|
||||
pkmn.moves.each do |m|
|
||||
next if m.id==0
|
||||
moveData = movesData[m.id]
|
||||
next if moveData[MoveData::BASE_DAMAGE]==0
|
||||
next if m.base_damage == 0
|
||||
@battle.battlers[idxBattler].eachOpposing do |b|
|
||||
bTypes = b.pbTypes(true)
|
||||
sum += PBTypes.getCombinedEffectiveness(moveData[MoveData::TYPE],
|
||||
bTypes[0],bTypes[1],bTypes[2])
|
||||
sum += PBTypes.getCombinedEffectiveness(m.type, bTypes[0], bTypes[1], bTypes[2])
|
||||
end
|
||||
end
|
||||
if best==-1 || sum>bestSum
|
||||
|
||||
@@ -105,7 +105,7 @@ class PokeBattle_AI
|
||||
end
|
||||
# Log the result
|
||||
if @battle.choices[idxBattler][2]
|
||||
PBDebug.log("[AI] #{user.pbThis} (#{user.index}) will use #{@battle.choices[user.index][2].name}")
|
||||
PBDebug.log("[AI] #{user.pbThis} (#{user.index}) will use #{@battle.choices[idxBattler][2].name}")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class PokeBattle_AI
|
||||
when "007", "008", "009", "0C5"
|
||||
if target.pbCanParalyze?(user,false) &&
|
||||
!(skill>=PBTrainerAI.mediumSkill &&
|
||||
isConst?(move.id,PBMoves,:THUNDERWAVE) &&
|
||||
move.id == :THUNDERWAVE &&
|
||||
PBTypes.ineffective?(pbCalcTypeMod(move.type,user,target)))
|
||||
score += 30
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
@@ -1275,17 +1275,19 @@ class PokeBattle_AI
|
||||
"05D", # Sketch
|
||||
"0B6" # Metronome
|
||||
]
|
||||
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
|
||||
if user.effects[PBEffects::Transform] ||
|
||||
target.lastRegularMoveUsed<=0 ||
|
||||
moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
|
||||
isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
|
||||
if user.effects[PBEffects::Transform] || !target.lastRegularMoveUsed
|
||||
score -= 90
|
||||
end
|
||||
user.eachMove do |m|
|
||||
next if m.id!=target.lastRegularMoveUsed
|
||||
score -= 90
|
||||
break
|
||||
else
|
||||
lastMoveData = GameData::Move.get(target.lastRegularMoveUsed)
|
||||
if moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
score -= 90
|
||||
end
|
||||
user.eachMove do |m|
|
||||
next if m != target.lastRegularMoveUsed
|
||||
score -= 90
|
||||
break
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "05D"
|
||||
@@ -1294,17 +1296,19 @@ class PokeBattle_AI
|
||||
"014", # Chatter
|
||||
"05D" # Sketch
|
||||
]
|
||||
lastMoveData = pbGetMoveData(target.lastRegularMoveUsed)
|
||||
if user.effects[PBEffects::Transform] ||
|
||||
target.lastRegularMoveUsed<=0 ||
|
||||
moveBlacklist.include?(lastMoveData[MoveData::FUNCTION_CODE]) ||
|
||||
isConst?(lastMoveData[MoveData::TYPE],PBTypes,:SHADOW)
|
||||
if user.effects[PBEffects::Transform] || !target.lastRegularMoveUsed
|
||||
score -= 90
|
||||
end
|
||||
user.eachMove do |m|
|
||||
next if m.id!=target.lastRegularMoveUsed
|
||||
score -= 90 # User already knows the move that will be Sketched
|
||||
break
|
||||
else
|
||||
lastMoveData = GameData::Move.get(target.lastRegularMoveUsed)
|
||||
if moveBlacklist.include?(lastMoveData.function_code) ||
|
||||
isConst?(lastMoveData.type, PBTypes,:SHADOW)
|
||||
score -= 90
|
||||
end
|
||||
user.eachMove do |m|
|
||||
next if m != target.lastRegularMoveUsed
|
||||
score -= 90 # User already knows the move that will be Sketched
|
||||
break
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "05E"
|
||||
@@ -1324,8 +1328,8 @@ class PokeBattle_AI
|
||||
when "05F"
|
||||
if user.ability == :MULTITYPE || user.ability == :RKSSYSTEM
|
||||
score -= 90
|
||||
elsif target.lastMoveUsed<=0 ||
|
||||
PBTypes.isPseudoType?(pbGetMoveData(target.lastMoveUsed,MoveData::TYPE))
|
||||
elsif !target.lastMoveUsed ||
|
||||
PBTypes.isPseudoType?(GameData::Move.get(target.lastMoveUsed).type)
|
||||
score -= 90
|
||||
else
|
||||
aType = -1
|
||||
@@ -1507,11 +1511,11 @@ class PokeBattle_AI
|
||||
spatk = pbRoughStat(user,PBStats::SPATK,skill)
|
||||
if attack*1.5<spatk
|
||||
score -= 60
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed>0
|
||||
moveData = pbGetMoveData(target.lastMoveUsed)
|
||||
if moveData[MoveData::BASE_DAMAGE]>0 &&
|
||||
(MOVE_CATEGORY_PER_MOVE && moveData[MoveData::CATEGORY]==0) ||
|
||||
(!MOVE_CATEGORY_PER_MOVE && PBTypes.isPhysicalType?(moveData[MoveData::TYPE]))
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
if moveData.base_damage > 0 &&
|
||||
(MOVE_CATEGORY_PER_MOVE && moveData.category == 0) ||
|
||||
(!MOVE_CATEGORY_PER_MOVE && PBTypes.isPhysicalType?(moveData.type))
|
||||
score -= 60
|
||||
end
|
||||
end
|
||||
@@ -1525,11 +1529,11 @@ class PokeBattle_AI
|
||||
spatk = pbRoughStat(user,PBStats::SPATK,skill)
|
||||
if attack>spatk*1.5
|
||||
score -= 60
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed>0
|
||||
moveData = pbGetMoveData(target.lastMoveUsed)
|
||||
if moveData[MoveData::BASE_DAMAGE]>0 &&
|
||||
(MOVE_CATEGORY_PER_MOVE && moveData[MoveData::CATEGORY]==1) ||
|
||||
(!MOVE_CATEGORY_PER_MOVE && !PBTypes.isSpecialType?(moveData[MoveData::TYPE]))
|
||||
elsif skill>=PBTrainerAI.mediumSkill && target.lastMoveUsed
|
||||
moveData = GameData::Move.get(target.lastMoveUsed)
|
||||
if moveData.base_damage > 0 &&
|
||||
(MOVE_CATEGORY_PER_MOVE && moveData.caegory == 1) ||
|
||||
(!MOVE_CATEGORY_PER_MOVE && !PBTypes.isSpecialType?(moveData.type))
|
||||
score -= 60
|
||||
end
|
||||
end
|
||||
@@ -1709,7 +1713,7 @@ class PokeBattle_AI
|
||||
score -= user.effects[PBEffects::ProtectRate]*40
|
||||
end
|
||||
score += 50 if user.turnCount==0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]>0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "0AB"
|
||||
@@ -1721,8 +1725,8 @@ class PokeBattle_AI
|
||||
when "0AE"
|
||||
score -= 40
|
||||
if skill>=PBTrainerAI.highSkill
|
||||
score -= 100 if target.lastRegularMoveUsed<=0 ||
|
||||
!pbGetMoveData(target.lastRegularMoveUsed,MoveData::FLAGS)[/e/] # Not copyable by Mirror Move
|
||||
score -= 100 if !target.lastRegularMoveUsed ||
|
||||
!GameData::Move.get(target.lastRegularMoveUsed).flags[/e/] # Not copyable by Mirror Move
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "0AF"
|
||||
@@ -1767,17 +1771,16 @@ class PokeBattle_AI
|
||||
if target.effects[PBEffects::Encore]>0
|
||||
score -= 90
|
||||
elsif aspeed>ospeed
|
||||
if target.lastMoveUsed<=0
|
||||
if !target.lastRegularMoveUsed
|
||||
score -= 90
|
||||
else
|
||||
moveData = pbGetMoveData(target.lastRegularMoveUsed)
|
||||
if moveData[MoveData::CATEGORY]==2 && # Status move
|
||||
(moveData[MoveData::TARGET]==PBTargets::User ||
|
||||
moveData[MoveData::TARGET]==PBTargets::BothSides)
|
||||
moveData = GameData::Move.get(target.lastRegularMoveUsed)
|
||||
if moveData.category == 2 && # Status move
|
||||
[PBTargets::User, PBTargets::BothSides].include?(moveData.target)
|
||||
score += 60
|
||||
elsif moveData[MoveData::CATEGORY]!=2 && # Damaging move
|
||||
moveData[MoveData::TARGET]==PBTargets::NearOther &&
|
||||
PBTypes.ineffective?(pbCalcTypeMod(moveData[MoveData::TYPE],target,user))
|
||||
elsif moveData.category != 2 && # Damaging move
|
||||
moveData.target == PBTargets::NearOther &&
|
||||
PBTypes.ineffective?(pbCalcTypeMod(moveData.type, target, user))
|
||||
score += 60
|
||||
end
|
||||
end
|
||||
@@ -2054,7 +2057,8 @@ class PokeBattle_AI
|
||||
:CHOICEBAND,:CHOICESCARF,:CHOICESPECS])
|
||||
score += 50
|
||||
elsif !user.item && target.item
|
||||
score -= 30 if pbGetMoveData(user.lastMoveUsed,MoveData::FUNCTION_CODE)=="0F2" # Trick/Switcheroo
|
||||
score -= 30 if user.lastMoveUsed &&
|
||||
GameData::Move.get(user.lastMoveUsed).function_code == "0F2" # Trick/Switcheroo
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "0F3"
|
||||
@@ -2712,7 +2716,7 @@ class PokeBattle_AI
|
||||
score -= user.effects[PBEffects::ProtectRate]*40
|
||||
end
|
||||
score += 50 if user.turnCount==0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]>0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
when "14D"
|
||||
@@ -2924,7 +2928,7 @@ class PokeBattle_AI
|
||||
score -= user.effects[PBEffects::ProtectRate]*40
|
||||
end
|
||||
score += 50 if user.turnCount==0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]>0
|
||||
score += 30 if target.effects[PBEffects::TwoTurnAttack]
|
||||
score += 20 # Because of possible poisoning
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -2940,7 +2944,7 @@ class PokeBattle_AI
|
||||
#---------------------------------------------------------------------------
|
||||
when "16B"
|
||||
if skill>=PBTrainerAI.mediumSkill
|
||||
if target.lastRegularMoveUsed<0 ||
|
||||
if !target.lastRegularMoveUsed ||
|
||||
!target.pbHasMove?(target.lastRegularMoveUsed) ||
|
||||
target.usingMultiTurnAttack?
|
||||
score -= 90
|
||||
|
||||
@@ -287,7 +287,7 @@ class PokeBattle_AI
|
||||
abilityBlacklist = [:ANALYTIC,:SNIPER,:TINTEDLENS,:AERILATE,:PIXILATE,:REFRIGERATE]
|
||||
canCheck = true
|
||||
abilityBlacklist.each do |m|
|
||||
next if !isConst?(move.id,PBMoves,m)
|
||||
next if move.id != m
|
||||
canCheck = false
|
||||
break
|
||||
end
|
||||
@@ -309,7 +309,7 @@ class PokeBattle_AI
|
||||
abilityBlacklist = [:FILTER,:SOLIDROCK]
|
||||
canCheck = true
|
||||
abilityBlacklist.each do |m|
|
||||
next if !isConst?(move.id,PBMoves,m)
|
||||
next if move.id != m
|
||||
canCheck = false
|
||||
break
|
||||
end
|
||||
|
||||
@@ -179,7 +179,7 @@ class CommandMenuDisplay < BattleMenuBase
|
||||
|
||||
def refreshButtons
|
||||
return if !USE_GRAPHICS
|
||||
for i in 0...4
|
||||
for i in 0...@buttons.length
|
||||
button = @buttons[i]
|
||||
button.src_rect.x = (i==@index) ? @buttonBitmap.width/2 : 0
|
||||
button.src_rect.y = MODES[@mode][i]*BUTTON_HEIGHT
|
||||
@@ -218,7 +218,6 @@ class FightMenuDisplay < BattleMenuBase
|
||||
Color.new(248,192,0),Color.new(144,104,0), # Yellow, 1/2 of total PP or less
|
||||
TEXT_BASE_COLOR,TEXT_SHADOW_COLOR # Black, more than 1/2 of total PP
|
||||
]
|
||||
MAX_MOVES = 4 # Number of moves to display at once
|
||||
|
||||
def initialize(viewport,z)
|
||||
super(viewport)
|
||||
@@ -239,7 +238,7 @@ class FightMenuDisplay < BattleMenuBase
|
||||
background.setBitmap("Graphics/Pictures/Battle/overlay_fight")
|
||||
addSprite("background",background)
|
||||
# Create move buttons
|
||||
@buttons = Array.new(MAX_MOVES) do |i|
|
||||
@buttons = Array.new(Pokemon::MAX_MOVES) do |i|
|
||||
button = SpriteWrapper.new(viewport)
|
||||
button.bitmap = @buttonBitmap.bitmap
|
||||
button.x = self.x+4
|
||||
@@ -337,20 +336,21 @@ class FightMenuDisplay < BattleMenuBase
|
||||
if !USE_GRAPHICS
|
||||
# Fill in command window
|
||||
commands = []
|
||||
moves.each { |m| commands.push((m && m.id>0) ? m.name : "-") }
|
||||
for i in 0...[4, moves.length].max
|
||||
commands.push((moves[i]) ? moves[i].name : "-")
|
||||
end
|
||||
@cmdWindow.commands = commands
|
||||
return
|
||||
end
|
||||
# Draw move names onto overlay
|
||||
@overlay.bitmap.clear
|
||||
textPos = []
|
||||
moves.each_with_index do |m,i|
|
||||
button = @buttons[i]
|
||||
@buttons.each_with_index do |button,i|
|
||||
next if !@visibility["button_#{i}"]
|
||||
x = button.x-self.x+button.src_rect.width/2
|
||||
y = button.y-self.y+8
|
||||
moveNameBase = TEXT_BASE_COLOR
|
||||
if m.type>=0
|
||||
if moves[i].type>=0
|
||||
# NOTE: This takes a colour from a particular pixel in the button
|
||||
# graphic and makes the move name's base colour that same colour.
|
||||
# The pixel is at coordinates 10,34 in the button box. If you
|
||||
@@ -358,7 +358,7 @@ class FightMenuDisplay < BattleMenuBase
|
||||
# of code to ensure the font is an appropriate colour.
|
||||
moveNameBase = button.bitmap.get_pixel(10,button.src_rect.y+34)
|
||||
end
|
||||
textPos.push([m.name,x,y,2,moveNameBase,TEXT_SHADOW_COLOR])
|
||||
textPos.push([moves[i].name,x,y,2,moveNameBase,TEXT_SHADOW_COLOR])
|
||||
end
|
||||
pbDrawTextPositions(@overlay.bitmap,textPos)
|
||||
end
|
||||
@@ -368,7 +368,7 @@ class FightMenuDisplay < BattleMenuBase
|
||||
if USE_GRAPHICS
|
||||
# Choose appropriate button graphics and z positions
|
||||
@buttons.each_with_index do |button,i|
|
||||
if !moves[i] || moves[i].id==0
|
||||
if !moves[i]
|
||||
@visibility["button_#{i}"] = false
|
||||
next
|
||||
end
|
||||
@@ -385,16 +385,16 @@ class FightMenuDisplay < BattleMenuBase
|
||||
# Write PP and type of the selected move
|
||||
if !USE_GRAPHICS
|
||||
moveType = PBTypes.getName(move.type)
|
||||
if move.totalpp<=0
|
||||
if move.total_pp<=0
|
||||
@msgBox.text = _INTL("PP: ---<br>TYPE/{1}",moveType)
|
||||
else
|
||||
@msgBox.text = _ISPRINTF("PP: {1: 2d}/{2: 2d}<br>TYPE/{3:s}",
|
||||
move.pp,move.totalpp,moveType)
|
||||
move.pp,move.total_pp,moveType)
|
||||
end
|
||||
return
|
||||
end
|
||||
@infoOverlay.bitmap.clear
|
||||
if !move || move.id==0
|
||||
if !move
|
||||
@visibility["typeIcon"] = false
|
||||
return
|
||||
end
|
||||
@@ -402,10 +402,10 @@ class FightMenuDisplay < BattleMenuBase
|
||||
# Type icon
|
||||
@typeIcon.src_rect.y = move.type*TYPE_ICON_HEIGHT
|
||||
# PP text
|
||||
if move.totalpp>0
|
||||
ppFraction = [(4.0*move.pp/move.totalpp).ceil,3].min
|
||||
if move.total_pp>0
|
||||
ppFraction = [(4.0*move.pp/move.total_pp).ceil,3].min
|
||||
textPos = []
|
||||
textPos.push([_INTL("PP: {1}/{2}",move.pp,move.totalpp),
|
||||
textPos.push([_INTL("PP: {1}/{2}",move.pp,move.total_pp),
|
||||
448,50,2,PP_COLORS[ppFraction*2],PP_COLORS[ppFraction*2+1]])
|
||||
pbDrawTextPositions(@infoOverlay.bitmap,textPos)
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ class PokeBattle_Scene
|
||||
cw = @sprites["fightWindow"]
|
||||
cw.battler = battler
|
||||
moveIndex = 0
|
||||
if battler.moves[@lastMove[idxBattler]] && battler.moves[@lastMove[idxBattler]].id>0
|
||||
if battler.moves[@lastMove[idxBattler]] && battler.moves[@lastMove[idxBattler]].id
|
||||
moveIndex = @lastMove[idxBattler]
|
||||
end
|
||||
cw.shiftMode = (@battle.pbCanShift?(idxBattler)) ? 1 : 0
|
||||
@@ -98,13 +98,13 @@ class PokeBattle_Scene
|
||||
if Input.trigger?(Input::LEFT)
|
||||
cw.index -= 1 if (cw.index&1)==1
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
if battler.moves[cw.index+1] && battler.moves[cw.index+1].id>0
|
||||
if battler.moves[cw.index+1] && battler.moves[cw.index+1].id
|
||||
cw.index += 1 if (cw.index&1)==0
|
||||
end
|
||||
elsif Input.trigger?(Input::UP)
|
||||
cw.index -= 2 if (cw.index&2)==2
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
if battler.moves[cw.index+2] && battler.moves[cw.index+2].id>0
|
||||
if battler.moves[cw.index+2] && battler.moves[cw.index+2].id
|
||||
cw.index += 2 if (cw.index&2)==0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -383,13 +383,14 @@ class PokeBattle_Scene
|
||||
# Returns the animation ID to use for a given move/user. Returns nil if that
|
||||
# move has no animations defined for it.
|
||||
def pbFindMoveAnimDetails(move2anim,moveID,idxUser,hitNum=0)
|
||||
id_number = GameData::Move.get(moveID).id_number
|
||||
noFlip = false
|
||||
if (idxUser&1)==0 # On player's side
|
||||
anim = move2anim[0][moveID]
|
||||
anim = move2anim[0][id_number]
|
||||
else # On opposing side
|
||||
anim = move2anim[1][moveID]
|
||||
anim = move2anim[1][id_number]
|
||||
noFlip = true if anim
|
||||
anim = move2anim[0][moveID] if !anim
|
||||
anim = move2anim[0][id_number] if !anim
|
||||
end
|
||||
return [anim+hitNum,noFlip] if anim
|
||||
return nil
|
||||
@@ -399,62 +400,62 @@ class PokeBattle_Scene
|
||||
# animations, tries to use a default move animation depending on the move's
|
||||
# type. If that default move animation doesn't exist, trues to use Tackle's
|
||||
# move animation. Returns nil if it can't find any of these animations to use.
|
||||
def pbFindMoveAnimation(moveID,idxUser,hitNum)
|
||||
def pbFindMoveAnimation(moveID, idxUser, hitNum)
|
||||
begin
|
||||
move2anim = pbLoadMoveToAnim
|
||||
# Find actual animation requested (an opponent using the animation first
|
||||
# looks for an OppMove version then a Move version)
|
||||
anim = pbFindMoveAnimDetails(move2anim,moveID,idxUser,hitNum)
|
||||
anim = pbFindMoveAnimDetails(move2anim, moveID, idxUser, hitNum)
|
||||
return anim if anim
|
||||
# Actual animation not found, get the default animation for the move's type
|
||||
moveData = pbGetMoveData(moveID)
|
||||
moveType = moveData[MoveData::TYPE]
|
||||
moveKind = moveData[MoveData::CATEGORY]
|
||||
moveKind += 3 if PBTargets.multipleTargets?(moveData[MoveData::TARGET]) ||
|
||||
PBTargets.targetsFoeSide?(moveData[MoveData::TARGET])
|
||||
moveKind += 3 if moveKind==2 && moveData[MoveData::TARGET]!=PBTargets::User &&
|
||||
moveData[MoveData::TARGET]!=PBTargets::UserSide
|
||||
moveData = GameData::Move.get(moveID)
|
||||
moveType = moveData.type
|
||||
moveKind = moveData.category
|
||||
moveKind += 3 if PBTargets.multipleTargets?(moveData.target) ||
|
||||
PBTargets.targetsFoeSide?(moveData.target)
|
||||
moveKind += 3 if moveKind == 2 && moveData.target != PBTargets::User &&
|
||||
moveData.target != PBTargets::UserSide
|
||||
# [one target physical, one target special, user status,
|
||||
# multiple targets physical, multiple targets special, non-user status]
|
||||
typeDefaultAnim = {
|
||||
:NORMAL => [:TACKLE,:SONICBOOM,:DEFENSECURL,:EXPLOSION,:SWIFT,:TAILWHIP],
|
||||
:FIGHTING => [:MACHPUNCH,:AURASPHERE,:DETECT,nil,nil,nil],
|
||||
:FLYING => [:WINGATTACK,:GUST,:ROOST,nil,:AIRCUTTER,:FEATHERDANCE],
|
||||
:POISON => [:POISONSTING,:SLUDGE,:ACIDARMOR,nil,:ACID,:POISONPOWDER],
|
||||
:GROUND => [:SANDTOMB,:MUDSLAP,nil,:EARTHQUAKE,:EARTHPOWER,:MUDSPORT],
|
||||
:ROCK => [:ROCKTHROW,:POWERGEM,:ROCKPOLISH,:ROCKSLIDE,nil,:SANDSTORM],
|
||||
:BUG => [:TWINEEDLE,:BUGBUZZ,:QUIVERDANCE,nil,:STRUGGLEBUG,:STRINGSHOT],
|
||||
:GHOST => [:LICK,:SHADOWBALL,:GRUDGE,nil,nil,:CONFUSERAY],
|
||||
:STEEL => [:IRONHEAD,:MIRRORSHOT,:IRONDEFENSE,nil,nil,:METALSOUND],
|
||||
:FIRE => [:FIREPUNCH,:EMBER,:SUNNYDAY,nil,:INCINERATE,:WILLOWISP],
|
||||
:WATER => [:CRABHAMMER,:WATERGUN,:AQUARING,nil,:SURF,:WATERSPORT],
|
||||
:GRASS => [:VINEWHIP,:MEGADRAIN,:COTTONGUARD,:RAZORLEAF,nil,:SPORE],
|
||||
:ELECTRIC => [:THUNDERPUNCH,:THUNDERSHOCK,:CHARGE,nil,:DISCHARGE,:THUNDERWAVE],
|
||||
:PSYCHIC => [:ZENHEADBUTT,:CONFUSION,:CALMMIND,nil,:SYNCHRONOISE,:MIRACLEEYE],
|
||||
:ICE => [:ICEPUNCH,:ICEBEAM,:MIST,nil,:POWDERSNOW,:HAIL],
|
||||
:DRAGON => [:DRAGONCLAW,:DRAGONRAGE,:DRAGONDANCE,nil,:TWISTER,nil],
|
||||
:DARK => [:PURSUIT,:DARKPULSE,:HONECLAWS,nil,:SNARL,:EMBARGO],
|
||||
:FAIRY => [:TACKLE,:FAIRYWIND,:MOONLIGHT,nil,:SWIFT,:SWEETKISS]
|
||||
:NORMAL => [:TACKLE, :SONICBOOM, :DEFENSECURL, :EXPLOSION, :SWIFT, :TAILWHIP],
|
||||
:FIGHTING => [:MACHPUNCH, :AURASPHERE, :DETECT, nil, nil, nil],
|
||||
:FLYING => [:WINGATTACK, :GUST, :ROOST, nil, :AIRCUTTER, :FEATHERDANCE],
|
||||
:POISON => [:POISONSTING, :SLUDGE, :ACIDARMOR, nil, :ACID, :POISONPOWDER],
|
||||
:GROUND => [:SANDTOMB, :MUDSLAP, nil, :EARTHQUAKE, :EARTHPOWER, :MUDSPORT],
|
||||
:ROCK => [:ROCKTHROW, :POWERGEM, :ROCKPOLISH, :ROCKSLIDE, nil, :SANDSTORM],
|
||||
:BUG => [:TWINEEDLE, :BUGBUZZ, :QUIVERDANCE, nil, :STRUGGLEBUG, :STRINGSHOT],
|
||||
:GHOST => [:LICK, :SHADOWBALL, :GRUDGE, nil, nil, :CONFUSERAY],
|
||||
:STEEL => [:IRONHEAD, :MIRRORSHOT, :IRONDEFENSE, nil, nil, :METALSOUND],
|
||||
:FIRE => [:FIREPUNCH, :EMBER, :SUNNYDAY, nil, :INCINERATE, :WILLOWISP],
|
||||
:WATER => [:CRABHAMMER, :WATERGUN, :AQUARING, nil, :SURF, :WATERSPORT],
|
||||
:GRASS => [:VINEWHIP, :MEGADRAIN, :COTTONGUARD, :RAZORLEAF, nil, :SPORE],
|
||||
:ELECTRIC => [:THUNDERPUNCH, :THUNDERSHOCK, :CHARGE, nil, :DISCHARGE, :THUNDERWAVE],
|
||||
:PSYCHIC => [:ZENHEADBUTT, :CONFUSION, :CALMMIND, nil, :SYNCHRONOISE, :MIRACLEEYE],
|
||||
:ICE => [:ICEPUNCH, :ICEBEAM, :MIST, nil, :POWDERSNOW, :HAIL],
|
||||
:DRAGON => [:DRAGONCLAW, :DRAGONRAGE, :DRAGONDANCE, nil, :TWISTER, nil],
|
||||
:DARK => [:PURSUIT, :DARKPULSE, :HONECLAWS, nil, :SNARL, :EMBARGO],
|
||||
:FAIRY => [:TACKLE, :FAIRYWIND, :MOONLIGHT, nil, :SWIFT, :SWEETKISS]
|
||||
}
|
||||
typeDefaultAnim.each do |type, anims|
|
||||
next if !isConst?(moveType,PBTypes,type)
|
||||
if anims[moveKind] && hasConst?(PBMoves,anims[moveKind])
|
||||
anim = pbFindMoveAnimDetails(move2anim,getConst(PBMoves,anims[moveKind]),idxUser)
|
||||
next if !isConst?(moveType, PBTypes, type)
|
||||
if GameData::Move.exists?(anims[moveKind])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind], idxUser)
|
||||
end
|
||||
break if anim
|
||||
if moveKind>=3 && anims[moveKind-3] && hasConst?(PBMoves,anims[moveKind-3])
|
||||
anim = pbFindMoveAnimDetails(move2anim,getConst(PBMoves,anims[moveKind-3]),idxUser)
|
||||
if moveKind >= 3 && GameData::Move.exists?(anims[moveKind - 3])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[moveKind - 3], idxUser)
|
||||
end
|
||||
break if anim
|
||||
if anims[2] && hasConst?(PBMoves,anims[2])
|
||||
anim = pbFindMoveAnimDetails(move2anim,getConst(PBMoves,anims[2]),idxUser)
|
||||
if GameData::Move.exists?(anims[2])
|
||||
anim = pbFindMoveAnimDetails(move2anim, anims[2], idxUser)
|
||||
end
|
||||
break
|
||||
end
|
||||
return anim if anim
|
||||
# Default animation for the move's type not found, use Tackle's animation
|
||||
if hasConst?(PBMoves,:TACKLE)
|
||||
return pbFindMoveAnimDetails(move2anim,getConst(PBMoves,:TACKLE),idxUser)
|
||||
if GameData::Move.exists?(:TACKLE)
|
||||
return pbFindMoveAnimDetails(move2anim, :TACKLE, idxUser)
|
||||
end
|
||||
rescue
|
||||
end
|
||||
|
||||
@@ -85,38 +85,37 @@ begin
|
||||
Quash = 79
|
||||
Rage = 80
|
||||
RagePowder = 81 # Used along with FollowMe
|
||||
Revenge = 82
|
||||
Rollout = 83
|
||||
Roost = 84
|
||||
ShellTrap = 85
|
||||
SkyDrop = 86
|
||||
SlowStart = 87
|
||||
SmackDown = 88
|
||||
Snatch = 89
|
||||
SpikyShield = 90
|
||||
Spotlight = 91
|
||||
Stockpile = 92
|
||||
StockpileDef = 93
|
||||
StockpileSpDef = 94
|
||||
Substitute = 95
|
||||
Taunt = 96
|
||||
Telekinesis = 97
|
||||
ThroatChop = 98
|
||||
Torment = 99
|
||||
Toxic = 100
|
||||
Transform = 101
|
||||
TransformSpecies = 102
|
||||
Trapping = 103 # Trapping move
|
||||
TrappingMove = 104
|
||||
TrappingUser = 105
|
||||
Truant = 106
|
||||
TwoTurnAttack = 107
|
||||
Type3 = 108
|
||||
Unburden = 109
|
||||
Uproar = 110
|
||||
WaterSport = 111
|
||||
WeightChange = 112
|
||||
Yawn = 113
|
||||
Rollout = 82
|
||||
Roost = 83
|
||||
ShellTrap = 84
|
||||
SkyDrop = 85
|
||||
SlowStart = 86
|
||||
SmackDown = 87
|
||||
Snatch = 88
|
||||
SpikyShield = 89
|
||||
Spotlight = 90
|
||||
Stockpile = 91
|
||||
StockpileDef = 92
|
||||
StockpileSpDef = 93
|
||||
Substitute = 94
|
||||
Taunt = 95
|
||||
Telekinesis = 96
|
||||
ThroatChop = 97
|
||||
Torment = 98
|
||||
Toxic = 99
|
||||
Transform = 100
|
||||
TransformSpecies = 101
|
||||
Trapping = 102 # Trapping move
|
||||
TrappingMove = 103
|
||||
TrappingUser = 104
|
||||
Truant = 105
|
||||
TwoTurnAttack = 106
|
||||
Type3 = 107
|
||||
Unburden = 108
|
||||
Uproar = 109
|
||||
WaterSport = 110
|
||||
WeightChange = 111
|
||||
Yawn = 112
|
||||
|
||||
#===========================================================================
|
||||
# These effects apply to a battler position
|
||||
|
||||
@@ -78,15 +78,15 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
|
||||
def pbCanChooseMovePartial?(idxPokemon,idxMove)
|
||||
thispkmn = @battlers[idxPokemon]
|
||||
thismove = thispkmn.moves[idxMove]
|
||||
return false if !thismove || thismove.id==0
|
||||
return false if !thismove
|
||||
return false if thismove.pp<=0
|
||||
if thispkmn.effects[PBEffects::ChoiceBand]>=0 &&
|
||||
if thispkmn.effects[PBEffects::ChoiceBand] &&
|
||||
thismove.id!=thispkmn.effects[PBEffects::ChoiceBand] &&
|
||||
thispkmn.hasActiveItem?(:CHOICEBAND)
|
||||
return false
|
||||
end
|
||||
# though incorrect, just for convenience (actually checks Torment later)
|
||||
if thispkmn.effects[PBEffects::Torment]
|
||||
if thispkmn.effects[PBEffects::Torment] && thispkmn.lastMoveUsed
|
||||
return false if thismove.id==thispkmn.lastMoveUsed
|
||||
end
|
||||
return true
|
||||
@@ -135,28 +135,28 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
|
||||
end
|
||||
|
||||
def pbRegisterMove(idxBattler,idxMove,_showMessages=true)
|
||||
thispkmn = @battlers[idxBattler]
|
||||
this_battler = @battlers[idxBattler]
|
||||
if idxMove==-2
|
||||
@choices[idxPokemon][0] = :UseMove # Move
|
||||
@choices[idxPokemon][1] = -2 # "Incapable of using its power..."
|
||||
@choices[idxPokemon][2] = @struggle
|
||||
@choices[idxPokemon][3] = -1
|
||||
@choices[idxBattler][0] = :UseMove # Move
|
||||
@choices[idxBattler][1] = -2 # "Incapable of using its power..."
|
||||
@choices[idxBattler][2] = @struggle
|
||||
@choices[idxBattler][3] = -1
|
||||
else
|
||||
@choices[idxPokemon][0] = :UseMove # Move
|
||||
@choices[idxPokemon][1] = idxMove # Index of move
|
||||
@choices[idxPokemon][2] = thispkmn.moves[idxMove] # Move object
|
||||
@choices[idxPokemon][3] = -1 # No target chosen
|
||||
@choices[idxBattler][0] = :UseMove # Move
|
||||
@choices[idxBattler][1] = idxMove # Index of move
|
||||
@choices[idxBattler][2] = this_battler.moves[idxMove] # Move object
|
||||
@choices[idxBattler][3] = -1 # No target chosen
|
||||
end
|
||||
end
|
||||
|
||||
def pbAutoFightMenu(idxBattler)
|
||||
thispkmn = @battlers[idxBattler]
|
||||
nature = thispkmn.nature
|
||||
this_battler = @battlers[idxBattler]
|
||||
nature = this_battler.nature
|
||||
randnum = @battleAI.pbAIRandom(100)
|
||||
category = 0
|
||||
atkpercent = 0
|
||||
defpercent = 0
|
||||
if thispkmn.effects[PBEffects::Pinch]
|
||||
if this_battler.effects[PBEffects::Pinch]
|
||||
atkpercent = @@BattlePalacePinchTable[nature*3]
|
||||
defpercent = atkpercent+@@BattlePalacePinchTable[nature*3+1]
|
||||
else
|
||||
@@ -171,9 +171,9 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
|
||||
category = 2
|
||||
end
|
||||
moves = []
|
||||
for i in 0...thispkmn.moves.length
|
||||
for i in 0...this_battler.moves.length
|
||||
next if !pbCanChooseMovePartial?(idxBattler,i)
|
||||
next if pbMoveCategory(thispkmn.moves[i])!=category
|
||||
next if pbMoveCategory(this_battler.moves[i])!=category
|
||||
moves[moves.length] = i
|
||||
end
|
||||
if moves.length==0
|
||||
|
||||
@@ -1080,7 +1080,8 @@ BattleHandlers::DamageCalcUserAbility.add(:SWARM,
|
||||
|
||||
BattleHandlers::DamageCalcUserAbility.add(:TECHNICIAN,
|
||||
proc { |ability,user,target,move,mults,baseDmg,type|
|
||||
if user.index!=target.index && move.id>0 && baseDmg*mults[BASE_DMG_MULT]<=60
|
||||
if user.index!=target.index && move && move.id != :STRUGGLE &&
|
||||
baseDmg*mults[BASE_DMG_MULT]<=60
|
||||
mults[BASE_DMG_MULT] *= 1.5
|
||||
end
|
||||
}
|
||||
@@ -1358,7 +1359,7 @@ BattleHandlers::TargetAbilityOnHit.add(:CURSEDBODY,
|
||||
regularMove = m
|
||||
break
|
||||
end
|
||||
next if !regularMove || (regularMove.pp==0 && regularMove.totalpp>0)
|
||||
next if !regularMove || (regularMove.pp==0 && regularMove.total_pp>0)
|
||||
next if battle.pbRandom(100)>=30
|
||||
battle.pbShowAbilitySplash(target)
|
||||
if !move.pbMoveFailedAromaVeil?(target,user,PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
|
||||
@@ -2098,17 +2099,16 @@ BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
|
||||
battle.eachOtherSideBattler(battler.index) do |b|
|
||||
b.eachMove do |m|
|
||||
next if m.statusMove?
|
||||
moveData = pbGetMoveData(m.id)
|
||||
if type1
|
||||
moveType = moveData[MoveData::TYPE]
|
||||
if NEWEST_BATTLE_MECHANICS && isConst?(m.id,PBMoves,:HIDDENPOWER)
|
||||
moveType = m.type
|
||||
if NEWEST_BATTLE_MECHANICS && m.function == "090" # Hidden Power
|
||||
moveType = pbHiddenPower(b.pokemon)[0]
|
||||
end
|
||||
eff = PBTypes.getCombinedEffectiveness(moveType,type1,type2,type3)
|
||||
next if PBTypes.ineffective?(eff)
|
||||
next if !PBTypes.superEffective?(eff) && moveData[MoveData::FUNCTION_CODE]!="070" # OHKO
|
||||
next if !PBTypes.superEffective?(eff) && m.function != "070" # OHKO
|
||||
else
|
||||
next if moveData[MoveData::FUNCTION_CODE]!="070" # OHKO
|
||||
next if m.function != "070" # OHKO
|
||||
end
|
||||
found = true
|
||||
break
|
||||
@@ -2207,33 +2207,32 @@ BattleHandlers::AbilityOnSwitchIn.add(:FOREWARN,
|
||||
forewarnMoves = []
|
||||
battle.eachOtherSideBattler(battler.index) do |b|
|
||||
b.eachMove do |m|
|
||||
moveData = pbGetMoveData(m.id)
|
||||
power = moveData[MoveData::BASE_DAMAGE]
|
||||
power = 160 if ["070"].include?(moveData[MoveData::FUNCTION_CODE]) # OHKO
|
||||
power = 150 if ["08B"].include?(moveData[MoveData::FUNCTION_CODE]) # Eruption
|
||||
power = m.baseDamage
|
||||
power = 160 if ["070"].include?(m.function) # OHKO
|
||||
power = 150 if ["08B"].include?(m.function) # Eruption
|
||||
# Counter, Mirror Coat, Metal Burst
|
||||
power = 120 if ["071","072","073"].include?(moveData[MoveData::FUNCTION_CODE])
|
||||
power = 120 if ["071","072","073"].include?(m.function)
|
||||
# Sonic Boom, Dragon Rage, Night Shade, Endeavor, Psywave,
|
||||
# Return, Frustration, Crush Grip, Gyro Ball, Hidden Power,
|
||||
# Natural Gift, Trump Card, Flail, Grass Knot
|
||||
power = 80 if ["06A","06B","06D","06E","06F",
|
||||
"089","08A","08C","08D","090",
|
||||
"096","097","098","09A"].include?(moveData[MoveData::FUNCTION_CODE])
|
||||
"096","097","098","09A"].include?(m.function)
|
||||
next if power<highestPower
|
||||
forewarnMoves = [] if power>highestPower
|
||||
forewarnMoves.push(m.id)
|
||||
forewarnMoves.push(m.name)
|
||||
highestPower = power
|
||||
end
|
||||
end
|
||||
if forewarnMoves.length>0
|
||||
battle.pbShowAbilitySplash(battler)
|
||||
forewarnMoveID = forewarnMoves[battle.pbRandom(forewarnMoves.length)]
|
||||
forewarnMoveName = forewarnMoves[battle.pbRandom(forewarnMoves.length)]
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
battle.pbDisplay(_INTL("{1} was alerted to {2}!",
|
||||
battler.pbThis,PBMoves.getName(forewarnMoveID)))
|
||||
battler.pbThis, forewarnMoveName))
|
||||
else
|
||||
battle.pbDisplay(_INTL("{1}'s Forewarn alerted it to {2}!",
|
||||
battler.pbThis,PBMoves.getName(forewarnMoveID)))
|
||||
battler.pbThis, forewarnMoveName))
|
||||
end
|
||||
battle.pbHideAbilitySplash(battler)
|
||||
end
|
||||
@@ -2285,7 +2284,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:IMPOSTER,
|
||||
choice.semiInvulnerable?
|
||||
battle.pbShowAbilitySplash(battler,true)
|
||||
battle.pbHideAbilitySplash(battler)
|
||||
battle.pbAnimation(getConst(PBMoves,:TRANSFORM),battler,choice)
|
||||
battle.pbAnimation(:TRANSFORM,battler,choice)
|
||||
battle.scene.pbChangePokemon(battler,choice.pokemon)
|
||||
battler.pbTransform(choice)
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ BattleHandlers::StatusCureItem.add(:MENTALHERB,
|
||||
battler.effects[PBEffects::Taunt] = 0
|
||||
battle.pbDisplay(_INTL("{1}'s encore ended!",battler.pbThis)) if battler.effects[PBEffects::Encore]>0
|
||||
battler.effects[PBEffects::Encore] = 0
|
||||
battler.effects[PBEffects::EncoreMove] = 0
|
||||
battler.effects[PBEffects::EncoreMove] = nil
|
||||
battle.pbDisplay(_INTL("{1}'s torment wore off!",battler.pbThis)) if battler.effects[PBEffects::Torment]
|
||||
battler.effects[PBEffects::Torment] = false
|
||||
battle.pbDisplay(_INTL("{1} is no longer disabled!",battler.pbThis)) if battler.effects[PBEffects::Disable]>0
|
||||
@@ -1288,8 +1288,7 @@ BattleHandlers::EndOfMoveItem.add(:LEPPABERRY,
|
||||
next false if !forced && battle.pbCheckOpposingAbility(:UNNERVE,battler.index)
|
||||
found = []
|
||||
battler.pokemon.moves.each_with_index do |m,i|
|
||||
next if !m || m.id==0
|
||||
next if m.totalpp<=0 || m.pp==m.totalpp
|
||||
next if m.total_pp<=0 || m.pp==m.total_pp
|
||||
next if !forced && m.pp>0
|
||||
found.push(i)
|
||||
end
|
||||
@@ -1300,9 +1299,9 @@ BattleHandlers::EndOfMoveItem.add(:LEPPABERRY,
|
||||
choice = found[battle.pbRandom(found.length)]
|
||||
pkmnMove = battler.pokemon.moves[choice]
|
||||
pkmnMove.pp += 10
|
||||
pkmnMove.pp = pkmnMove.totalpp if pkmnMove.pp>pkmnMove.totalpp
|
||||
pkmnMove.pp = pkmnMove.total_pp if pkmnMove.pp>pkmnMove.total_pp
|
||||
battler.moves[choice].pp = pkmnMove.pp
|
||||
moveName = PBMoves.getName(pkmnMove.id)
|
||||
moveName = pkmnMove.name
|
||||
if forced
|
||||
battle.pbDisplay(_INTL("{1} restored its {2}'s PP.",battler.pbThis,moveName))
|
||||
else
|
||||
|
||||
@@ -72,7 +72,7 @@ begin
|
||||
def initialize
|
||||
@effects = []
|
||||
@effects[PBEffects::FutureSightCounter] = 0
|
||||
@effects[PBEffects::FutureSightMove] = 0
|
||||
@effects[PBEffects::FutureSightMove] = nil
|
||||
@effects[PBEffects::FutureSightUserIndex] = -1
|
||||
@effects[PBEffects::FutureSightUserPartyIndex] = -1
|
||||
@effects[PBEffects::HealingWish] = false
|
||||
|
||||
Reference in New Issue
Block a user