forked from External/mage
Fix Deadshot by using common effect class (#10158)
This commit is contained in:
parent
abedc6fe8f
commit
1bfb339d57
1 changed files with 3 additions and 39 deletions
|
|
@ -2,23 +2,18 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.other.AnotherTargetPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.SecondTargetPointer;
|
||||
import mage.abilities.effects.common.DamageWithPowerFromOneToAnotherTargetEffect;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
* @author fireshoes, xenohedron
|
||||
*/
|
||||
public final class Deadshot extends CardImpl {
|
||||
|
||||
|
|
@ -38,7 +33,7 @@ public final class Deadshot extends CardImpl {
|
|||
this.getSpellAbility().addTarget(target);
|
||||
|
||||
// It deals damage equal to its power to another target creature.
|
||||
this.getSpellAbility().addEffect(new DeadshotDamageEffect());
|
||||
this.getSpellAbility().addEffect(new DamageWithPowerFromOneToAnotherTargetEffect("It"));
|
||||
target = new TargetCreaturePermanent(filter);
|
||||
target.setTargetTag(2);
|
||||
this.getSpellAbility().addTarget(target);
|
||||
|
|
@ -54,34 +49,3 @@ public final class Deadshot extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class DeadshotDamageEffect extends OneShotEffect {
|
||||
|
||||
public DeadshotDamageEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "Target creature deals damage equal to its power to another target creature";
|
||||
}
|
||||
|
||||
public DeadshotDamageEffect(final DeadshotDamageEffect effect) {
|
||||
super(effect);
|
||||
this.setTargetPointer(new SecondTargetPointer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeadshotDamageEffect copy() {
|
||||
return new DeadshotDamageEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent ownCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
||||
if (ownCreature != null) {
|
||||
int damage = ownCreature.getPower().getValue();
|
||||
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (targetCreature != null) {
|
||||
targetCreature.damage(damage, ownCreature.getId(), source, game, false, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue