@Override
public void assignDamage(int damage, List<UUID> targets, UUID sourceId, Game game) {
int remainingDamage = damage;
while (remainingDamage > 0) {
Target target = new TargetCreatureOrPlayer();
choose(Outcome.Damage, target, game);
if (targets.size() == 0 || targets.contains(target.getFirstTarget())) {
int damageAmount = getAmount(0, remainingDamage, "Select amount", game);
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
permanent.damage(damageAmount, sourceId, game, true, false);
remainingDamage -= damageAmount;
}
else {
Player player = game.getPlayer(target.getFirstTarget());
if (player != null) {
player.damage(damageAmount, sourceId, game, false, true);
remainingDamage -= damageAmount;
}
}