Implementing Snow Mercy (HHO) - Christmas Special Occasion card

This commit is contained in:
spjspj 2018-02-08 01:14:25 +11:00
parent b924f4bb6b
commit 7dcbc0f441
6 changed files with 202 additions and 1 deletions

View file

@ -0,0 +1,173 @@
/*
* 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.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.TapAllEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author spjspj
*/
public class SnowMercy extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with globe counters on them");
static {
filter.add(new CounterPredicate(CounterType.GLOBE));
}
public SnowMercy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
addSuperType(SuperType.SNOW);
// Whenever a creature deals damage to you, put a globe counter on it.
this.addAbility(new AddGlobeCountersAbility());
// {t},{q},{t},{q},{t}: Tap all creatures with globe counters on them.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapAllEffect(filter), new SnowMercyCost());
this.addAbility(ability);
}
public SnowMercy(final SnowMercy card) {
super(card);
}
@Override
public SnowMercy copy() {
return new SnowMercy(this);
}
}
class AddGlobeCountersAbility extends TriggeredAbilityImpl {
public AddGlobeCountersAbility() {
super(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.GLOBE.createInstance()));
}
public AddGlobeCountersAbility(final AddGlobeCountersAbility ability) {
super(ability);
}
@Override
public AddGlobeCountersAbility copy() {
return new AddGlobeCountersAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())) {
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null && permanent.isCreature()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
}
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever a creature deals damage to you, put a globe counter on it.";
}
}
class SnowMercyCost extends CostImpl {
SnowMercyCost() {
this.text = "{t}, {q}, {t}, {q}, {t}";
}
SnowMercyCost(final SnowMercyCost cost) {
super(cost);
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
Player controller = game.getPlayer(controllerId);
Permanent permanent = game.getPermanent(sourceId);
if (controller != null && permanent != null) {
// Tap, Untap, Tap, Untap, Tap:
if (!permanent.isTapped() && permanent.tap(game)) {
if (permanent.isTapped() && permanent.untap(game)) {
if (!permanent.isTapped() && permanent.tap(game)) {
if (permanent.isTapped() && permanent.untap(game)) {
if (!permanent.isTapped() && permanent.tap(game)) {
paid = true;
}
}
}
}
}
}
return paid;
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null) {
return !permanent.isTapped();
}
return false;
}
@Override
public SnowMercyCost copy() {
return new SnowMercyCost(this);
}
}

View file

@ -0,0 +1,24 @@
package mage.sets;
import mage.cards.ExpansionSet;
import mage.constants.Rarity;
import mage.constants.SetType;
/**
*
* @author spjspj
*/
public class HappyHolidays extends ExpansionSet {
private static final HappyHolidays instance = new HappyHolidays();
public static HappyHolidays getInstance() {
return instance;
}
private HappyHolidays() {
super("Happy Holidays", "HHO", ExpansionSet.buildDate(2006, 12, 31), SetType.JOKESET);
cards.add(new SetCardInfo("Snow Mercy", 10, Rarity.RARE, mage.cards.s.SnowMercy.class));
}
}

View file

@ -70,6 +70,7 @@ public enum CounterType {
FURY("fury"),
FUNGUS("fungus"),
FUSE("fuse"),
GLOBE("globe"),
GOLD("gold"),
GROWTH("growth"),
HATCHLING("hatchling"),

View file

@ -89,6 +89,7 @@ Gatecrash|Gatecrash|
Grand Prix|GrandPrix|
Guildpact|Guildpact|
Guru|Guru|
Happy Holidays|HappyHolidays|
HASCON Promo 2017|HasconPromo2017|
Heroes of the Realm|HeroesOfTheRealm|
Homelands|Homelands|
@ -196,4 +197,4 @@ World Magic Cup Qualifier|WorldMagicCupQualifier|
Worldwake|Worldwake|
WPN Gateway|WPNGateway|
Zendikar|Zendikar|
Zendikar Expeditions|ZendikarExpeditions|
Zendikar Expeditions|ZendikarExpeditions|

View file

@ -33074,3 +33074,4 @@ Rock Lobster|Unglued|79|C|{4}|Artifact Creature - Lobster|4|3| Creatures named S
Scissors Lizard|Unglued|80|C|{4}|Artifact Creature - Lizard|4|3| Creatures named Paper Tiger can't attack or block.|
Spatula of the Ages|Unglued|81|U|{4}|Artifact|||{4}, {T}, Sacrifice Spatula of the Ages: You may put a silver-bordered permanent card from your hand onto the battlefield.|
Urza's Science Fair Project|Unglued|83|U|{6}|Artifact Creature - Construct|4|4| {2}: Roll a six-sided die. Urza's Science Fair Project gets the indicated result. 1 - It gets -2/-2 until end of turn. 2 - Prevent all combat damage it would deal this turn. 3 - It gains vigilance until end of turn. 4 - It gains first strike until end of turn. 5 - It gains flying until end of turn. 6 - It gets +2/+2 until end of turn.|
Snow Mercy|Happy Holidays|10|R|{2}{W}{W}|Snow Enchantment|||Whenever a creature deals damage to you, put a globe counter on it.${t},{untap},{t},{untap},{t}: Tap all creatures with globe counters on them.|

View file

@ -206,3 +206,4 @@ Worldwake|WWK|
Ixalan|XLN|
Zendikar|ZEN|
Star Wars|SWS|
Happy Holidays|HHO|