DEV Community

Discussion on: AoC Day 24: Immune System Simulator 20XX

Collapse
 
neilgall profile image
Neil Gall

I got it in the end. I missed the sentence "If it cannot deal any defending groups damage, it does not choose a target". A simple extra clause in the target selection:

if (defendingGroup == null) ...

became

if (defendingGroup == null || defendingGroup.damageFrom(attackingGroup.unit.attack) == 0) ...