mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[BIG] Implement Territory Forge
This commit is contained in:
parent
f5168e7c98
commit
71b267a3ca
2 changed files with 130 additions and 0 deletions
129
Mage.Sets/src/mage/cards/t/TerritoryForge.java
Normal file
129
Mage.Sets/src/mage/cards/t/TerritoryForge.java
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.CastFromEverywhereSourceCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class TerritoryForge extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifact or land");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(CardType.ARTIFACT.getPredicate(), CardType.LAND.getPredicate()));
|
||||
}
|
||||
|
||||
public TerritoryForge(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}{R}");
|
||||
|
||||
// When Territory Forge enters the battlefield, if you cast it, exile target artifact or land.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new TerritoryForgeExileEffect()),
|
||||
CastFromEverywhereSourceCondition.instance,
|
||||
"When {this} enters the battlefield, if you cast it, exile target artifact or land."
|
||||
);
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Territory Forge has all activated abilities of the exiled card.
|
||||
this.addAbility(new SimpleStaticAbility(new TerritoryForgeStaticEffect()));
|
||||
}
|
||||
|
||||
private TerritoryForge(final TerritoryForge card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerritoryForge copy() {
|
||||
return new TerritoryForge(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TerritoryForgeExileEffect extends OneShotEffect {
|
||||
|
||||
TerritoryForgeExileEffect() {
|
||||
super(Outcome.Exile);
|
||||
}
|
||||
|
||||
private TerritoryForgeExileEffect(final TerritoryForgeExileEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerritoryForgeExileEffect copy() {
|
||||
return new TerritoryForgeExileEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if (player == null || permanent == null) {
|
||||
return false;
|
||||
}
|
||||
UUID exileId = CardUtil.getExileZoneId(game, source);
|
||||
String exileName = CardUtil.getSourceName(game, source);
|
||||
return player.moveCardsToExile(permanent, source, game, true, exileId, exileName);
|
||||
}
|
||||
}
|
||||
|
||||
// Inspired by Dark Impostor
|
||||
class TerritoryForgeStaticEffect extends ContinuousEffectImpl {
|
||||
|
||||
TerritoryForgeStaticEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "{this} has all activated ability of the exiled card";
|
||||
}
|
||||
|
||||
private TerritoryForgeStaticEffect(final TerritoryForgeStaticEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerritoryForgeStaticEffect copy() {
|
||||
return new TerritoryForgeStaticEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), permanent.getZoneChangeCounter(game));
|
||||
ExileZone exileZone = game.getExile().getExileZone(exileId);
|
||||
if (exileZone == null || exileZone.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (Card card : exileZone.getCards(game)) {
|
||||
for (Ability ability : card.getAbilities(game)) {
|
||||
if (ability.getAbilityType() == AbilityType.ACTIVATED || ability.getAbilityType() == AbilityType.MANA) {
|
||||
ActivatedAbility copyAbility = (ActivatedAbility) ability.copy();
|
||||
permanent.addAbility(copyAbility, source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -46,6 +46,7 @@ public final class TheBigScore extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Simulacrum Synthesizer", 6, Rarity.MYTHIC, mage.cards.s.SimulacrumSynthesizer.class));
|
||||
cards.add(new SetCardInfo("Sword of Wealth and Power", 26, Rarity.MYTHIC, mage.cards.s.SwordOfWealthAndPower.class));
|
||||
cards.add(new SetCardInfo("Tarnation Vista", 30, Rarity.MYTHIC, mage.cards.t.TarnationVista.class));
|
||||
cards.add(new SetCardInfo("Territory Forge", 15, Rarity.MYTHIC, mage.cards.t.TerritoryForge.class));
|
||||
cards.add(new SetCardInfo("Torpor Orb", 27, Rarity.MYTHIC, mage.cards.t.TorporOrb.class));
|
||||
cards.add(new SetCardInfo("Transmutation Font", 28, Rarity.MYTHIC, mage.cards.t.TransmutationFont.class));
|
||||
cards.add(new SetCardInfo("Vaultborn Tyrant", 20, Rarity.MYTHIC, mage.cards.v.VaultbornTyrant.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue