From b17d35dff3e5cab18708566295844baae615ece9 Mon Sep 17 00:00:00 2001 From: spjspj Date: Sat, 16 Dec 2017 18:04:26 +1100 Subject: [PATCH] Add 1.25 UST cards --- .../src/mage/cards/e/EarlOfSquirrel.java | 102 ++++++++++++++++++ Mage.Sets/src/mage/sets/Unstable.java | 2 + .../keyword/SquirrellinkAbility.java | 66 ++++++++++++ .../src/main/java/mage/constants/SubType.java | 3 +- .../mage/game/permanent/PermanentImpl.java | 6 ++ .../main/java/mage/players/PlayerImpl.java | 12 ++- 6 files changed, 187 insertions(+), 4 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/e/EarlOfSquirrel.java create mode 100644 Mage/src/main/java/mage/abilities/keyword/SquirrellinkAbility.java diff --git a/Mage.Sets/src/mage/cards/e/EarlOfSquirrel.java b/Mage.Sets/src/mage/cards/e/EarlOfSquirrel.java new file mode 100644 index 00000000000..26ab0455af2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EarlOfSquirrel.java @@ -0,0 +1,102 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.e; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.keyword.SquirrellinkAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.filter.predicate.permanent.TokenPredicate; +import mage.util.SubTypeList; + +/** + * + * @author spjspj + */ +public class EarlOfSquirrel extends CardImpl { + + private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("Creature tokens you control"); + + static { + filter.add(new TokenPredicate()); + filter.add(new ControllerPredicate(TargetController.YOU)); + } + + private final static FilterCreaturePermanent filter2 = new FilterCreaturePermanent("Other squirrels you control"); + + static { + filter2.add(new SubtypePredicate(SubType.SQUIRREL)); + filter2.add(new AnotherPredicate()); + filter2.add(new ControllerPredicate(TargetController.YOU)); + } + + public EarlOfSquirrel(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}"); + + this.subtype.add(SubType.SQUIRREL); + this.subtype.add(SubType.ADVISOR); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Squirrellink (Damage dealt by this creature also causes you to create that many 1/1 green Squirrel creature tokens.) + this.addAbility(SquirrellinkAbility.getInstance()); + + // Creature tokens you control are Squirrels in addition to their other creature types. + SubTypeList subTypes = new SubTypeList(); + subTypes.add(SubType.SQUIRREL); + Effect effect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, subTypes, filter, false); + effect.setText("Creature tokens you control are Squirrels in addition to their other creature types"); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); + + // Other Squirrels you control get +1/+1. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter2))); + } + + public EarlOfSquirrel(final EarlOfSquirrel card) { + super(card); + } + + @Override + public EarlOfSquirrel copy() { + return new EarlOfSquirrel(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Unstable.java b/Mage.Sets/src/mage/sets/Unstable.java index e7a07efbcec..fe31fd78449 100644 --- a/Mage.Sets/src/mage/sets/Unstable.java +++ b/Mage.Sets/src/mage/sets/Unstable.java @@ -53,6 +53,8 @@ public class Unstable extends ExpansionSet { cards.add(new SetCardInfo("Box of Free-Range Goblins", 77, Rarity.COMMON, mage.cards.b.BoxOfFreerangeGoblins.class)); cards.add(new SetCardInfo("Chittering Doom", 104, Rarity.UNCOMMON, mage.cards.c.ChitteringDoom.class)); cards.add(new SetCardInfo("Crow Storm", 31, Rarity.UNCOMMON, mage.cards.c.CrowStorm.class)); + cards.add(new SetCardInfo("Curious Killbot", 145, Rarity.COMMON, mage.cards.c.CuriousKillbot.class)); + cards.add(new SetCardInfo("Earl of Squirrel", 108, Rarity.RARE, mage.cards.e.EarlOfSquirrel.class)); cards.add(new SetCardInfo("Forest", 216, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(FrameStyle.UNH_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Garbage Elemental", 82, Rarity.UNCOMMON, mage.cards.g.GarbageElemental.class)); cards.add(new SetCardInfo("Ground Pounder", 110, Rarity.COMMON, mage.cards.g.GroundPounder.class)); diff --git a/Mage/src/main/java/mage/abilities/keyword/SquirrellinkAbility.java b/Mage/src/main/java/mage/abilities/keyword/SquirrellinkAbility.java new file mode 100644 index 00000000000..a2c1f55e389 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/keyword/SquirrellinkAbility.java @@ -0,0 +1,66 @@ +/* +* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, are +* permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this list of +* conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, this list +* of conditions and the following disclaimer in the documentation and/or other materials +* provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* The views and conclusions contained in the software and documentation are those of the +* authors and should not be interpreted as representing official policies, either expressed +* or implied, of BetaSteward_at_googlemail.com. +*/ + +package mage.abilities.keyword; + +import mage.constants.Zone; +import mage.abilities.MageSingleton; +import mage.abilities.StaticAbility; + +import java.io.ObjectStreamException; + +/** + * + * @author BetaSteward_at_googlemail.com (spjspj) + */ +public class SquirrellinkAbility extends StaticAbility implements MageSingleton { + + private static final SquirrellinkAbility instance = new SquirrellinkAbility(); + + private Object readResolve() throws ObjectStreamException { + return instance; + } + + public static SquirrellinkAbility getInstance() { + return instance; + } + + private SquirrellinkAbility() { + super(Zone.ALL, null); + } + + @Override + public String getRule() { + return "Squirrellink (Damage dealt by this creature also causes you to create that many 1/1/ green Squirrel creature tokens.)"; + } + + @Override + public SquirrellinkAbility copy() { + return instance; + } +} diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 1c10167deff..4766d9114d4 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -178,7 +178,8 @@ public enum SubType { KALEESH("Kaleesh", SubTypeSet.CreatureType, true), // Star Wars KAVU("Kavu", SubTypeSet.CreatureType), KELDOR("KelDor", SubTypeSet.CreatureType, true), - KIRIN("Kirin", SubTypeSet.CreatureType), + KILLBOT("Killbot", SubTypeSet.CreatureType, true), // Unstable + KIRIN("Kirin", SubTypeSet.CreatureType), KITHKIN("Kithkin", SubTypeSet.CreatureType), KNIGHT("Knight", SubTypeSet.CreatureType), KOBOLD("Kobold", SubTypeSet.CreatureType), diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index c30051d825d..a5e5b9d59c1 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -52,6 +52,7 @@ import mage.game.combat.CombatGroup; import mage.game.command.CommandObject; import mage.game.events.*; import mage.game.events.GameEvent.EventType; +import mage.game.permanent.token.SquirrelToken; import mage.game.stack.Spell; import mage.game.stack.StackObject; import mage.players.Player; @@ -802,6 +803,11 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { if (dealtDamageByThisTurn == null) { dealtDamageByThisTurn = new HashSet<>(); } + // Unstable ability - Earl of Squirrel + if (sourceAbilities.containsKey(SquirrellinkAbility.getInstance().getId())) { + Player player = game.getPlayer(sourceControllerId); + new SquirrelToken().putOntoBattlefield(damageDone, game, sourceId, player.getId()); + } dealtDamageByThisTurn.add(new MageObjectReference(source, game)); } if (source == null) { diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 42fc10f5533..423aee4372d 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -80,6 +80,7 @@ import mage.game.events.ZoneChangeEvent; import mage.game.match.MatchPlayer; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentCard; +import mage.game.permanent.token.SquirrelToken; import mage.game.stack.Spell; import mage.game.stack.StackAbility; import mage.game.stack.StackObject; @@ -1841,6 +1842,11 @@ public abstract class PlayerImpl implements Player, Serializable { Player player = game.getPlayer(sourceControllerId); player.gainLife(actualDamage, game); } + // Unstable ability - Earl of Squirrel + if (sourceAbilities.containsKey(SquirrellinkAbility.getInstance().getId())) { + Player player = game.getPlayer(sourceControllerId); + new SquirrelToken().putOntoBattlefield(actualDamage, game, sourceId, player.getId()); + } game.fireEvent(new DamagedPlayerEvent(playerId, sourceId, playerId, actualDamage, combatDamage)); return actualDamage; } @@ -2312,7 +2318,7 @@ public abstract class PlayerImpl implements Player, Serializable { public boolean flipCoin(Game game) { return this.flipCoin(game, null); } - + /** * @param game * @param appliedEffects @@ -2331,7 +2337,7 @@ public abstract class PlayerImpl implements Player, Serializable { } return event.getFlag(); } - + @Override public int rollDice(Game game, int numSides) { return this.rollDice(game, null, numSides); @@ -2344,7 +2350,7 @@ public abstract class PlayerImpl implements Player, Serializable { */ @Override public int rollDice(Game game, ArrayList appliedEffects, int numSides) { - int result = RandomUtil.nextInt(numSides) + 1; + int result = RandomUtil.nextInt(numSides) + 1; if (!game.isSimulation()) { game.informPlayers("[Roll a die] " + getLogName() + " rolled a " + result + " on a " + numSides + " sided dice"); }