Implemented GameData::Move

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

View File

@@ -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

View File

@@ -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!"))

View File

@@ -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

View File

@@ -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

View File

@@ -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])

View File

@@ -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