1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-11 17:00:08 -09:00

[CMR] Implemented Jared Carthalion, True Heir

This commit is contained in:
Evan Kranzler 2020-11-07 20:08:27 -05:00
parent f28273a126
commit ea83757b41
4 changed files with 123 additions and 0 deletions
Mage.Sets/src/mage
Mage/src/main/java/mage/game

View file

@ -0,0 +1,115 @@
package mage.cards.j;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.common.BecomesMonarchTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class JaredCarthalionTrueHeir extends CardImpl {
public JaredCarthalionTrueHeir(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{G}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(3);
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.addEffect(new JaredCarthalionTrueHeirMonarchEffect());
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
// If damage would be dealt to Jared Carthalion while you're the monarch, prevent that damage and put that many +1/+1 counters on it.
this.addAbility(new SimpleStaticAbility(new JaredCarthalionTrueHeirPreventionEffect()));
}
private JaredCarthalionTrueHeir(final JaredCarthalionTrueHeir card) {
super(card);
}
@Override
public JaredCarthalionTrueHeir copy() {
return new JaredCarthalionTrueHeir(this);
}
}
class JaredCarthalionTrueHeirMonarchEffect extends ContinuousRuleModifyingEffectImpl {
JaredCarthalionTrueHeirMonarchEffect() {
super(Duration.EndOfTurn, Outcome.Detriment, false, false);
staticText = "You can't become the monarch this turn";
}
private JaredCarthalionTrueHeirMonarchEffect(final JaredCarthalionTrueHeirMonarchEffect effect) {
super(effect);
}
@Override
public JaredCarthalionTrueHeirMonarchEffect copy() {
return new JaredCarthalionTrueHeirMonarchEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.BECOME_MONARCH;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return source.isControlledBy(event.getPlayerId());
}
}
class JaredCarthalionTrueHeirPreventionEffect extends PreventionEffectImpl {
JaredCarthalionTrueHeirPreventionEffect() {
super(Duration.WhileOnBattlefield, Integer.MAX_VALUE, false, false);
staticText = "if damage would be dealt to {this} while you're the monarch, " +
"prevent that damage and put that many +1/+1 counters on it";
}
private JaredCarthalionTrueHeirPreventionEffect(final JaredCarthalionTrueHeirPreventionEffect effect) {
super(effect);
}
@Override
public JaredCarthalionTrueHeirPreventionEffect copy() {
return new JaredCarthalionTrueHeirPreventionEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return super.applies(event, source, game)
&& event.getTargetId().equals(source.getSourceId())
&& source.isControlledBy(game.getMonarchId());
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance(event.getAmount()), source, game);
}
return super.replaceEvent(event, source, game);
}
}

View file

@ -235,6 +235,7 @@ public final class CommanderLegends extends ExpansionSet {
cards.add(new SetCardInfo("Island", 506, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ivy Lane Denizen", 236, Rarity.COMMON, mage.cards.i.IvyLaneDenizen.class));
cards.add(new SetCardInfo("Jalum Tome", 318, Rarity.COMMON, mage.cards.j.JalumTome.class));
cards.add(new SetCardInfo("Jared Carthalion, True Heir", 281, Rarity.RARE, mage.cards.j.JaredCarthalionTrueHeir.class));
cards.add(new SetCardInfo("Jaya's Immolating Inferno", 415, Rarity.RARE, mage.cards.j.JayasImmolatingInferno.class));
cards.add(new SetCardInfo("Jeska's Will", 187, Rarity.RARE, mage.cards.j.JeskasWill.class));
cards.add(new SetCardInfo("Jeska, Thrice Reborn", 186, Rarity.MYTHIC, mage.cards.j.JeskaThriceReborn.class));

View file

@ -3364,6 +3364,12 @@ public abstract class GameImpl implements Game, Serializable {
if (monarchId.equals(getMonarchId())) { // Nothing happens if you're already the monarch
return;
}
if (replaceEvent(GameEvent.getEvent(
GameEvent.EventType.BECOME_MONARCH,
monarchId, source.getSourceId(), monarchId
))) {
return;
}
Player newMonarch = getPlayer(monarchId);
if (getMonarchId() == null) {
getState().addDesignation(new Monarch(), this, monarchId);

View file

@ -296,6 +296,7 @@ public class GameEvent implements Serializable {
amount not used for this event
flag not used for this event
*/
BECOME_MONARCH,
BECOMES_MONARCH,
MEDITATED,
PHASE_OUT, PHASED_OUT,