mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
Added log text to use of conditional mana of Cavern of Soul.
This commit is contained in:
parent
d37f40a14e
commit
5b79f99a85
4 changed files with 56 additions and 13 deletions
|
|
@ -109,15 +109,15 @@ class MeddlingMageReplacementEffect extends ContinuousRuleModifiyingEffectImpl {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.CAST_SPELL;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getType() == EventType.CAST_SPELL) {
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
return object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY));
|
||||||
if (object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -75,10 +75,10 @@ public class CavernOfSouls extends CardImpl {
|
||||||
// As Cavern of Souls enters the battlefield, choose a creature type.
|
// As Cavern of Souls enters the battlefield, choose a creature type.
|
||||||
this.addAbility(new AsEntersBattlefieldAbility(new CavernOfSoulsEffect(), ruleText));
|
this.addAbility(new AsEntersBattlefieldAbility(new CavernOfSoulsEffect(), ruleText));
|
||||||
|
|
||||||
// {tap}: Add {1} to your mana pool.
|
// {T}: Add {1} to your mana pool.
|
||||||
this.addAbility(new ColorlessManaAbility());
|
this.addAbility(new ColorlessManaAbility());
|
||||||
|
|
||||||
// {tap}: Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered.
|
// {T}: Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered.
|
||||||
this.addAbility(new ConditionalAnyColorManaAbility(1, new CavernOfSoulsManaBuilder()));
|
this.addAbility(new ConditionalAnyColorManaAbility(1, new CavernOfSoulsManaBuilder()));
|
||||||
this.addWatcher(new CavernOfSoulsWatcher());
|
this.addWatcher(new CavernOfSoulsWatcher());
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CavernOfSoulsCantCounterEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CavernOfSoulsCantCounterEffect()));
|
||||||
|
|
@ -133,21 +133,28 @@ class CavernOfSoulsEffect extends OneShotEffect {
|
||||||
|
|
||||||
class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
|
class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
|
||||||
|
|
||||||
String creatuerType;
|
String creatureType;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConditionalManaBuilder setMana(Mana mana, Ability source, Game game) {
|
public ConditionalManaBuilder setMana(Mana mana, Ability source, Game game) {
|
||||||
Object value = game.getState().getValue(source.getSourceId() + "_type");
|
Object value = game.getState().getValue(source.getSourceId() + "_type");
|
||||||
if (value != null && value instanceof String) {
|
if (value != null && value instanceof String) {
|
||||||
creatuerType = (String) value;
|
creatureType = (String) value;
|
||||||
}
|
}
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
|
if (controller != null && sourceObject != null) {
|
||||||
|
game.informPlayers(controller.getName() + " produces " + mana.toString() + " with " + sourceObject.getLogName() +
|
||||||
|
" (can only be spend to cast for creatures of type " + creatureType + " and that spell can't be countered)");
|
||||||
|
}
|
||||||
|
|
||||||
return super.setMana(mana, source, game);
|
return super.setMana(mana, source, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConditionalMana build(Object... options) {
|
public ConditionalMana build(Object... options) {
|
||||||
this.mana.setFlag(true); // indicates that the mana is from second ability
|
this.mana.setFlag(true); // indicates that the mana is from second ability
|
||||||
return new CavernOfSoulsConditionalMana(this.mana, creatuerType);
|
return new CavernOfSoulsConditionalMana(this.mana, creatureType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -68,5 +68,42 @@ public class ExileAndReturnUnderYourControl extends CardTestPlayerBase {
|
||||||
Assert.assertFalse("player B should play NOT with top card revealed", playerB.isTopCardRevealed());
|
Assert.assertFalse("player B should play NOT with top card revealed", playerB.isTopCardRevealed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testVillainousWealthExilesBoost() {
|
||||||
|
// Villainous Wealth {X}{B}{G}{U}
|
||||||
|
// Target opponent exiles the top X cards of his or her library. You may cast any number
|
||||||
|
// of nonland cards with converted mana cost X or less from among them without paying
|
||||||
|
// their mana costs.
|
||||||
|
addCard(Zone.HAND, playerA, "Villainous Wealth");
|
||||||
|
addCard(Zone.HAND, playerA, "Master of Pearls");
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
|
||||||
|
|
||||||
|
// Secret Plans {G}{U}
|
||||||
|
// Face-down creatures you control get +0/+1.
|
||||||
|
// Whenever a permanent you control is turned face up, draw a card.
|
||||||
|
addCard(Zone.LIBRARY, playerB, "Secret Plans");
|
||||||
|
skipInitShuffling(); // to keep this card on top of library
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Master of Pearls");
|
||||||
|
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Villainous Wealth", playerB);
|
||||||
|
setChoice(playerA, "X=3");
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Secret Plans");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertGraveyardCount(playerA, "Villainous Wealth", 1);
|
||||||
|
assertExileCount(playerB, 2);
|
||||||
|
assertExileCount("Secret Plans", 0);
|
||||||
|
assertPermanentCount(playerA, "Secret Plans", 1);
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "face down creature", 1);
|
||||||
|
assertPowerToughness(playerA, "face down creature", 2, 3);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ import mage.constants.Layer;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.PhaseStep;
|
import mage.constants.PhaseStep;
|
||||||
import mage.constants.SubLayer;
|
import mage.constants.SubLayer;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue