fakemon/FakeMon/src/fmon/stat/Element.scala

22 lines
553 B
Scala

package fmon.stat
import scala.io.Source
import scalafx.scene.paint.Color
import fmon.util.YamlHelper
case class Element(val name : String, val bgColor: Color, val fontColor: Color, val effect : Map[String, Double]) {
def -->(other : Element) = other <-- this
def <--(other : Element) = effect.getOrElse(other.name, 1.0)
override def toString = name
}
object Element {
private val elements = YamlHelper.extractMap[Element](Element.getClass.getResourceAsStream("data/elements.yaml"))
def apply(name : String) = elements(name)
}