[PIP] Implement The Nipton Lottery (#12249)

This commit is contained in:
Cameron Merkel 2024-05-20 22:52:26 -05:00 committed by GitHub
parent c234599644
commit e71753db73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,93 @@
package mage.cards.t;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import mage.util.RandomUtil;
/**
* @author Cguy7777
*/
public final class TheNiptonLottery extends CardImpl {
public TheNiptonLottery(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{R}");
// Choose a creature at random.
// You gain control of that creature until end of turn. Untap it. It gains haste until end of turn.
// Then destroy all other creatures.
this.getSpellAbility().addEffect(new TheNiptonLotteryEffect());
}
private TheNiptonLottery(final TheNiptonLottery card) {
super(card);
}
@Override
public TheNiptonLottery copy() {
return new TheNiptonLottery(this);
}
}
class TheNiptonLotteryEffect extends OneShotEffect {
TheNiptonLotteryEffect() {
super(Outcome.Benefit);
staticText = "Choose a creature at random. You gain control of that creature until end of turn. " +
"Untap it. It gains haste until end of turn. Then destroy all other creatures.";
}
private TheNiptonLotteryEffect(final TheNiptonLotteryEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
// Choose a creature at random.
List<Permanent> creatureList = game.getBattlefield()
.getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game);
if (creatureList.isEmpty()) {
return true;
}
Permanent permanentToSteal = creatureList.get(RandomUtil.nextInt(creatureList.size()));
// You gain control of that creature until end of turn. Untap it. It gains haste until end of turn.
ContinuousEffect controlEffect = new GainControlTargetEffect(Duration.EndOfTurn);
controlEffect.setTargetPointer(new FixedTarget(permanentToSteal, game));
game.addEffect(controlEffect, source);
game.getState().processAction(game);
permanentToSteal.untap(game);
ContinuousEffect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
hasteEffect.setTargetPointer(new FixedTarget(permanentToSteal, game));
game.addEffect(hasteEffect, source);
// Then destroy all other creatures.
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(Predicates.not(new PermanentIdPredicate(permanentToSteal.getId())));
return new DestroyAllEffect(filter).apply(game, source);
}
@Override
public TheNiptonLotteryEffect copy() {
return new TheNiptonLotteryEffect(this);
}
}

View file

@ -357,6 +357,10 @@ public final class Fallout extends ExpansionSet {
cards.add(new SetCardInfo("The Motherlode, Excavator", 389, Rarity.RARE, mage.cards.t.TheMotherlodeExcavator.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("The Motherlode, Excavator", 590, Rarity.RARE, mage.cards.t.TheMotherlodeExcavator.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("The Motherlode, Excavator", 917, Rarity.RARE, mage.cards.t.TheMotherlodeExcavator.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("The Nipton Lottery", 113, Rarity.RARE, mage.cards.t.TheNiptonLottery.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("The Nipton Lottery", 423, Rarity.RARE, mage.cards.t.TheNiptonLottery.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("The Nipton Lottery", 641, Rarity.RARE, mage.cards.t.TheNiptonLottery.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("The Nipton Lottery", 951, Rarity.RARE, mage.cards.t.TheNiptonLottery.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("The Wise Mothman", 4, Rarity.MYTHIC, mage.cards.t.TheWiseMothman.class));
cards.add(new SetCardInfo("Thirst for Knowledge", 180, Rarity.UNCOMMON, mage.cards.t.ThirstForKnowledge.class));
cards.add(new SetCardInfo("Thought Vessel", 251, Rarity.COMMON, mage.cards.t.ThoughtVessel.class));