[J25] Implement Plagon, Lord of the Beach

This commit is contained in:
theelk801 2024-11-12 10:40:40 -05:00
parent e50baf0fa5
commit c168cb06c0
3 changed files with 81 additions and 9 deletions

View file

@ -0,0 +1,67 @@
package mage.cards.p;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessTargetEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ToughnessGreaterThanPowerPredicate;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PlagonLordOfTheBeach extends CardImpl {
private static final FilterPermanent filter
= new FilterControlledCreaturePermanent("creature you control with toughness greater than its power");
static {
filter.add(ToughnessGreaterThanPowerPredicate.instance);
}
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
private static final Hint hint = new ValueHint("Creatures you control with toughness greater than power", xValue);
public PlagonLordOfTheBeach(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.STARFISH);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(0);
this.toughness = new MageInt(3);
// When Plagon, Lord of the Beach enters, draw a card for each creature you control with toughness greater than its power.
this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(xValue)).addHint(hint));
// {W/U}: Target creature you control assigns combat damage equal to its toughness rather than its power this turn.
Ability ability = new SimpleActivatedAbility(new CombatDamageByToughnessTargetEffect(), new ManaCostsImpl<>("{W/U}"));
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
}
private PlagonLordOfTheBeach(final PlagonLordOfTheBeach card) {
super(card);
}
@Override
public PlagonLordOfTheBeach copy() {
return new PlagonLordOfTheBeach(this);
}
}

View file

@ -508,6 +508,7 @@ public final class FoundationsJumpstart extends ExpansionSet {
cards.add(new SetCardInfo("Pigment Storm", 585, Rarity.COMMON, mage.cards.p.PigmentStorm.class));
cards.add(new SetCardInfo("Pilfering Imp", 475, Rarity.UNCOMMON, mage.cards.p.PilferingImp.class));
cards.add(new SetCardInfo("Pitiless Plunderer", 476, Rarity.UNCOMMON, mage.cards.p.PitilessPlunderer.class));
cards.add(new SetCardInfo("Plagon, Lord of the Beach", 37, Rarity.RARE, mage.cards.p.PlagonLordOfTheBeach.class));
cards.add(new SetCardInfo("Plains", 81, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Plate Armor", 100, Rarity.UNCOMMON, mage.cards.p.PlateArmor.class));
cards.add(new SetCardInfo("Play with Fire", 586, Rarity.UNCOMMON, mage.cards.p.PlayWithFire.class));

View file

@ -1,9 +1,5 @@
package mage.abilities.effects.common.ruleModifying;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ContinuousEffectImpl;
@ -16,8 +12,16 @@ import mage.filter.predicate.permanent.PermanentReferenceInCollectionPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
public class CombatDamageByToughnessTargetEffect extends ContinuousEffectImpl {
public CombatDamageByToughnessTargetEffect() {
this(Duration.EndOfTurn);
}
public CombatDamageByToughnessTargetEffect(Duration duration) {
super(duration, Layer.RulesEffects, SubLayer.NA, Outcome.Neutral);
}
@ -34,9 +38,9 @@ public class CombatDamageByToughnessTargetEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Game game, Ability source) {
Set<Permanent> set = getTargetPointer().getTargets(game, source).stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
.map(game::getPermanent)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new PermanentReferenceInCollectionPredicate(set, game));
@ -53,7 +57,7 @@ public class CombatDamageByToughnessTargetEffect extends ContinuousEffectImpl {
}
return (duration.toString().isEmpty() ? "" : duration.toString() + ", ")
+ getTargetPointer().describeTargets(mode.getTargets(), "that creature")
+ " assigns combat damage equal to its toughness rather than its power";
+ " assigns combat damage equal to its toughness rather than its power";
}
}