Implemented The Akroan War

This commit is contained in:
Evan Kranzler 2019-12-16 21:13:15 -05:00
parent cdad32aed4
commit 9f19866435
2 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,103 @@
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.common.SagaAbility;
import mage.abilities.condition.common.SourceOnBattlefieldCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.combat.AttacksIfAbleAllEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterOpponentsCreaturePermanent;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TheAkroanWar extends CardImpl {
private static final FilterCreaturePermanent filter
= new FilterOpponentsCreaturePermanent("creatures your opponents control");
public TheAkroanWar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}");
this.subtype.add(SubType.SAGA);
// (As this Saga enters and after your draw step, add a lore counter. Sacrifice after III.)
SagaAbility sagaAbility = new SagaAbility(this, SagaChapter.CHAPTER_III);
// I Gain control of target creature for as long as The Akroan War remains on the battlefield.
sagaAbility.addChapterEffect(
this,
SagaChapter.CHAPTER_I,
SagaChapter.CHAPTER_I,
new ConditionalContinuousEffect(
new GainControlTargetEffect(Duration.Custom, true),
SourceOnBattlefieldCondition.instance, "gain control of target creature " +
"for as long as {this} remains on the battlefield"
), new TargetCreaturePermanent()
);
// II Until your next turn, creatures your opponents control attack each combat if able.
sagaAbility.addChapterEffect(
this,
SagaChapter.CHAPTER_II,
new AttacksIfAbleAllEffect(
filter, Duration.UntilYourNextTurn, true
)
);
// III Each tapped creature deals damage to itself equal to its power.
sagaAbility.addChapterEffect(this, SagaChapter.CHAPTER_III, new TheAkroanWarEffect());
}
private TheAkroanWar(final TheAkroanWar card) {
super(card);
}
@Override
public TheAkroanWar copy() {
return new TheAkroanWar(this);
}
}
class TheAkroanWarEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterCreaturePermanent();
static {
filter.add(TappedPredicate.instance);
}
TheAkroanWarEffect() {
super(Outcome.Benefit);
staticText = "each tapped creature deals damage to itself equal to its power";
}
private TheAkroanWarEffect(final TheAkroanWarEffect effect) {
super(effect);
}
@Override
public TheAkroanWarEffect copy() {
return new TheAkroanWarEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
game.getBattlefield()
.getActivePermanents(filter, source.getControllerId(), game)
.stream()
.forEach(permanent -> permanent.damage(permanent.getPower().getValue(), permanent.getId(), game));
return true;
}
}

View file

@ -49,5 +49,6 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Setessan Champion", 198, Rarity.RARE, mage.cards.s.SetessanChampion.class));
cards.add(new SetCardInfo("Staggering Insight", 228, Rarity.UNCOMMON, mage.cards.s.StaggeringInsight.class));
cards.add(new SetCardInfo("Swamp", 252, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("The Akroan War", 124, Rarity.RARE, mage.cards.t.TheAkroanWar.class));
}
}