@Override public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanent(source.getFirstTarget()); if (creature != null) { creature.damage(creature.getDamage(), source.getSourceId(), game, false, true); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null) { permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } return permanent.getDamage() > 3; } }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null) { permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } return permanent.getDamage() > 3; } }
lethalDamage = 1; } else { lethalDamage = Math.max(attacker.getToughness().getValue() - attacker.getDamage(), 0);
lethalDamage = 1; } else { lethalDamage = Math.max(blocker.getToughness().getValue() - blocker.getDamage(), 0);
public CreatureSimulator(Permanent permanent) { this.id = permanent.getId(); this.damage = permanent.getDamage(); this.power = permanent.getPower().getValue(); this.toughness = permanent.getToughness().getValue(); this.hasDoubleStrike = permanent.getAbilities().containsKey(DoubleStrikeAbility.getInstance().getId()); this.hasFirstStrike = permanent.getAbilities().containsKey(FirstStrikeAbility.getInstance().getId()); this.hasTrample = permanent.getAbilities().containsKey(TrampleAbility.getInstance().getId()); }
this.morphed = permanent.isMorphed(); this.manifested = permanent.isManifested(); this.damage = permanent.getDamage(); if (!permanent.getAttachments().isEmpty()) { attachments = new ArrayList<>();
lethalDamage = 1; } else { lethalDamage = Math.max(blocker.getToughness().getValue() - blocker.getDamage(), 0);
private void playDamage(List<UUID> creatures, Game game) { for (UUID creatureId : creatures) { Permanent creature = game.getPermanent(creatureId); for (Card card : this.playableInstant) { if (card.getSpellAbility().canActivate(playerId, game).canActivate()) { for (Effect effect : card.getSpellAbility().getEffects()) { if (effect instanceof DamageTargetEffect) { if (card.getSpellAbility().getTargets().get(0).canTarget(creatureId, card.getSpellAbility(), game)) { if (((DamageTargetEffect) effect).getAmount() > (creature.getPower().getValue() - creature.getDamage())) { if (this.activateAbility(card.getSpellAbility(), game)) { return; } } } } } } } } }
score -= permanent.getDamage() * 2; if (!canTap(permanent)) { score += getTappedScore(permanent);
else if (perm.getToughness().getValue() <= perm.getDamage() || perm.isDeathtouched()) { if (perm.destroy(null, this, false)) { somethingHappened = true;