[M12][10E] Sengir Vampire

This commit is contained in:
magenoxx 2011-08-20 22:59:49 +04:00
parent 5231aa2dd3
commit b8076aa1d3
5 changed files with 206 additions and 0 deletions

View file

@ -0,0 +1,54 @@
/*
* 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.magic2012;
import java.util.UUID;
import mage.Constants.Rarity;
/**
*
* @author nantuko
*/
public class SengirVampire extends mage.sets.tenth.SengirVampire {
public SengirVampire(UUID ownerId) {
super(ownerId);
this.cardNumber = 107;
this.expansionSetCode = "M12";
this.rarity = Rarity.UNCOMMON;
}
public SengirVampire(final SengirVampire card) {
super(card);
}
@Override
public SengirVampire copy() {
return new SengirVampire(this);
}
}

View file

@ -0,0 +1,80 @@
/*
* 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.tenth;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.DiesAndDealtDamageThisTurnTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author nantuko
*/
public class SengirVampire extends CardImpl<SengirVampire> {
public SengirVampire(UUID ownerId) {
super(ownerId, 176, "Sengir Vampire", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.expansionSetCode = "10E";
this.subtype.add("Vampire");
this.color.setBlack(true);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
this.addAbility(FlyingAbility.getInstance());
// Whenever a creature dealt damage by Sengir Vampire this turn dies, put a +1/+1 counter on Sengir Vampire.
this.addAbility(new DiesAndDealtDamageThisTurnTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance())));
}
public SengirVampire(final SengirVampire card) {
super(card);
}
@Override
public SengirVampire copy() {
return new SengirVampire(this);
}
}

View file

@ -0,0 +1,44 @@
package mage.abilities.common;
import mage.Constants;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
public class DiesAndDealtDamageThisTurnTriggeredAbility extends TriggeredAbilityImpl<DiesAndDealtDamageThisTurnTriggeredAbility> {
public DiesAndDealtDamageThisTurnTriggeredAbility(Effect effect) {
super(Constants.Zone.BATTLEFIELD, effect);
}
public DiesAndDealtDamageThisTurnTriggeredAbility(final DiesAndDealtDamageThisTurnTriggeredAbility ability) {
super(ability);
}
@Override
public DiesAndDealtDamageThisTurnTriggeredAbility copy() {
return new DiesAndDealtDamageThisTurnTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Constants.Zone.BATTLEFIELD && zEvent.getToZone() == Constants.Zone.GRAVEYARD) {
Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD);
if (p.getDealtDamageByThisTurn().contains(this.sourceId)) {
return true;
}
}
}
return false;
}
@Override
public String getRule() {
return "Whenever a creature dealt damage by {this} this turn dies, " + super.getRule();
}
}

View file

@ -112,6 +112,12 @@ public interface Permanent extends Card {
public boolean removeFromCombat(Game game);
public boolean isDeathtouched();
/**
* Returns the list of sources that dealt damage this turn to this permanent
* @return
*/
public List<UUID> getDealtDamageByThisTurn();
/**
* Imprint some other card to this one.
*

View file

@ -45,6 +45,7 @@ import mage.game.events.GameEvent.EventType;
import mage.players.Player;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
@ -73,8 +74,11 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
protected List<UUID> attachments = new ArrayList<UUID>();
protected List<UUID> imprinted = new ArrayList<UUID>();
protected List<UUID> connectedCards = new ArrayList<UUID>();
protected List<UUID> dealtDamageByThisTurn;
protected UUID attachedTo;
private static final List<UUID> emptyList = Collections.unmodifiableList(new ArrayList<UUID>());
public PermanentImpl(UUID ownerId, UUID controllerId, String name) {
super(ownerId, name);
this.originalControllerId = controllerId;
@ -115,6 +119,12 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
for (UUID connectedCardId : permanent.connectedCards) {
this.connectedCards.add(connectedCardId);
}
if (permanent.dealtDamageByThisTurn != null) {
dealtDamageByThisTurn = new ArrayList<UUID>();
for (UUID sourceId : permanent.dealtDamageByThisTurn) {
this.dealtDamageByThisTurn.add(sourceId);
}
}
this.attachedTo = permanent.attachedTo;
}
@ -197,6 +207,7 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
this.loyaltyUsed = false;
this.turnsOnBattlefield++;
this.deathtouched = false;
dealtDamageByThisTurn = null;
for (Ability ability : this.abilities) {
ability.reset(game);
}
@ -501,6 +512,10 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
if (source != null && source.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
deathtouched = true;
}
if (dealtDamageByThisTurn == null) {
dealtDamageByThisTurn = new ArrayList<UUID>();
}
dealtDamageByThisTurn.add(sourceId);
}
}
return damageDone;
@ -709,4 +724,11 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
return this.imprinted;
}
@Override
public List<UUID> getDealtDamageByThisTurn() {
if (dealtDamageByThisTurn == null) {
return emptyList;
}
return dealtDamageByThisTurn;
}
}