From 7a2eed338b6b0db817806302b18ba0dfd112b679 Mon Sep 17 00:00:00 2001 From: Matt Soucy Date: Sat, 7 Dec 2019 12:50:26 -0500 Subject: [PATCH] Add skill messages --- core/src/me/msoucy/ptures/PTureTest.kt | 1 - core/src/me/msoucy/ptures/controller/Engine.kt | 4 +++- core/src/me/msoucy/ptures/view/TextView.kt | 4 ++++ core/src/me/msoucy/ptures/view/ViewBase.kt | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/me/msoucy/ptures/PTureTest.kt b/core/src/me/msoucy/ptures/PTureTest.kt index 4fde9c7..b53b859 100644 --- a/core/src/me/msoucy/ptures/PTureTest.kt +++ b/core/src/me/msoucy/ptures/PTureTest.kt @@ -40,7 +40,6 @@ val TestBattle = SingleBattle(TeamA, TeamB) object PTureTest { @JvmStatic fun main(arg: Array) { - println("Hello, world!") val e = Engine(TestBattle) val v = BattleViewText() e.resolveTurn(v) diff --git a/core/src/me/msoucy/ptures/controller/Engine.kt b/core/src/me/msoucy/ptures/controller/Engine.kt index 2d1f5d0..3409e35 100644 --- a/core/src/me/msoucy/ptures/controller/Engine.kt +++ b/core/src/me/msoucy/ptures/controller/Engine.kt @@ -75,8 +75,10 @@ class Engine(private val battle: BattleType) { // Resolve each move for (c in activeCreatures) { // Resolve move - val (skill, targets) = c.creature.activeSkill!! + val skillView = c.creature.activeSkill!! + val (skill, targets) = skillView currentCreature = c + view.useSkill(skillView, c.creature) val attackingCreature = currentCreature for (step in skill.damageSteps) { for (targetCreature in targets) { diff --git a/core/src/me/msoucy/ptures/view/TextView.kt b/core/src/me/msoucy/ptures/view/TextView.kt index 7e4ca9b..801572f 100644 --- a/core/src/me/msoucy/ptures/view/TextView.kt +++ b/core/src/me/msoucy/ptures/view/TextView.kt @@ -83,4 +83,8 @@ class PlayerViewText(playerId: Int) : PlayerView(playerId) { class BattleViewText : BattleView() { + override fun useSkill(skillChoice: SkillChoice, attacker : Creature) { + println("${attacker.name} used ${skillChoice.skill.name}!") + } + } \ No newline at end of file diff --git a/core/src/me/msoucy/ptures/view/ViewBase.kt b/core/src/me/msoucy/ptures/view/ViewBase.kt index aebad59..0d76373 100644 --- a/core/src/me/msoucy/ptures/view/ViewBase.kt +++ b/core/src/me/msoucy/ptures/view/ViewBase.kt @@ -20,6 +20,8 @@ abstract class CreatureView(val playerId : Int, val creature: Creature) { } abstract class BattleView { + + abstract fun useSkill(skillChoice: SkillChoice, attacker : Creature) } abstract class PlayerView(val playerId : Int) {