diff --git a/core/src/me/msoucy/ptures/model/Engine.kt b/core/src/me/msoucy/ptures/model/Engine.kt index 729d0c7..4bc9feb 100644 --- a/core/src/me/msoucy/ptures/model/Engine.kt +++ b/core/src/me/msoucy/ptures/model/Engine.kt @@ -1,5 +1,7 @@ package me.msoucy.ptures.model +import me.msoucy.ptures.view.BattleView + class Engine(private vararg val creatures : Pair) { init { assert(creatures.isNotEmpty()) @@ -11,21 +13,31 @@ class Engine(private vararg val creatures : Pair) { return creatures[currentCreature].first } + val forcedSkills = mutableMapOf() + val activeCreatures get() = creatures.withIndex() .filter { (_, c) -> !c.first.hasStatus() } .sortedBy { (_, c) -> c.first.spd } .map { (i, _) -> i} - fun resolveTurn() { + fun resolveTurn(view : BattleView) { + forcedSkills.clear() // All preconditions for (i in activeCreatures) { val creature = creatures[i] for (status in creature.first.statuses) { - status.onTurnStart(this) + status.onTurnStart(this, creature.first) } } // Get the moves each creature will use this turn - val moves = activeCreatures.map { i -> Pair(Ignore, nextOpponent(i)) } + val moves = activeCreatures.map { i -> + if (creatures[i].first in forcedSkills) { + Pair(forcedSkills[creatures[i].first], nextOpponent(i)) + } else { + TODO("Fill in view here") + } + } + // Resolve each move for (i in activeCreatures) { // Resolve move val (skill, target) = moves[i] diff --git a/core/src/me/msoucy/ptures/model/Status.kt b/core/src/me/msoucy/ptures/model/Status.kt index 82d34c2..f93cf15 100644 --- a/core/src/me/msoucy/ptures/model/Status.kt +++ b/core/src/me/msoucy/ptures/model/Status.kt @@ -2,7 +2,7 @@ package me.msoucy.ptures.model sealed class Status { - open fun onTurnStart(engine : Engine) { + open fun onTurnStart(engine : Engine, creature : Creature) { // Do nothing } diff --git a/core/src/me/msoucy/ptures/view/TextView.kt b/core/src/me/msoucy/ptures/view/TextView.kt index a67677b..e3bbccb 100644 --- a/core/src/me/msoucy/ptures/view/TextView.kt +++ b/core/src/me/msoucy/ptures/view/TextView.kt @@ -2,7 +2,6 @@ package me.msoucy.ptures.view import me.msoucy.ptures.model.Creature import me.msoucy.ptures.model.Skill -import me.msoucy.ptures.model.Skills import me.msoucy.ptures.model.VisibleStatus class SkillViewText(val skill : Skill) : SkillView() { diff --git a/core/src/me/msoucy/ptures/view/ViewBase.kt b/core/src/me/msoucy/ptures/view/ViewBase.kt index d4bb977..70d8219 100644 --- a/core/src/me/msoucy/ptures/view/ViewBase.kt +++ b/core/src/me/msoucy/ptures/view/ViewBase.kt @@ -2,16 +2,20 @@ package me.msoucy.ptures.view import me.msoucy.ptures.model.Skill -abstract class SkillView { - abstract fun display() - abstract fun displayEnumerated(idx : Int) +interface SkillView { + fun display() + fun displayEnumerated(idx : Int) } -abstract class CreatureView { +interface CreatureView { - abstract val skillChoice : Skill + val skillChoice : Skill - abstract fun displayName() - abstract fun displaySkills() - abstract fun displayStatuses() + fun displayName() + fun displaySkills() + fun displayStatuses() +} + +interface BattleView { + // } \ No newline at end of file