@Override public int calculate(Game game, Ability source, Effect effect) { Object object = effect.getValue(valueKey); if (object instanceof Integer) { return (Integer) object; } return 0; }
@Override public int calculate(Game game, Ability source, Effect effect) { return (Integer)effect.getValue(key); }
@Override public boolean checkInterveningIfClause(Game game) { Spell spell = (Spell) getEffects().get(0).getValue("triggeringSpell"); if (spell != null) { boolean allTargetsInkTreaderNephilim = true; boolean atLeastOneTargetsInkTreaderNephilim = false; for (TargetAddress addr : TargetAddress.walk(spell)) { Target targetInstance = addr.getTarget(spell); for (UUID target : targetInstance.getTargets()) { allTargetsInkTreaderNephilim &= target.equals(sourceId); atLeastOneTargetsInkTreaderNephilim |= target.equals(sourceId); } } if (allTargetsInkTreaderNephilim && atLeastOneTargetsInkTreaderNephilim) { return true; } } return false; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent attachmentPermanent = game.getPermanent(sourceAbility.getSourceId()); if (attachmentPermanent == null) { attachmentPermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD, sourceAbility.getSourceObjectZoneChangeCounter()); } if (attachmentPermanent != null && attachmentPermanent.getAttachedTo() != null) { if (effect.getValue("attachedTo") != null) { Permanent attached = (Permanent)effect.getValue("attachedTo"); if (attached != null) { return attached.getPower().getValue(); } } } return 0; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { Permanent attachmentPermanent = game.getPermanent(sourceAbility.getSourceId()); if (attachmentPermanent == null) { attachmentPermanent = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD, sourceAbility.getSourceObjectZoneChangeCounter()); } if (attachmentPermanent != null && attachmentPermanent.getAttachedTo() != null) { if (effect.getValue("attachedTo") != null) { Permanent attached = (Permanent) effect.getValue("attachedTo"); if (attached != null) { return attached.getPower().getValue(); } } } return 0; }
@Override public void adjustTargets(Ability ability, Game game) { Permanent attachedTo = null; for (Effect effect : ability.getEffects()) { attachedTo = (Permanent) effect.getValue("attachedTo"); } if (attachedTo == null) { return; } Player creatureController = game.getPlayer(attachedTo.getControllerId()); if (creatureController == null) { return; } ability.setControllerId(creatureController.getId()); ability.getTargets().clear(); TargetPermanent target = new TargetOpponentsCreaturePermanent(); ability.getTargets().add(target); } }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId()); if (permanent == null) { permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } if (permanent != null) { Permanent attachedTo = null; if (permanent.getAttachedTo() != null) { attachedTo = game.getBattlefield().getPermanent(permanent.getAttachedTo()); if (attachedTo == null) { attachedTo = (Permanent) game.getLastKnownInformation(permanent.getAttachedTo(), Zone.BATTLEFIELD); } } if (attachedTo == null) { for (Effect effect : source.getEffects()) { attachedTo = (Permanent) effect.getValue("attachedTo"); } } if (attachedTo != null) { return filter.match(attachedTo, attachedTo.getId(), attachedTo.getControllerId(), game); } } return false; } }