forked from External/mage
98 lines
3.2 KiB
Java
98 lines
3.2 KiB
Java
|
|
package mage.cards.s;
|
|
|
|
import java.util.UUID;
|
|
|
|
import mage.MageObject;
|
|
import mage.abilities.TriggeredAbilityImpl;
|
|
import mage.abilities.common.SimpleStaticAbility;
|
|
import mage.abilities.costs.mana.GenericManaCost;
|
|
import mage.abilities.effects.common.CreateTokenEffect;
|
|
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
|
import mage.abilities.keyword.EquipAbility;
|
|
import mage.cards.CardImpl;
|
|
import mage.cards.CardSetInfo;
|
|
import mage.constants.CardType;
|
|
import mage.constants.Outcome;
|
|
import mage.constants.SubType;
|
|
import mage.constants.Zone;
|
|
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.game.permanent.token.SpiritWhiteToken;
|
|
import mage.target.common.TargetControlledCreaturePermanent;
|
|
|
|
/**
|
|
*
|
|
* @author fireshoes
|
|
*/
|
|
public final class SlayersPlate extends CardImpl {
|
|
|
|
public SlayersPlate(UUID ownerId, CardSetInfo setInfo) {
|
|
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
|
|
this.subtype.add(SubType.EQUIPMENT);
|
|
|
|
// Equipped creature gets +4/+2.
|
|
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(4, 2)));
|
|
|
|
// Whenever equipped creature dies, if it was a Human, create a 1/1 white Spirit creature token with flying.
|
|
this.addAbility(new SlayersPlateTriggeredAbility());
|
|
|
|
// Equip {3}
|
|
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(3), new TargetControlledCreaturePermanent(), false));
|
|
}
|
|
|
|
private SlayersPlate(final SlayersPlate card) {
|
|
super(card);
|
|
}
|
|
|
|
@Override
|
|
public SlayersPlate copy() {
|
|
return new SlayersPlate(this);
|
|
}
|
|
}
|
|
|
|
class SlayersPlateTriggeredAbility extends TriggeredAbilityImpl {
|
|
|
|
public SlayersPlateTriggeredAbility() {
|
|
super(Zone.BATTLEFIELD, new CreateTokenEffect(new SpiritWhiteToken()));
|
|
setLeavesTheBattlefieldTrigger(true);
|
|
}
|
|
|
|
private SlayersPlateTriggeredAbility(final SlayersPlateTriggeredAbility ability) {
|
|
super(ability);
|
|
}
|
|
|
|
@Override
|
|
public SlayersPlateTriggeredAbility copy() {
|
|
return new SlayersPlateTriggeredAbility(this);
|
|
}
|
|
|
|
@Override
|
|
public boolean checkEventType(GameEvent event, Game game) {
|
|
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
|
}
|
|
|
|
@Override
|
|
public boolean checkTrigger(GameEvent event, Game game) {
|
|
if (((ZoneChangeEvent) event).isDiesEvent()) {
|
|
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
|
if (permanent.getAttachments().contains(this.getSourceId()) && permanent.hasSubtype(SubType.HUMAN, game)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public String getRule() {
|
|
return "Whenever equipped creature dies, if it was a Human, create a 1/1 white Spirit creature token with flying.";
|
|
}
|
|
|
|
@Override
|
|
public boolean isInUseableZone(Game game, MageObject sourceObject, GameEvent event) {
|
|
return TriggeredAbilityImpl.isInUseableZoneDiesTrigger(this, sourceObject, event, game);
|
|
}
|
|
}
|