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

Using unique/special new event type for taking special actions and special mana payment(fixes ).

This commit is contained in:
LevelX2 2020-09-17 17:01:59 +02:00
parent 08d9e8cfa0
commit 75c4ff7d8e
9 changed files with 45 additions and 6 deletions

View file

@ -14,6 +14,7 @@ import mage.abilities.effects.common.CreateSpecialActionEffect;
import mage.abilities.effects.common.RemoveSpecialActionEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AbilityType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
@ -75,6 +76,7 @@ class ChannelSpecialAction extends SpecialAction {
ChannelSpecialAction() {
super();
this.abilityType = AbilityType.SPECIAL_MANA_PAYMENT;
this.addCost(new PayLifeCost(1));
this.addEffect(new BasicManaEffect(Mana.ColorlessMana(1)));
}

View file

@ -56,7 +56,8 @@ public class DampingEngine extends CardImpl {
public DampingEngine(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// A player who controls more permanents than each other player can't play lands or cast artifact, creature, or enchantment spells. That player may sacrifice a permanent for that player to ignore this effect until end of turn.
// A player who controls more permanents than each other player can't play lands or cast artifact, creature, or enchantment spells.
// That player may sacrifice a permanent for that player to ignore this effect until end of turn.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DampingEngineEffect()));
this.addAbility(new DampingEngineSpecialAction());

View file

@ -127,6 +127,7 @@ class AssistSpecialAction extends SpecialAction {
AssistSpecialAction(ManaCost unpaid, AlternateManaPaymentAbility manaAbility) {
super(Zone.ALL, manaAbility);
this.abilityType = AbilityType.SPECIAL_MANA_PAYMENT;
setRuleVisible(false);
this.addEffect(new AssistEffect(unpaid));
}

View file

@ -173,6 +173,7 @@ class ConvokeSpecialAction extends SpecialAction {
public ConvokeSpecialAction(ManaCost unpaid, AlternateManaPaymentAbility manaAbility) {
super(Zone.ALL, manaAbility);
this.abilityType = AbilityType.SPECIAL_MANA_PAYMENT;
setRuleVisible(false);
this.addEffect(new ConvokeEffect(unpaid));
}

View file

@ -126,6 +126,7 @@ class DelveSpecialAction extends SpecialAction {
public DelveSpecialAction(AlternateManaPaymentAbility manaAbility) {
super(Zone.ALL, manaAbility);
this.abilityType = AbilityType.SPECIAL_MANA_PAYMENT;
this.addEffect(new DelveEffect());
}

View file

@ -115,6 +115,7 @@ class ImproviseSpecialAction extends SpecialAction {
public ImproviseSpecialAction(ManaCost unpaid, AlternateManaPaymentAbility manaAbility) {
super(Zone.ALL, manaAbility);
this.abilityType = AbilityType.SPECIAL_MANA_PAYMENT;
setRuleVisible(false);
this.addEffect(new ImproviseEffect(unpaid));
}

View file

@ -12,7 +12,8 @@ public enum AbilityType {
TRIGGERED("Triggered", false),
EVASION("Evasion", false),
LOYALTY("Loyalty", false),
SPECIAL_ACTION("Special Action", false);
SPECIAL_ACTION("Special Action", false),
SPECIAL_MANA_PAYMENT("Special Mana Payment", false); // No activated ability and no special action. (e.g. Improvise, Delve)
private final String text;
private final boolean playCardAbility;

View file

@ -156,12 +156,18 @@ public class GameEvent implements Serializable {
sourceId sourceId of the object with that ability
playerId player that tries to use this ability
*/
TAKE_SPECIAL_ACTION, TAKEN_SPECIAL_ACTION, // not used in implementation yet
TAKE_SPECIAL_ACTION, TAKEN_SPECIAL_ACTION,
/* TAKE_SPECIAL_ACTION, TAKEN_SPECIAL_ACTION,
targetId id of the ability to activate / use
sourceId sourceId of the object with that ability
playerId player that tries to use this ability
*/
TAKE_SPECIAL_MANA_PAYMENT, TAKEN_SPECIAL_MANA_PAYMENT,
/* TAKE_SPECIAL_MANA_PAYMENT, TAKEN_SPECIAL_MANA_PAYMENT
targetId id of the ability to activate / use
sourceId sourceId of the object with that ability
playerId player that tries to use this ability
*/
TRIGGERED_ABILITY,
RESOLVING_ABILITY,
COPY_STACKOBJECT, COPIED_STACKOBJECT,

View file

@ -1378,11 +1378,11 @@ public abstract class PlayerImpl implements Player, Serializable {
protected boolean specialAction(SpecialAction action, Game game) {
//20091005 - 114
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATE_ABILITY,
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TAKE_SPECIAL_ACTION,
action.getId(), action.getSourceId(), getId()))) {
int bookmark = game.bookmarkState();
if (action.activate(game, false)) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATED_ABILITY,
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TAKEN_SPECIAL_ACTION,
action.getId(), action.getSourceId(), getId()));
if (!game.isSimulation()) {
game.informPlayers(getLogName() + action.getGameLogMessage(game));
@ -1397,7 +1397,29 @@ public abstract class PlayerImpl implements Player, Serializable {
}
return false;
}
protected boolean specialManaPayment(SpecialAction action, Game game) {
//20091005 - 114
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TAKE_SPECIAL_MANA_PAYMENT,
action.getId(), action.getSourceId(), getId()))) {
int bookmark = game.bookmarkState();
if (action.activate(game, false)) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.TAKEN_SPECIAL_MANA_PAYMENT,
action.getId(), action.getSourceId(), getId()));
if (!game.isSimulation()) {
game.informPlayers(getLogName() + action.getGameLogMessage(game));
}
if (action.resolve(game)) {
game.removeBookmark(bookmark);
resetStoredBookmark(game);
return true;
}
}
restoreState(bookmark, action.getRule(), game);
}
return false;
}
@Override
public boolean activateAbility(ActivatedAbility ability, Game game) {
if (ability == null) {
@ -1445,6 +1467,9 @@ public abstract class PlayerImpl implements Player, Serializable {
case SPECIAL_ACTION:
result = specialAction((SpecialAction) ability.copy(), game);
break;
case SPECIAL_MANA_PAYMENT:
result = specialManaPayment((SpecialAction) ability.copy(), game);
break;
case MANA:
result = playManaAbility((ActivatedManaAbilityImpl) ability.copy(), game);
break;