package fmon.stat import com.fasterxml.jackson.module.scala.JsonScalaEnumeration import scala.io.Source import scalafx.scene.paint.Color import fmon._ import fmon.util._ object Effectiveness extends Enumeration { case class Val protected(val mult: Double) extends super.Val val Immune = Val(Config.immuneMult) val Resist = Val(Config.resistMult) val Regular = Val(1.0) val Weak = Val(Config.weakMult) } class EffectivenessType extends TypeReference[Effectiveness.type] case class Element(val name : String, val bgColor: Color, val fontColor: Color, @JsonScalaEnumeration(classOf[EffectivenessType]) val effect : Map[String, Effectiveness]) { def -->(other : Element) = other <-- this def <--(other : Element) = effect.getOrElse(other.name, Effectiveness.Regular).mult override def toString = name } object Element { private val elements = YamlHelper.extractMap[Element](Element.getClass.getResourceAsStream("data/elements.yaml")) def apply(name : String) = elements(name) }