@Override public boolean apply(Game game, Ability source) { SpellsCostReductionAllEffect effect = new SpellsCostReductionAllEffect(filter, 2); effect.setDuration(Duration.UntilYourNextTurn); effect.setControllerId(source.getFirstTarget()); game.addEffect(effect, source); return true; } }
@Override public SpellsCostReductionAllEffect copy() { return new SpellsCostReductionAllEffect(this); } }
@Override public boolean applies(Ability abilityToModify, Ability source, Game game) { if (onlyControlled && !abilityToModify.isControlledBy(source.getControllerId())) { return false; } if (controllerId != null && !abilityToModify.isControlledBy(controllerId)) { return false; } if (abilityToModify instanceof SpellAbility) { Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId()); if (spell != null) { return this.filter.match(spell, game) && selectedByRuntimeData(spell, source, game); } else { // used at least for flashback ability because Flashback ability doesn't use stack Card sourceCard = game.getCard(abilityToModify.getSourceId()); return sourceCard != null && this.filter.match(sourceCard, game) && selectedByRuntimeData(sourceCard, source, game); } } return false; }
public UrzasFilter(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}"); // Multicolored spells cost up to {2} less to cast. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionAllEffect(filter, 2, true))); }
public HelmOfAwakening(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); // Spells cost {1} less to cast. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionAllEffect(1))); }
@Override public boolean apply(Game game, Ability source) { new ChooseACardNameEffect(TypeOfName.ALL).apply(game, source); String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); FilterCard filter = new FilterCard(); filter.add(new NamePredicate(cardName)); ContinuousEffect effect = new SpellsCostReductionAllEffect(filter, 1); effect.setDuration(Duration.EndOfTurn); game.addEffect(effect, source); return true; } }