Continuing implementation of Planechase.

This commit is contained in:
spjspj 2018-04-15 19:40:15 +10:00
parent 2f966b7a2c
commit b45a409939
4 changed files with 58 additions and 50 deletions

View file

@ -36,7 +36,6 @@ import mage.MageObject;
import mage.abilities.*;
import mage.abilities.common.AttachableToRestrictedAbility;
import mage.abilities.common.CantHaveMoreThanAmountCountersSourceAbility;
import mage.abilities.common.SagaAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffects;
import mage.abilities.effects.Effect;
@ -1079,6 +1078,7 @@ public abstract class GameImpl implements Game, Serializable {
Plane plane = Plane.getRandomPlane();
plane.setControllerId(getActivePlayerId());
addPlane(plane, null, getActivePlayerId());
state.setPlaneChase(this, gameOptions.planeChase);
}
}
@ -1564,6 +1564,14 @@ public abstract class GameImpl implements Game, Serializable {
}
state.addCommandObject(newPlane);
informPlayers("You have planeswalked to " + newPlane.getLogName());
// Fire off the planeswalked event
GameEvent event = new GameEvent(GameEvent.EventType.PLANESWALK, newPlane.getId(), null, newPlane.getId(), 0, true);
if (!replaceEvent(event)) {
GameEvent ge = new GameEvent(GameEvent.EventType.PLANESWALKED, newPlane.getId(), null, newPlane.getId(), 0, true);
fireEvent(ge);
}
return true;
}
@ -1915,7 +1923,7 @@ public abstract class GameImpl implements Game, Serializable {
if (perm.isWorld()) {
worldEnchantment.add(perm);
}
if (perm.hasSubtype(SubType.AURA, this)) {
if (StaticFilters.FILTER_PERMANENT_AURA.match(perm, this)) {
//20091005 - 704.5n, 702.14c
if (perm.getAttachedTo() == null) {
Card card = this.getCard(perm.getId());
@ -2005,30 +2013,6 @@ public abstract class GameImpl implements Game, Serializable {
}
}
}
// Remove Saga enchantment if last chapter is reached and chapter ability has left the stack
if (perm.hasSubtype(SubType.SAGA, this)) {
for (Ability sagaAbility : perm.getAbilities()) {
if (sagaAbility instanceof SagaAbility) {
int maxChapter = ((SagaAbility) sagaAbility).getMaxChapter().getNumber();
if (maxChapter <= perm.getCounters(this).getCount(CounterType.LORE)) {
boolean noChapterAbilityOnStack = true;
// Check chapter abilities on stack
for (StackObject stackObject : getStack()) {
if (stackObject.getSourceId().equals(perm.getId()) && SagaAbility.isChapterAbility(stackObject)) {
noChapterAbilityOnStack = false;
break;
}
}
if (noChapterAbilityOnStack) {
// After the last chapter ability has left the stack, you'll sacrifice the Saga
perm.sacrifice(perm.getId(), this);
somethingHappened = true;
}
}
}
}
}
if (this.getState().isLegendaryRuleActive() && StaticFilters.FILTER_PERMANENT_LEGENDARY.match(perm, this)) {
legendary.add(perm);
}

View file

@ -232,6 +232,7 @@ public class GameEvent implements Serializable {
FLIP_COIN, COIN_FLIPPED, SCRY, FATESEAL,
ROLL_DICE, DICE_ROLLED,
ROLL_PLANAR_DIE, PLANAR_DIE_ROLLED,
PLANESWALK, PLANESWALKED,
PAID_CUMULATIVE_UPKEEP,
DIDNT_PAY_CUMULATIVE_UPKEEP,
//permanent events