Verified Commit 4904a104 authored by Lars Mitsem Selbekk's avatar Lars Mitsem Selbekk Committed by Mathias O. Myklebust
Browse files

Review fixes for spellcasting

parent 70c083aa
Pipeline #175621 passed with stages
in 11 minutes and 27 seconds
......@@ -314,7 +314,8 @@ class BattleMapController(
}
private fun updateFromModel() {
for (unitController in unitControllers.values.asSequence()) {
// Wrap with toList to avoid ConcurrentModificationException when removing while iterating
for (unitController in unitControllers.values.toList()) {
val model = unitController.unitModel
if (model.isDead()) {
removeUnit(unitController)
......
......@@ -6,7 +6,8 @@ import se.battlegoo.battlegoose.models.heroes.Hero
class AdrenalineShotSpell : Spell<SpellData.AdrenalineShot>(
"Adrenaline Shot",
"Get an extra action point every turn for the following 3 turns.",
4,
4, // 1 extra duration beecause the spell isn't helpful the first turn when casting uses
// the (presumably) only action point
6
) {
override fun cast(
......
......@@ -121,6 +121,7 @@ class SpellTest {
battle.battleMap.count { battle.battleMap.getUnit(it)?.owner == hero2 }
)
assertTrue("Wrong hero spell type", hero1.spell is EphemeralAllegianceSpell)
val spell = (hero1.spell as EphemeralAllegianceSpell).cast(
hero1,
SpellData.EphemeralAllegiance(GridVector(2, 2))
......@@ -223,6 +224,7 @@ class SpellTest {
battle.battleMap.placeUnit(unit1Team2, GridVector(2, 2))
battle.battleMap.placeUnit(unit2Team2, GridVector(4, 2))
assertTrue("Wrong hero spell type", hero.spell is Bird52Spell)
val spell = (hero.spell as Bird52Spell).cast(hero, SpellData.Bird52)
var stats1Team1 = unit1Team1.currentStats
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment