diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/KamiOfTheHonoredDead.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/KamiOfTheHonoredDead.java new file mode 100644 index 0000000000..f6b866b577 --- /dev/null +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/KamiOfTheHonoredDead.java @@ -0,0 +1,137 @@ +/* + * 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.betrayersofkamigawa; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.SoulshiftAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.players.Player; + +/** + * + * @author LevelX + */ +public class KamiOfTheHonoredDead extends CardImpl<KamiOfTheHonoredDead> { + + public KamiOfTheHonoredDead(UUID ownerId) { + super(ownerId, 12, "Kami of the Honored Dead", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{W}{W}"); + this.expansionSetCode = "BOK"; + this.subtype.add("Spirit"); + this.color.setWhite(true); + this.power = new MageInt(3); + this.toughness = new MageInt(5); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever Kami of the Honored Dead is dealt damage, you gain that much life. + this.addAbility(new KamiOfTheHonoredDeadTriggeredAbility()); + // Soulshift 6 (When this creature dies, you may return target Spirit card with converted mana cost 6 or less from your graveyard to your hand.) + this.addAbility(new SoulshiftAbility(6)); + } + + public KamiOfTheHonoredDead(final KamiOfTheHonoredDead card) { + super(card); + } + + @Override + public KamiOfTheHonoredDead copy() { + return new KamiOfTheHonoredDead(this); + } +} + +class KamiOfTheHonoredDeadTriggeredAbility extends TriggeredAbilityImpl<KamiOfTheHonoredDeadTriggeredAbility> { + + public KamiOfTheHonoredDeadTriggeredAbility() { + super(Constants.Zone.BATTLEFIELD, new KamiOfTheHonoredDeadGainLifeEffect()); + } + + public KamiOfTheHonoredDeadTriggeredAbility(final KamiOfTheHonoredDeadTriggeredAbility effect) { + super(effect); + } + + @Override + public KamiOfTheHonoredDeadTriggeredAbility copy() { + return new KamiOfTheHonoredDeadTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) { + this.getEffects().get(0).setValue("damageAmount", event.getAmount()); + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} is dealt damage, " + super.getRule(); + } +} + + +class KamiOfTheHonoredDeadGainLifeEffect extends OneShotEffect<KamiOfTheHonoredDeadGainLifeEffect> { + + public KamiOfTheHonoredDeadGainLifeEffect() { + super(Outcome.GainLife); + staticText = "you gain that much life"; + } + + public KamiOfTheHonoredDeadGainLifeEffect(final KamiOfTheHonoredDeadGainLifeEffect effect) { + super(effect); + } + + @Override + public KamiOfTheHonoredDeadGainLifeEffect copy() { + return new KamiOfTheHonoredDeadGainLifeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + player.gainLife((Integer) this.getValue("damageAmount"), game); + } + return true; + } + + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/HeartbeatOfSpring.java b/Mage.Sets/src/mage/sets/championsofkamigawa/HeartbeatOfSpring.java new file mode 100644 index 0000000000..b2f000f801 --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/HeartbeatOfSpring.java @@ -0,0 +1,186 @@ +/* + * 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.Constants.Zone; +import mage.Mana; +import mage.abilities.Abilities; +import mage.abilities.Ability; +import mage.abilities.effects.common.ManaEffect; +import mage.abilities.mana.ManaAbility; +import mage.abilities.mana.TriggeredManaAbility; +import mage.cards.CardImpl; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author Loki + */ +public class HeartbeatOfSpring extends CardImpl<HeartbeatOfSpring> { + + public HeartbeatOfSpring (UUID ownerId) { + super(ownerId, 212, "Heartbeat of Spring", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); + this.expansionSetCode = "CHK"; + this.color.setGreen(true); + // Whenever a player taps a land for mana, that player adds one mana to his or her mana pool of any type that land produced. + this.addAbility(new HeartbeatOfSpringAbility()); + } + + public HeartbeatOfSpring (final HeartbeatOfSpring card) { + super(card); + } + + @Override + public HeartbeatOfSpring copy() { + return new HeartbeatOfSpring(this); + } + +} + +class HeartbeatOfSpringAbility extends TriggeredManaAbility<HeartbeatOfSpringAbility> { + + private static final String staticText = "Whenever a player taps a land for mana, that player adds one mana to his or her mana pool of any type that land produced."; + + public HeartbeatOfSpringAbility() { + super(Zone.BATTLEFIELD, new HeartbeatOfSpringEffect()); + } + + public HeartbeatOfSpringAbility(HeartbeatOfSpringAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA ) { + Permanent permanent = game.getPermanent(event.getSourceId()); + if (permanent == null) { + permanent = (Permanent) game.getLastKnownInformation(event.getSourceId(), Zone.BATTLEFIELD); + } + if (permanent != null && permanent.getCardType().contains(CardType.LAND)) { + getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); + return true; + } + } + return false; + } + + @Override + public HeartbeatOfSpringAbility copy() { + return new HeartbeatOfSpringAbility(this); + } + + @Override + public String getRule() { + return staticText; + } +} + +class HeartbeatOfSpringEffect extends ManaEffect<HeartbeatOfSpringEffect> { + + public HeartbeatOfSpringEffect() { + super(); + staticText = "that player adds one mana to his or her mana pool of any type that land produced"; + } + + public HeartbeatOfSpringEffect(final HeartbeatOfSpringEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent land = game.getPermanent(this.targetPointer.getFirst(source)); + Abilities<ManaAbility> mana = land.getAbilities().getManaAbilities(Zone.BATTLEFIELD); + Mana types = new Mana(); + for (ManaAbility ability: mana) { + types.add(ability.getNetMana(game)); + } + Choice choice = new ChoiceImpl(true); + choice.setMessage("Pick a mana color"); + if (types.getBlack() > 0) + choice.getChoices().add("Black"); + if (types.getRed() > 0) + choice.getChoices().add("Red"); + if (types.getBlue() > 0) + choice.getChoices().add("Blue"); + if (types.getGreen() > 0) + choice.getChoices().add("Green"); + if (types.getWhite() > 0) + choice.getChoices().add("White"); + if (types.getColorless() > 0) + choice.getChoices().add("Colorless"); + if (choice.getChoices().size() > 0) { + Player player = game.getPlayer(source.getControllerId()); + if (choice.getChoices().size() == 1) + choice.setChoice(choice.getChoices().iterator().next()); + else + player.choose(outcome, choice, game); + if (choice.getChoice().equals("Black")) { + player.getManaPool().addMana(Mana.BlackMana, game, source); + return true; + } + else if (choice.getChoice().equals("Blue")) { + player.getManaPool().addMana(Mana.BlueMana, game, source); + return true; + } + else if (choice.getChoice().equals("Red")) { + player.getManaPool().addMana(Mana.RedMana, game, source); + return true; + } + else if (choice.getChoice().equals("Green")) { + player.getManaPool().addMana(Mana.GreenMana, game, source); + return true; + } + else if (choice.getChoice().equals("White")) { + player.getManaPool().addMana(Mana.WhiteMana, game, source); + return true; + } + else if (choice.getChoice().equals("Colorless")) { + player.getManaPool().addMana(Mana.ColorlessMana, game, source); + return true; + } + } + return true; + } + + @Override + public HeartbeatOfSpringEffect copy() { + return new HeartbeatOfSpringEffect(this); + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/JuganTheRisingStar.java b/Mage.Sets/src/mage/sets/championsofkamigawa/JuganTheRisingStar.java new file mode 100644 index 0000000000..1103b9e86f --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/JuganTheRisingStar.java @@ -0,0 +1,112 @@ +/* + * 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.Outcome; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.counters.Counter; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.Target; +import mage.target.common.TargetCreaturePermanentAmount; + +/** + * @author LevelX + */ +public class JuganTheRisingStar extends CardImpl<JuganTheRisingStar> { + + public JuganTheRisingStar(UUID ownerId) { + super(ownerId, 217, "Jugan, the Rising Star", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{G}{G}{G}"); + this.expansionSetCode = "CHK"; + this.supertype.add("Legendary"); + this.subtype.add("Dragon"); + this.subtype.add("Spirit"); + this.color.setGreen(true); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + // Flying + this.addAbility(FlyingAbility.getInstance()); + // When Jugan, the Rising Star dies, you may distribute five +1/+1 counters among any number of target creatures. + Ability ability = new DiesTriggeredAbility(new JuganTheRisingStarMultiEffect(), true); + ability.addTarget(new TargetCreaturePermanentAmount(5)); + this.addAbility(ability); + } + + public JuganTheRisingStar(final JuganTheRisingStar card) { + super(card); + } + + @Override + public JuganTheRisingStar copy() { + return new JuganTheRisingStar(this); + } + +} + +class JuganTheRisingStarMultiEffect extends OneShotEffect<JuganTheRisingStarMultiEffect> { + + public JuganTheRisingStarMultiEffect() { + super(Outcome.BoostCreature); + this.staticText = "you may distribute five +1/+1 counters among any number of target creatures"; + } + + public JuganTheRisingStarMultiEffect(final JuganTheRisingStarMultiEffect effect) { + super(effect); + } + + @Override + public JuganTheRisingStarMultiEffect copy() { + return new JuganTheRisingStarMultiEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if (source.getTargets().size() > 0) { + Target multiTarget = source.getTargets().get(0); + for (UUID target: multiTarget.getTargets()) { + Permanent permanent = game.getPermanent(target); + if (permanent != null) { + permanent.addCounters(CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game); + } + } + } + return true; + } + +} diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/KitsuneRiftwalker.java b/Mage.Sets/src/mage/sets/championsofkamigawa/KitsuneRiftwalker.java new file mode 100644 index 0000000000..c352a40e27 --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/KitsuneRiftwalker.java @@ -0,0 +1,74 @@ +/* + * 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.MageInt; +import mage.abilities.keyword.ProtectionAbility; +import mage.cards.CardImpl; +import mage.filter.Filter.ComparisonScope; +import mage.filter.FilterCard; + +/** + * + * @author LevelX + */ +public class KitsuneRiftwalker extends CardImpl<KitsuneRiftwalker> { + + private final static FilterCard filter = new FilterCard("Spirits and from Arcane"); + + static { + filter.getSubtype().add("Arcane"); + filter.getSubtype().add("Spirit"); + filter.setScopeSubtype(ComparisonScope.Any); + } + + public KitsuneRiftwalker(UUID ownerId) { + super(ownerId, 29, "Kitsune Riftwalker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{W}{W}"); + this.expansionSetCode = "CHK"; + this.subtype.add("Fox"); + this.subtype.add("Wizard"); + this.color.setWhite(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Protection from Spirits and from Arcane + this.addAbility(new ProtectionAbility(filter)); + } + + public KitsuneRiftwalker(final KitsuneRiftwalker card) { + super(card); + } + + @Override + public KitsuneRiftwalker copy() { + return new KitsuneRiftwalker(this); + } +} diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/KumanaoMasterYamabushi.java b/Mage.Sets/src/mage/sets/championsofkamigawa/KumanoMasterYamabushi.java similarity index 92% rename from Mage.Sets/src/mage/sets/championsofkamigawa/KumanaoMasterYamabushi.java rename to Mage.Sets/src/mage/sets/championsofkamigawa/KumanoMasterYamabushi.java index 47d768e144..ff7df7259d 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/KumanaoMasterYamabushi.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/KumanoMasterYamabushi.java @@ -55,10 +55,12 @@ import mage.game.permanent.Permanent; import mage.target.common.TargetCreatureOrPlayer; import mage.watchers.common.DamagedByWatcher; + + /** * @author LevelX */ -public class KumanaoMasterYamabushi extends CardImpl<KumanaoMasterYamabushi> { +public class KumanoMasterYamabushi extends CardImpl<KumanoMasterYamabushi> { private final static FilterControlledPermanent filter = new FilterControlledPermanent("a land"); @@ -67,8 +69,8 @@ public class KumanaoMasterYamabushi extends CardImpl<KumanaoMasterYamabushi> { filter.setScopeCardType(Filter.ComparisonScope.Any); } - public KumanaoMasterYamabushi(UUID ownerId) { - super(ownerId, 176, "Kumanao, Master Yamabushi", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); + public KumanoMasterYamabushi(UUID ownerId) { + super(ownerId, 176, "Kumano, Master Yamabushi", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); this.expansionSetCode = "CHK"; this.supertype.add("Legendary"); this.subtype.add("Human"); @@ -86,18 +88,16 @@ public class KumanaoMasterYamabushi extends CardImpl<KumanaoMasterYamabushi> { this.addWatcher(new DamagedByWatcher()); } - public KumanaoMasterYamabushi(final KumanaoMasterYamabushi card) { + public KumanoMasterYamabushi(final KumanoMasterYamabushi card) { super(card); } @Override - public KumanaoMasterYamabushi copy() { - return new KumanaoMasterYamabushi(this); + public KumanoMasterYamabushi copy() { + return new KumanoMasterYamabushi(this); } } - - class KumanaoMasterYamabushiEffect extends ReplacementEffectImpl<KumanaoMasterYamabushiEffect> { public KumanaoMasterYamabushiEffect() { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfInfiniteRage.java b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfInfiniteRage.java index 13f115e0ab..c5925f6d1d 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfInfiniteRage.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/MyojinOfInfiniteRage.java @@ -65,7 +65,7 @@ public class MyojinOfInfiniteRage extends CardImpl<MyojinOfInfiniteRage> { this.color.setRed(true); this.power = new MageInt(7); - this.toughness = new MageInt(7); + this.toughness = new MageInt(4); this.addWatcher(new CastFromHandWatcher()); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/MysticRestraints.java b/Mage.Sets/src/mage/sets/championsofkamigawa/MysticRestraints.java new file mode 100644 index 0000000000..a33ebb3e99 --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/MysticRestraints.java @@ -0,0 +1,112 @@ +/* + * 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.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.SkipEnchantedUntapEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * @author LevelX + */ +public class MysticRestraints extends CardImpl<MysticRestraints> { + + public MysticRestraints(UUID ownerId) { + super(ownerId, 76, "Mystic Restraints", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}{U}"); + this.expansionSetCode = "CHK"; + this.subtype.add("Aura"); + + this.color.setBlue(true); + + // Flash + this.addAbility(FlashAbility.getInstance()); + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + // When Claustrophobia enters the battlefield, tap enchanted creature. + this.addAbility(new EntersBattlefieldTriggeredAbility(new MysticRestraintsEffect())); + // Enchanted creature doesn't untap during its controller's untap step. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SkipEnchantedUntapEffect())); + } + + public MysticRestraints(final MysticRestraints card) { + super(card); + } + + @Override + public MysticRestraints copy() { + return new MysticRestraints(this); + } +} + +class MysticRestraintsEffect extends OneShotEffect<MysticRestraintsEffect> { + MysticRestraintsEffect() { + super(Constants.Outcome.Tap); + staticText = "tap enchanted creature"; + } + + MysticRestraintsEffect(final MysticRestraintsEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent enchantment = game.getPermanent(source.getSourceId()); + if (enchantment != null && enchantment.getAttachedTo() != null) { + Permanent permanent = game.getPermanent(enchantment.getAttachedTo()); + if (permanent != null) { + return permanent.tap(game); + } + } + return false; + } + + @Override + public MysticRestraintsEffect copy() { + return new MysticRestraintsEffect(); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/NezumiBoneReader.java b/Mage.Sets/src/mage/sets/championsofkamigawa/NezumiBoneReader.java new file mode 100644 index 0000000000..ae332ff571 --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/NezumiBoneReader.java @@ -0,0 +1,76 @@ +/* + * 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.Constants.Zone; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DiscardTargetEffect; +import mage.cards.CardImpl; +import mage.target.TargetPlayer; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LevelX + */ +public class NezumiBoneReader extends CardImpl<NezumiBoneReader> { + + public NezumiBoneReader (UUID ownerId) { + super(ownerId, 127, "Nezumi Bone Reader", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "CHK"; + this.subtype.add("Rat"); + this.subtype.add("Shaman"); + this.color.setBlack(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + // {B}, Sacrifice a creature: Target player discards a card. Activate this ability only any time you could cast a sorcery. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1),new SacrificeTargetCost(new TargetControlledCreaturePermanent())); + ability.addCost(new ManaCostsImpl("{B}")); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + } + + public NezumiBoneReader (final NezumiBoneReader card) { + super(card); + } + + @Override + public NezumiBoneReader copy() { + return new NezumiBoneReader(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/NineRingedBo.java b/Mage.Sets/src/mage/sets/championsofkamigawa/NineRingedBo.java new file mode 100644 index 0000000000..c154ac3a36 --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/NineRingedBo.java @@ -0,0 +1,134 @@ +/* + * 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.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.filter.Filter.ComparisonScope; +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.target.common.TargetCreaturePermanent; +import mage.watchers.common.DamagedByWatcher; + +/** + * + * @author LevelX + */ +public class NineRingedBo extends CardImpl<NineRingedBo> { + + private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("spirit"); + + static { + filter.getSubtype().add("Spirit"); + filter.setScopeSubtype(ComparisonScope.Any); + } + + public NineRingedBo(UUID ownerId) { + super(ownerId, 263, "Nine-Ringed Bo", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{3}"); + this.expansionSetCode = "CHK"; + + // {T}: Nine-Ringed Bo deals 1 damage to target Spirit creature. If that creature would die this turn, exile it instead. + Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost()); + ability.addTarget(new TargetCreaturePermanent(filter)); + // If that creature would die this turn, exile it instead. + this.addAbility(ability); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new NineRingedBoEffect())); + + this.addWatcher(new DamagedByWatcher()); + + } + + public NineRingedBo(final NineRingedBo card) { + super(card); + } + + @Override + public NineRingedBo copy() { + return new NineRingedBo(this); + } +} + + class NineRingedBoEffect extends ReplacementEffectImpl<NineRingedBoEffect> { + + public NineRingedBoEffect() { + super(Duration.EndOfTurn, Outcome.Exile); + staticText = "If that creature would die this turn, exile it instead"; + } + + public NineRingedBoEffect(final NineRingedBoEffect effect) { + super(effect); + } + + @Override + public NineRingedBoEffect copy() { + return new NineRingedBoEffect(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; + } + +} + + diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/SamuraiOfThePaleCurtain.java b/Mage.Sets/src/mage/sets/championsofkamigawa/SamuraiOfThePaleCurtain.java new file mode 100644 index 0000000000..277319a91d --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/SamuraiOfThePaleCurtain.java @@ -0,0 +1,123 @@ +/* + * 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.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.keyword.BushidoAbility; +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; + +/** + * + * @author LevelX + */ +public class SamuraiOfThePaleCurtain extends CardImpl<SamuraiOfThePaleCurtain> { + + public SamuraiOfThePaleCurtain (UUID ownerId) { + super(ownerId, 43, "Samurai of the Pale Curtain", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{W}{W}"); + this.expansionSetCode = "CHK"; + this.subtype.add("Fox"); + this.subtype.add("Samurai"); + this.color.setWhite(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + // Bushido 1 (When this blocks or becomes blocked, it gets +1/+1 until end of turn.) + this.addAbility(new BushidoAbility(1)); + // If a permanent would be put into a graveyard, exile it instead. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SamuraiOfThePaleCurtainEffect())); + + } + + public SamuraiOfThePaleCurtain (final SamuraiOfThePaleCurtain card) { + super(card); + } + + @Override + public SamuraiOfThePaleCurtain copy() { + return new SamuraiOfThePaleCurtain(this); + } + +} + + +class SamuraiOfThePaleCurtainEffect extends ReplacementEffectImpl<SamuraiOfThePaleCurtainEffect> { + + public SamuraiOfThePaleCurtainEffect() { + super(Duration.EndOfTurn, Outcome.Exile); + staticText = "If a permanent would be put into a graveyard, exile it instead"; + } + + public SamuraiOfThePaleCurtainEffect(final SamuraiOfThePaleCurtainEffect effect) { + super(effect); + } + + @Override + public SamuraiOfThePaleCurtainEffect copy() { + return new SamuraiOfThePaleCurtainEffect(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 zEvent = (ZoneChangeEvent)event; + if (zEvent.getToZone() == Zone.GRAVEYARD) { + return true; + } + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/SenseiGoldenTail.java b/Mage.Sets/src/mage/sets/championsofkamigawa/SenseiGoldenTail.java new file mode 100644 index 0000000000..fa66b48a82 --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/SenseiGoldenTail.java @@ -0,0 +1,98 @@ +/* + * 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.Duration; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continious.AddCardSubTypeTargetEffect; +import mage.abilities.effects.common.continious.GainAbilityTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.keyword.BushidoAbility; +import mage.cards.CardImpl; +import mage.counters.Counter; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX + */ +public class SenseiGoldenTail extends CardImpl<SenseiGoldenTail> { + + public SenseiGoldenTail (UUID ownerId) { + super(ownerId, 44, "Sensei Golden-Tail", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{W}"); + this.supertype.add("Legendary"); + this.expansionSetCode = "CHK"; + this.subtype.add("Fox"); + this.subtype.add("Samurai"); + this.color.setWhite(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + // Bushido 1 (When this blocks or becomes blocked, it gets +1/+1 until end of turn.) + this.addAbility(new BushidoAbility(1)); + // {1}{W}, {T}: Put a training counter on target creature. + Ability ability = new ActivateAsSorceryActivatedAbility(Constants.Zone.BATTLEFIELD, new AddCountersTargetEffect(new TrainingCounter()), new ManaCostsImpl("{1}{W}")); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetCreaturePermanent()); + // That creature gains bushido 1 and becomes a Samurai in addition to its other creature types. Activate this ability only any time you could cast a sorcery. + ability.addEffect(new GainAbilityTargetEffect(new BushidoAbility(1),Duration.WhileOnBattlefield)); + ability.addEffect(new AddCardSubTypeTargetEffect("Samurai",Duration.WhileOnBattlefield)); + this.addAbility(ability); + } + + public SenseiGoldenTail (final SenseiGoldenTail card) { + super(card); + } + + @Override + public SenseiGoldenTail copy() { + return new SenseiGoldenTail(this); + } + +} + + +class TrainingCounter extends Counter<TrainingCounter> { + + public TrainingCounter() { + this(1); + } + + public TrainingCounter(int amount) { + super("training"); + this.count = amount; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/TenzaGodosMaul.java b/Mage.Sets/src/mage/sets/championsofkamigawa/TenzaGodosMaul.java new file mode 100644 index 0000000000..d9ff72f79e --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/TenzaGodosMaul.java @@ -0,0 +1,106 @@ +/* + * + * 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.AttachmentType; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.EquippedMatchesFilterCondition; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.decorator.ConditionalStaticAbility; +import mage.abilities.effects.common.continious.BoostEnchantedEffect; +import mage.abilities.effects.common.continious.BoostEquippedEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.filter.Filter; +import mage.filter.common.FilterCreaturePermanent; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LevelX + */ + +public class TenzaGodosMaul extends CardImpl<TenzaGodosMaul> { + + private static final String rule1 = "As long as it's legendary, it gets an additional +2/+2"; + private static final String rule2 = "As long as it's red, it has trample."; + + private final static FilterCreaturePermanent legendaryFilter = new FilterCreaturePermanent("legendary"); + private final static FilterCreaturePermanent redFilter = new FilterCreaturePermanent("red"); + + static { + legendaryFilter.getSupertype().add("Legendary"); + legendaryFilter.setScopeSupertype(Filter.ComparisonScope.Any); + redFilter.getColor().setRed(true); + redFilter.setUseColor(true); + redFilter.setScopeColor(Filter.ComparisonScope.Any); + } + + public TenzaGodosMaul(UUID ownerId) { + super(ownerId, 271, "Tenza, Godo's Maul", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{3}"); + this.expansionSetCode = "CHK"; + this.supertype.add("Legendary"); + this.subtype.add("Equipment"); + + // Equipped creature gets +1/+1. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1))); + // As long as it's legendary, it gets an additional +2/+2. + this.addAbility(new ConditionalStaticAbility( + Constants.Zone.BATTLEFIELD, + new BoostEnchantedEffect(2, 2, Constants.Duration.WhileOnBattlefield), + new EquippedMatchesFilterCondition(legendaryFilter), rule1)); + // As long as it's red, it has trample. + this.addAbility(new ConditionalStaticAbility( + Constants.Zone.BATTLEFIELD, + new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.EQUIPMENT), + new EquippedMatchesFilterCondition(redFilter), rule2)); + // Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.) + this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new GenericManaCost(1), new TargetControlledCreaturePermanent())); + + } + + public TenzaGodosMaul(final TenzaGodosMaul card) { + super(card); + } + + @Override + public TenzaGodosMaul copy() { + return new TenzaGodosMaul(this); + } +} + + diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/UnearthlyBlizzard.java b/Mage.Sets/src/mage/sets/championsofkamigawa/UnearthlyBlizzard.java index c10cf4e40b..b433ed3810 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/UnearthlyBlizzard.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/UnearthlyBlizzard.java @@ -39,6 +39,7 @@ import mage.abilities.Mode; import mage.abilities.common.CantBlockAbility; import mage.abilities.effects.common.continious.GainAbilityTargetEffect; import mage.cards.CardImpl; +import mage.filter.common.FilterCreaturePermanent; import mage.target.Target; import mage.target.common.TargetCreaturePermanent; @@ -54,7 +55,7 @@ public class UnearthlyBlizzard extends CardImpl<UnearthlyBlizzard> { this.color.setRed(true); Target target = new TargetCreaturePermanent(0,3); - target.setTargetName("up to three"); + target.setTargetName("Select up to three creatures that can't block this turn."); // Up to three target creatures can't block this turn. this.getSpellAbility().addEffect(new UnearthlyBlizzardEffect()); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/WickedAkuba.java b/Mage.Sets/src/mage/sets/championsofkamigawa/WickedAkuba.java new file mode 100644 index 0000000000..d5f501fde9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/WickedAkuba.java @@ -0,0 +1,127 @@ +/* + * 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.Constants.Zone; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ColoredManaCost; +//import mage.abilities.effects.common.continious.GainAbilitySourceEffect; +import mage.abilities.effects.common.LoseLifeTargetEffect; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.target.TargetPlayer; +import mage.target.common.TargetOpponent; +import mage.watchers.common.PlayerDamagedByWatcher; + +/** + * + * @author LevelX + */ +public class WickedAkuba extends CardImpl<WickedAkuba> { + + public WickedAkuba(UUID ownerId) { + super(ownerId, 150, "Wicked Akuba", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{B}{B}"); + this.expansionSetCode = "CHK"; + this.subtype.add("Spirit"); + + this.color.setBlack(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // {B}: Target player dealt damage by Wicked Akuba this turn loses 1 life. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LoseLifeTargetEffect(1), new ColoredManaCost(Constants.ColoredManaSymbol.B)); + ability.addTarget(new WickedAkubaTarget()); + this.addAbility(ability); + // watcher to know if player was damaged by this Wicked Akuba + this.addWatcher(new PlayerDamagedByWatcher()); + } + + public WickedAkuba(final WickedAkuba card) { + super(card); + } + + @Override + public WickedAkuba copy() { + return new WickedAkuba(this); + } + +} + +class WickedAkubaTarget extends TargetPlayer<TargetOpponent> { + + public WickedAkubaTarget() { + super(); + this.targetName = "player dealt damage by Wicked Akuba this turn"; + } + + public WickedAkubaTarget(final WickedAkubaTarget target) { + super(target); + } + + @Override + public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) { + filter.getPlayerId().clear(); + PlayerDamagedByWatcher watcher = (PlayerDamagedByWatcher) game.getState().getWatchers().get("PlayerDamagedByWatcher", sourceId); + if (watcher != null) { + for (UUID playerId: game.getPlayer(sourceControllerId).getInRange()){ + if (watcher.damagedPlayers.contains(playerId)) + filter.getPlayerId().add(playerId); + } + if (filter.getPlayerId().isEmpty()) // neccessary because empty playerId filter allows all players + return false; + } + return super.canChoose(sourceId, sourceControllerId, game); + } + + @Override + public boolean canTarget(UUID id, Ability source, Game game) { + filter.getPlayerId().clear(); + PlayerDamagedByWatcher watcher = (PlayerDamagedByWatcher) game.getState().getWatchers().get("PlayerDamagedByWatcher", source.getSourceId()); + if (watcher != null) { + for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()){ + if (watcher.damagedPlayers.contains(playerId)) + filter.getPlayerId().add(playerId); + } + if (filter.getPlayerId().isEmpty()) // neccessary because empty playerId filter allows all players + return false; + } + return super.canTarget(id, source, game); + } + + @Override + public WickedAkubaTarget copy() { + return new WickedAkubaTarget(this); + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/YoseiTheMorningStar.java b/Mage.Sets/src/mage/sets/championsofkamigawa/YoseiTheMorningStar.java new file mode 100644 index 0000000000..96601a1e9e --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/YoseiTheMorningStar.java @@ -0,0 +1,180 @@ +/* + * 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.Outcome; +import mage.Constants.PhaseStep; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.filter.FilterPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.turn.TurnMod; +import mage.players.Player; +import mage.target.Target; +import mage.target.TargetPermanent; +import mage.target.TargetPlayer; +import mage.target.Targets; + +/** + * + * @author LevelX + */ +public class YoseiTheMorningStar extends CardImpl<YoseiTheMorningStar> { + + public YoseiTheMorningStar(UUID ownerId) { + super(ownerId, 50, "Yosei, the Morning Star", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{W}{W}"); + this.expansionSetCode = "CHK"; + this.subtype.add("Dragon"); + this.subtype.add("Spirit"); + this.color.setWhite(true); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // When Yosei, the Morning Star dies, target player skips his or her next untap step. Tap up to five target permanents that player controls. + Ability ability = new DiesTriggeredAbility(new SkipNextUntapStepTargetEffect()); + ability.addTarget(new TargetPlayer()); + ability.addTarget(new YoseiTheMorningStarTarget()); + ability.addEffect(new YoseiTheMorningStarTapEffect()); + this.addAbility(ability); + } + + public YoseiTheMorningStar(final YoseiTheMorningStar card) { + super(card); + } + + @Override + public YoseiTheMorningStar copy() { + return new YoseiTheMorningStar(this); + } +} + +class SkipNextUntapStepTargetEffect extends OneShotEffect<SkipNextUntapStepTargetEffect> { + + public SkipNextUntapStepTargetEffect() { + super(Constants.Outcome.Detriment); + staticText = "target player skips his or her next untap step"; + } + + public SkipNextUntapStepTargetEffect(SkipNextUntapStepTargetEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + UUID playerId = source.getFirstTarget(); + if (playerId != null) { + game.getState().getTurnMods().add(new TurnMod(playerId, PhaseStep.UNTAP)); + return true; + } + return false; + } + + @Override + public SkipNextUntapStepTargetEffect copy() { + return new SkipNextUntapStepTargetEffect(); + } +} + + class YoseiTheMorningStarTarget extends TargetPermanent { + + public YoseiTheMorningStarTarget() { + super(0, 5, new FilterPermanent("up to five target permanents that player controls that will be tapped"), false); + } + + public YoseiTheMorningStarTarget(final YoseiTheMorningStarTarget target) { + super(target); + } + + @Override + public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) { + Player player = game.getPlayer(source.getFirstTarget()); + if (player != null) { + filter.getControllerId().clear(); + filter.getControllerId().add(player.getId()); + return super.canTarget(controllerId, id, source, game); + } + return false; + } + + @Override + public YoseiTheMorningStarTarget copy() { + return new YoseiTheMorningStarTarget(this); + } + +} + +class YoseiTheMorningStarTapEffect extends OneShotEffect<YoseiTheMorningStarTapEffect> { + + public YoseiTheMorningStarTapEffect() { + super(Outcome.Tap); + staticText = "Tap up to five target permanents that player controls"; + } + + public YoseiTheMorningStarTapEffect(final YoseiTheMorningStarTapEffect effect) { + super(effect); + } + + @Override + public YoseiTheMorningStarTapEffect copy() { + return new YoseiTheMorningStarTapEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Targets targets = source.getTargets(); + Target target1 = targets.get(1); + for (UUID target: target1.getTargets()) { + Permanent permanent = game.getPermanent(target); + if (permanent != null) { + permanent.tap(game); + } else { + return false; + } + } + return true; + } + + @Override + public String getText(Mode mode) { + return staticText; + } + +} diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/DescendantOfSoramaro.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/DescendantOfSoramaro.java new file mode 100644 index 0000000000..86f51ffbe9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/DescendantOfSoramaro.java @@ -0,0 +1,67 @@ +/* + * 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.saviorsofkamigawa; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.CardsInControllerHandCount; +import mage.abilities.effects.common.LookLibraryControllerEffect; +import mage.cards.CardImpl; + +/** + * + * @author LevelX + */ +public class DescendantOfSoramaro extends CardImpl<DescendantOfSoramaro> { + + public DescendantOfSoramaro(UUID ownerId) { + super(ownerId, 33, "Descendant of Soramaro", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{U}"); + this.expansionSetCode = "SOK"; + this.subtype.add("Human"); + this.subtype.add("Wizard"); + this.color.setBlue(true); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + // {1}{U}: Look at the top X cards of your library, where X is the number of cards in your hand, then put them back in any order. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new LookLibraryControllerEffect(new CardsInControllerHandCount(), false), new ManaCostsImpl("{1}{U}"))); + } + + public DescendantOfSoramaro(final DescendantOfSoramaro card) { + super(card); + } + + @Override + public DescendantOfSoramaro copy() { + return new DescendantOfSoramaro(this); + } +} diff --git a/Mage/src/mage/abilities/condition/common/EquippedMatchesFilterCondition.java b/Mage/src/mage/abilities/condition/common/EquippedMatchesFilterCondition.java new file mode 100644 index 0000000000..982c5bca76 --- /dev/null +++ b/Mage/src/mage/abilities/condition/common/EquippedMatchesFilterCondition.java @@ -0,0 +1,64 @@ +/* + * 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.condition.common; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + + +/** + * Describes condition when equipped permanent has superType + * + * @author LevelX + */ +public class EquippedMatchesFilterCondition implements Condition { + + private FilterCreaturePermanent filter; + + public EquippedMatchesFilterCondition(FilterCreaturePermanent filter) { + this.filter = filter; + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId()); + if (permanent != null && permanent.getAttachedTo() != null) { + Permanent attachedTo = game.getBattlefield().getPermanent(permanent.getAttachedTo()); + if (attachedTo != null) { + if (filter.match(attachedTo, attachedTo.getId(),attachedTo.getControllerId(), game)) { + return true; + } + + } + } + return false; + } +} diff --git a/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java b/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java index c737e544f4..ad1afd85f5 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/CardsInControllerHandCount.java @@ -8,9 +8,11 @@ import mage.players.Player; public class CardsInControllerHandCount implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility) { - Player controller = game.getPlayer(sourceAbility.getControllerId()); - if (controller != null) { - return controller.getHand().size(); + if (sourceAbility != null) { + Player controller = game.getPlayer(sourceAbility.getControllerId()); + if (controller != null) { + return controller.getHand().size(); + } } return 0; } diff --git a/Mage/src/mage/abilities/effects/common/LookLibraryControllerEffect.java b/Mage/src/mage/abilities/effects/common/LookLibraryControllerEffect.java index e7ff33ef2d..5d59b2945c 100644 --- a/Mage/src/mage/abilities/effects/common/LookLibraryControllerEffect.java +++ b/Mage/src/mage/abilities/effects/common/LookLibraryControllerEffect.java @@ -34,6 +34,8 @@ import mage.Constants.Zone; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.SpellAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.Cards; @@ -50,7 +52,7 @@ import mage.target.TargetCard; */ public class LookLibraryControllerEffect extends OneShotEffect<LookLibraryControllerEffect> { - private int numberOfCards; + private DynamicValue numberOfCards; private boolean mayShuffleAfter; public LookLibraryControllerEffect() { @@ -60,8 +62,16 @@ public class LookLibraryControllerEffect extends OneShotEffect<LookLibraryContro public LookLibraryControllerEffect(int numberOfCards) { this(numberOfCards, false); } + + public LookLibraryControllerEffect(DynamicValue numberOfCards) { + this(numberOfCards, false); + } public LookLibraryControllerEffect(int numberOfCards, boolean mayShuffleAfter) { + this(new StaticValue(numberOfCards), mayShuffleAfter); + } + + public LookLibraryControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter) { super(Outcome.Benefit); this.numberOfCards = numberOfCards; this.mayShuffleAfter = mayShuffleAfter; @@ -69,7 +79,7 @@ public class LookLibraryControllerEffect extends OneShotEffect<LookLibraryContro public LookLibraryControllerEffect(final LookLibraryControllerEffect effect) { super(effect); - this.numberOfCards = effect.numberOfCards; + this.numberOfCards = effect.numberOfCards.clone(); this.mayShuffleAfter = effect.mayShuffleAfter; } @@ -99,7 +109,7 @@ public class LookLibraryControllerEffect extends OneShotEffect<LookLibraryContro } Cards cards = new CardsImpl(Zone.PICK); - int count = Math.min(player.getLibrary().size(), this.numberOfCards); + int count = Math.min(player.getLibrary().size(), this.numberOfCards.calculate(game, source)); for (int i = 0; i < count; i++) { Card card = player.getLibrary().removeFromTop(game); if (card != null) { @@ -134,8 +144,12 @@ public class LookLibraryControllerEffect extends OneShotEffect<LookLibraryContro @Override public String getText(Mode mode) { + int number = numberOfCards.calculate(null, null); StringBuilder sb = new StringBuilder("Look at the top "); - switch(this.numberOfCards) { + switch(number) { + case 0: + sb.append(" X "); + break; case 1: sb.append("card "); break; @@ -152,14 +166,16 @@ public class LookLibraryControllerEffect extends OneShotEffect<LookLibraryContro sb.append("five"); break; default: - sb.append(this.numberOfCards); + sb.append(number); break; } - if (this.numberOfCards > 1) + if (number != 1) sb.append(" cards "); sb.append("of your Library"); - if (this.numberOfCards > 1) + if (number == 0) + sb.append(", where {X} is the number of cards ").append(numberOfCards.getMessage()); + if (number > 1) sb.append(", then put them back in any order"); if (this.mayShuffleAfter) sb.append(". You may shuffle your library"); diff --git a/Mage/src/mage/watchers/common/PlayerDamagedByWatcher.java b/Mage/src/mage/watchers/common/PlayerDamagedByWatcher.java new file mode 100644 index 0000000000..2c97067561 --- /dev/null +++ b/Mage/src/mage/watchers/common/PlayerDamagedByWatcher.java @@ -0,0 +1,75 @@ +/* + * Copyright 2011 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.watchers.common; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import mage.Constants.WatcherScope; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.watchers.WatcherImpl; + +/** + * + * @author LevelX + */ +public class PlayerDamagedByWatcher extends WatcherImpl<PlayerDamagedByWatcher> { + + public List<UUID> damagedPlayers = new ArrayList<UUID>(); + + public PlayerDamagedByWatcher() { + super("PlayerDamagedByWatcher", WatcherScope.CARD); + } + + public PlayerDamagedByWatcher(final PlayerDamagedByWatcher watcher) { + super(watcher); + this.damagedPlayers = watcher.damagedPlayers; + } + + @Override + public PlayerDamagedByWatcher copy() { + return new PlayerDamagedByWatcher(this); + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() == EventType.DAMAGED_PLAYER) { + if (sourceId.equals(event.getSourceId()) && !damagedPlayers.contains(event.getTargetId())) { + damagedPlayers.add(event.getTargetId()); + } + } + } + + @Override + public void reset() { + super.reset(); + damagedPlayers.clear(); + } +}