Add skill messages
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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}!")
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user