From 33901e8b3d3609312f2f15c6969ec01396b798fe Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 11 Sep 2013 17:38:43 +0200 Subject: [PATCH] [THS] Added 4 white cards. --- .../src/mage/sets/theros/FabledHero.java | 70 ++++++++++++ .../src/mage/sets/theros/FavoredHoplite.java | 72 ++++++++++++ .../sets/theros/SoldierOfThePantheon.java | 81 ++++++++++++++ .../src/mage/sets/theros/SpearOfHeliod.java | 87 +++++++++++++++ .../DamagedPlayerThisTurnPredicate.java | 105 ++++++++++++++++++ Mage/src/mage/game/Controllable.java | 1 + 6 files changed, 416 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/theros/FabledHero.java create mode 100644 Mage.Sets/src/mage/sets/theros/FavoredHoplite.java create mode 100644 Mage.Sets/src/mage/sets/theros/SoldierOfThePantheon.java create mode 100644 Mage.Sets/src/mage/sets/theros/SpearOfHeliod.java create mode 100644 Mage/src/mage/filter/predicate/permanent/DamagedPlayerThisTurnPredicate.java diff --git a/Mage.Sets/src/mage/sets/theros/FabledHero.java b/Mage.Sets/src/mage/sets/theros/FabledHero.java new file mode 100644 index 0000000000..923e8756cc --- /dev/null +++ b/Mage.Sets/src/mage/sets/theros/FabledHero.java @@ -0,0 +1,70 @@ +/* + * 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.theros; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.DoubleStrikeAbility; +import mage.abilities.keyword.HeroicAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; + +/** + * + * @author LevelX2 + */ +public class FabledHero extends CardImpl { + + public FabledHero(UUID ownerId) { + super(ownerId, 12, "Fabled Hero", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{W}{W}"); + this.expansionSetCode = "THS"; + this.subtype.add("Human"); + this.subtype.add("Soldier"); + + this.color.setWhite(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Double strike + this.addAbility(DoubleStrikeAbility.getInstance()); + // Heroic - Whenever you cast a spell that targets Fabled Hero, put a +1/+1 counter on Fabled Hero. + this.addAbility(new HeroicAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()))); + } + + public FabledHero(final FabledHero card) { + super(card); + } + + @Override + public FabledHero copy() { + return new FabledHero(this); + } +} diff --git a/Mage.Sets/src/mage/sets/theros/FavoredHoplite.java b/Mage.Sets/src/mage/sets/theros/FavoredHoplite.java new file mode 100644 index 0000000000..6f7910dcc6 --- /dev/null +++ b/Mage.Sets/src/mage/sets/theros/FavoredHoplite.java @@ -0,0 +1,72 @@ +/* + * 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.theros; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.effects.common.PreventAllDamageSourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.HeroicAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.counters.CounterType; + +/** + * + * @author LevelX2 + */ +public class FavoredHoplite extends CardImpl { + + public FavoredHoplite(UUID ownerId) { + super(ownerId, 13, "Favored Hoplite", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{W}"); + this.expansionSetCode = "THS"; + this.subtype.add("Human"); + this.subtype.add("Soldier"); + + this.color.setWhite(true); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // Heroic - Whenever you cast a spell that targets Favored Hoplite, put a +1/+1 counter on Favored Hoplite and prevent all damage that would be dealt to it this turn. + Ability ability = new HeroicAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance())); + ability.addEffect(new PreventAllDamageSourceEffect(Duration.EndOfTurn)); + this.addAbility(ability); + } + + public FavoredHoplite(final FavoredHoplite card) { + super(card); + } + + @Override + public FavoredHoplite copy() { + return new FavoredHoplite(this); + } +} diff --git a/Mage.Sets/src/mage/sets/theros/SoldierOfThePantheon.java b/Mage.Sets/src/mage/sets/theros/SoldierOfThePantheon.java new file mode 100644 index 0000000000..fce1ea7fae --- /dev/null +++ b/Mage.Sets/src/mage/sets/theros/SoldierOfThePantheon.java @@ -0,0 +1,81 @@ +/* + * 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.theros; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SpellCastOpponentTriggeredAbility; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.keyword.ProtectionAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterObject; +import mage.filter.FilterSpell; +import mage.filter.predicate.mageobject.MulticoloredPredicate; + +/** + * + * @author LevelX2 + */ +public class SoldierOfThePantheon extends CardImpl { + + private static final FilterSpell filterSpell = new FilterSpell("multicolored spell"); + private static final FilterObject filter = new FilterObject("multicolored"); + static { + filter.add(new MulticoloredPredicate()); + filterSpell.add(new MulticoloredPredicate()); + } + + public SoldierOfThePantheon(UUID ownerId) { + super(ownerId, 32, "Soldier of the Pantheon", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{W}"); + this.expansionSetCode = "THS"; + this.subtype.add("Human"); + this.subtype.add("Soldier"); + + this.color.setWhite(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Protection from multicolored + this.addAbility(new ProtectionAbility(filter)); + // Whenever an opponent casts a multicolored spell, you gain 1 life. + this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new GainLifeEffect(1), filterSpell, false)); + + } + + public SoldierOfThePantheon(final SoldierOfThePantheon card) { + super(card); + } + + @Override + public SoldierOfThePantheon copy() { + return new SoldierOfThePantheon(this); + } +} diff --git a/Mage.Sets/src/mage/sets/theros/SpearOfHeliod.java b/Mage.Sets/src/mage/sets/theros/SpearOfHeliod.java new file mode 100644 index 0000000000..5b15e6865b --- /dev/null +++ b/Mage.Sets/src/mage/sets/theros/SpearOfHeliod.java @@ -0,0 +1,87 @@ +/* + * 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.theros; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.continious.BoostControlledEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.DamagedPlayerThisTurnPredicate; +import mage.target.Target; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class SpearOfHeliod extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature that dealt damage to you this turn"); + static { + filter.add(new DamagedPlayerThisTurnPredicate(TargetController.YOU)); + } + + public SpearOfHeliod(UUID ownerId) { + super(ownerId, 33, "Spear of Heliod", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT, CardType.ARTIFACT}, "{1}{W}{W}"); + this.expansionSetCode = "THS"; + this.supertype.add("Legendary"); + + this.color.setWhite(true); + + // Creatures you control get +1/+1. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1,1, Duration.WhileOnBattlefield))); + // {1}{W}{W}, {T}: Destroy target creature that dealt damage to you this turn. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{1}{W}{W}")); + ability.addCost(new TapSourceCost()); + Target target = new TargetCreaturePermanent(filter); + target.setRequired(true); + ability.addTarget(target); + this.addAbility(ability); + + } + + public SpearOfHeliod(final SpearOfHeliod card) { + super(card); + } + + @Override + public SpearOfHeliod copy() { + return new SpearOfHeliod(this); + } +} diff --git a/Mage/src/mage/filter/predicate/permanent/DamagedPlayerThisTurnPredicate.java b/Mage/src/mage/filter/predicate/permanent/DamagedPlayerThisTurnPredicate.java new file mode 100644 index 0000000000..fcb90b1a02 --- /dev/null +++ b/Mage/src/mage/filter/predicate/permanent/DamagedPlayerThisTurnPredicate.java @@ -0,0 +1,105 @@ +/* + * 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.filter.predicate.permanent; + +import java.util.UUID; +import mage.constants.TargetController; +import mage.filter.predicate.ObjectPlayer; +import mage.filter.predicate.ObjectPlayerPredicate; +import mage.game.Controllable; +import mage.game.Game; +import mage.players.Player; +import mage.watchers.common.PlayerDamagedBySourceWatcher; + +/** + * + * @author LevelX2 + */ + +public class DamagedPlayerThisTurnPredicate implements ObjectPlayerPredicate> { + + private TargetController controller; + + public DamagedPlayerThisTurnPredicate(TargetController controller) { + this.controller = controller; + } + + @Override + public boolean apply(ObjectPlayer input, Game game) { + Controllable object = input.getObject(); + UUID playerId = input.getPlayerId(); + + switch (controller) { + case YOU: + PlayerDamagedBySourceWatcher watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource",playerId); + if (watcher != null && watcher.damageSources.contains(object.getId())) { + return true; + } + break; + case OPPONENT: + for (UUID opponentId : game.getOpponents(playerId)) { + watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource",opponentId); + if (watcher != null && watcher.damageSources.contains(object.getId())) { + return true; + } + } + break; + case NOT_YOU: + Player you = game.getPlayer(playerId); + if (you != null) { + for (UUID notYouId : you.getInRange()) { + if (!notYouId.equals(playerId)) { + watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource",notYouId); + if (watcher != null && watcher.damageSources.contains(object.getId())) { + return true; + } + } + } + } + break; + case ANY: + you = game.getPlayer(playerId); + if (you != null) { + for (UUID anyId : you.getInRange()) { + watcher = (PlayerDamagedBySourceWatcher) game.getState().getWatchers().get("PlayerDamagedBySource",anyId); + if (watcher != null && watcher.damageSources.contains(object.getId())) { + return true; + } + } + } + return true; + } + + return false; + } + + @Override + public String toString() { + return "Damaged player (" + controller.toString() + ')'; + } +} diff --git a/Mage/src/mage/game/Controllable.java b/Mage/src/mage/game/Controllable.java index 7d678297d1..3822544d6a 100644 --- a/Mage/src/mage/game/Controllable.java +++ b/Mage/src/mage/game/Controllable.java @@ -35,4 +35,5 @@ import java.util.UUID; */ public interface Controllable { UUID getControllerId(); + UUID getId(); }