mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Eldrazi Temple - Fixed that the first ability was automatically used for spells (fixes #908) .
This commit is contained in:
parent
454df4505c
commit
c3447ccff0
5 changed files with 26 additions and 27 deletions
|
|
@ -34,7 +34,6 @@ import mage.ConditionalMana;
|
|||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
|
|
|
|||
|
|
@ -36,9 +36,10 @@ 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.costs.common.TapSourceCost;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.abilities.mana.ConditionalColorlessManaAbility;
|
||||
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
|
||||
|
|
@ -52,8 +53,11 @@ public class EldraziTemple extends CardImpl {
|
|||
super(ownerId, 227, "Eldrazi Temple", Rarity.RARE, new CardType[]{ CardType.LAND }, null);
|
||||
this.expansionSetCode = "ROE";
|
||||
|
||||
// {T}: Add {1} to your mana pool.
|
||||
this.addAbility(new ColorlessManaAbility());
|
||||
this.addAbility(new EldraziTempleManaAbility());
|
||||
|
||||
// {T}: Add {2} to your mana pool. Spend this mana only to cast colorless Eldrazi spells or activate abilities of colorless Eldrazi.
|
||||
this.addAbility(new ConditionalColorlessManaAbility(new TapSourceCost(), 2, new EldraziTempleManaBuilder()));
|
||||
}
|
||||
|
||||
public EldraziTemple(final EldraziTemple card) {
|
||||
|
|
@ -66,39 +70,32 @@ public class EldraziTemple extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class EldraziTempleManaAbility extends BasicManaAbility {
|
||||
class EldraziTempleManaBuilder extends ConditionalManaBuilder {
|
||||
|
||||
EldraziTempleManaAbility ( ) {
|
||||
super(new BasicManaEffect(new EldraziConditionalMana()));
|
||||
this.netMana.add(new Mana(0,0,0,0,0,2,0));
|
||||
}
|
||||
|
||||
EldraziTempleManaAbility ( EldraziTempleManaAbility ability ) {
|
||||
super(ability);
|
||||
@Override
|
||||
public ConditionalMana build(Object... options) {
|
||||
return new EldraziTempleConditionalMana(this.mana);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EldraziTempleManaAbility copy ( ) {
|
||||
return new EldraziTempleManaAbility(this);
|
||||
public String getRule() {
|
||||
return "Spend this mana only to cast colorless Eldrazi spells or activate abilities of colorless Eldrazi";
|
||||
}
|
||||
}
|
||||
|
||||
class EldraziConditionalMana extends ConditionalMana {
|
||||
class EldraziTempleConditionalMana 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());
|
||||
public EldraziTempleConditionalMana(Mana mana) {
|
||||
super(mana);
|
||||
addCondition(new EldraziTempleCondition());
|
||||
}
|
||||
}
|
||||
|
||||
class EldraziManaCondition implements Condition {
|
||||
class EldraziTempleCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject object = game.getObject(source.getSourceId());
|
||||
if (object != null && object.hasSubtype("Eldrazi") && !object.getColor().hasColor()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return object != null && object.hasSubtype("Eldrazi") && object.getColor().isColorless();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* This test checks if the calculated possible mana options are correct related to the given mana sources available.
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class ManaUtilTest extends CardTestPlayerBase {
|
|||
testManaToPayVsLand("{1}{R}", "Cavern of Souls", 2, 2); // can't auto choose to pay
|
||||
testManaToPayVsLand("{2}", "Cavern of Souls", 2, 2); // can't auto choose to pay
|
||||
|
||||
testManaToPayVsLand("{2}", "Eldrazi Temple", 2, 2); // can't auto choose to pay
|
||||
|
||||
// hybrid mana
|
||||
testManaToPayVsLand("{W/R}{W/R}{W/R}", "Sacred Foundry", 2, 1); // auto choose for hybrid mana: choose any
|
||||
testManaToPayVsLand("{R}{W/R}", "Sacred Foundry", 2, RedManaAbility.class); // auto choose for hybrid mana: we should choose {R}
|
||||
|
|
@ -122,7 +124,7 @@ public class ManaUtilTest extends CardTestPlayerBase {
|
|||
* @return
|
||||
*/
|
||||
private HashMap<UUID, ManaAbility> getManaAbilities(Card card) {
|
||||
HashMap<UUID, ManaAbility> useableAbilities = new LinkedHashMap<UUID, ManaAbility>();
|
||||
HashMap<UUID, ManaAbility> useableAbilities = new LinkedHashMap<>();
|
||||
for (Ability ability: card.getAbilities()) {
|
||||
if (ability instanceof ManaAbility) {
|
||||
ability.newId(); // we need to assign id manually as we are not in game
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class AddConditionalColorlessManaEffect extends ManaEffect {
|
|||
super();
|
||||
this.amount = amount;
|
||||
this.manaBuilder = manaBuilder;
|
||||
staticText = "Add " + amount + " to your mana pool. " + manaBuilder.getRule();
|
||||
staticText = "Add {" + amount + "} to your mana pool. " + manaBuilder.getRule();
|
||||
}
|
||||
|
||||
public AddConditionalColorlessManaEffect(final AddConditionalColorlessManaEffect effect) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue