Add skill messages
This commit is contained in:
		@@ -40,7 +40,6 @@ val TestBattle = SingleBattle(TeamA, TeamB)
 | 
				
			|||||||
object PTureTest {
 | 
					object PTureTest {
 | 
				
			||||||
    @JvmStatic
 | 
					    @JvmStatic
 | 
				
			||||||
    fun main(arg: Array<String>) {
 | 
					    fun main(arg: Array<String>) {
 | 
				
			||||||
        println("Hello, world!")
 | 
					 | 
				
			||||||
        val e = Engine(TestBattle)
 | 
					        val e = Engine(TestBattle)
 | 
				
			||||||
        val v = BattleViewText()
 | 
					        val v = BattleViewText()
 | 
				
			||||||
        e.resolveTurn(v)
 | 
					        e.resolveTurn(v)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,8 +75,10 @@ class Engine(private val battle: BattleType) {
 | 
				
			|||||||
        // Resolve each move
 | 
					        // Resolve each move
 | 
				
			||||||
        for (c in activeCreatures) {
 | 
					        for (c in activeCreatures) {
 | 
				
			||||||
            // Resolve move
 | 
					            // Resolve move
 | 
				
			||||||
            val (skill, targets) = c.creature.activeSkill!!
 | 
					            val skillView = c.creature.activeSkill!!
 | 
				
			||||||
 | 
					            val (skill, targets) = skillView
 | 
				
			||||||
            currentCreature = c
 | 
					            currentCreature = c
 | 
				
			||||||
 | 
					            view.useSkill(skillView, c.creature)
 | 
				
			||||||
            val attackingCreature = currentCreature
 | 
					            val attackingCreature = currentCreature
 | 
				
			||||||
            for (step in skill.damageSteps) {
 | 
					            for (step in skill.damageSteps) {
 | 
				
			||||||
                for (targetCreature in targets) {
 | 
					                for (targetCreature in targets) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -83,4 +83,8 @@ class PlayerViewText(playerId: Int) : PlayerView(playerId) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class BattleViewText : BattleView() {
 | 
					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 class BattleView {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    abstract fun useSkill(skillChoice: SkillChoice, attacker : Creature)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
abstract class PlayerView(val playerId : Int) {
 | 
					abstract class PlayerView(val playerId : Int) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user