public FixedTarget(Permanent permanent, Game game) { this.targetId = permanent.getId(); this.zoneChangeCounter = permanent.getZoneChangeCounter(game); this.initialized = true; }
/** * We need this to check Flying existence in not-common way: by instanceof. * @return */ private static boolean hasFlying(Permanent permanent) { for (Ability ability : permanent.getAbilities()) { if (ability instanceof FlyingAbility) { return true; } } return false; }
@Override public boolean untap(Game game) { //20091005 - 701.15b if (tapped) { if (!replaceEvent(EventType.UNTAP, game)) { this.tapped = false; fireEvent(EventType.UNTAPPED, game); return true; } } return false; }
public ZoneChangeEvent(Permanent target, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone) { super(EventType.ZONE_CHANGE, target.getId(), sourceId, playerId); this.fromZone = fromZone; this.toZone = toZone; this.target = target; }
public Permanent getPermanent(UUID permanentId) { if (permanentId != null && battlefield.containsPermanent(permanentId)) { Permanent permanent = battlefield.getPermanent(permanentId); // setZone(permanent.getId(), Zone.BATTLEFIELD); // shouldn't this be set anyway? (LevelX2) return permanent; } return null; }
@Override protected boolean selectedByRuntimeData(Permanent permanent, Ability source, Game game) { if (subtype != null) { return permanent.hasSubtype(subtype, game); } return false; }
@Override public boolean applies(Permanent permanent, Ability source, Game game) { if (!permanent.isArtifact()) { return true; } return false; }
@Override public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { permanent.addAbility(ability, game); return true; }
@Override public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) { permanent.addCardType(cardType); return 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); }
public ZoneChangeEvent(Permanent target, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone, List<UUID> appliedEffects) { super(EventType.ZONE_CHANGE, target.getId(), sourceId, playerId); this.fromZone = fromZone; this.toZone = toZone; this.target = target; if (appliedEffects != null) { this.appliedEffects = appliedEffects; } }
private static boolean hasIntimidate(Permanent permanent) { for (Ability ability : permanent.getAbilities()) { if (ability instanceof IntimidateAbility) { return true; } } return false; }
@Override public boolean unflip(Game game) { if (flipped) { if (!replaceEvent(EventType.UNFLIP, game)) { this.flipped = false; fireEvent(EventType.UNFLIPPED, game); return true; } } return false; }
@Override protected boolean selectedByRuntimeData(Permanent permanent, Ability source, Game game) { if (subtype != null) { return permanent.hasSubtype(subtype, game); } return false; }
@Override public void setPairedCard(MageObjectReference pairedCard) { this.pairedPermanent = pairedCard; if (pairedCard == null) { // remove existing soulbond info text this.addInfo("soulbond", null, null); } }
private static boolean cantBeBlocked(Permanent permanent) { for (Ability ability : permanent.getAbilities()) { if (ability instanceof CantBeBlockedSourceAbility) { return true; } } return false; }
@Override public boolean flip(Game game) { if (!flipped) { if (!replaceEvent(EventType.FLIP, game)) { this.flipped = true; fireEvent(EventType.FLIPPED, game); return true; } } return false; }
private static boolean hasReach(Permanent permanent) { for (Ability ability : permanent.getAbilities()) { if (ability instanceof ReachAbility) { return true; } } return false; }