mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
[KHM] Implemented Surtland Flinger
This commit is contained in:
parent
c06e29c4e4
commit
f54d691977
2 changed files with 97 additions and 0 deletions
96
Mage.Sets/src/mage/cards/s/SurtlandFlinger.java
Normal file
96
Mage.Sets/src/mage/cards/s/SurtlandFlinger.java
Normal file
|
@ -0,0 +1,96 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SurtlandFlinger extends CardImpl {
|
||||
|
||||
public SurtlandFlinger(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
|
||||
|
||||
this.subtype.add(SubType.GIANT);
|
||||
this.subtype.add(SubType.BERSERKER);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(6);
|
||||
|
||||
// Whenever Surtland Flinger attacks, you may sacrifice another creature. When you do, Surtland Flinger deals damage equal to the sacrificed creature's power to any target. If the sacrificed creature was a Giant, Surtland Flinger deals twice that much damage instead.
|
||||
this.addAbility(new AttacksTriggeredAbility(new SurtlandFlingerEffect(), true));
|
||||
}
|
||||
|
||||
private SurtlandFlinger(final SurtlandFlinger card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurtlandFlinger copy() {
|
||||
return new SurtlandFlinger(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SurtlandFlingerEffect extends OneShotEffect {
|
||||
|
||||
private static final String rule
|
||||
= "{this} deals damage equal to the sacrificed creature's power to any target. " +
|
||||
"If the sacrificed creature was a Giant, {this} deals twice that much damage instead.";
|
||||
|
||||
SurtlandFlingerEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "sacrifice another creature. When you do, " + rule;
|
||||
}
|
||||
|
||||
private SurtlandFlingerEffect(final SurtlandFlingerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurtlandFlingerEffect copy() {
|
||||
return new SurtlandFlingerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
TargetPermanent target = new TargetPermanent(
|
||||
0, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true
|
||||
);
|
||||
player.choose(outcome, target, source.getSourceId(), game);
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
int power = permanent.getPower().getValue();
|
||||
if (permanent.hasSubtype(SubType.GIANT, game)) {
|
||||
power *= 2;
|
||||
}
|
||||
power = Math.max(power, 0);
|
||||
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(
|
||||
new DamageTargetEffect(power), false, rule
|
||||
);
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
game.fireReflexiveTriggeredAbility(ability, source);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -45,5 +45,6 @@ public final class Kaldheim extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Renegade Reaper", 386, Rarity.UNCOMMON, mage.cards.r.RenegadeReaper.class));
|
||||
cards.add(new SetCardInfo("Showdown of the Skalds", 229, Rarity.RARE, mage.cards.s.ShowdownOfTheSkalds.class));
|
||||
cards.add(new SetCardInfo("Starnheim Aspirant", 380, Rarity.UNCOMMON, mage.cards.s.StarnheimAspirant.class));
|
||||
cards.add(new SetCardInfo("Surtland Flinger", 377, Rarity.RARE, mage.cards.s.SurtlandFlinger.class));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue