mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
- Added Volrath's Dungeon.
This commit is contained in:
parent
d397c8126a
commit
21c6afa1c7
3 changed files with 325 additions and 175 deletions
132
Mage.Sets/src/mage/cards/v/VolrathsDungeon.java
Normal file
132
Mage.Sets/src/mage/cards/v/VolrathsDungeon.java
Normal file
|
@ -0,0 +1,132 @@
|
|||
package mage.cards.v;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.DiscardCardCost;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DestroySourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class VolrathsDungeon extends CardImpl {
|
||||
|
||||
public VolrathsDungeon(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}");
|
||||
|
||||
// Pay 5 life: Destroy Volrath's Dungeon. Any player may activate this ability but only during his or her turn.
|
||||
ActivatedAbility ability = new SimpleActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new DestroySourceEffect().setText("Destroy {this}. Any player may activate this ability but only during his or her turn."),
|
||||
new PayLifeActivePlayerCost(5));
|
||||
ability.setMayActivate(TargetController.ACTIVE);
|
||||
this.addAbility(ability);
|
||||
|
||||
// Discard a card: Target player puts a card from his or her hand on top of his or her library. Activate this ability only any time you could cast a sorcery.
|
||||
FilterCard filter = new FilterCard("a card for payment");
|
||||
Ability ability2 = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new VolrathsDungeonEffect(), new DiscardCardCost(filter));
|
||||
ability2.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability2);
|
||||
}
|
||||
|
||||
public VolrathsDungeon(final VolrathsDungeon card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VolrathsDungeon copy() {
|
||||
return new VolrathsDungeon(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PayLifeActivePlayerCost extends CostImpl {
|
||||
|
||||
private final DynamicValue amount;
|
||||
|
||||
public PayLifeActivePlayerCost(int amount) {
|
||||
this.amount = new StaticValue(amount);
|
||||
this.text = "Pay " + Integer.toString(amount) + " life";
|
||||
}
|
||||
|
||||
public PayLifeActivePlayerCost(DynamicValue amount, String text) {
|
||||
this.amount = amount.copy();
|
||||
this.text = "Pay " + text;
|
||||
}
|
||||
|
||||
public PayLifeActivePlayerCost(PayLifeActivePlayerCost cost) {
|
||||
super(cost);
|
||||
this.amount = cost.amount.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
|
||||
int lifeToPayAmount = amount.calculate(game, ability, null);
|
||||
return game.getPlayer(game.getActivePlayerId()).getLife() >= lifeToPayAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
int lifeToPayAmount = amount.calculate(game, ability, null);
|
||||
Player activatingPlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activatingPlayer != null
|
||||
&& activatingPlayer.chooseUse(Outcome.LoseLife, "Do you wish to pay + lifeToPayAmount + life?", ability, game)) {
|
||||
this.paid = game.getPlayer(game.getActivePlayerId()).loseLife(lifeToPayAmount, game, false) == lifeToPayAmount;
|
||||
}
|
||||
return paid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayLifeActivePlayerCost copy() {
|
||||
return new PayLifeActivePlayerCost(this);
|
||||
}
|
||||
}
|
||||
|
||||
class VolrathsDungeonEffect extends OneShotEffect {
|
||||
|
||||
public VolrathsDungeonEffect() {
|
||||
super(Outcome.Detriment);
|
||||
this.staticText = "Target player puts a card from his or her hand on top of his or her library";
|
||||
}
|
||||
|
||||
public VolrathsDungeonEffect(final VolrathsDungeonEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VolrathsDungeonEffect copy() {
|
||||
return new VolrathsDungeonEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player targetedPlayer = game.getPlayer(source.getFirstTarget());
|
||||
if (targetedPlayer != null) {
|
||||
TargetCardInHand target = new TargetCardInHand();
|
||||
if (targetedPlayer.choose(Outcome.Detriment, targetedPlayer.getHand(), target, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
return targetedPlayer.putCardOnTopXOfLibrary(card, game, source, 0);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -154,6 +154,7 @@ public final class Exodus extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Treasure Hunter", 23, Rarity.UNCOMMON, mage.cards.t.TreasureHunter.class));
|
||||
cards.add(new SetCardInfo("Treasure Trove", 50, Rarity.UNCOMMON, mage.cards.t.TreasureTrove.class));
|
||||
cards.add(new SetCardInfo("Vampire Hounds", 77, Rarity.COMMON, mage.cards.v.VampireHounds.class));
|
||||
cards.add(new SetCardInfo("Volrath's Dungeon", 78, Rarity.RARE, mage.cards.v.VolrathsDungeon.class));
|
||||
cards.add(new SetCardInfo("Wall of Nets", 24, Rarity.RARE, mage.cards.w.WallOfNets.class));
|
||||
cards.add(new SetCardInfo("Wayward Soul", 51, Rarity.COMMON, mage.cards.w.WaywardSoul.class));
|
||||
cards.add(new SetCardInfo("Welkin Hawk", 25, Rarity.COMMON, mage.cards.w.WelkinHawk.class));
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -154,13 +153,19 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
|
|||
@Override
|
||||
public ActivationStatus canActivate(UUID playerId, Game game) {
|
||||
//20091005 - 602.2
|
||||
if (!(hasMoreActivationsThisTurn(game) && (condition == null || condition.apply(game, this)))) {
|
||||
if (!(hasMoreActivationsThisTurn(game)
|
||||
&& (condition == null
|
||||
|| condition.apply(game, this)))) {
|
||||
return ActivationStatus.getFalse();
|
||||
}
|
||||
switch (mayActivate) {
|
||||
case ANY:
|
||||
break;
|
||||
|
||||
case ACTIVE:
|
||||
if (game.getActivePlayerId() != playerId) {
|
||||
return ActivationStatus.getFalse();
|
||||
}
|
||||
break;
|
||||
case NOT_YOU:
|
||||
if (controlsAbility(playerId, game)) {
|
||||
return ActivationStatus.getFalse();
|
||||
|
@ -198,9 +203,17 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
|
|||
return ActivationStatus.getFalse();
|
||||
}
|
||||
//20091005 - 602.5d/602.5e
|
||||
MageObjectReference permittingObject = game.getContinuousEffects().asThough(sourceId, AsThoughEffectType.ACTIVATE_AS_INSTANT, this, controllerId, game);
|
||||
if (timing == TimingRule.INSTANT || game.canPlaySorcery(playerId) || null != permittingObject) {
|
||||
if (costs.canPay(this, sourceId, playerId, game) && canChooseTarget(game)) {
|
||||
MageObjectReference permittingObject = game.getContinuousEffects()
|
||||
.asThough(sourceId,
|
||||
AsThoughEffectType.ACTIVATE_AS_INSTANT,
|
||||
this,
|
||||
controllerId,
|
||||
game);
|
||||
if (timing == TimingRule.INSTANT
|
||||
|| game.canPlaySorcery(playerId)
|
||||
|| null != permittingObject) {
|
||||
if (costs.canPay(this, sourceId, playerId, game)
|
||||
&& canChooseTarget(game)) {
|
||||
this.activatorId = playerId;
|
||||
return new ActivationStatus(true, permittingObject);
|
||||
}
|
||||
|
@ -297,8 +310,10 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
|
|||
}
|
||||
|
||||
protected ActivationInfo getActivationInfo(Game game) {
|
||||
Integer turnNum = (Integer) game.getState().getValue(CardUtil.getCardZoneString("activationsTurn" + originalId, sourceId, game));
|
||||
Integer activationCount = (Integer) game.getState().getValue(CardUtil.getCardZoneString("activationsCount" + originalId, sourceId, game));
|
||||
Integer turnNum = (Integer) game.getState()
|
||||
.getValue(CardUtil.getCardZoneString("activationsTurn" + originalId, sourceId, game));
|
||||
Integer activationCount = (Integer) game.getState()
|
||||
.getValue(CardUtil.getCardZoneString("activationsCount" + originalId, sourceId, game));
|
||||
if (turnNum == null || activationCount == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -306,7 +321,9 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
|
|||
}
|
||||
|
||||
protected void setActivationInfo(ActivationInfo activationInfo, Game game) {
|
||||
game.getState().setValue(CardUtil.getCardZoneString("activationsTurn" + originalId, sourceId, game), activationInfo.turnNum);
|
||||
game.getState().setValue(CardUtil.getCardZoneString("activationsCount" + originalId, sourceId, game), activationInfo.activationCounter);
|
||||
game.getState().setValue(CardUtil
|
||||
.getCardZoneString("activationsTurn" + originalId, sourceId, game), activationInfo.turnNum);
|
||||
game.getState().setValue(CardUtil
|
||||
.getCardZoneString("activationsCount" + originalId, sourceId, game), activationInfo.activationCounter);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue