mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[DMC] Implemented Historian's Boon
This commit is contained in:
parent
231c6c1eeb
commit
5160922af6
3 changed files with 108 additions and 0 deletions
102
Mage.Sets/src/mage/cards/h/HistoriansBoon.java
Normal file
102
Mage.Sets/src/mage/cards/h/HistoriansBoon.java
Normal file
|
@ -0,0 +1,102 @@
|
|||
package mage.cards.h;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
|
||||
import mage.abilities.common.SagaAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SagaChapter;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledEnchantmentPermanent;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.AngelVigilanceToken;
|
||||
import mage.game.permanent.token.SoldierToken;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class HistoriansBoon extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledEnchantmentPermanent("another nontoken enchantment");
|
||||
|
||||
static {
|
||||
filter.add(TokenPredicate.FALSE);
|
||||
}
|
||||
|
||||
public HistoriansBoon(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
|
||||
|
||||
// Whenever Historian's Boon or another nontoken enchantment enters the battlefield under your control, create a 1/1 white Soldier creature token.
|
||||
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
|
||||
new CreateTokenEffect(new SoldierToken()), filter, false, true
|
||||
));
|
||||
|
||||
// Whenever the final chapter of a Saga you control triggers, create a 4/4 white Angel creature token with flying and vigilance.
|
||||
this.addAbility(new HistoriansBoonTriggeredAbility());
|
||||
}
|
||||
|
||||
private HistoriansBoon(final HistoriansBoon card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HistoriansBoon copy() {
|
||||
return new HistoriansBoon(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HistoriansBoonTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
HistoriansBoonTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CreateTokenEffect(new AngelVigilanceToken()));
|
||||
}
|
||||
|
||||
private HistoriansBoonTriggeredAbility(final HistoriansBoonTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HistoriansBoonTriggeredAbility copy() {
|
||||
return new HistoriansBoonTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ABILITY_TRIGGERED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||
if (permanent == null
|
||||
|| !permanent.isControlledBy(getControllerId())
|
||||
|| !permanent.hasSubtype(SubType.SAGA, game)) {
|
||||
return false;
|
||||
}
|
||||
int maxChapter = CardUtil
|
||||
.castStream(permanent.getAbilities(game).stream(), SagaAbility.class)
|
||||
.map(SagaAbility::getMaxChapter)
|
||||
.mapToInt(SagaChapter::getNumber)
|
||||
.sum();
|
||||
Ability ability = game.getAbility(event.getTargetId(), event.getSourceId()).orElse(null);
|
||||
return SagaAbility.isFinalAbility(ability, maxChapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever the final chapter of a Saga you control triggers, " +
|
||||
"create a 4/4 white Angel creature token with flying and vigilance.";
|
||||
}
|
||||
}
|
|
@ -99,6 +99,7 @@ public final class DominariaUnitedCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Hero's Blade", 186, Rarity.UNCOMMON, mage.cards.h.HerosBlade.class));
|
||||
cards.add(new SetCardInfo("Hero's Downfall", 112, Rarity.UNCOMMON, mage.cards.h.HerosDownfall.class));
|
||||
cards.add(new SetCardInfo("Heroes' Podium", 185, Rarity.RARE, mage.cards.h.HeroesPodium.class));
|
||||
cards.add(new SetCardInfo("Historian's Boon", 21, Rarity.RARE, mage.cards.h.HistoriansBoon.class));
|
||||
cards.add(new SetCardInfo("Honor-Worn Shaku", 187, Rarity.UNCOMMON, mage.cards.h.HonorWornShaku.class));
|
||||
cards.add(new SetCardInfo("Illuna, Apex of Wishes", 154, Rarity.MYTHIC, mage.cards.i.IllunaApexOfWishes.class));
|
||||
cards.add(new SetCardInfo("Iridian Maelstrom", 12, Rarity.RARE, mage.cards.i.IridianMaelstrom.class));
|
||||
|
|
|
@ -139,6 +139,11 @@ public class SagaAbility extends SimpleStaticAbility {
|
|||
public static boolean isChapterAbility(TriggeredAbility ability) {
|
||||
return ability instanceof ChapterTriggeredAbility;
|
||||
}
|
||||
|
||||
public static boolean isFinalAbility(Ability ability, int maxChapter) {
|
||||
return ability instanceof ChapterTriggeredAbility
|
||||
&& ((ChapterTriggeredAbility) ability).getChapterFrom().getNumber() == maxChapter;
|
||||
}
|
||||
}
|
||||
|
||||
class SagaLoreCountersEffect extends OneShotEffect {
|
||||
|
|
Loading…
Reference in a new issue