mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
[WOE] Implement Gruff Triplets (#10791)
* [WOE] Implement (Leaked) Gruff Triplets * fix name predicate * remove unecessary file with wrong predicate --------- Co-authored-by: Evan Kranzler <theelk801@gmail.com>
This commit is contained in:
parent
d499efe971
commit
493cb811d5
3 changed files with 107 additions and 3 deletions
73
Mage.Sets/src/mage/cards/g/GruffTriplets.java
Normal file
73
Mage.Sets/src/mage/cards/g/GruffTriplets.java
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.condition.common.SourceMatchesFilterCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.SourcePermanentPowerCount;
|
||||
import mage.abilities.effects.CreateTokenCopySourceEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersAllEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class GruffTriplets extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filterNonToken = new FilterPermanent("non-token permanent");
|
||||
private static final FilterControlledPermanent filterNamedGruffTriplets = new FilterControlledPermanent("creature you control named Gruff Triplets");
|
||||
|
||||
static {
|
||||
filterNonToken.add(TokenPredicate.FALSE);
|
||||
filterNamedGruffTriplets.add(new NamePredicate("Gruff Triplets"));
|
||||
}
|
||||
|
||||
public GruffTriplets(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}{G}");
|
||||
|
||||
this.subtype.add(SubType.SATYR);
|
||||
this.subtype.add(SubType.WARRIOR);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Trample
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
|
||||
// When Gruff Triplets enters the battlefield, if it isn't a token, create two tokens that are copies of it.
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new CreateTokenCopySourceEffect(2)),
|
||||
new SourceMatchesFilterCondition(filterNonToken),
|
||||
"When {this} enters the battlefield, if it isn't a token, create two tokens that are copies of it."
|
||||
));
|
||||
|
||||
// When Gruff Triplets dies, put a number of +1/+1 counters equal to its power on each creature you control named Gruff Triplets.
|
||||
this.addAbility(new DiesSourceTriggeredAbility(
|
||||
new AddCountersAllEffect(
|
||||
CounterType.P1P1.createInstance(),
|
||||
new SourcePermanentPowerCount(),
|
||||
filterNamedGruffTriplets
|
||||
).setText("put a number of +1/+1 counters equal to its power on each creature you control named Gruff Triplets.")
|
||||
));
|
||||
}
|
||||
|
||||
private GruffTriplets(final GruffTriplets card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GruffTriplets copy() {
|
||||
return new GruffTriplets(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -84,6 +84,7 @@ public final class WildsOfEldraine extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Flick a Coin", 128, Rarity.COMMON, mage.cards.f.FlickACoin.class));
|
||||
cards.add(new SetCardInfo("Food Coma", 308, Rarity.UNCOMMON, mage.cards.f.FoodComa.class));
|
||||
cards.add(new SetCardInfo("Forest", 266, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Gruff Triplets", 172, Rarity.RARE, mage.cards.g.GruffTriplets.class));
|
||||
cards.add(new SetCardInfo("Frantic Firebolt", 130, Rarity.COMMON, mage.cards.f.FranticFirebolt.class));
|
||||
cards.add(new SetCardInfo("Freeze in Place", 50, Rarity.COMMON, mage.cards.f.FreezeInPlace.class));
|
||||
cards.add(new SetCardInfo("Frolicking Familiar", 226, Rarity.UNCOMMON, mage.cards.f.FrolickingFamiliar.class));
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package mage.abilities.effects.common.counter;
|
|||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.Counter;
|
||||
|
|
@ -9,6 +12,7 @@ import mage.filter.FilterPermanent;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author North
|
||||
|
|
@ -16,19 +20,25 @@ import mage.players.Player;
|
|||
public class AddCountersAllEffect extends OneShotEffect {
|
||||
|
||||
private final Counter counter;
|
||||
private DynamicValue amount;
|
||||
private final FilterPermanent filter;
|
||||
|
||||
public AddCountersAllEffect(Counter counter, FilterPermanent filter) {
|
||||
this(counter, StaticValue.get(0), filter);
|
||||
}
|
||||
|
||||
public AddCountersAllEffect(Counter counter, DynamicValue amount, FilterPermanent filter) {
|
||||
super(Outcome.Benefit);
|
||||
this.counter = counter;
|
||||
this.amount = amount;
|
||||
this.filter = filter;
|
||||
staticText = "put " + counter.getDescription() + " on each " + filter.getMessage();
|
||||
}
|
||||
|
||||
protected AddCountersAllEffect(final AddCountersAllEffect effect) {
|
||||
super(effect);
|
||||
this.counter = effect.counter.copy();
|
||||
this.filter = effect.filter.copy();
|
||||
this.amount = effect.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -38,9 +48,21 @@ public class AddCountersAllEffect extends OneShotEffect {
|
|||
if (controller != null && sourceObject != null) {
|
||||
if (counter != null) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {
|
||||
permanent.addCounters(counter.copy(), source.getControllerId(), source, game);
|
||||
Counter newCounter = counter.copy();
|
||||
int calculated = amount.calculate(game, source, this); // 0 -- you must use default couner
|
||||
if (calculated < 0) {
|
||||
continue;
|
||||
} else if (calculated == 0) {
|
||||
// use original counter
|
||||
} else {
|
||||
// increase to calculated value
|
||||
newCounter.remove(newCounter.getCount());
|
||||
newCounter.add(calculated);
|
||||
}
|
||||
|
||||
permanent.addCounters(newCounter, source.getControllerId(), source, game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + counter.getCount() + ' ' + counter.getName()
|
||||
game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " puts " + newCounter.getCount() + ' ' + newCounter.getName()
|
||||
+ " counter on " + permanent.getLogName());
|
||||
}
|
||||
}
|
||||
|
|
@ -50,6 +72,14 @@ public class AddCountersAllEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (!staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return CardUtil.getAddRemoveCountersText(amount, counter, getTargetPointer().describeTargets(mode.getTargets(), "that creature"), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AddCountersAllEffect copy() {
|
||||
return new AddCountersAllEffect(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue