[RIX] Added 2 cards.

This commit is contained in:
LevelX2 2017-12-24 00:36:56 +01:00
parent c5054e34c7
commit 6f8aec173d
4 changed files with 272 additions and 0 deletions

View file

@ -0,0 +1,51 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.abilities.effects.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class DestroyEquippedEffect extends OneShotEffect {
public DestroyEquippedEffect() {
super(Outcome.DestroyPermanent);
staticText = "destroy that permanent";
}
public DestroyEquippedEffect(final DestroyEquippedEffect effect) {
super(effect);
}
@Override
public DestroyEquippedEffect copy() {
return new DestroyEquippedEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
UUID uuid = getTargetPointer().getFirst(game, source);
Permanent permanent = game.getPermanent(uuid);
if (permanent == null) {
permanent = game.getPermanent(equipment.getAttachedTo());
}
if (permanent != null) {
return permanent.destroy(source.getSourceId(), game, false);
}
}
return false;
}
}