Incorporated a UI

This commit is contained in:
James Daly
2019-06-12 22:11:34 -04:00
parent 273a79c9c6
commit 2805bbf1c7
11 changed files with 299 additions and 7 deletions

View File

@@ -1,19 +1,20 @@
package fmon
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import javafx.application.Application
import javafx.fxml._
import javafx.scene.{Scene, Parent}
import javafx.stage.Stage
import scala.reflect.runtime.universe._
import scala.tools.reflect.ToolBox
import scalafx.Includes._
import fmon.battle.BattleEngine
import fmon.battle.{BattleEngine, BattleUI}
import fmon.stat._
case class Prop(url : Seq[String])
object Game {
def main(args : Array[String]): Unit = {
/*
implicit val rng = new scala.util.Random()
val form1 = Form("Diabolo")
val form2 = Form("Chanilla")
@@ -29,5 +30,36 @@ object Game {
val engine = new BattleEngine(party1, party2)
engine.play()
println(party1.lead.elements)
* */
Application.launch(classOf[Game], args: _*)
}
}
class Game extends Application {
override def start(primaryStage: Stage): Unit = {
val url = getClass.getResource("battle/battle.fxml")
val loader = new FXMLLoader(url)
val root: Parent = loader.load()
val controller = loader.getController[BattleUI]()
val scene: Scene = new Scene(root)
implicit val rng = new scala.util.Random()
val form1 = Form("Diabolo")
val form2 = Form("Chanilla")
val movepool1 = IndexedSeq(Move("eruption"), Move("willowisp"), Move("thunderbolt"), Move("thunderwave"))
val movepool2 = IndexedSeq(Move("flail"))
val p1 = TrainerID("Jaeda", Gender.Female, 0)
val p2 = TrainerID("Wild Monster", Gender.Male, 0)
val party1 = new Party(p1, new MonsterPtr(Monster.generate("Allied Mon", p1, 500, form1, movepool1)), IndexedSeq())
val party2 = new Party(p2, new MonsterPtr(Monster.generate("Wild Mon", p2, 500, form2, movepool2)), IndexedSeq(
Monster.generate("Sideboard Mon", p2, 500, form2, movepool2)
))
println(form1.xpCurve)
val engine = new BattleEngine(party1, party2)
controller.setEngine(engine)
primaryStage.setTitle("FakeMon Battle Simulator")
primaryStage.setScene(scene)
primaryStage.show()
}
}