mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
[J22] Implement Agrus Kos, Eternal Soldier
This commit is contained in:
parent
4bb2b2df28
commit
20e3088c8f
2 changed files with 154 additions and 0 deletions
153
Mage.Sets/src/mage/cards/a/AgrusKosEternalSoldier.java
Normal file
153
Mage.Sets/src/mage/cards/a/AgrusKosEternalSoldier.java
Normal file
|
|
@ -0,0 +1,153 @@
|
||||||
|
package mage.cards.a;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObjectReference;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.common.CopySpellForEachItCouldTargetEffect;
|
||||||
|
import mage.abilities.effects.common.DoIfCostPaid;
|
||||||
|
import mage.abilities.keyword.VigilanceAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.SuperType;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.filter.predicate.mageobject.MageObjectReferencePredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.game.stack.StackObject;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.Target;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class AgrusKosEternalSoldier extends CardImpl {
|
||||||
|
|
||||||
|
public AgrusKosEternalSoldier(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
|
||||||
|
|
||||||
|
this.addSuperType(SuperType.LEGENDARY);
|
||||||
|
this.subtype.add(SubType.SPIRIT);
|
||||||
|
this.subtype.add(SubType.SOLDIER);
|
||||||
|
this.power = new MageInt(3);
|
||||||
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
// Vigilance
|
||||||
|
this.addAbility(VigilanceAbility.getInstance());
|
||||||
|
|
||||||
|
// Whenever Agrus Kos, Eternal Soldier becomes the target of an ability that targets only it, you may pay {1}{R/W}. If you do, copy that ability for each other creature you control that ability could target. Each copy targets a different one of those creatures.
|
||||||
|
this.addAbility(new AgrusKosEternalSoldierTriggeredAbility());
|
||||||
|
}
|
||||||
|
|
||||||
|
private AgrusKosEternalSoldier(final AgrusKosEternalSoldier card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AgrusKosEternalSoldier copy() {
|
||||||
|
return new AgrusKosEternalSoldier(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AgrusKosEternalSoldierTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
AgrusKosEternalSoldierTriggeredAbility() {
|
||||||
|
super(Zone.BATTLEFIELD, new DoIfCostPaid(
|
||||||
|
new AgrusKosEternalSoldierEffect(), new ManaCostsImpl<>("{1}{R/W}")
|
||||||
|
));
|
||||||
|
setTriggerPhrase("Whenever {this} becomes the target of an ability that targets only it, ");
|
||||||
|
}
|
||||||
|
|
||||||
|
private AgrusKosEternalSoldierTriggeredAbility(final AgrusKosEternalSoldierTriggeredAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AgrusKosEternalSoldierTriggeredAbility copy() {
|
||||||
|
return new AgrusKosEternalSoldierTriggeredAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.TARGETED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
if (!event.getTargetId().equals(getSourceId())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||||
|
if (stackObject == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Set<UUID> targets = stackObject
|
||||||
|
.getStackAbility()
|
||||||
|
.getTargets()
|
||||||
|
.stream()
|
||||||
|
.map(Target::getTargets)
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
if (targets.isEmpty() || !targets.stream().allMatch(getSourceId()::equals)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.getEffects().setValue("triggeringAbility", stackObject);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class AgrusKosEternalSoldierEffect extends CopySpellForEachItCouldTargetEffect {
|
||||||
|
|
||||||
|
AgrusKosEternalSoldierEffect() {
|
||||||
|
super();
|
||||||
|
staticText = "copy that ability for each other creature you control " +
|
||||||
|
"that ability could target. Each copy targets a different one of those creatures";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected StackObject getStackObject(Game game, Ability source) {
|
||||||
|
return (StackObject) getValue("triggeringAbility");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Player getPlayer(Game game, Ability source) {
|
||||||
|
return game.getPlayer(source.getControllerId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<MageObjectReferencePredicate> prepareCopiesWithTargets(StackObject stackObject, Player player, Ability source, Game game) {
|
||||||
|
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||||
|
return game
|
||||||
|
.getBattlefield()
|
||||||
|
.getActivePermanents(
|
||||||
|
StaticFilters.FILTER_CONTROLLED_CREATURE,
|
||||||
|
source.getControllerId(), source, game
|
||||||
|
)
|
||||||
|
.stream()
|
||||||
|
.filter(p -> !p.equals(permanent))
|
||||||
|
.filter(p -> stackObject.canTarget(game, p.getId()))
|
||||||
|
.map(p -> new MageObjectReference(p, game))
|
||||||
|
.map(MageObjectReferencePredicate::new)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private AgrusKosEternalSoldierEffect(final AgrusKosEternalSoldierEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AgrusKosEternalSoldierEffect copy() {
|
||||||
|
return new AgrusKosEternalSoldierEffect(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -30,6 +30,7 @@ public final class Jumpstart2022 extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Aether Spellbomb", 752, Rarity.COMMON, mage.cards.a.AetherSpellbomb.class));
|
cards.add(new SetCardInfo("Aether Spellbomb", 752, Rarity.COMMON, mage.cards.a.AetherSpellbomb.class));
|
||||||
cards.add(new SetCardInfo("Aethershield Artificer", 140, Rarity.UNCOMMON, mage.cards.a.AethershieldArtificer.class));
|
cards.add(new SetCardInfo("Aethershield Artificer", 140, Rarity.UNCOMMON, mage.cards.a.AethershieldArtificer.class));
|
||||||
cards.add(new SetCardInfo("Aftershock", 129, Rarity.COMMON, mage.cards.a.Aftershock.class));
|
cards.add(new SetCardInfo("Aftershock", 129, Rarity.COMMON, mage.cards.a.Aftershock.class));
|
||||||
|
cards.add(new SetCardInfo("Agrus Kos, Eternal Soldier", 1, Rarity.RARE, mage.cards.a.AgrusKosEternalSoldier.class));
|
||||||
cards.add(new SetCardInfo("Ajani's Pridemate", 142, Rarity.UNCOMMON, mage.cards.a.AjanisPridemate.class));
|
cards.add(new SetCardInfo("Ajani's Pridemate", 142, Rarity.UNCOMMON, mage.cards.a.AjanisPridemate.class));
|
||||||
cards.add(new SetCardInfo("Ajani, Strength of the Pride", 141, Rarity.MYTHIC, mage.cards.a.AjaniStrengthOfThePride.class));
|
cards.add(new SetCardInfo("Ajani, Strength of the Pride", 141, Rarity.MYTHIC, mage.cards.a.AjaniStrengthOfThePride.class));
|
||||||
cards.add(new SetCardInfo("Alandra, Sky Dreamer", 9, Rarity.RARE, mage.cards.a.AlandraSkyDreamer.class));
|
cards.add(new SetCardInfo("Alandra, Sky Dreamer", 9, Rarity.RARE, mage.cards.a.AlandraSkyDreamer.class));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue