General tidying up

This commit is contained in:
Maruno17
2020-12-28 15:46:08 +00:00
parent d3d7222fd3
commit fb29c6b760
44 changed files with 1822 additions and 2650 deletions

View File

@@ -1,30 +1,6 @@
# Unused
def pbHasRelearnableMove?(pokemon)
return pbGetRelearnableMoves(pokemon).length>0
end
def pbGetRelearnableMoves(pokemon)
return [] if !pokemon || pokemon.egg? || pokemon.shadowPokemon?
moves=[]
pokemon.getMoveList.each do |m|
next if m[0] > pokemon.level || pokemon.hasMove?(m[1])
moves.push(m[1]) if !moves.include?(m[1])
end
tmoves=[]
if pokemon.firstmoves
for i in pokemon.firstmoves
tmoves.push(i) if !pokemon.hasMove?(i) && !moves.include?(i)
end
end
moves=tmoves+moves
return moves|[] # remove duplicates
end
################################################################################
#===============================================================================
# Scene class for handling appearance of the screen
################################################################################
#===============================================================================
class MoveRelearner_Scene
VISIBLEMOVES = 4
@@ -168,27 +144,44 @@ class MoveRelearner_Scene
end
end
#===============================================================================
# Screen class for handling game logic
#===============================================================================
class MoveRelearnerScreen
def initialize(scene)
@scene = scene
end
def pbStartScreen(pokemon)
moves=pbGetRelearnableMoves(pokemon)
@scene.pbStartScene(pokemon,moves)
def pbGetRelearnableMoves(pkmn)
return [] if !pkmn || pkmn.egg? || pkmn.shadowPokemon?
moves = []
pkmn.getMoveList.each do |m|
next if m[0] > pkmn.level || pkmn.hasMove?(m[1])
moves.push(m[1]) if !moves.include?(m[1])
end
tmoves = []
if pkmn.firstmoves
for i in pkmn.firstmoves
tmoves.push(i) if !pkmn.hasMove?(i) && !moves.include?(i)
end
end
moves = tmoves + moves
return moves | [] # remove duplicates
end
def pbStartScreen(pkmn)
moves = pbGetRelearnableMoves(pkmn)
@scene.pbStartScene(pkmn, moves)
loop do
move=@scene.pbChooseMove
move = @scene.pbChooseMove
if move
if @scene.pbConfirm(_INTL("Teach {1}?",GameData::Move.get(move).name))
if pbLearnMove(pokemon,move)
if @scene.pbConfirm(_INTL("Teach {1}?", GameData::Move.get(move).name))
if pbLearnMove(pkmn, move)
@scene.pbEndScene
return true
end
end
elsif @scene.pbConfirm(_INTL("Give up trying to teach a new move to {1}?",pokemon.name))
elsif @scene.pbConfirm(_INTL("Give up trying to teach a new move to {1}?", pkmn.name))
@scene.pbEndScene
return false
end
@@ -196,14 +189,15 @@ class MoveRelearnerScreen
end
end
def pbRelearnMoveScreen(pokemon)
#===============================================================================
#
#===============================================================================
def pbRelearnMoveScreen(pkmn)
retval = true
pbFadeOutIn {
scene = MoveRelearner_Scene.new
screen = MoveRelearnerScreen.new(scene)
retval = screen.pbStartScreen(pokemon)
retval = screen.pbStartScreen(pkmn)
}
return retval
end