@Override public void addAbility(Ability ability, UUID sourceId, Game game) { addAbility(ability, sourceId, game, true); }
@Override public void unattach(Game game) { this.attachedTo = null; this.addInfo("attachedToCard", null, game); }
@Override public boolean canAttack(UUID defenderId, Game game) { if (tapped) { return false; } return canAttackInPrinciple(defenderId, game); }
if (damageAmount > 0 && canDamage(game.getObject(sourceId), game)) { if (this.isPlaneswalker()) { damageDone = damagePlaneswalker(damageAmount, sourceId, game, preventable, combat, markDamage, appliedEffects); } else { damageDone = damageCreature(damageAmount, sourceId, game, preventable, combat, markDamage, appliedEffects); game.informPlayers(getLogName() + " gets " + damageDone + " damage"); } else { game.informPlayers(source.getLogName() + " deals " + damageDone + " damage to " + getLogName());
for (Ability ability : this.getAbilities()) { for (Iterator<Effect> ite = ability.getEffects(game, EffectType.CONTINUOUS).iterator(); ite.hasNext(); ) { ContinuousEffect effect = (ContinuousEffect) ite.next(); if (getSpellAbility() == null) { if (!getSpellAbility().getTargets().isEmpty() && (getSpellAbility().getTargets().get(0) instanceof TargetCard)) { Card attachedToCard = game.getCard(this.getAttachedTo()); if (attachedToCard != null) { this.addInfo("attachedToCard", CardUtil.addToolTipMarkTags("Enchanted card: " + attachedToCard.getIdName()), game);
@Override public boolean fight(Permanent fightTarget, Ability source, Game game) { game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FIGHTED_PERMANENT, fightTarget.getId(), getId(), source.getControllerId())); game.fireEvent(GameEvent.getEvent(GameEvent.EventType.FIGHTED_PERMANENT, getId(), fightTarget.getId(), source.getControllerId())); damage(fightTarget.getPower().getValue(), fightTarget.getId(), game, false, true); fightTarget.damage(getPower().getValue(), getId(), game, false, true); return true; }
@Override public boolean canAttackInPrinciple(UUID defenderId, Game game) { if (hasSummoningSickness() && null == game.getContinuousEffects().asThough(this.objectId, AsThoughEffectType.ATTACK_AS_HASTE, null, this.getControllerId(), game)) { return false; } //20101001 - 508.1c if (defenderId == null) { boolean oneCanBeAttacked = false; for (UUID defenderToCheckId : game.getCombat().getDefenders()) { if (canAttackCheckRestrictionEffects(defenderToCheckId, game)) { oneCanBeAttacked = true; break; } } if (!oneCanBeAttacked) { return false; } } else if (!canAttackCheckRestrictionEffects(defenderId, game)) { return false; } return !abilities.containsKey(DefenderAbility.getInstance().getId()) || null != game.getContinuousEffects().asThough(this.objectId, AsThoughEffectType.ATTACK, null, this.getControllerId(), game); }
event.setAppliedEffects(appliedEffects); if (!game.replaceEvent(event)) { int actualDamage = checkProtectionAbilities(event, sourceId, game); if (actualDamage > 0) { if (markDamage) { markDamage(CounterType.M1M1.createInstance(actualDamage), source); } else { Ability damageSourceAbility = null; addCounters(CounterType.M1M1.createInstance(actualDamage), damageSourceAbility, game);
@Override public int damage(int damage, UUID sourceId, Game game) { return damage(damage, sourceId, game, true, false, false, null); }
@Override public int applyDamage(Game game) { if (markedDamage == null) { return 0; } for (MarkedDamageInfo mdi : markedDamage) { Ability source = null; if (mdi.sourceObject instanceof Permanent) { source = ((Permanent) mdi.sourceObject).getSpellAbility(); } addCounters(mdi.counter, source, game); } markedDamage.clear(); return 0; }
@Override public void adjustTargets(Ability ability, Game game) { if (getToken().getCopySourceCard() != null) { getToken().getCopySourceCard().adjustTargets(ability, game); } else { super.adjustTargets(ability, game); } }
@Override public void adjustCosts(Ability ability, Game game) { if (getToken().getCopySourceCard() != null) { getToken().getCopySourceCard().adjustCosts(ability, game); } else { super.adjustCosts(ability, game); } }
@Override public int damage(int damage, UUID sourceId, Game game, boolean combat, boolean preventable, List<UUID> appliedEffects) { return damage(damage, sourceId, game, preventable, combat, false, appliedEffects); }
@Override public int damage(int damage, UUID sourceId, Game game, boolean combat, boolean preventable) { return damage(damage, sourceId, game, preventable, combat, false, null); }
@Override public void setPairedCard(MageObjectReference pairedCard) { this.pairedPermanent = pairedCard; if (pairedCard == null) { // remove existing soulbond info text this.addInfo("soulbond", null, null); } }
@Override public int markDamage(int damageAmount, UUID sourceId, Game game, boolean preventable, boolean combat) { return damage(damageAmount, sourceId, game, preventable, combat, true, null); }