Rewrote party screen, implemented redesign of it

This commit is contained in:
Maruno17
2024-09-07 21:51:54 +01:00
parent fab5fc0641
commit 2190f7c251
26 changed files with 2236 additions and 562 deletions

View File

@@ -445,39 +445,35 @@ def pbMoveTutorAnnotations(move, movelist = nil)
return ret
end
def pbMoveTutorChoose(move, movelist = nil, bymachine = false, oneusemachine = false)
def pbMoveTutorChoose(move, movelist = nil, by_machine = false, one_use_machine = false)
ret = false
move = GameData::Move.get(move).id
if movelist.is_a?(Array)
movelist.map! { |m| GameData::Move.get(m).id }
end
pbFadeOutIn do
movename = GameData::Move.get(move).name
move_name = GameData::Move.get(move).name
screen = UI::Party.new($player.party, mode: :teach_pokemon)
annot = pbMoveTutorAnnotations(move, movelist)
scene = PokemonParty_Scene.new
screen = PokemonPartyScreen.new(scene, $player.party)
screen.pbStartScene(_INTL("Teach which Pokémon?"), false, annot)
loop do
chosen = screen.pbChoosePokemon
break if chosen < 0
pokemon = $player.party[chosen]
if pokemon.egg?
pbMessage(_INTL("Eggs can't be taught any moves.")) { screen.pbUpdate }
elsif pokemon.shadowPokemon?
pbMessage(_INTL("Shadow Pokémon can't be taught any moves.")) { screen.pbUpdate }
elsif movelist && movelist.none? { |j| j == pokemon.species }
pbMessage(_INTL("{1} can't learn {2}.", pokemon.name, movename)) { screen.pbUpdate }
elsif !pokemon.compatible_with_move?(move)
pbMessage(_INTL("{1} can't learn {2}.", pokemon.name, movename)) { screen.pbUpdate }
elsif pbLearnMove(pokemon, move, false, bymachine) { screen.pbUpdate }
$stats.moves_taught_by_item += 1 if bymachine
$stats.moves_taught_by_tutor += 1 if !bymachine
pokemon.add_first_move(move) if oneusemachine
ret = true
break
screen.set_annotations(annot)
screen.choose_pokemon do |pkmn, party_index|
next true if party_index < 0
if pkmn.egg?
screen.show_message(_INTL("Eggs can't be taught any moves."))
elsif pkmn.shadowPokemon?
screen.show_message(_INTL("Shadow Pokémon can't be taught any moves."))
elsif movelist && movelist.none? { |j| j == pkmn.species }
screen.show_message(_INTL("{1} can't learn {2}.", pkmn.name, move_name))
elsif !pkmn.compatible_with_move?(move)
screen.show_message(_INTL("{1} can't learn {2}.", pkmn.name, move_name))
elsif pbLearnMove(pkmn, move, false, by_machine, screen) { screen.update }
$stats.moves_taught_by_item += 1 if by_machine
$stats.moves_taught_by_tutor += 1 if !by_machine
pkmn.add_first_move(move) if one_use_machine
next true
end
next false
end
screen.pbEndScene
end
return ret # Returns whether the move was learned by a Pokemon
end