@Override public boolean canBlockAny(Game game) { if (tapped && null == game.getState().getContinuousEffects().asThough(this.getId(), AsThoughEffectType.BLOCK_TAPPED, null, this.getControllerId(), game)) { return false; } //20101001 - 509.1b for (Map.Entry<RestrictionEffect, Set<Ability>> entry : game.getContinuousEffects().getApplicableRestrictionEffects(this, game).entrySet()) { RestrictionEffect effect = entry.getKey(); for (Ability ability : entry.getValue()) { if (!effect.canBlock(null, this, ability, game)) { return false; } } } return true; }
@Override public boolean entersBattlefield(UUID sourceId, Game game, Zone fromZone, boolean fireEvent) { controlledFromStartOfControllerTurn = false; if (this.isFaceDown(game)) { // remove some attributes here, because first apply effects comes later otherwise abilities (e.g. color related) will unintended trigger MorphAbility.setPermanentToFaceDownCreature(this); } EntersTheBattlefieldEvent event = new EntersTheBattlefieldEvent(this, sourceId, getControllerId(), fromZone, EnterEventType.SELF); if (game.replaceEvent(event)) { return false; } event = new EntersTheBattlefieldEvent(this, sourceId, getControllerId(), fromZone); if (!game.replaceEvent(event)) { if (fireEvent) { game.addSimultaneousEvent(event); return true; } } return false; }
@Override public boolean canBlock(UUID attackerId, Game game) { if (tapped && null == game.getState().getContinuousEffects().asThough(this.getId(), AsThoughEffectType.BLOCK_TAPPED, null, this.getControllerId(), game)) { return false; if (!game.getPlayer(this.getControllerId()).hasOpponent(attacker.getControllerId(), game)) { return false;
@Override public boolean transform(Game game) { if (transformable) { if (!replaceEvent(EventType.TRANSFORM, game)) { setTransformed(!transformed); game.applyEffects(); game.addSimultaneousEvent(GameEvent.getEvent(EventType.TRANSFORMED, getId(), getControllerId())); return true; } } return false; }
@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); }
@Override public boolean sacrifice(UUID sourceId, Game game) { //20091005 - 701.13 if (isPhasedIn() && !game.replaceEvent(GameEvent.getEvent(EventType.SACRIFICE_PERMANENT, objectId, sourceId, controllerId))) { // Commander replacement effect or Rest in Peace (exile instead of graveyard) in play does not prevent successful sacrifice // so the return value of the moveToZone is not taken into account here moveToZone(Zone.GRAVEYARD, sourceId, game, false); Player player = game.getPlayer(getControllerId()); if (player != null && !game.isSimulation()) { game.informPlayers(player.getLogName() + " sacrificed " + this.getLogName()); } game.fireEvent(GameEvent.getEvent(EventType.SACRIFICED_PERMANENT, objectId, sourceId, controllerId)); return true; } return false; }
if (game.getPlayer(this.getControllerId()).hasOpponent(sourceControllerId, game) && null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)) { return false; if (game.getPlayer(this.getControllerId()).hasOpponent(sourceControllerId, game) && null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game) && source.getColor(game).isBlack()) { if (game.getPlayer(this.getControllerId()).hasOpponent(sourceControllerId, game) && null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game) && source.getColor(game).isWhite()) { if (game.getPlayer(this.getControllerId()).hasOpponent(sourceControllerId, game) && null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game) && !source.getColor(game).isColorless() && !source.getColor(game).isMulticolored()) {