mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Implemented Pramikon, Sky Rampart
This commit is contained in:
parent
9754542be2
commit
4e3709fb89
3 changed files with 182 additions and 40 deletions
|
@ -30,16 +30,17 @@ public final class MysticBarrier extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}");
|
||||
|
||||
// When Mystic Barrier enters the battlefield or at the beginning of your upkeep, choose left or right.
|
||||
this.addAbility(new OrTriggeredAbility(Zone.BATTLEFIELD, new ChooseModeEffect("Choose a direction to allow attacking in.",
|
||||
this.addAbility(new OrTriggeredAbility(Zone.BATTLEFIELD, new ChooseModeEffect(
|
||||
"Choose a direction to allow attacking in.",
|
||||
ALLOW_ATTACKING_LEFT, ALLOW_ATTACKING_RIGHT),
|
||||
new EntersBattlefieldTriggeredAbility(null, false),
|
||||
new BeginningOfUpkeepTriggeredAbility(null, TargetController.YOU, false)));
|
||||
|
||||
// Each player may attack only the opponent seated nearest him or her in the last chosen direction and planeswalkers controlled by that player.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MysticBarrierReplacementEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(new MysticBarrierReplacementEffect()));
|
||||
}
|
||||
|
||||
public MysticBarrier(final MysticBarrier card) {
|
||||
private MysticBarrier(final MysticBarrier card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -53,10 +54,11 @@ class MysticBarrierReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
MysticBarrierReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "Each player may attack only the opponent seated nearest him or her in the last chosen direction and planeswalkers controlled by that player";
|
||||
staticText = "Each player may attack only the nearest opponent in the " +
|
||||
"last chosen direction and planeswalkers controlled by that player.";
|
||||
}
|
||||
|
||||
MysticBarrierReplacementEffect(MysticBarrierReplacementEffect effect) {
|
||||
private MysticBarrierReplacementEffect(MysticBarrierReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -74,10 +76,16 @@ class MysticBarrierReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getPlayers().size() > 2) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (game.getState().getPlayersInRange(controller.getId(), game).contains(event.getPlayerId())) {
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
if (!game.getState().getPlayersInRange(controller.getId(), game).contains(event.getPlayerId())) {
|
||||
return false;
|
||||
}
|
||||
String allowedDirection = (String) game.getState().getValue(source.getSourceId() + "_modeChoice");
|
||||
if (allowedDirection != null) {
|
||||
if (allowedDirection == null) {
|
||||
return false;
|
||||
}
|
||||
Player defender = game.getPlayer(event.getTargetId());
|
||||
if (defender == null) {
|
||||
Permanent planeswalker = game.getPermanent(event.getTargetId());
|
||||
|
@ -85,10 +93,12 @@ class MysticBarrierReplacementEffect extends ReplacementEffectImpl {
|
|||
defender = game.getPlayer(planeswalker.getControllerId());
|
||||
}
|
||||
}
|
||||
if (defender != null) {
|
||||
if (defender == null) {
|
||||
return false;
|
||||
}
|
||||
PlayerList playerList = game.getState().getPlayerList(event.getPlayerId());
|
||||
if (allowedDirection.equals(MysticBarrier.ALLOW_ATTACKING_LEFT)) {
|
||||
if (!playerList.getNext().equals(defender.getId())) {
|
||||
if (allowedDirection.equals(MysticBarrier.ALLOW_ATTACKING_LEFT)
|
||||
&& !playerList.getNext().equals(defender.getId())) {
|
||||
// the defender is not the player to the left
|
||||
Player attacker = game.getPlayer(event.getPlayerId());
|
||||
if (attacker != null) {
|
||||
|
@ -96,9 +106,8 @@ class MysticBarrierReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (allowedDirection.equals(MysticBarrier.ALLOW_ATTACKING_RIGHT)) {
|
||||
if (!playerList.getPrevious().equals(defender.getId())) {
|
||||
if (allowedDirection.equals(MysticBarrier.ALLOW_ATTACKING_RIGHT)
|
||||
&& !playerList.getPrevious().equals(defender.getId())) {
|
||||
// the defender is not the player to the right
|
||||
Player attacker = game.getPlayer(event.getPlayerId());
|
||||
if (attacker != null) {
|
||||
|
@ -107,11 +116,6 @@ class MysticBarrierReplacementEffect extends ReplacementEffectImpl {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
137
Mage.Sets/src/mage/cards/p/PramikonSkyRampart.java
Normal file
137
Mage.Sets/src/mage/cards/p/PramikonSkyRampart.java
Normal file
|
@ -0,0 +1,137 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.ChooseModeEffect;
|
||||
import mage.abilities.keyword.DefenderAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.players.PlayerList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PramikonSkyRampart extends CardImpl {
|
||||
|
||||
static final String ALLOW_ATTACKING_LEFT = "Allow attacking left";
|
||||
static final String ALLOW_ATTACKING_RIGHT = "Allow attacking right";
|
||||
|
||||
public PramikonSkyRampart(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{R}{W}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.WALL);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Defender
|
||||
this.addAbility(DefenderAbility.getInstance());
|
||||
|
||||
// As Pramikon, Sky Rampart enters the battlefield, choose left or right.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseModeEffect(
|
||||
"Choose a direction to allow attacking in.",
|
||||
ALLOW_ATTACKING_LEFT, ALLOW_ATTACKING_RIGHT
|
||||
)));
|
||||
|
||||
// Each player may attack only the nearest opponent in the chosen direction and planeswalkers controlled by that opponent.
|
||||
this.addAbility(new SimpleStaticAbility(new PramikonSkyRampartReplacementEffect()));
|
||||
}
|
||||
|
||||
private PramikonSkyRampart(final PramikonSkyRampart card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PramikonSkyRampart copy() {
|
||||
return new PramikonSkyRampart(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PramikonSkyRampartReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
PramikonSkyRampartReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "Each player may attack only the nearest opponent " +
|
||||
"in the chosen direction and planeswalkers controlled by that opponent.";
|
||||
}
|
||||
|
||||
private PramikonSkyRampartReplacementEffect(PramikonSkyRampartReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARE_ATTACKER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getPlayers().size() > 2) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
if (!game.getState().getPlayersInRange(controller.getId(), game).contains(event.getPlayerId())) {
|
||||
return false;
|
||||
}
|
||||
String allowedDirection = (String) game.getState().getValue(source.getSourceId() + "_modeChoice");
|
||||
if (allowedDirection == null) {
|
||||
return false;
|
||||
}
|
||||
Player defender = game.getPlayer(event.getTargetId());
|
||||
if (defender == null) {
|
||||
Permanent planeswalker = game.getPermanent(event.getTargetId());
|
||||
if (planeswalker != null) {
|
||||
defender = game.getPlayer(planeswalker.getControllerId());
|
||||
}
|
||||
}
|
||||
if (defender == null) {
|
||||
return false;
|
||||
}
|
||||
PlayerList playerList = game.getState().getPlayerList(event.getPlayerId());
|
||||
if (allowedDirection.equals(PramikonSkyRampart.ALLOW_ATTACKING_LEFT)
|
||||
&& !playerList.getNext().equals(defender.getId())) {
|
||||
// the defender is not the player to the left
|
||||
Player attacker = game.getPlayer(event.getPlayerId());
|
||||
if (attacker != null) {
|
||||
game.informPlayer(attacker, "You can only attack to the left!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (allowedDirection.equals(PramikonSkyRampart.ALLOW_ATTACKING_RIGHT)
|
||||
&& !playerList.getPrevious().equals(defender.getId())) {
|
||||
// the defender is not the player to the right
|
||||
Player attacker = game.getPlayer(event.getPlayerId());
|
||||
if (attacker != null) {
|
||||
game.informPlayer(attacker, "You can only attack to the right!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PramikonSkyRampartReplacementEffect copy() {
|
||||
return new PramikonSkyRampartReplacementEffect(this);
|
||||
}
|
||||
}
|
|
@ -50,6 +50,7 @@ public final class Commander2019Edition extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Nantuko Vigilante", 174, Rarity.COMMON, mage.cards.n.NantukoVigilante.class));
|
||||
cards.add(new SetCardInfo("Plains", 288, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Prairie Stream", 265, Rarity.RARE, mage.cards.p.PrairieStream.class));
|
||||
cards.add(new SetCardInfo("Pramikon, Sky Rampart", 47, Rarity.MYTHIC, mage.cards.p.PramikonSkyRampart.class));
|
||||
cards.add(new SetCardInfo("Prismatic Strands", 69, Rarity.COMMON, mage.cards.p.PrismaticStrands.class));
|
||||
cards.add(new SetCardInfo("Ral Zarek", 198, Rarity.MYTHIC, mage.cards.r.RalZarek.class));
|
||||
cards.add(new SetCardInfo("Reality Shift", 92, Rarity.UNCOMMON, mage.cards.r.RealityShift.class));
|
||||
|
|
Loading…
Reference in a new issue