mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 06:04:59 +00:00
Implemented GameData::Move
This commit is contained in:
@@ -103,6 +103,8 @@ class Pokemon
|
||||
EV_STAT_LIMIT = 252
|
||||
# Maximum length a Pokémon's nickname can be
|
||||
MAX_NAME_SIZE = 10
|
||||
# Maximum number of moves a Pokémon can know at once
|
||||
MAX_MOVES = 4
|
||||
|
||||
#=============================================================================
|
||||
# Ownership, obtained information
|
||||
@@ -495,18 +497,15 @@ class Pokemon
|
||||
|
||||
# @return [Integer] the number of moves known by the Pokémon
|
||||
def numMoves
|
||||
ret = 0
|
||||
@moves.each { |m| ret += 1 if m && m.id != 0 }
|
||||
return ret
|
||||
return @moves.length
|
||||
end
|
||||
|
||||
# @param move [Integer, Symbol, String] ID of the move to check
|
||||
# @return [Boolean] whether the Pokémon knows the given move
|
||||
def hasMove?(move)
|
||||
move = getID(PBMoves, move)
|
||||
return false if !move || move <= 0
|
||||
@moves.each { |m| return true if m && m.id == move }
|
||||
return false
|
||||
def hasMove?(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
return false if !move_data
|
||||
return @moves.any? { |m| m.id == move_data.id }
|
||||
end
|
||||
alias knowsMove? hasMove?
|
||||
|
||||
@@ -518,101 +517,79 @@ class Pokemon
|
||||
|
||||
# Sets this Pokémon's movelist to the default movelist it originally had.
|
||||
def resetMoves
|
||||
lvl = self.level
|
||||
fullMoveList = self.getMoveList
|
||||
moveList = []
|
||||
fullMoveList.each { |m| moveList.push(m[1]) if m[0] <= lvl }
|
||||
moveList = moveList.reverse
|
||||
moveList |= [] # Remove duplicates
|
||||
moveList = moveList.reverse
|
||||
listend = moveList.length - 4
|
||||
listend = 0 if listend < 0
|
||||
j = 0
|
||||
for i in listend...listend+4
|
||||
moveid = (i >= moveList.length) ? 0 : moveList[i]
|
||||
@moves[j] = PBMove.new(moveid)
|
||||
j += 1
|
||||
this_level = self.level
|
||||
# Find all level-up moves that self could have learned
|
||||
moveset = self.getMoveList
|
||||
knowable_moves = []
|
||||
moveset.each { |m| knowable_moves.push(m[1]) if m[0] <= this_level }
|
||||
# Remove duplicates (retaining the latest copy of each move)
|
||||
knowable_moves = knowable_moves.reverse
|
||||
knowable_moves |= []
|
||||
knowable_moves = knowable_moves.reverse
|
||||
# Add all moves
|
||||
@moves.clear
|
||||
first_move_index = knowable_moves.length - MAX_MOVES
|
||||
first_move_index = 0 if first_move_index < 0
|
||||
for i in first_move_index...knowable_moves.length
|
||||
@moves.push(PBMove.new(knowable_moves[i]))
|
||||
end
|
||||
end
|
||||
|
||||
# Silently learns the given move. Will erase the first known move if it has to.
|
||||
# @param move [Integer, Symbol, String] ID of the move to learn
|
||||
def pbLearnMove(move)
|
||||
move = getID(PBMoves, move)
|
||||
return if move <= 0
|
||||
for i in 0...4 # Already knows move, relocate it to the end of the list
|
||||
next if @moves[i].id != move
|
||||
j = i + 1
|
||||
while j < 4
|
||||
break if @moves[j].id == 0
|
||||
tmp = @moves[j]
|
||||
@moves[j] = @moves[j - 1]
|
||||
@moves[j - 1] = tmp
|
||||
j += 1
|
||||
end
|
||||
# @param move_id [Integer, Symbol, String] ID of the move to learn
|
||||
def pbLearnMove(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
return if !move_data
|
||||
# Check if self already knows the move; if so, move it to the end of the array
|
||||
@moves.each_with_index do |m, i|
|
||||
next if m.id != move_data.id
|
||||
@moves.push(m)
|
||||
@moves.delete_at(i)
|
||||
return
|
||||
end
|
||||
for i in 0...4 # Has empty move slot, put move in there
|
||||
next if @moves[i].id != 0
|
||||
@moves[i] = PBMove.new(move)
|
||||
return
|
||||
end
|
||||
# Already knows 4 moves, forget the first move and learn the new move
|
||||
@moves[0] = @moves[1]
|
||||
@moves[1] = @moves[2]
|
||||
@moves[2] = @moves[3]
|
||||
@moves[3] = PBMove.new(move)
|
||||
# Move is not already known; learn it
|
||||
@moves.push(PBMove.new(move_data.id))
|
||||
# Delete the first known move if self now knows more moves than it should
|
||||
@moves.shift if numMoves > MAX_MOVES
|
||||
end
|
||||
|
||||
# Deletes the given move from the Pokémon.
|
||||
# @param move [Integer, Symbol, String] ID of the move to delete
|
||||
def pbDeleteMove(move)
|
||||
move = getID(PBMoves,move)
|
||||
return if !move || move <= 0
|
||||
newMoves = []
|
||||
@moves.each { |m| newMoves.push(m) if m && m.id != move }
|
||||
newMoves.push(PBMove.new(0))
|
||||
for i in 0...4
|
||||
@moves[i] = newMoves[i]
|
||||
end
|
||||
# @param move_id [Integer, Symbol, String] ID of the move to delete
|
||||
def pbDeleteMove(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
return if !move_data
|
||||
@moves.delete_if { |m| m.id == move_data.id }
|
||||
end
|
||||
|
||||
# Deletes the move at the given index from the Pokémon.
|
||||
# @param index [Integer] index of the move to be deleted
|
||||
def pbDeleteMoveAtIndex(index)
|
||||
newMoves = []
|
||||
@moves.each_with_index { |m, i| newMoves.push(m) if m && i != index }
|
||||
newMoves.push(PBMove.new(0))
|
||||
for i in 0...4
|
||||
@moves[i] = newMoves[i]
|
||||
end
|
||||
@moves.delete_at(index)
|
||||
end
|
||||
|
||||
# Deletes all moves from the Pokémon.
|
||||
def pbDeleteAllMoves
|
||||
for i in 0...4
|
||||
@moves[i] = PBMove.new(0)
|
||||
end
|
||||
@moves = []
|
||||
end
|
||||
|
||||
# Copies currently known moves into a separate array, for Move Relearner.
|
||||
def pbRecordFirstMoves
|
||||
@firstmoves = []
|
||||
@moves.each { |m| @firstmoves.push(m.id) if m && m.id > 0 }
|
||||
@moves.each { |m| @firstmoves.push(m.id) }
|
||||
end
|
||||
|
||||
# Adds a move to this Pokémon's first moves.
|
||||
# @param move [Integer, Symbol, String] ID of the move to add
|
||||
def pbAddFirstMove(move)
|
||||
move = getID(PBMoves, move)
|
||||
@firstmoves.push(move) if move > 0 && !@firstmoves.include?(move)
|
||||
# @param move_id [Integer, Symbol, String] ID of the move to add
|
||||
def pbAddFirstMove(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
@firstmoves.push(move_data.id) if move_data && !@firstmoves.include?(move_data.id)
|
||||
end
|
||||
|
||||
# Removes a move from this Pokémon's first moves.
|
||||
# @param move [Integer, Symbol, String] ID of the move to remove
|
||||
def pbRemoveFirstMove(move)
|
||||
move = getID(PBMoves, move)
|
||||
@firstmoves.delete(move) if move > 0
|
||||
# @param move_id [Integer, Symbol, String] ID of the move to remove
|
||||
def pbRemoveFirstMove(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
@firstmoves.delete(move_data.id) if move_data
|
||||
end
|
||||
|
||||
# Clears this Pokémon's first moves.
|
||||
@@ -622,8 +599,8 @@ class Pokemon
|
||||
|
||||
# @param move [Integer, Symbol, String] ID of the move to check
|
||||
# @return [Boolean] whether the Pokémon is compatible with the given move
|
||||
def compatibleWithMove?(move)
|
||||
return pbSpeciesCompatible?(self.fSpecies, move)
|
||||
def compatibleWithMove?(move_id)
|
||||
return pbSpeciesCompatible?(self.fSpecies, move_id)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -830,9 +807,9 @@ class Pokemon
|
||||
def healPP(move_index = -1)
|
||||
return if egg?
|
||||
if move_index >= 0
|
||||
@moves[move_index].pp = @moves[move_index].totalpp
|
||||
@moves[move_index].pp = @moves[move_index].total_pp
|
||||
else
|
||||
@moves.each { |m| m.pp = m.totalpp }
|
||||
@moves.each { |m| m.pp = m.total_pp }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1107,12 +1084,6 @@ class Pokemon
|
||||
calcStats
|
||||
@hp = @totalhp
|
||||
@happiness = pbGetSpeciesData(@species, formSimple, SpeciesData::HAPPINESS)
|
||||
if withMoves
|
||||
self.resetMoves
|
||||
else
|
||||
for i in 0...4
|
||||
@moves[i] = PBMove.new(0)
|
||||
end
|
||||
end
|
||||
self.resetMoves if withMoves
|
||||
end
|
||||
end
|
||||
|
||||
@@ -270,48 +270,48 @@ MultipleForms.register(:CHERRIM,{
|
||||
})
|
||||
|
||||
MultipleForms.register(:ROTOM,{
|
||||
"onSetForm" => proc { |pkmn,form,oldForm|
|
||||
formMoves = [
|
||||
"onSetForm" => proc { |pkmn, form, oldForm|
|
||||
form_moves = [
|
||||
:OVERHEAT, # Heat, Microwave
|
||||
:HYDROPUMP, # Wash, Washing Machine
|
||||
:BLIZZARD, # Frost, Refrigerator
|
||||
:AIRSLASH, # Fan
|
||||
:LEAFSTORM # Mow, Lawnmower
|
||||
]
|
||||
idxMoveToReplace = -1
|
||||
pkmn.moves.each_with_index do |move,i|
|
||||
next if !move
|
||||
formMoves.each do |newMove|
|
||||
next if !isConst?(move.id,PBMoves,newMove)
|
||||
idxMoveToReplace = i
|
||||
break
|
||||
end
|
||||
break if idxMoveToReplace>=0
|
||||
move_index = -1
|
||||
pkmn.moves.each_with_index do |move, i|
|
||||
next if !form_moves.any? { |m| move == m }
|
||||
move_index = i
|
||||
break
|
||||
end
|
||||
if form==0
|
||||
if idxMoveToReplace>=0
|
||||
moveName = PBMoves.getName(pkmn.moves[idxMoveToReplace].id)
|
||||
pkmn.pbDeleteMoveAtIndex(idxMoveToReplace)
|
||||
pbMessage(_INTL("{1} forgot {2}...",pkmn.name,moveName))
|
||||
pkmn.pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves==0
|
||||
if form == 0
|
||||
# Turned back into the base form; forget form-specific moves
|
||||
if move_index >= 0
|
||||
move_name = pkmn.moves[move_index].name
|
||||
pkmn.pbDeleteMoveAtIndex(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, move_name))
|
||||
pkmn.pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves == 0
|
||||
end
|
||||
else
|
||||
newMove = getConst(PBMoves,formMoves[form-1])
|
||||
if idxMoveToReplace>=0
|
||||
oldMoveName = PBMoves.getName(pkmn.moves[idxMoveToReplace].id)
|
||||
if newMove && newMove>0
|
||||
newMoveName = PBMoves.getName(newMove)
|
||||
pkmn.moves[idxMoveToReplace].id = newMove
|
||||
# Turned into an alternate form; try learning that form's unique move
|
||||
new_move_id = form_moves[form - 1]
|
||||
if move_index >= 0
|
||||
# Knows another form's unique move; replace it
|
||||
old_move_name = pkmn.moves[move_index].name
|
||||
if GameData::Move.exists?(new_move_id)
|
||||
pkmn.moves[move_index].id = new_move_id
|
||||
new_move_name = pkmn.moves[move_index].name
|
||||
pbMessage(_INTL("1,\\wt[16] 2, and\\wt[16]...\\wt[16] ...\\wt[16] ... Ta-da!\\se[Battle ball drop]\1"))
|
||||
pbMessage(_INTL("{1} forgot how to use {2}.\\nAnd...\1",pkmn.name,oldMoveName))
|
||||
pbMessage(_INTL("\\se[]{1} learned {2}!\\se[Pkmn move learnt]",pkmn.name,newMoveName))
|
||||
pbMessage(_INTL("{1} forgot how to use {2}.\\nAnd...\1", pkmn.name, old_move_name))
|
||||
pbMessage(_INTL("\\se[]{1} learned {2}!\\se[Pkmn move learnt]", pkmn.name, new_move_name))
|
||||
else
|
||||
pkmn.pbDeleteMoveAtIndex(idxMoveToReplace)
|
||||
pbMessage(_INTL("{1} forgot {2}...",pkmn.name,oldMoveName))
|
||||
pkmn.pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves==0
|
||||
pkmn.pbDeleteMoveAtIndex(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, old_move_name))
|
||||
pkmn.pbLearnMove(:THUNDERSHOCK) if pkmn.numMoves == 0
|
||||
end
|
||||
elsif newMove && newMove>0
|
||||
pbLearnMove(pkmn,newMove,true)
|
||||
else
|
||||
# Just try to learn this form's unique move
|
||||
pbLearnMove(pkmn, new_move_id, true)
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -396,39 +396,26 @@ MultipleForms.register(:KYUREM,{
|
||||
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
|
||||
next pkmn.form-2 if pkmn.form>=3 # Fused forms stop glowing
|
||||
},
|
||||
"onSetForm" => proc { |pkmn,form,oldForm|
|
||||
"onSetForm" => proc { |pkmn, form, oldForm|
|
||||
case form
|
||||
when 0 # Normal
|
||||
pkmn.moves.each do |move|
|
||||
next if !move
|
||||
if (isConst?(move.id,PBMoves,:ICEBURN) ||
|
||||
isConst?(move.id,PBMoves,:FREEZESHOCK)) && hasConst?(PBMoves,:GLACIATE)
|
||||
move.id = getConst(PBMoves,:GLACIATE)
|
||||
if [:ICEBURN, :FREEZESHOCK].include?(move.id)
|
||||
move.id = :GLACIATE if GameData::Move.exists?(:GLACIATE)
|
||||
end
|
||||
if (isConst?(move.id,PBMoves,:FUSIONFLARE) ||
|
||||
isConst?(move.id,PBMoves,:FUSIONBOLT)) && hasConst?(PBMoves,:SCARYFACE)
|
||||
move.id = getConst(PBMoves,:SCARYFACE)
|
||||
if [:FUSIONFLARE, :FUSIONBOLT].include?(move.id)
|
||||
move.id = :SCARYFACE if GameData::Move.exists?(:SCARYFACE)
|
||||
end
|
||||
end
|
||||
when 1 # White
|
||||
pkmn.moves.each do |move|
|
||||
next if !move
|
||||
if isConst?(move.id,PBMoves,:GLACIATE) && hasConst?(PBMoves,:ICEBURN)
|
||||
move.id = getConst(PBMoves,:ICEBURN)
|
||||
end
|
||||
if isConst?(move.id,PBMoves,:SCARYFACE) && hasConst?(PBMoves,:FUSIONFLARE)
|
||||
move.id = getConst(PBMoves,:FUSIONFLARE)
|
||||
end
|
||||
move.id = :ICEBURN if move == :GLACIATE && GameData::Move.exists?(:ICEBURN)
|
||||
move.id = :FUSIONFLARE if move == :SCARYFACE && GameData::Move.exists?(:FUSIONFLARE)
|
||||
end
|
||||
when 2 # Black
|
||||
pkmn.moves.each do |move|
|
||||
next if !move
|
||||
if isConst?(move.id,PBMoves,:GLACIATE) && hasConst?(PBMoves,:FREEZESHOCK)
|
||||
move.id = getConst(PBMoves,:FREEZESHOCK)
|
||||
end
|
||||
if isConst?(move.id,PBMoves,:SCARYFACE) && hasConst?(PBMoves,:FUSIONBOLT)
|
||||
move.id = getConst(PBMoves,:FUSIONBOLT)
|
||||
end
|
||||
move.id = :FREEZESHOCK if move == :GLACIATE && GameData::Move.exists?(:FREEZESHOCK)
|
||||
move.id = :FUSIONBOLT if move == :SCARYFACE && GameData::Move.exists?(:FUSIONBOLT)
|
||||
end
|
||||
end
|
||||
}
|
||||
@@ -629,34 +616,30 @@ MultipleForms.register(:NECROZMA,{
|
||||
# Fused forms are 1 and 2, Ultra form is 3 or 4 depending on which fusion
|
||||
next pkmn.form-2 if pkmn.form>=3 && (pkmn.fainted? || endBattle)
|
||||
},
|
||||
"onSetForm" => proc { |pkmn,form,oldForm|
|
||||
next if form>2 || oldForm>2 # Ultra form changes don't affect moveset
|
||||
formMoves = [
|
||||
"onSetForm" => proc { |pkmn, form, oldForm|
|
||||
next if form > 2 || oldForm > 2 # Ultra form changes don't affect moveset
|
||||
form_moves = [
|
||||
:SUNSTEELSTRIKE, # Dusk Mane (with Solgaleo) (form 1)
|
||||
:MOONGEISTBEAM # Dawn Wings (with Lunala) (form 2)
|
||||
]
|
||||
if form==0
|
||||
idxMoveToReplace = -1
|
||||
pkmn.moves.each_with_index do |move,i|
|
||||
next if !move
|
||||
formMoves.each do |newMove|
|
||||
next if !isConst?(move.id,PBMoves,newMove)
|
||||
idxMoveToReplace = i
|
||||
break
|
||||
end
|
||||
break if idxMoveToReplace>=0
|
||||
if form == 0
|
||||
# Turned back into the base form; forget form-specific moves
|
||||
move_index = -1
|
||||
pkmn.moves.each_with_index do |move, i|
|
||||
next if !form_moves.any? { |m| move == m }
|
||||
move_index = i
|
||||
break
|
||||
end
|
||||
if idxMoveToReplace>=0
|
||||
moveName = PBMoves.getName(pkmn.moves[idxMoveToReplace].id)
|
||||
pkmn.pbDeleteMoveAtIndex(idxMoveToReplace)
|
||||
pbMessage(_INTL("{1} forgot {2}...",pkmn.name,moveName))
|
||||
pkmn.pbLearnMove(:CONFUSION) if pkmn.numMoves==0
|
||||
if move_index >= 0
|
||||
move_name = pkmn.moves[move_index].name
|
||||
pkmn.pbDeleteMoveAtIndex(move_index)
|
||||
pbMessage(_INTL("{1} forgot {2}...", pkmn.name, move_name))
|
||||
pkmn.pbLearnMove(:CONFUSION) if pkmn.numMoves == 0
|
||||
end
|
||||
else
|
||||
newMove = getConst(PBMoves,formMoves[form-1])
|
||||
if newMove && newMove>0
|
||||
pbLearnMove(pkmn,newMove,true)
|
||||
end
|
||||
# Turned into an alternate form; try learning that form's unique move
|
||||
new_move_id = form_moves[form - 1]
|
||||
pbLearnMove(pkmn, new_move_id, true)
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
@@ -16,8 +16,8 @@ class Pokemon
|
||||
ret = i; break
|
||||
end
|
||||
if !checkItemOnly
|
||||
megaMove = speciesData[fSpec][SpeciesData::MEGA_MOVE] || 0
|
||||
if megaMove>0 && self.hasMove?(megaMove)
|
||||
megaMove = speciesData[fSpec][SpeciesData::MEGA_MOVE]
|
||||
if self.hasMove?(megaMove)
|
||||
ret = i; break
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,13 +22,12 @@ def pbPurify(pokemon,scene)
|
||||
pokemon.shadow = false
|
||||
pokemon.giveRibbon(PBRibbons::NATIONAL)
|
||||
scene.pbDisplay(_INTL("{1} opened the door to its heart!",pokemon.name))
|
||||
oldmoves = []
|
||||
for i in 0...4; oldmoves.push(pokemon.moves[i].id); end
|
||||
old_moves = []
|
||||
pokemon.moves.each { |m| old_moves.push(m.id) }
|
||||
pokemon.pbUpdateShadowMoves
|
||||
for i in 0...4
|
||||
next if pokemon.moves[i].id<=0 || pokemon.moves[i].id==oldmoves[i]
|
||||
scene.pbDisplay(_INTL("{1} regained the move \n{2}!",
|
||||
pokemon.name,PBMoves.getName(pokemon.moves[i].id)))
|
||||
pokemon.moves.each_with_index do |m, i|
|
||||
next if m == old_moves[i]
|
||||
scene.pbDisplay(_INTL("{1} regained the move {2}!", pokemon.name, m.name))
|
||||
end
|
||||
pokemon.pbRecordFirstMoves
|
||||
if pokemon.savedev
|
||||
@@ -75,31 +74,23 @@ def pbApplyEVGain(pokemon,ev,evgain)
|
||||
end
|
||||
end
|
||||
|
||||
def pbReplaceMoves(pokemon,move1,move2=0,move3=0,move4=0)
|
||||
return if !pokemon
|
||||
[move1,move2,move3,move4].each { |move|
|
||||
moveIndex = -1
|
||||
if move!=0
|
||||
# Look for given move
|
||||
for i in 0...4
|
||||
moveIndex = i if pokemon.moves[i].id==move
|
||||
def pbReplaceMoves(pkmn, new_moves)
|
||||
return if !pkmn
|
||||
new_moves.each do |move|
|
||||
next if !move || pkmn.hasMove?(move)
|
||||
# Find a move slot to put move into
|
||||
for i in 0...Pokemon::MAX_MOVES
|
||||
if i >= pkmn.numMoves
|
||||
# Empty slot; add the new move there
|
||||
pkmn.pbLearnMove(move)
|
||||
break
|
||||
elsif !new_moves.include?(pkmn.moves[i].id)
|
||||
# Known move that isn't a move to be relearned; replace it
|
||||
pkmn.moves[i].id = move
|
||||
break
|
||||
end
|
||||
end
|
||||
if moveIndex==-1
|
||||
# Look for slot to replace move
|
||||
for i in 0...4
|
||||
if (pokemon.moves[i].id==0 && move!=0) || (
|
||||
pokemon.moves[i].id!=move1 &&
|
||||
pokemon.moves[i].id!=move2 &&
|
||||
pokemon.moves[i].id!=move3 &&
|
||||
pokemon.moves[i].id!=move4)
|
||||
# Replace move
|
||||
pokemon.moves[i] = PBMove.new(move)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -288,47 +279,57 @@ class Pokemon
|
||||
self.heartgauge = HEARTGAUGESIZE
|
||||
self.savedexp = 0
|
||||
self.savedev = [0,0,0,0,0,0]
|
||||
self.shadowmoves = [0,0,0,0,0,0,0,0]
|
||||
# Retrieve shadow moves
|
||||
moves = pbLoadShadowMovesets
|
||||
if moves[self.species] && moves[self.species].length>0
|
||||
for i in 0...[4,moves[self.species].length].min
|
||||
self.shadowmoves[i] = moves[self.species][i]
|
||||
self.shadowmoves = []
|
||||
# Retrieve Shadow moveset for this Pokémon
|
||||
shadow_moveset = pbLoadShadowMovesets[self.fSpecies]
|
||||
shadow_moveset = pbLoadShadowMovesets[self.species] if !shadow_moveset || shadow_moveset.length == 0
|
||||
# Record this Pokémon's Shadow moves
|
||||
if shadow_moveset && shadow_moveset.length > 0
|
||||
for i in 0...[shadow_moveset.length, MAX_MOVES].min
|
||||
self.shadowmoves[i] = shadow_moveset[i]
|
||||
end
|
||||
self.shadowmovenum = moves[self.species].length
|
||||
self.shadowmovenum = shadow_moveset.length
|
||||
else
|
||||
# No special shadow moves
|
||||
self.shadowmoves[0] = getConst(PBMoves,:SHADOWRUSH) || 0
|
||||
# No Shadow moveset defined; just use Shadow Rush
|
||||
self.shadowmoves[0] = :SHADOWRUSH if GameData::Move.exists?(:SHADOWRUSH)
|
||||
self.shadowmovenum = 1
|
||||
end
|
||||
for i in 0...4 # Save old moves
|
||||
self.shadowmoves[4+i] = self.moves[i].id
|
||||
end
|
||||
# Record this Pokémon's original moves
|
||||
@moves.each_with_index { |m, i| self.shadowmoves[MAX_MOVES + i] = m.id }
|
||||
# Update moves
|
||||
pbUpdateShadowMoves
|
||||
end
|
||||
|
||||
def pbUpdateShadowMoves(allmoves=false)
|
||||
def pbUpdateShadowMoves(relearn_all_moves = false)
|
||||
return if !@shadowmoves
|
||||
m = @shadowmoves
|
||||
# Not a Shadow Pokémon (any more); relearn all its original moves
|
||||
if !@shadow
|
||||
# No shadow moves
|
||||
pbReplaceMoves(self,m[4],m[5],m[6],m[7])
|
||||
@shadowmoves = nil
|
||||
else
|
||||
moves = []
|
||||
relearning = (allmoves) ? 3 : [3,3,2,1,1,0][self.heartStage]
|
||||
relearned = 0
|
||||
# Add all Shadow moves
|
||||
for i in 0...4; moves.push(m[i]) if m[i]!=0; end
|
||||
# Add X regular moves
|
||||
for i in 0...4
|
||||
next if i<@shadowmovenum
|
||||
if m[i+4]!=0 && relearned<relearning
|
||||
moves.push(m[i+4]); relearned += 1
|
||||
end
|
||||
if @shadowmoves.length > MAX_MOVES
|
||||
new_moves = []
|
||||
@shadowmoves.each_with_index { |m, i| new_moves.push(m) if m && i >= MAX_MOVES }
|
||||
pbReplaceMoves(self, new_moves)
|
||||
end
|
||||
pbReplaceMoves(self,moves[0] || 0,moves[1] || 0,moves[2] || 0,moves[3] || 0)
|
||||
@shadowmoves = nil
|
||||
return
|
||||
end
|
||||
# Is a Shadow Pokémon; ensure it knows the appropriate moves depending on its heart stage
|
||||
m = @shadowmoves
|
||||
# Start with all Shadow moves
|
||||
new_moves = []
|
||||
@shadowmoves.each_with_index { |m, i| new_moves.push(m) if m && i < MAX_MOVES }
|
||||
# Add some original moves (skipping ones in the same slot as a Shadow Move)
|
||||
num_original_moves = (relearn_all_moves) ? 3 : [3, 3, 2, 1, 1, 0][self.heartStage]
|
||||
if num_original_moves > 0
|
||||
relearned_count = 0
|
||||
@shadowmoves.each_with_index do |m, i|
|
||||
next if !m || i < MAX_MOVES + @shadowmovenum
|
||||
new_moves.push(m)
|
||||
relearned_count += 1
|
||||
break if relearned_count >= num_original_moves
|
||||
end
|
||||
end
|
||||
# Relearn Shadow moves plus some original moves (may not change anything)
|
||||
pbReplaceMoves(self, new_moves)
|
||||
end
|
||||
|
||||
alias :__shadow_clone :clone
|
||||
|
||||
@@ -493,7 +493,7 @@ PBEvolution.register(:HappinessNight, {
|
||||
|
||||
PBEvolution.register(:HappinessMove, {
|
||||
"minimumLevel" => 1, # Needs any level up
|
||||
"parameterType" => :PBMoves,
|
||||
"parameterType" => :Move,
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
if pkmn.happiness >= 220
|
||||
next pkmn.moves.any? { |m| m && m.id == parameter }
|
||||
@@ -619,7 +619,7 @@ PBEvolution.register(:HoldItemHappiness, {
|
||||
|
||||
PBEvolution.register(:HasMove, {
|
||||
"minimumLevel" => 1, # Needs any level up
|
||||
"parameterType" => :PBMoves,
|
||||
"parameterType" => :Move,
|
||||
"levelUpCheck" => proc { |pkmn, parameter|
|
||||
next pkmn.moves.any? { |m| m && m.id == parameter }
|
||||
}
|
||||
|
||||
@@ -4,75 +4,75 @@
|
||||
#===============================================================================
|
||||
|
||||
# @deprecated Use {Pokemon} instead. PokeBattle_Pokemon has been turned into an alias
|
||||
# and is slated to be removed in vXX.
|
||||
# and is slated to be removed in v20.
|
||||
class PokeBattle_Pokemon; end
|
||||
|
||||
PokeBattle_Pokemon = Pokemon
|
||||
|
||||
class Pokemon
|
||||
# @deprecated Use {MAX_NAME_SIZE} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {MAX_NAME_SIZE} instead. This alias is slated to be removed in v20.
|
||||
MAX_POKEMON_NAME_SIZE = MAX_NAME_SIZE
|
||||
|
||||
# @deprecated Use {Owner#public_id} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#public_id} instead. This alias is slated to be removed in v20.
|
||||
def publicID
|
||||
Deprecation.warn_method('Pokemon#publicID', 'vXX', 'Pokemon::Owner#public_id')
|
||||
Deprecation.warn_method('Pokemon#publicID', 'v20', 'Pokemon::Owner#public_id')
|
||||
return @owner.public_id
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#id} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#id} instead. This alias is slated to be removed in v20.
|
||||
def trainerID
|
||||
Deprecation.warn_method('Pokemon#trainerID', 'vXX', 'Pokemon::Owner#id')
|
||||
Deprecation.warn_method('Pokemon#trainerID', 'v20', 'Pokemon::Owner#id')
|
||||
return @owner.id
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#id=} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#id=} instead. This alias is slated to be removed in v20.
|
||||
def trainerID=(value)
|
||||
Deprecation.warn_method('Pokemon#trainerID=', 'vXX', 'Pokemon::Owner#id=')
|
||||
Deprecation.warn_method('Pokemon#trainerID=', 'v20', 'Pokemon::Owner#id=')
|
||||
@owner.id = value
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#name} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#name} instead. This alias is slated to be removed in v20.
|
||||
def ot
|
||||
Deprecation.warn_method('Pokemon#ot', 'vXX', 'Pokemon::Owner#name')
|
||||
Deprecation.warn_method('Pokemon#ot', 'v20', 'Pokemon::Owner#name')
|
||||
return @owner.name
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#name=} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#name=} instead. This alias is slated to be removed in v20.
|
||||
def ot=(value)
|
||||
Deprecation.warn_method('Pokemon#ot=', 'vXX', 'Pokemon::Owner#name=')
|
||||
Deprecation.warn_method('Pokemon#ot=', 'v20', 'Pokemon::Owner#name=')
|
||||
@owner.name = value
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#gender} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#gender} instead. This alias is slated to be removed in v20.
|
||||
def otgender
|
||||
Deprecation.warn_method('Pokemon#otgender', 'vXX', 'Pokemon::Owner#gender')
|
||||
Deprecation.warn_method('Pokemon#otgender', 'v20', 'Pokemon::Owner#gender')
|
||||
return @owner.gender
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#gender=} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#gender=} instead. This alias is slated to be removed in v20.
|
||||
def otgender=(value)
|
||||
Deprecation.warn_method('Pokemon#otgender=', 'vXX', 'Pokemon::Owner#gender=')
|
||||
Deprecation.warn_method('Pokemon#otgender=', 'v20', 'Pokemon::Owner#gender=')
|
||||
@owner.gender = value
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#language} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#language} instead. This alias is slated to be removed in v20.
|
||||
def language
|
||||
Deprecation.warn_method('Pokemon#language', 'vXX', 'Pokemon::Owner#language')
|
||||
Deprecation.warn_method('Pokemon#language', 'v20', 'Pokemon::Owner#language')
|
||||
return @owner.language
|
||||
end
|
||||
|
||||
# @deprecated Use {Owner#language=} instead. This alias is slated to be removed in vXX.
|
||||
# @deprecated Use {Owner#language=} instead. This alias is slated to be removed in v20.
|
||||
def language=(value)
|
||||
Deprecation.warn_method('Pokemon#language=', 'vXX', 'Pokemon::Owner#language=')
|
||||
Deprecation.warn_method('Pokemon#language=', 'v20', 'Pokemon::Owner#language=')
|
||||
@owner.language = value
|
||||
end
|
||||
end
|
||||
|
||||
# (see Pokemon#initialize)
|
||||
# @deprecated Use +Pokemon.new+ instead. This method and its aliases are
|
||||
# slated to be removed in vXX.
|
||||
# slated to be removed in v20.
|
||||
def pbNewPkmn(species, level, owner = $Trainer, withMoves = true)
|
||||
Deprecation.warn_method('pbNewPkmn', 'vXX', 'Pokemon.new')
|
||||
Deprecation.warn_method('pbNewPkmn', 'v20', 'Pokemon.new')
|
||||
return Pokemon.new(species, level, owner, withMoves)
|
||||
end
|
||||
alias pbGenPkmn pbNewPkmn
|
||||
|
||||
Reference in New Issue
Block a user