Refactored Eldrazi Temple

This commit is contained in:
magenoxx 2011-08-04 18:11:10 +04:00
parent ed3f96c668
commit 0c3feda6dd

View file

@ -28,22 +28,25 @@
package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.ConditionalMana;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageObject;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.mana.BasicManaAbility;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.SpellStack;
import mage.game.stack.StackObject;
/**
*
* @author Loki
* @author Loki, nantuko
*/
public class EldraziTemple extends CardImpl<EldraziTemple> {
@ -67,11 +70,8 @@ public class EldraziTemple extends CardImpl<EldraziTemple> {
class EldraziTempleManaAbility extends BasicManaAbility<EldraziTempleManaAbility> {
private static final String abilityText = "Spend this mana only to cast colorless Eldrazi spells or activate abilities of colorless Eldrazi. "
+ "<b>(Mage Tip: This ability can only be activated when an Eldrazi spell or ability is on the stack.)</b>";
EldraziTempleManaAbility ( ) {
super(new BasicManaEffect(Mana.ColorlessMana(2)));
super(new BasicManaEffect(new EldraziConditionalMana()));
this.netMana.setColorless(2);
}
@ -79,7 +79,7 @@ class EldraziTempleManaAbility extends BasicManaAbility<EldraziTempleManaAbility
super(ability);
}
@Override
/*@Override
public boolean canActivate(UUID playerId, Game game) {
boolean eldraziSpellBeingCast = false;
@ -95,12 +95,7 @@ class EldraziTempleManaAbility extends BasicManaAbility<EldraziTempleManaAbility
}
return super.canActivate(playerId, game) && eldraziSpellBeingCast;
}
@Override
public String getRule() {
return super.getRule() + " " + abilityText;
}
}*/
@Override
public String getRule(String source) {
@ -112,3 +107,23 @@ class EldraziTempleManaAbility extends BasicManaAbility<EldraziTempleManaAbility
return new EldraziTempleManaAbility(this);
}
}
class EldraziConditionalMana extends ConditionalMana {
public EldraziConditionalMana() {
super(Mana.ColorlessMana(2));
staticText = "Spend this mana only to cast colorless Eldrazi spells or activate abilities of colorless Eldrazi";
addCondition(new EldraziManaCondition());
}
}
class EldraziManaCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
MageObject object = game.getObject(source.getSourceId());
if (object != null && object.getSubtype().contains("Eldrazi") && !object.getColor().hasColor()) {
return true;
}
return false;
}
}