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

@@ -79,6 +79,7 @@ def pbSetUpSystem
consts = [] if !consts
GameData::Ability.load
GameData::Item.load
GameData::Move.load
GameData::BerryPlant.load
GameData::Metadata.load
GameData::MapMetadata.load

View File

@@ -270,7 +270,7 @@ def pbItemIconFile(item)
bitmapFileName = sprintf("Graphics/Icons/item%03d",itm.id_number)
if !pbResolveBitmap(bitmapFileName) && itm.is_machine?
move = itm.move
type = pbGetMoveData(move,MoveData::TYPE)
type = GameData::Move.get(move).type
bitmapFileName = sprintf("Graphics/Icons/itemMachine%s",getConstantName(PBTypes,type)) rescue nil
if !pbResolveBitmap(bitmapFileName)
bitmapFileName = sprintf("Graphics/Icons/itemMachine%03d",type)

View File

@@ -368,12 +368,8 @@ end
# Checks whether any Pokémon in the party knows the given move, and returns
# the first Pokémon it finds with that move, or nil if no Pokémon has that move.
def pbCheckMove(move)
move = getID(PBMoves,move)
return nil if !move || move<=0
for i in $Trainer.pokemonParty
for j in i.moves
return i if j.id==move
end
$Trainer.pokemonParty.each do |pkmn|
return pkmn if pkmn.hasMove?(move)
end
return nil
end

View File

@@ -982,28 +982,24 @@ def pbTextEntry(helptext,minlength,maxlength,variableNumber)
$game_map.need_refresh = true if $game_map
end
def pbMoveTutorAnnotations(move,movelist=nil)
def pbMoveTutorAnnotations(move, movelist = nil)
ret = []
for i in 0...6
ret[i] = nil
next if i>=$Trainer.party.length
found = false
for j in 0...4
if !$Trainer.party[i].egg? && $Trainer.party[i].moves[j].id==move
ret[i] = _INTL("LEARNED")
found = true
end
end
next if found
species = $Trainer.party[i].species
if !$Trainer.party[i].egg? && movelist && movelist.any? { |j| j==species }
# Checked data from movelist
ret[i] = _INTL("ABLE")
elsif !$Trainer.party[i].egg? && $Trainer.party[i].compatibleWithMove?(move)
# Checked data from PBS/tm.txt
ret[i] = _INTL("ABLE")
else
$Trainer.party.each_with_index do |pkmn, i|
if pkmn.egg?
ret[i] = _INTL("NOT ABLE")
elsif pkmn.hasMove?(move)
ret[i] = _INTL("LEARNED")
else
species = pkmn.species
if movelist && movelist.any? { |j| j == species }
# Checked data from movelist given in parameter
ret[i] = _INTL("ABLE")
elsif pkmn.compatibleWithMove?(move)
# Checked data from PBS/tm.txt
ret[i] = _INTL("ABLE")
else
ret[i] = _INTL("NOT ABLE")
end
end
end
return ret
@@ -1011,14 +1007,14 @@ end
def pbMoveTutorChoose(move,movelist=nil,bymachine=false)
ret = false
move = getID(PBMoves,move)
move = GameData::Move.get(move).id
if movelist!=nil && movelist.is_a?(Array)
for i in 0...movelist.length
movelist[i] = getID(PBSpecies,movelist[i])
movelist[i] = GameData::Move.get(movelist[i]).id
end
end
pbFadeOutIn {
movename = PBMoves.getName(move)
movename = GameData::Move.get(move).name
annot = pbMoveTutorAnnotations(move,movelist)
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene,$Trainer.party)
@@ -1053,11 +1049,11 @@ def pbChooseMove(pokemon,variableNumber,nameVarNumber)
pbFadeOutIn {
scene = PokemonSummary_Scene.new
screen = PokemonSummaryScreen.new(scene)
ret = screen.pbStartForgetScreen([pokemon],0,0)
ret = screen.pbStartForgetScreen([pokemon],0,nil)
}
$game_variables[variableNumber] = ret
if ret>=0
$game_variables[nameVarNumber] = PBMoves.getName(pokemon.moves[ret].id)
$game_variables[nameVarNumber] = pokemon.moves[ret].name
else
$game_variables[nameVarNumber] = ""
end