@Override public MageObject getSourceObject(Game game) { return game.getObject(getSourceId()); }
@Override public Permanent getSourcePermanentOrLKI(Game game) { if (getSourceObjectZoneChangeCounter() == 0 || getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(getSourceId())) { return game.getPermanent(getSourceId()); } return (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD, getSourceObjectZoneChangeCounter()); }
@Override public MageObject getSourceObjectIfItStillExists(Game game) { if (getSourceObjectZoneChangeCounter() == 0 || getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(getSourceId())) { return game.getObject(getSourceId()); } return null; }
if (this.getSourceId() == null) { // commander effects return true; MageObject object = game.getObject(this.getSourceId()); parameterSourceId = source.getId(); } else { parameterSourceId = getSourceId(); if (game.getShortLivingLKI(getSourceId(), getZone())) { return true;
@Override public boolean hasSourceObjectAbility(Game game, MageObject source, GameEvent event) { MageObject object = source; // for singleton abilities like Flying we can't rely on abilities' source because it's only once in continuous effects // so will use the sourceId of the object itself that came as a parameter if it is not null if (object == null) { object = game.getPermanentEntering(getSourceId()); if (object == null) { object = game.getObject(getSourceId()); } } if (object != null) { if (object instanceof Permanent) { if (!((Permanent) object).getAbilities(game).contains(this)) { return false; } return ((Permanent) object).isPhasedIn(); } else if (!object.getAbilities().contains(this)) { // check if it's an ability that is temporary gained to a card Abilities<Ability> otherAbilities = game.getState().getAllOtherAbilities(this.getSourceId()); if (otherAbilities == null || !otherAbilities.contains(this)) { return false; } } } return true; }
if (this.getAbilityType() != AbilityType.MANA) { if (!effectResult) { if (this.getSourceId() != null) { MageObject mageObject = game.getObject(this.getSourceId()); if (mageObject != null) { logger.debug("AbilityImpl.resolve: object: " + mageObject.getName());
@Override public boolean canChooseTarget(Game game) { if (this instanceof SpellAbility) { if (SpellAbilityType.SPLIT_FUSED.equals(((SpellAbility) this).getSpellAbilityType())) { Card card = game.getCard(getSourceId()); if (card != null) { return canChooseTargetAbility(((SplitCard) card).getLeftHalfCard().getSpellAbility(), game, getControllerId()) && canChooseTargetAbility(((SplitCard) card).getRightHalfCard().getSpellAbility(), game, getControllerId()); } return false; } } return canChooseTargetAbility(this, game, getControllerId()); }
setSourceObjectZoneChangeCounter(game.getState().getZoneChangeCounter(getSourceId())); && game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL_LATE, getId(), getSourceId(), getControllerId()), this)) { return false;