Add skill messages

This commit is contained in:
Matt Soucy 2019-12-07 12:50:26 -05:00
parent 5f7199e229
commit 7a2eed338b
4 changed files with 9 additions and 2 deletions

View File

@ -40,7 +40,6 @@ val TestBattle = SingleBattle(TeamA, TeamB)
object PTureTest {
@JvmStatic
fun main(arg: Array<String>) {
println("Hello, world!")
val e = Engine(TestBattle)
val v = BattleViewText()
e.resolveTurn(v)

View File

@ -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) {

View File

@ -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}!")
}
}

View File

@ -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) {