forked from External/mage
[SPM] Implement Wisecrack
This commit is contained in:
parent
2a39c13f4a
commit
1fc6abc08e
2 changed files with 73 additions and 0 deletions
72
Mage.Sets/src/mage/cards/w/Wisecrack.java
Normal file
72
Mage.Sets/src/mage/cards/w/Wisecrack.java
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
package mage.cards.w;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Controllable;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class Wisecrack extends CardImpl {
|
||||
|
||||
public Wisecrack(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
|
||||
|
||||
// Target creature deals damage equal to its power to itself. If that creature is attacking, Wisecrack deals 2 damage to that creature's controller.
|
||||
this.getSpellAbility().addEffect(new WisecrackEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
private Wisecrack(final Wisecrack card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Wisecrack copy() {
|
||||
return new Wisecrack(this);
|
||||
}
|
||||
}
|
||||
|
||||
class WisecrackEffect extends OneShotEffect {
|
||||
|
||||
WisecrackEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "target creature deals damage equal to its power to itself. " +
|
||||
"If that creature is attacking, {this} deals 2 damage to that creature's controller";
|
||||
}
|
||||
|
||||
private WisecrackEffect(final WisecrackEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WisecrackEffect copy() {
|
||||
return new WisecrackEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
permanent.damage(permanent.getPower().getValue(), permanent.getId(), source, game);
|
||||
if (permanent.isAttacking()) {
|
||||
Optional.ofNullable(permanent)
|
||||
.map(Controllable::getControllerId)
|
||||
.map(game::getPlayer)
|
||||
.map(player -> player.damage(2, source, game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -287,6 +287,7 @@ public final class MarvelsSpiderMan extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Web-Warriors", 203, Rarity.UNCOMMON, mage.cards.w.WebWarriors.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Whoosh!", 48, Rarity.COMMON, mage.cards.w.Whoosh.class));
|
||||
cards.add(new SetCardInfo("Wild Pack Squad", 23, Rarity.COMMON, mage.cards.w.WildPackSquad.class));
|
||||
cards.add(new SetCardInfo("Wisecrack", 98, Rarity.UNCOMMON, mage.cards.w.Wisecrack.class));
|
||||
cards.add(new SetCardInfo("With Great Power...", 24, Rarity.RARE, mage.cards.w.WithGreatPower.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("With Great Power...", 248, Rarity.RARE, mage.cards.w.WithGreatPower.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Wraith, Vicious Vigilante", 160, Rarity.UNCOMMON, mage.cards.w.WraithViciousVigilante.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue