Skip to content
Snippets Groups Projects
Verified Commit af41a2df authored by v-lafeychine's avatar v-lafeychine
Browse files

Update backend Pokemon

parent 5e2e7266
No related branches found
No related tags found
1 merge request!22Resolve "Refactor: GameEngine"
import Engine.Game
import Scene.Battle.{Battle, BattleScene}
import Pokemon.{PokemonFactory, Trainer}
val trainer = Trainer("", List(PokemonFactory("Bulbasaur"), PokemonFactory("Squirtle")), 0)
val trainerEnemy = Trainer("", List(PokemonFactory("Charmander")), 0)
class PokemonGame() extends Game(Scene.Battle.BattleScene(trainer, trainerEnemy))
class PokemonGame() extends Game(BattleScene(Battle(trainer, trainerEnemy)));
......@@ -5,8 +5,8 @@ class Trainer(val name: String, var listPokemon: List[Pokemon], var indexPrimary
def numberPokemon: Int =
this.listPokemon.length
def primaryPokemon: Option[Pokemon] =
this.listPokemon.lift(this.indexPrimaryPokemon)
def primaryPokemon: Pokemon =
this.listPokemon.lift(this.indexPrimaryPokemon).get
def changePrimaryPokemon(index: Int): Unit =
assert(0 <= index && index < this.numberPokemon, "This Pokemon doesn't exists.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment