}
}
private void singleBlockerDamage(boolean first, Game game) {
//TODO: handle banding
Permanent blocker = game.getPermanent(blockers.get(0));
Permanent attacker = game.getPermanent(attackers.get(0));
if (blocker != null && attacker != null) {
if (canDamage(attacker, first)) {
int damage = attacker.getPower().getValue();
if (hasTrample(attacker)) {
int lethalDamage = blocker.getToughness().getValue() - blocker.getDamage();
if (lethalDamage >= damage) {
blocker.damage(damage, attacker.getId(), game, true, true);
}
else {
Player player = game.getPlayer(attacker.getControllerId());
int damageAssigned = player.getAmount(lethalDamage, damage, "Assign damage to " + blocker.getName(), game);
blocker.damage(damageAssigned, attacker.getId(), game, true, true);
damage -= damageAssigned;
if (damage > 0)
defenderDamage(attacker, damage, game);
}
}
else {
blocker.damage(damage, attacker.getId(), game, true, true);
}
}
if (canDamage(blocker, first)) {
attacker.damage(blocker.getPower().getValue(), blocker.getId(), game, true, true);
}
}
}