[LTC] Implement Field-Tested Frying Pan (#10721)

This commit is contained in:
Susucre 2023-08-01 15:51:19 +02:00 committed by GitHub
parent 241226cd83
commit 04845072ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 98 additions and 2 deletions

View file

@ -0,0 +1,90 @@
package mage.cards.f;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.GainLifeControllerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenAttachSourceEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.token.FoodToken;
import mage.game.permanent.token.HalflingToken;
import java.util.UUID;
/**
* @author Susucr
*/
public final class FieldTestedFryingPan extends CardImpl {
public FieldTestedFryingPan(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{W}");
this.subtype.add(SubType.EQUIPMENT);
// When Field-Tested Frying Pan enters the battlefield, create a Food token, then create a 1/1 white Halfling creature token and attach Field-Tested Frying Pan to it.
TriggeredAbility trigger = new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new FoodToken()));
trigger.addEffect(new CreateTokenAttachSourceEffect(new HalflingToken(), " and").concatBy(", then"));
this.addAbility(trigger);
// Equipped creature has "Whenever you gain life, this creature gets +X/+X until end of turn, where X is the amount of life you gained."
TriggeredAbility equippedTrigger = new GainLifeControllerTriggeredAbility(
new BoostSourceEffect(
FieldTestedFryingPanValue.instance,
FieldTestedFryingPanValue.instance,
Duration.EndOfTurn
).setText("this creature gets +X/+X until end of turn, where X is the amount of life you gained.")
);
this.addAbility(new SimpleStaticAbility(
new GainAbilityAttachedEffect(equippedTrigger, AttachmentType.EQUIPMENT)
));
// Equip {2}
this.addAbility(new EquipAbility(2, false));
}
private FieldTestedFryingPan(final FieldTestedFryingPan card) {
super(card);
}
@Override
public FieldTestedFryingPan copy() {
return new FieldTestedFryingPan(this);
}
}
enum FieldTestedFryingPanValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return (Integer) effect.getValue("gainedLife");
}
@Override
public FieldTestedFryingPanValue copy() {
return this;
}
@Override
public String getMessage() {
return "";
}
@Override
public String toString() {
return "X";
}
}

View file

@ -104,6 +104,7 @@ public final class TalesOfMiddleEarthCommander extends ExpansionSet {
cards.add(new SetCardInfo("Feed the Swarm", 200, Rarity.COMMON, mage.cards.f.FeedTheSwarm.class));
cards.add(new SetCardInfo("Fell the Mighty", 167, Rarity.RARE, mage.cards.f.FellTheMighty.class));
cards.add(new SetCardInfo("Field of Ruin", 308, Rarity.UNCOMMON, mage.cards.f.FieldOfRuin.class));
cards.add(new SetCardInfo("Field-Tested Frying Pan", 11, Rarity.RARE, mage.cards.f.FieldTestedFryingPan.class));
cards.add(new SetCardInfo("Fiend Hunter", 168, Rarity.UNCOMMON, mage.cards.f.FiendHunter.class));
cards.add(new SetCardInfo("Flamerush Rider", 216, Rarity.RARE, mage.cards.f.FlamerushRider.class));
cards.add(new SetCardInfo("Flooded Grove", 309, Rarity.RARE, mage.cards.f.FloodedGrove.class));

View file

@ -28,7 +28,7 @@ public class GainLifeControllerTriggeredAbility extends TriggeredAbilityImpl {
setTriggerPhrase("Whenever you gain life, ");
}
public GainLifeControllerTriggeredAbility(final GainLifeControllerTriggeredAbility ability) {
private GainLifeControllerTriggeredAbility(final GainLifeControllerTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
}

View file

@ -10,9 +10,14 @@ import mage.game.permanent.token.Token;
*/
public class CreateTokenAttachSourceEffect extends CreateTokenEffect {
public CreateTokenAttachSourceEffect(Token token) {
this(token, ", then");
}
public CreateTokenAttachSourceEffect(Token token, String innerConcat) {
super(token);
staticText = staticText.concat(", then attach {this} to it");
staticText = staticText.concat(innerConcat + " attach {this} to it");
}
private CreateTokenAttachSourceEffect(final CreateTokenAttachSourceEffect effect) {