Added the ability for statuses to have data (like duration) and the sleep and toxic status effects

This commit is contained in:
James Daly
2019-06-02 22:46:32 -04:00
parent 40553d36b9
commit 34cd67c36f
7 changed files with 127 additions and 56 deletions

View File

@@ -58,7 +58,7 @@ abstract class Move extends MoveTurn {
val target: Target
val boosts: Map[Stat, Int]
val crit: Int
val status: Status
val status: StatusTemplate
val drain: Fraction
val selfEffect: Secondary
val secondary: Secondary
@@ -152,17 +152,18 @@ abstract class Move extends MoveTurn {
}
}
def applyEffect(target: Monster, effect: Secondary) {
def applyEffect(target: Monster, effect: Secondary)(implicit rng: Random) {
applyBoosts(target, effect.boosts)
applyStatus(target, effect.status)
}
def applyStatus(target: Monster, status: Status) {
def applyStatus(target: Monster, status: StatusTemplate)(implicit rng: Random) {
if (target.isAlive && status != null) {
if (target.status == None) {
// apply status
target.status = Some(status)
status.onStart(target)
val s = status.build
target.status = Some(s)
s.onStart(target)
} else {
println("But it failed!")
}