mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
[DMU] Implemented Golden Argosy
This commit is contained in:
parent
51fb4df5a0
commit
6d50e3d508
2 changed files with 135 additions and 0 deletions
134
Mage.Sets/src/mage/cards/g/GoldenArgosy.java
Normal file
134
Mage.Sets/src/mage/cards/g/GoldenArgosy.java
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
|
||||
import mage.abilities.keyword.CrewAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTargets;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class GoldenArgosy extends CardImpl {
|
||||
|
||||
public GoldenArgosy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.VEHICLE);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(6);
|
||||
|
||||
// Whenever Golden Argosy attacks, exile each creature that crewed it this turn. Return them to the battlefield tapped under their owner's control at the beginning of the next end step.
|
||||
this.addAbility(new AttacksTriggeredAbility(new GoldenArgosyEffect()), new GoldenArgosyWatcher());
|
||||
|
||||
// Crew 1
|
||||
this.addAbility(new CrewAbility(1));
|
||||
}
|
||||
|
||||
private GoldenArgosy(final GoldenArgosy card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GoldenArgosy copy() {
|
||||
return new GoldenArgosy(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GoldenArgosyEffect extends OneShotEffect {
|
||||
|
||||
GoldenArgosyEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "exile each creature that crewed it this turn. Return them to the battlefield " +
|
||||
"tapped under their owner's control at the beginning of the next end step";
|
||||
}
|
||||
|
||||
private GoldenArgosyEffect(final GoldenArgosyEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GoldenArgosyEffect copy() {
|
||||
return new GoldenArgosyEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(GoldenArgosyWatcher.getCrewers(source, game));
|
||||
if (cards.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
player.moveCards(cards, Zone.EXILED, source, game);
|
||||
cards.retainZone(Zone.EXILED, game);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||
new ReturnToBattlefieldUnderOwnerControlTargetEffect(true, false)
|
||||
.setTargetPointer(new FixedTargets(cards, game))
|
||||
.setText("return them to the battlefield tapped")
|
||||
), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class GoldenArgosyWatcher extends Watcher {
|
||||
|
||||
private final Map<MageObjectReference, Set<MageObjectReference>> crewMap = new HashMap<>();
|
||||
|
||||
GoldenArgosyWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() != GameEvent.EventType.CREWED_VEHICLE) {
|
||||
return;
|
||||
}
|
||||
Permanent vehicle = game.getPermanent(event.getSourceId());
|
||||
Permanent crewer = game.getPermanent(event.getTargetId());
|
||||
if (vehicle == null) {
|
||||
return;
|
||||
}
|
||||
crewMap.computeIfAbsent(
|
||||
new MageObjectReference(vehicle, game), x -> new HashSet<>()
|
||||
).add(new MageObjectReference(crewer, game));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
crewMap.clear();
|
||||
}
|
||||
|
||||
static Set<Permanent> getCrewers(Ability source, Game game) {
|
||||
return game
|
||||
.getState()
|
||||
.getWatcher(GoldenArgosyWatcher.class)
|
||||
.crewMap
|
||||
.getOrDefault(new MageObjectReference(source), Collections.emptySet())
|
||||
.stream()
|
||||
.map(mor -> mor.getPermanent(game))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
|
@ -115,6 +115,7 @@ public final class DominariaUnited extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Ghitu Amplifier", 127, Rarity.COMMON, mage.cards.g.GhituAmplifier.class));
|
||||
cards.add(new SetCardInfo("Gibbering Barricade", 95, Rarity.COMMON, mage.cards.g.GibberingBarricade.class));
|
||||
cards.add(new SetCardInfo("Goblin Picker", 128, Rarity.COMMON, mage.cards.g.GoblinPicker.class));
|
||||
cards.add(new SetCardInfo("Golden Argosy", 230, Rarity.RARE, mage.cards.g.GoldenArgosy.class));
|
||||
cards.add(new SetCardInfo("Griffin Protector", 18, Rarity.COMMON, mage.cards.g.GriffinProtector.class));
|
||||
cards.add(new SetCardInfo("Guardian of New Benalia", 19, Rarity.RARE, mage.cards.g.GuardianOfNewBenalia.class));
|
||||
cards.add(new SetCardInfo("Hammerhand", 129, Rarity.COMMON, mage.cards.h.Hammerhand.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue