mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
[WAR] added God-Eternal Kefnet
This commit is contained in:
parent
a737df0995
commit
7b7c80c80a
3 changed files with 178 additions and 9 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.effects.common.cost;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -13,14 +12,17 @@ import mage.game.Game;
|
|||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SpellCostReductionSourceEffect extends CostModificationEffectImpl {
|
||||
|
||||
private final int amount;
|
||||
private ManaCosts<ManaCost> manaCostsToReduce = null;
|
||||
private final Condition condition;
|
||||
private Condition condition;
|
||||
|
||||
public SpellCostReductionSourceEffect(ManaCosts<ManaCost> manaCostsToReduce) {
|
||||
this(manaCostsToReduce, null);
|
||||
}
|
||||
|
||||
public SpellCostReductionSourceEffect(ManaCosts<ManaCost> manaCostsToReduce, Condition condition) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
|
|
@ -33,19 +35,28 @@ public class SpellCostReductionSourceEffect extends CostModificationEffectImpl {
|
|||
for (String manaSymbol : manaCostsToReduce.getSymbols()) {
|
||||
sb.append(manaSymbol);
|
||||
}
|
||||
sb.append(" less to if ").append(this.condition.toString());
|
||||
sb.append(" less");
|
||||
if (this.condition != null) {
|
||||
sb.append(" to if ").append(this.condition.toString());
|
||||
}
|
||||
|
||||
this.staticText = sb.toString();
|
||||
}
|
||||
|
||||
public SpellCostReductionSourceEffect(int amount) {
|
||||
this(amount, null);
|
||||
}
|
||||
|
||||
public SpellCostReductionSourceEffect(int amount, Condition condition) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
this.amount = amount;
|
||||
this.condition = condition;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{this} costs {")
|
||||
.append(amount).append("} less to cast ")
|
||||
.append((this.condition.toString().startsWith("if ") ? "" : "if "))
|
||||
.append(this.condition.toString());
|
||||
sb.append("{this} costs {").append(amount).append("} less to cast");
|
||||
if (this.condition != null) {
|
||||
sb.append(" ").append(this.condition.toString().startsWith("if ") ? "" : "if ");
|
||||
sb.append(this.condition.toString());
|
||||
}
|
||||
this.staticText = sb.toString();
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +80,7 @@ public class SpellCostReductionSourceEffect extends CostModificationEffectImpl {
|
|||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (abilityToModify.getSourceId().equals(source.getSourceId()) && (abilityToModify instanceof SpellAbility)) {
|
||||
return condition.apply(game, source);
|
||||
return condition == null || condition.apply(game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue