mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[FIC] Implement Garland, Royal Kidnapper
This commit is contained in:
parent
4b146dec7e
commit
928a851d79
4 changed files with 175 additions and 4 deletions
172
Mage.Sets/src/mage/cards/g/GarlandRoyalKidnapper.java
Normal file
172
Mage.Sets/src/mage/cards/g/GarlandRoyalKidnapper.java
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.BecomesMonarchTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostAllEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class GarlandRoyalKidnapper extends CardImpl {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter
|
||||
= new FilterControlledCreaturePermanent("creatures you control but don't own");
|
||||
|
||||
static {
|
||||
filter.add(TargetController.NOT_YOU.getOwnerPredicate());
|
||||
}
|
||||
|
||||
public GarlandRoyalKidnapper(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{B}");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.KNIGHT);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// When Garland enters, target opponent becomes the monarch.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new BecomesMonarchTargetEffect());
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
||||
// Whenever an opponent becomes the monarch, gain control of target creature that player controls for as long as they're the monarch.
|
||||
this.addAbility(new GarlandRoyalKidnapperTriggeredAbility());
|
||||
|
||||
// Creatures you control but don't own get +2/+2 and can't be sacrificed.
|
||||
ability = new SimpleStaticAbility(new BoostAllEffect(
|
||||
2, 2, Duration.WhileOnBattlefield, filter, false
|
||||
));
|
||||
ability.addEffect(new GarlandRoyalKidnapperSacrificeEffect());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private GarlandRoyalKidnapper(final GarlandRoyalKidnapper card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GarlandRoyalKidnapper copy() {
|
||||
return new GarlandRoyalKidnapper(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GarlandRoyalKidnapperTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
GarlandRoyalKidnapperTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new GarlandRoyalKidnapperControlEffect());
|
||||
this.addTarget(new TargetOpponent());
|
||||
this.setTriggerPhrase("Whenever an opponent becomes the monarch, ");
|
||||
}
|
||||
|
||||
private GarlandRoyalKidnapperTriggeredAbility(final GarlandRoyalKidnapperTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GarlandRoyalKidnapperTriggeredAbility copy() {
|
||||
return new GarlandRoyalKidnapperTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.BECOMES_MONARCH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Player player = game.getPlayer(event.getTargetId());
|
||||
if (player == null || !game.getOpponents(getControllerId()).contains(player.getId())) {
|
||||
return false;
|
||||
}
|
||||
FilterPermanent filter = new FilterCreaturePermanent("creature controlled by " + player.getName());
|
||||
filter.add(new ControllerIdPredicate(player.getId()));
|
||||
this.getTargets().clear();
|
||||
this.addTarget(new TargetPermanent(filter));
|
||||
this.getEffects().setValue("monarchId", player.getId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class GarlandRoyalKidnapperControlEffect extends GainControlTargetEffect {
|
||||
|
||||
GarlandRoyalKidnapperControlEffect() {
|
||||
super(Duration.Custom, true);
|
||||
staticText = "gain control of target creature that player controls for as long as they're the monarch";
|
||||
}
|
||||
|
||||
private GarlandRoyalKidnapperControlEffect(final GarlandRoyalKidnapperControlEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GarlandRoyalKidnapperControlEffect copy() {
|
||||
return new GarlandRoyalKidnapperControlEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null
|
||||
&& Optional
|
||||
.ofNullable((UUID) getValue("monarchId"))
|
||||
.filter(uuid -> uuid.equals(game.getMonarchId()))
|
||||
.isPresent()) {
|
||||
return super.apply(game, source);
|
||||
}
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class GarlandRoyalKidnapperSacrificeEffect extends ContinuousEffectImpl {
|
||||
|
||||
GarlandRoyalKidnapperSacrificeEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.RulesEffects, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "and can't be sacrificed";
|
||||
}
|
||||
|
||||
private GarlandRoyalKidnapperSacrificeEffect(final GarlandRoyalKidnapperSacrificeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GarlandRoyalKidnapperSacrificeEffect copy() {
|
||||
return new GarlandRoyalKidnapperSacrificeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE, source.getControllerId(), source, game
|
||||
)) {
|
||||
if (!permanent.isOwnedBy(source.getControllerId())) {
|
||||
permanent.setCanBeSacrificed(true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -34,8 +34,7 @@ public final class JaredCarthalionTrueHeir extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// When Jared Carthalion, True Heir enters the battlefield, target opponent becomes the monarch. You can't become the monarch this turn.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new BecomesMonarchTargetEffect()
|
||||
.setText("target opponent becomes the monarch"));
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new BecomesMonarchTargetEffect());
|
||||
ability.addEffect(new JaredCarthalionTrueHeirMonarchEffect());
|
||||
ability.addTarget(new TargetOpponent());
|
||||
ability.addHint(MonarchHint.instance);
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ public final class FinalFantasyCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("G'raha Tia, Scion Reborn", 222, Rarity.MYTHIC, mage.cards.g.GrahaTiaScionReborn.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("G'raha Tia, Scion Reborn", 3, Rarity.MYTHIC, mage.cards.g.GrahaTiaScionReborn.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Game Trail", 398, Rarity.RARE, mage.cards.g.GameTrail.class));
|
||||
cards.add(new SetCardInfo("Garland, Royal Kidnapper", 442, Rarity.RARE, mage.cards.g.GarlandRoyalKidnapper.class));
|
||||
cards.add(new SetCardInfo("Gatta and Luzzu", 134, Rarity.RARE, mage.cards.g.GattaAndLuzzu.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Gatta and Luzzu", 19, Rarity.RARE, mage.cards.g.GattaAndLuzzu.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Gau, Feral Youth", 152, Rarity.RARE, mage.cards.g.GauFeralYouth.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class BecomesMonarchTargetEffect extends OneShotEffect {
|
|||
|
||||
public BecomesMonarchTargetEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "target player becomes the monarch";
|
||||
staticText = "target opponent becomes the monarch";
|
||||
}
|
||||
|
||||
protected BecomesMonarchTargetEffect(final BecomesMonarchTargetEffect effect) {
|
||||
|
|
@ -34,5 +34,4 @@ public class BecomesMonarchTargetEffect extends OneShotEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue