1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-05 09:12:29 -09:00

implemented Eternalize Ability + Steadfast Sentinel

This commit is contained in:
igoudt 2017-06-19 01:03:12 +02:00
parent 441e96ebcc
commit d63b241d54
4 changed files with 197 additions and 4 deletions
Mage.Sets/src/mage
Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords
Mage/src/main/java/mage/abilities/keyword

View file

@ -0,0 +1,39 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.EternalizeAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import java.util.UUID;
public class SteadfastSentinel extends CardImpl {
public SteadfastSentinel(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
subtype.add("Human");
subtype.add("Cleric");
power = new MageInt(2);
toughness = new MageInt(3);
//Vigilance
addAbility(VigilanceAbility.getInstance());
//Eternalize {4}{W}{W}
addAbility(new EternalizeAbility(new ManaCostsImpl("{4}{W}{W}"), this));
}
public SteadfastSentinel(final SteadfastSentinel card) {
super(card);
}
@Override
public SteadfastSentinel copy() {
return new SteadfastSentinel(this);
}
}

View file

@ -27,17 +27,17 @@
*/
package mage.sets;
import java.util.ArrayList;
import java.util.List;
import mage.cards.ExpansionSet;
import mage.constants.Rarity;
import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.constants.Rarity;
import mage.constants.SetType;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author fireshoes
*/
public class HourOfDevastation extends ExpansionSet {
@ -81,6 +81,7 @@ public class HourOfDevastation extends ExpansionSet {
cards.add(new SetCardInfo("Open Fire", 105, Rarity.COMMON, mage.cards.o.OpenFire.class));
cards.add(new SetCardInfo("Ramunap Excavator", 129, Rarity.RARE, mage.cards.r.RamunapExcavator.class));
cards.add(new SetCardInfo("Samut, the Tested", 144, Rarity.MYTHIC, mage.cards.s.SamutTheTested.class));
cards.add(new SetCardInfo("Steadfast Sentinel", 24, Rarity.COMMON, mage.cards.s.SteadfastSentinel.class));
cards.add(new SetCardInfo("Supreme Will", 49, Rarity.UNCOMMON, mage.cards.s.SupremeWill.class));
}

View file

@ -0,0 +1,25 @@
package org.mage.test.cards.abilities.keywords;
import mage.abilities.keyword.VigilanceAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
public class EternalizeTest extends CardTestPlayerBase {
private String sentinel = "Steadfast Sentinel";
@Test
public void testEternalize() {
addCard(Zone.GRAVEYARD, playerA, sentinel, 1);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 10);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Eternalize");
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertPermanentCount(playerA, sentinel, 1);
assertPowerToughness(playerA, sentinel, 4, 4);
assertAbility(playerA, sentinel, VigilanceAbility.getInstance(), true);
}
}

View file

@ -0,0 +1,128 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.keyword;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.ExileSourceFromGraveCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.TimingRule;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.EmptyToken;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
* @author igoudt
*/
public class EternalizeAbility extends ActivatedAbilityImpl {
private String rule;
public EternalizeAbility(Cost cost, Card card) {
super(Zone.GRAVEYARD, new EternalizeEffect(), cost);
addCost(new ExileSourceFromGraveCost());
this.rule = setRule(cost, card);
this.timing = TimingRule.SORCERY;
setRule(cost, card);
}
public EternalizeAbility(final EternalizeAbility ability) {
super(ability);
this.rule = ability.rule;
}
@Override
public EternalizeAbility copy() {
return new EternalizeAbility(this);
}
@Override
public String getRule() {
return rule;
}
private String setRule(Cost cost, Card card) {
StringBuilder sb = new StringBuilder("Eternalize ").append(cost.getText());
sb.append(" <i>(").append(cost.getText());
sb.append(", Exile this card from your graveyard: Create a token that's a copy of it, except it's a 4/4 black Zombie ");
for (String subtype : card.getSubtype(null)) {
sb.append(subtype).append(" ");
}
sb.append(" with no mana cost. Eternalize only as a sorcery.)</i>");
return sb.toString();
}
}
class EternalizeEffect extends OneShotEffect {
public EternalizeEffect() {
super(Outcome.PutCreatureInPlay);
}
public EternalizeEffect(final EternalizeEffect effect) {
super(effect);
}
@Override
public EternalizeEffect copy() {
return new EternalizeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && card != null) {
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(card); // needed so that entersBattlefied triggered abilities see the attributes (e.g. Master Biomancer)
token.getColor(game).setColor(ObjectColor.BLACK);
if (!token.getSubtype(game).contains("Zombie")) {
token.getSubtype(game).add(0, "Zombie");
}
token.getManaCost().clear();
token.getPower().modifyBaseValue(4);
token.getToughness().modifyBaseValue(4);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EMBALMED_CREATURE, token.getId(), source.getSourceId(), controller.getId()));
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, false, null);
// Probably it makes sense to remove also the Embalm ability (it's not shown on the token cards).
// Also it can never get active or? But it's not mentioned in the reminder text.
return true;
}
return false;
}
}