Implemented Shanna, Sisay's Legacy

This commit is contained in:
Evan Kranzler 2018-04-17 23:45:51 -04:00
parent 02efffe2a2
commit 61853f96e4
2 changed files with 141 additions and 0 deletions

View file

@ -0,0 +1,140 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.Card;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
/**
*
* @author TheElk801
*/
public class ShannaSisaysLegacy extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creatures you control");
public ShannaSisaysLegacy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Shanna, Sisay's Legacy can't be the target of abilities your opponents control.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ShannaSisaysLegacyEffect()));
// Shanna gets +1/+1 for each creature you control.
DynamicValue value = new PermanentsOnBattlefieldCount(filter);
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new BoostSourceEffect(value, value, Duration.WhileOnBattlefield)
.setText("{this} gets +1/+1 for each creature you control")
));
}
public ShannaSisaysLegacy(final ShannaSisaysLegacy card) {
super(card);
}
@Override
public ShannaSisaysLegacy copy() {
return new ShannaSisaysLegacy(this);
}
}
class ShannaSisaysLegacyEffect extends ContinuousRuleModifyingEffectImpl {
public ShannaSisaysLegacyEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
staticText = "{this} can't be the target of abilities your opponents control";
}
public ShannaSisaysLegacyEffect(final ShannaSisaysLegacyEffect effect) {
super(effect);
}
@Override
public ShannaSisaysLegacyEffect copy() {
return new ShannaSisaysLegacyEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public String getInfoMessage(Ability source, GameEvent event, Game game) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null) {
return sourcePermanent.getLogName() + " can't be the target of abilities you control";
}
return null;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TARGET;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Card targetCard = game.getCard(event.getTargetId());
StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId());
if (targetCard != null && stackObject != null && targetCard.getId().equals(source.getSourceId())) {
if (stackObject instanceof Ability) {
if (!stackObject.getControllerId().equals(source.getControllerId())) {
return true;
}
}
}
return false;
}
}

View file

@ -237,6 +237,7 @@ public class Dominaria extends ExpansionSet {
cards.add(new SetCardInfo("Serra Disciple", 34, Rarity.COMMON, mage.cards.s.SerraDisciple.class));
cards.add(new SetCardInfo("Settle the Score", 103, Rarity.UNCOMMON, mage.cards.s.SettleTheScore.class));
cards.add(new SetCardInfo("Shalai, Voice of Plenty", 35, Rarity.RARE, mage.cards.s.ShalaiVoiceOfPlenty.class));
cards.add(new SetCardInfo("Shanna, Sisay's Legacy", 204, Rarity.UNCOMMON, mage.cards.s.ShannaSisaysLegacy.class));
cards.add(new SetCardInfo("Shivan Fire", 142, Rarity.COMMON, mage.cards.s.ShivanFire.class));
cards.add(new SetCardInfo("Short Sword", 229, Rarity.COMMON, mage.cards.s.ShortSword.class));
cards.add(new SetCardInfo("Siege-Gang Commander", 143, Rarity.RARE, mage.cards.s.SiegeGangCommander.class));