mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
Fractured powerstone (#8805)
* Implement Fractured Powerstone * Rebase fix FracturedPowerstone Co-authored-by: teskogi <tojile7269@yeafam.com>
This commit is contained in:
parent
b279d4b318
commit
1538714555
4 changed files with 149 additions and 0 deletions
80
Mage.Sets/src/mage/cards/f/FracturedPowerstone.java
Normal file
80
Mage.Sets/src/mage/cards/f/FracturedPowerstone.java
Normal file
|
@ -0,0 +1,80 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.game.command.CommandObject;
|
||||
import mage.game.command.Plane;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.watchers.common.PlanarRollWatcher;
|
||||
|
||||
public final class FracturedPowerstone extends CardImpl {
|
||||
|
||||
public FracturedPowerstone(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
|
||||
|
||||
// {tap}: Add {C}.
|
||||
this.addAbility(new ColorlessManaAbility());
|
||||
// {tap}: Add roll planar die.
|
||||
Ability ability = new ActivateAsSorceryActivatedAbility(
|
||||
new FracturedPowerstoneEffect(), new TapSourceCost()
|
||||
);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public FracturedPowerstone(final FracturedPowerstone card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FracturedPowerstone copy() {
|
||||
return new FracturedPowerstone(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FracturedPowerstoneEffect extends OneShotEffect {
|
||||
|
||||
FracturedPowerstoneEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Roll the planar";
|
||||
}
|
||||
|
||||
private FracturedPowerstoneEffect(final FracturedPowerstoneEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FracturedPowerstoneEffect copy() {
|
||||
return new FracturedPowerstoneEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for(CommandObject commandObject : game.getState().getCommand()){
|
||||
if(commandObject instanceof Plane){
|
||||
Abilities<Ability> abilities = commandObject.getAbilities();
|
||||
for(Ability ability : abilities){
|
||||
if(ability instanceof ActivateIfConditionActivatedAbility){
|
||||
StackAbility stackAbility = new StackAbility(ability,game.getActivePlayerId());
|
||||
stackAbility.createCopyOnStack(game, source, source.getControllerId(), true);
|
||||
|
||||
PlanarRollWatcher watcher = game.getState().getWatcher(PlanarRollWatcher.class);
|
||||
watcher.removePlanarDieRoll(game.getActivePlayerId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -69,6 +69,7 @@ public final class Planechase2012Edition extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Forest", 154, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Forest", 155, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Forest", 156, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Fractured Powerstone", 111, Rarity.COMMON, mage.cards.f.FracturedPowerstone.class));
|
||||
cards.add(new SetCardInfo("Fusion Elemental", 93, Rarity.UNCOMMON, mage.cards.f.FusionElemental.class));
|
||||
cards.add(new SetCardInfo("Ghostly Prison", 7, Rarity.UNCOMMON, mage.cards.g.GhostlyPrison.class));
|
||||
cards.add(new SetCardInfo("Glen Elendra Liege", 94, Rarity.RARE, mage.cards.g.GlenElendraLiege.class));
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package org.mage.test.cards.single.pc2;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Planes;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBaseWithAIHelps;
|
||||
|
||||
public class FracturedPowerstoneTest extends CardTestPlayerBaseWithAIHelps {
|
||||
|
||||
@Test
|
||||
public void test_FracturedPowerstone_Single() {
|
||||
// Active player can roll the planar die: Whenever you roll {CHAOS}, create a 7/7 colorless Eldrazi creature with annhilator 1
|
||||
addPlane(playerA, Planes.PLANE_HEDRON_FIELDS_OF_AGADEEM);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Fractured Powerstone", 1);
|
||||
|
||||
// first chaos
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{0}: Roll the planar");
|
||||
setDieRollResult(playerA, 1); // make chaos
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
//second chaos (fractured powerstone)
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Roll the planar");
|
||||
setDieRollResult(playerA, 1); // make chaos
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Eldrazi Token", 2);
|
||||
assertTappedCount("Fractured Powerstone", true, 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_FracturedPowerstone_NoCost() {
|
||||
// Active player can roll the planar die: Whenever you roll {CHAOS}, create a 7/7 colorless Eldrazi creature with annhilator 1
|
||||
addPlane(playerA, Planes.PLANE_HEDRON_FIELDS_OF_AGADEEM);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Fractured Powerstone", 1);
|
||||
|
||||
// first chaos
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{0}: Roll the planar");
|
||||
setDieRollResult(playerA, 1); // make chaos
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
//second chaos (fractured powerstone)
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Roll the planar");
|
||||
setDieRollResult(playerA, 1); // make chaos
|
||||
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
// third chaos (with additional cost)
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{0}: Roll the planar");
|
||||
setDieRollResult(playerA, 1); // make chaos
|
||||
|
||||
setStrictChooseMode(true);
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertPermanentCount(playerA, "Eldrazi Token", 3);
|
||||
assertTappedCount("Mountain", true, 1); // cost for second planar die
|
||||
}
|
||||
}
|
|
@ -51,5 +51,12 @@ public class PlanarRollWatcher extends Watcher {
|
|||
super.reset();
|
||||
numberTimesPlanarDieRolled.clear();
|
||||
}
|
||||
|
||||
public void removePlanarDieRoll(UUID playerId) {
|
||||
Integer amount = numberTimesPlanarDieRolled.get(playerId);
|
||||
if (amount != null){
|
||||
numberTimesPlanarDieRolled.put(playerId, amount-1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue