[NCC] rework Life of the Party

This commit is contained in:
theelk801 2025-06-07 11:43:27 -04:00
parent 933750be95
commit 24c9d5509e

View file

@ -4,14 +4,15 @@ import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.condition.Condition;
import mage.abilities.condition.common.SourceMatchesFilterCondition;
import mage.abilities.dynamicvalue.common.CreaturesYouControlCount; import mage.abilities.dynamicvalue.common.CreaturesYouControlCount;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect; import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.effects.common.combat.GoadTargetEffect; import mage.abilities.effects.common.combat.GoadTargetEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.hint.ValueHint; import mage.abilities.hint.common.CreaturesYouControlHint;
import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
@ -21,13 +22,14 @@ import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.target.targetpointer.FixedTargets; import mage.target.targetpointer.FixedTargets;
import java.util.ArrayList; import java.util.HashSet;
import java.util.List; import java.util.Set;
import java.util.UUID; import java.util.UUID;
/** /**
@ -35,6 +37,14 @@ import java.util.UUID;
*/ */
public final class LifeOfTheParty extends CardImpl { public final class LifeOfTheParty extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("it's not a token");
static {
filter.add(TokenPredicate.FALSE);
}
private static final Condition condition = new SourceMatchesFilterCondition(filter);
public LifeOfTheParty(UUID ownerId, CardSetInfo setInfo) { public LifeOfTheParty(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
@ -55,15 +65,11 @@ public final class LifeOfTheParty extends CardImpl {
this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect( this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect(
CreaturesYouControlCount.instance, StaticValue.get(0), CreaturesYouControlCount.instance, StaticValue.get(0),
Duration.EndOfTurn, "it" Duration.EndOfTurn, "it"
).setText("it gets +X/+0 until end of turn, where X is the number of creatures you control") ).setText("it gets +X/+0 until end of turn, where X is the number of creatures you control"))
).addHint(new ValueHint("Creatures you control", CreaturesYouControlCount.instance))); .addHint(CreaturesYouControlHint.instance));
// When Life of the Party enters the battlefield, if it's not a token, each opponent creates a token that's a copy of it. The tokens are goaded for the rest of the game. // When Life of the Party enters the battlefield, if it's not a token, each opponent creates a token that's a copy of it. The tokens are goaded for the rest of the game.
this.addAbility(new ConditionalInterveningIfTriggeredAbility( this.addAbility(new EntersBattlefieldTriggeredAbility(new LifeOfThePartyEffect()).withInterveningIf(condition));
new EntersBattlefieldTriggeredAbility(new LifeOfThePartyEffect()), LifeOfTheParty::checkSource,
"When {this} enters, if it's not a token, each opponent creates a " +
"token that's a copy of it. The tokens are goaded for the rest of the game."
));
} }
private LifeOfTheParty(final LifeOfTheParty card) { private LifeOfTheParty(final LifeOfTheParty card) {
@ -74,16 +80,13 @@ public final class LifeOfTheParty extends CardImpl {
public LifeOfTheParty copy() { public LifeOfTheParty copy() {
return new LifeOfTheParty(this); return new LifeOfTheParty(this);
} }
static boolean checkSource(Game game, Ability source) {
return !(source.getSourcePermanentOrLKI(game) instanceof PermanentToken);
}
} }
class LifeOfThePartyEffect extends OneShotEffect { class LifeOfThePartyEffect extends OneShotEffect {
LifeOfThePartyEffect() { LifeOfThePartyEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = "each opponent creates a token that's a copy of it. The tokens are goaded for the rest of the game";
} }
private LifeOfThePartyEffect(final LifeOfThePartyEffect effect) { private LifeOfThePartyEffect(final LifeOfThePartyEffect effect) {
@ -101,7 +104,7 @@ class LifeOfThePartyEffect extends OneShotEffect {
if (permanent == null) { if (permanent == null) {
return false; return false;
} }
List<Permanent> permanents = new ArrayList<>(); Set<Permanent> permanents = new HashSet<>();
for (UUID playerId : game.getOpponents(source.getControllerId())) { for (UUID playerId : game.getOpponents(source.getControllerId())) {
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(playerId); CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(playerId);
effect.setSavedPermanent(permanent); effect.setSavedPermanent(permanent);
@ -111,12 +114,8 @@ class LifeOfThePartyEffect extends OneShotEffect {
if (permanents.isEmpty()) { if (permanents.isEmpty()) {
return false; return false;
} }
game.addEffect( game.addEffect(new GoadTargetEffect(Duration.EndOfGame)
new GoadTargetEffect() .setTargetPointer(new FixedTargets(permanents, game)), source);
.setDuration(Duration.EndOfGame)
.setTargetPointer(new FixedTargets(permanents, game)),
source
);
return true; return true;
} }
} }