Made it so crits ignore defense boosts and elements use enumerations for type effectiveness
This commit is contained in:
@@ -21,8 +21,9 @@ import org.yaml.snakeyaml.nodes.Tag
|
||||
import org.yaml.snakeyaml.constructor._
|
||||
import org.yaml.snakeyaml.representer._
|
||||
|
||||
import fmon.stat.Element
|
||||
import fmon.stat.{Effectiveness, Element}
|
||||
import fmon.util.YamlHelper
|
||||
import Effectiveness._
|
||||
|
||||
import TableColumn._
|
||||
|
||||
@@ -37,10 +38,10 @@ class ObsElement(name_ : String, bgColor_ : Color = Color.Gray, fontColor_ : Col
|
||||
val weak = new ObservableBuffer[ObsElement]()
|
||||
|
||||
def asElement = {
|
||||
def toMap(buffer: ObservableBuffer[ObsElement], mult: Double) = {
|
||||
def toMap(buffer: ObservableBuffer[ObsElement], mult: Effectiveness) = {
|
||||
buffer.map(e => (e.name(), mult)).toMap
|
||||
}
|
||||
val effect = toMap(immune, 0.0) ++ toMap(resist, 0.5) ++ toMap(normal, 1.0) ++ toMap(weak, 2.0)
|
||||
val effect = toMap(immune, Immune) ++ toMap(resist, Resist) ++ toMap(normal, Regular) ++ toMap(weak, Weak)
|
||||
new Element(name(), bgColor(), fontColor(), effect)
|
||||
}
|
||||
|
||||
@@ -184,15 +185,12 @@ class ElementBuilder extends Savable {
|
||||
es.foreach(eo => es.foreach(fo => {
|
||||
val e = elementMap(eo.name())
|
||||
val f = elementMap(fo.name())
|
||||
val mult = e <-- f
|
||||
if (mult < 0.1) {
|
||||
eo.immune += fo
|
||||
} else if (mult < 0.75) {
|
||||
eo.resist += fo
|
||||
} else if (mult < 1.25) {
|
||||
eo.normal += fo
|
||||
} else {
|
||||
eo.weak += fo
|
||||
e.effect.getOrElse(f.name, Regular) match {
|
||||
case Immune => eo.immune += fo
|
||||
case Resist => eo.resist += fo
|
||||
case Regular => eo.normal += fo
|
||||
case Weak => eo.weak += fo
|
||||
case _ => throw new IllegalArgumentException
|
||||
}
|
||||
}))
|
||||
elementList.clear()
|
||||
|
||||
Reference in New Issue
Block a user