mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
[BRC] Implement Sardian Avenger
This commit is contained in:
parent
6e5c019ab0
commit
aa7f55ce73
2 changed files with 101 additions and 0 deletions
100
Mage.Sets/src/mage/cards/s/SardianAvenger.java
Normal file
100
Mage.Sets/src/mage/cards/s/SardianAvenger.java
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterArtifactPermanent;
|
||||
import mage.game.Controllable;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SardianAvenger extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterArtifactPermanent("artifacts your opponents control");
|
||||
|
||||
static {
|
||||
filter.add(TargetController.OPPONENT.getControllerPredicate());
|
||||
}
|
||||
|
||||
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter, null);
|
||||
|
||||
public SardianAvenger(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
|
||||
|
||||
this.subtype.add(SubType.GOBLIN);
|
||||
this.subtype.add(SubType.WARRIOR);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// First strike
|
||||
this.addAbility(FirstStrikeAbility.getInstance());
|
||||
|
||||
// Trample
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
|
||||
// Whenever Sardian Avenger attacks, it gets +X/+0 until end of turn, where X is the number of artifacts your opponents control.
|
||||
this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(
|
||||
xValue, StaticValue.get(0), Duration.EndOfTurn, true, "it"
|
||||
)));
|
||||
|
||||
// Whenever an artifact an opponent controls is put into a graveyard from the battlefield, Sardian Avenger deals 1 damage to that player.
|
||||
this.addAbility(new DiesCreatureTriggeredAbility(
|
||||
new SardianAvengerEffect(), false, filter
|
||||
).setTriggerPhrase("Whenever an artifact an opponent controls is put into a graveyard from the battlefield, "));
|
||||
}
|
||||
|
||||
private SardianAvenger(final SardianAvenger card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SardianAvenger copy() {
|
||||
return new SardianAvenger(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SardianAvengerEffect extends OneShotEffect {
|
||||
|
||||
SardianAvengerEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "{this} deals 1 damage to that player";
|
||||
}
|
||||
|
||||
private SardianAvengerEffect(final SardianAvengerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SardianAvengerEffect copy() {
|
||||
return new SardianAvengerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Optional.ofNullable((Permanent) getValue("creatureDied"))
|
||||
.filter(Objects::nonNull)
|
||||
.map(Controllable::getControllerId)
|
||||
.map(game::getPlayer)
|
||||
.ifPresent(player -> player.damage(1, source, game));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -125,6 +125,7 @@ public final class TheBrothersWarCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Reliquary Tower", 196, Rarity.UNCOMMON, mage.cards.r.ReliquaryTower.class));
|
||||
cards.add(new SetCardInfo("River of Tears", 197, Rarity.RARE, mage.cards.r.RiverOfTears.class));
|
||||
cards.add(new SetCardInfo("Sai, Master Thopterist", 93, Rarity.RARE, mage.cards.s.SaiMasterThopterist.class));
|
||||
cards.add(new SetCardInfo("Sardian Avenger", 23, Rarity.RARE, mage.cards.s.SardianAvenger.class));
|
||||
cards.add(new SetCardInfo("Scavenged Brawler", 17, Rarity.RARE, mage.cards.s.ScavengedBrawler.class));
|
||||
cards.add(new SetCardInfo("Seat of the Synod", 198, Rarity.COMMON, mage.cards.s.SeatOfTheSynod.class));
|
||||
cards.add(new SetCardInfo("Servo Schematic", 158, Rarity.UNCOMMON, mage.cards.s.ServoSchematic.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue