[ONE] Implement All Will Be One (#9920)

* [ONE] Implement All Will Be One

* Apply requested changes
This commit is contained in:
PurpleCrowbar 2023-01-29 01:03:08 +00:00 committed by GitHub
parent 2c6974d35d
commit 0208196ccf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,84 @@
package mage.cards.a;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePlayerOrPlaneswalker;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetAnyTarget;
import java.util.UUID;
/**
* @author PurpleCrowbar
*/
public final class AllWillBeOne extends CardImpl {
public AllWillBeOne(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{R}{R}");
// Whenever you put one or more counters on a permanent or player, All Will Be One deals that much
// damage to target opponent, creature an opponent controls, or planeswalker an opponent controls.
this.addAbility(new AllWillBeOneTriggeredAbility());
}
private AllWillBeOne(final AllWillBeOne card) {
super(card);
}
@Override
public AllWillBeOne copy() {
return new AllWillBeOne(this);
}
}
class AllWillBeOneTriggeredAbility extends TriggeredAbilityImpl {
private static final FilterCreaturePlayerOrPlaneswalker filter =
new FilterCreaturePlayerOrPlaneswalker("target opponent, creature an opponent controls, or planeswalker an opponent controls");
static {
filter.getPermanentFilter().add(TargetController.NOT_YOU.getControllerPredicate());
filter.getPlayerFilter().add(TargetController.OPPONENT.getPlayerPredicate());
}
AllWillBeOneTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(SavedDamageValue.MUCH));
this.addTarget(new TargetAnyTarget(filter));
}
private AllWillBeOneTriggeredAbility(final AllWillBeOneTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.COUNTERS_ADDED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!isControlledBy(event.getPlayerId())) {
return false;
}
getEffects().setValue("damage", event.getAmount());
return true;
}
@Override
public AllWillBeOneTriggeredAbility copy() {
return new AllWillBeOneTriggeredAbility(this);
}
@Override
public String getRule() {
return "Whenever you put one or more counters on a permanent or player, {this} deals that much damage " +
"to target opponent, creature an opponent controls, or planeswalker an opponent controls.";
}
}

View file

@ -21,6 +21,8 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
this.hasBoosters = false; // temporary
cards.add(new SetCardInfo("Adaptive Sporesinger", 157, Rarity.COMMON, mage.cards.a.AdaptiveSporesinger.class));
cards.add(new SetCardInfo("All Will Be One", 118, Rarity.MYTHIC, mage.cards.a.AllWillBeOne.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("All Will Be One", 352, Rarity.MYTHIC, mage.cards.a.AllWillBeOne.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ambulatory Edifice", 79, Rarity.UNCOMMON, mage.cards.a.AmbulatoryEdifice.class));
cards.add(new SetCardInfo("Annex Sentry", 2, Rarity.UNCOMMON, mage.cards.a.AnnexSentry.class));
cards.add(new SetCardInfo("Anoint with Affliction", 81, Rarity.COMMON, mage.cards.a.AnointWithAffliction.class));