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

New Cards [CHK] Kumano, Master Yamabushi / Long-Forgotten Gohei / Terashi's Cry / Unearthly Blizzard / Yamabushi's Flame / Yamabushi's Storm

This commit is contained in:
LevelX 2011-12-26 17:39:20 +01:00
parent bbe2bbd965
commit e132eb6b69
6 changed files with 662 additions and 0 deletions

View file

@ -0,0 +1,142 @@
/*
*
* 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.sets.championsofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreatureOrPlayer;
import mage.watchers.common.DamagedByWatcher;
/**
* @author LevelX
*/
public class KumanaoMasterYamabushi extends CardImpl<KumanaoMasterYamabushi> {
private final static FilterControlledPermanent filter = new FilterControlledPermanent("a land");
static {
filter.getCardType().add(CardType.LAND);
filter.setScopeCardType(Filter.ComparisonScope.Any);
}
public KumanaoMasterYamabushi(UUID ownerId) {
super(ownerId, 176, "Kumanao, Master Yamabushi", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
this.expansionSetCode = "CHK";
this.supertype.add("Legendary");
this.subtype.add("Human");
this.subtype.add("Shaman");
this.color.setRed(true);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// {{1}{R}: Kumano, Master Yamabushi deals 1 damage to target creature or player.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{1}{R}") );
ability.addTarget(new TargetCreatureOrPlayer());
// If a creature dealt damage by Kumano this turn would die, exile it instead.
this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new KumanaoMasterYamabushiEffect()));
this.addWatcher(new DamagedByWatcher());
}
public KumanaoMasterYamabushi(final KumanaoMasterYamabushi card) {
super(card);
}
@Override
public KumanaoMasterYamabushi copy() {
return new KumanaoMasterYamabushi(this);
}
}
class KumanaoMasterYamabushiEffect extends ReplacementEffectImpl<KumanaoMasterYamabushiEffect> {
public KumanaoMasterYamabushiEffect() {
super(Duration.EndOfTurn, Outcome.Exile);
staticText = "If a creature dealt damage by {this} this turn would die, exile it instead";
}
public KumanaoMasterYamabushiEffect(final KumanaoMasterYamabushiEffect effect) {
super(effect);
}
@Override
public KumanaoMasterYamabushiEffect copy() {
return new KumanaoMasterYamabushiEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
if (permanent != null) {
return permanent.moveToExile(null, "", source.getId(), game);
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) {
DamagedByWatcher watcher =
(DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
if (watcher != null)
return watcher.damagedCreatures.contains(event.getTargetId());
}
return false;
}
}

View file

@ -0,0 +1,116 @@
/*
*
* 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.sets.championsofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.CostModificationEffectImpl;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.util.CardUtil;
/**
*
* @author Ludwig
*/
public class LongForgottenGohei extends CardImpl<LongForgottenGohei> {
private final static FilterCreaturePermanent spiritFilter = new FilterCreaturePermanent("Spirits");
static {
spiritFilter.getSubtype().add("Spirit");
}
public LongForgottenGohei(UUID ownerId) {
super(ownerId, 261, "Long-Forgotten Gohei", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "CHK";
// Arcane spells you cast cost {1} less to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LongForgottenGoheiCostReductionEffect()));
// Spirit creatures you control get +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, spiritFilter, false)));
}
public LongForgottenGohei(final LongForgottenGohei card) {
super(card);
}
@Override
public LongForgottenGohei copy() {
return new LongForgottenGohei(this);
}
}
class LongForgottenGoheiCostReductionEffect extends CostModificationEffectImpl<LongForgottenGoheiCostReductionEffect> {
LongForgottenGoheiCostReductionEffect ( ) {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "Arcane spells you cast cost {1} less to cast.";
}
LongForgottenGoheiCostReductionEffect(LongForgottenGoheiCostReductionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
SpellAbility spellAbility = (SpellAbility) abilityToModify;
CardUtil.adjustCost(spellAbility, 1);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if ( abilityToModify instanceof SpellAbility ) {
Card sourceCard = game.getCard(((SpellAbility)abilityToModify).getSourceId());
if ( sourceCard != null &&
sourceCard.getSubtype().contains("Arcane") &&
sourceCard.getOwnerId().equals(source.getControllerId()) ) {
return true;
}
}
return false;
}
@Override
public LongForgottenGoheiCostReductionEffect copy() {
return new LongForgottenGoheiCostReductionEffect(this);
}
}

View file

@ -0,0 +1,69 @@
/*
*
* 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.sets.championsofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.effects.common.TapTargetEffect;
import mage.cards.CardImpl;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX
*/
public class TerashisCry extends CardImpl<TerashisCry> {
public TerashisCry(UUID ownerId) {
super(ownerId, 47, "Terashi's Cry", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{3}{W}");
this.expansionSetCode = "CHK";
this.subtype.add("Arcane");
this.color.setWhite(true);
// Tap up to three target creatures.
Target target = new TargetCreaturePermanent(0,3);
target.setTargetName("up to three");
this.getSpellAbility().addEffect(new TapTargetEffect());
this.getSpellAbility().addTarget(target);
}
public TerashisCry(final TerashisCry card) {
super(card);
}
@Override
public TerashisCry copy() {
return new TerashisCry(this);
}
}

View file

@ -0,0 +1,95 @@
/*
*
* 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.sets.championsofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Mode;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.cards.CardImpl;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
/**
* @author LevelX
*/
public class UnearthlyBlizzard extends CardImpl<UnearthlyBlizzard> {
public UnearthlyBlizzard(UUID ownerId) {
super(ownerId, 196, "Unearthly Blizzard", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{R}");
this.expansionSetCode = "CHK";
this.subtype.add("Arcane");
this.color.setRed(true);
Target target = new TargetCreaturePermanent(0,3);
target.setTargetName("up to three");
// Up to three target creatures can't block this turn.
this.getSpellAbility().addEffect(new UnearthlyBlizzardEffect());
this.getSpellAbility().addTarget(target);
}
public UnearthlyBlizzard(final UnearthlyBlizzard card) {
super(card);
}
@Override
public UnearthlyBlizzard copy() {
return new UnearthlyBlizzard(this);
}
}
class UnearthlyBlizzardEffect extends GainAbilityTargetEffect {
public UnearthlyBlizzardEffect() {
super(CantBlockAbility.getInstance(), Constants.Duration.EndOfTurn);
staticText = "Up to three target creatures can't block this turn";
}
public UnearthlyBlizzardEffect(final UnearthlyBlizzardEffect effect) {
super(effect);
}
@Override
public UnearthlyBlizzardEffect copy() {
return new UnearthlyBlizzardEffect(this);
}
@Override
public String getText(Mode mode) {
return staticText;
}
}

View file

@ -0,0 +1,120 @@
/*
*
* 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.sets.championsofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreatureOrPlayer;
import mage.watchers.common.DamagedByWatcher;
/**
*
* @author LevelX
*/
public class YamabushisFlame extends CardImpl<YamabushisFlame> {
public YamabushisFlame(UUID ownerId) {
super(ownerId, 198, "Yamabushi's Flame", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{R}");
this.expansionSetCode = "CHK";
this.color.setRed(true);
// Yamabushi's Flame deals 3 damage to target creature or player.
this.getSpellAbility().addEffect(new DamageTargetEffect(3));
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
// If a creature dealt damage this way would die this turn, exile it instead.
this.getSpellAbility().addEffect(new YamabushisFlameEffect());
this.addWatcher(new DamagedByWatcher());
}
public YamabushisFlame(final YamabushisFlame card) {
super(card);
}
@Override
public YamabushisFlame copy() {
return new YamabushisFlame(this);
}
}
class YamabushisFlameEffect extends ReplacementEffectImpl<YamabushisFlameEffect> {
public YamabushisFlameEffect() {
super(Duration.EndOfTurn, Outcome.Exile);
staticText = "If a creature dealt damage this way would die this turn, exile it instead";
}
public YamabushisFlameEffect(final YamabushisFlameEffect effect) {
super(effect);
}
@Override
public YamabushisFlameEffect copy() {
return new YamabushisFlameEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
if (permanent != null) {
return permanent.moveToExile(null, "", source.getId(), game);
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) {
DamagedByWatcher watcher =
(DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
if (watcher != null)
return watcher.damagedCreatures.contains(event.getTargetId());
}
return false;
}
}

View file

@ -0,0 +1,120 @@
/*
*
* 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.sets.championsofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.DamageAllEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.watchers.common.DamagedByWatcher;
/**
*
* @author LevelX
*/
public class YamabushisStorm extends CardImpl<YamabushisStorm> {
public YamabushisStorm(UUID ownerId) {
super(ownerId, 199, "Yamabushi's Storm", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{R}");
this.expansionSetCode = "CHK";
this.color.setRed(true);
// Yamabushi's Storm deals 1 damage to each creature.
this.getSpellAbility().addEffect(new DamageAllEffect(1, new FilterCreaturePermanent()));
// If a creature dealt damage this way would die this turn, exile it instead.
this.getSpellAbility().addEffect(new YamabushisStormEffect());
this.addWatcher(new DamagedByWatcher());
}
public YamabushisStorm(final YamabushisStorm card) {
super(card);
}
@Override
public YamabushisStorm copy() {
return new YamabushisStorm(this);
}
}
class YamabushisStormEffect extends ReplacementEffectImpl<YamabushisStormEffect> {
public YamabushisStormEffect() {
super(Duration.EndOfTurn, Outcome.Exile);
staticText = "If a creature dealt damage this way would die this turn, exile it instead";
}
public YamabushisStormEffect(final YamabushisStormEffect effect) {
super(effect);
}
@Override
public YamabushisStormEffect copy() {
return new YamabushisStormEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
if (permanent != null) {
return permanent.moveToExile(null, "", source.getId(), game);
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) {
DamagedByWatcher watcher =
(DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
if (watcher != null)
return watcher.damagedCreatures.contains(event.getTargetId());
}
return false;
}
}