Implement Jangling Automaton (#6653)

* Implement Weatherlight 151 - Jangling Automaton

* Cleanup Jangling Automaton

* Revert line endings on WTH set file

* Change getDefenderId to getDefendingPlayerId
This commit is contained in:
arcox 2020-06-17 12:07:17 +00:00 committed by GitHub
parent 3839b0c665
commit c9cac3f87b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 1 deletions

View file

@ -0,0 +1,72 @@
package mage.cards.j;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
* @author arcox
*/
public final class JanglingAutomaton extends CardImpl {
public JanglingAutomaton(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
this.subtype.add(SubType.CONSTRUCT);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// Whenever Jangling Automaton attacks, untap all creatures defending player controls.
this.addAbility(new AttacksTriggeredAbility(new JanglingAutomatonEffect(), false));
}
public JanglingAutomaton(final JanglingAutomaton card) {
super(card);
}
@Override
public JanglingAutomaton copy() {
return new JanglingAutomaton(this);
}
}
class JanglingAutomatonEffect extends OneShotEffect {
public JanglingAutomatonEffect() {
super(Outcome.Untap);
this.staticText = "untap all creatures defending player controls";
}
public JanglingAutomatonEffect(final JanglingAutomatonEffect effect) {
super(effect);
}
@Override
public JanglingAutomatonEffect copy() {
return new JanglingAutomatonEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
UUID defenderId = game.getCombat().getDefendingPlayerId(source.getSourceId(), game);
if (defenderId != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerIdPredicate(defenderId));
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
permanent.untap(game);
}
return true;
}
return false;
}
}

View file

@ -38,7 +38,7 @@ public final class Weatherlight extends ExpansionSet {
cards.add(new SetCardInfo("Alms", 3, Rarity.COMMON, mage.cards.a.Alms.class));
cards.add(new SetCardInfo("Ancestral Knowledge", 32, Rarity.RARE, mage.cards.a.AncestralKnowledge.class));
cards.add(new SetCardInfo("Angelic Renewal", 4, Rarity.COMMON, mage.cards.a.AngelicRenewal.class));
cards.add(new SetCardInfo("Apathy", 33, Rarity.COMMON, mage.cards.a.Apathy.class));
cards.add(new SetCardInfo("Apathy", 33, Rarity.COMMON, mage.cards.a.Apathy.class));
cards.add(new SetCardInfo("Arctic Wolves", 118, Rarity.UNCOMMON, mage.cards.a.ArcticWolves.class));
cards.add(new SetCardInfo("Ardent Militia", 5, Rarity.COMMON, mage.cards.a.ArdentMilitia.class));
cards.add(new SetCardInfo("Argivian Find", 6, Rarity.UNCOMMON, mage.cards.a.ArgivianFind.class));
@ -108,6 +108,7 @@ public final class Weatherlight extends ExpansionSet {
cards.add(new SetCardInfo("Infernal Tribute", 73, Rarity.RARE, mage.cards.i.InfernalTribute.class));
cards.add(new SetCardInfo("Inner Sanctum", 18, Rarity.RARE, mage.cards.i.InnerSanctum.class));
cards.add(new SetCardInfo("Jabari's Banner", 150, Rarity.UNCOMMON, mage.cards.j.JabarisBanner.class));
cards.add(new SetCardInfo("Jangling Automaton", 151, Rarity.COMMON, mage.cards.j.JanglingAutomaton.class));
cards.add(new SetCardInfo("Kithkin Armor", 19, Rarity.COMMON, mage.cards.k.KithkinArmor.class));
cards.add(new SetCardInfo("Lava Hounds", 109, Rarity.UNCOMMON, mage.cards.l.LavaHounds.class));
cards.add(new SetCardInfo("Lava Storm", 110, Rarity.COMMON, mage.cards.l.LavaStorm.class));