mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
* Overload - Fixed that Overload ability can't be used to cast a spell without mana to pay.
This commit is contained in:
parent
209f3bc8c8
commit
ea7921c3de
4 changed files with 14 additions and 5 deletions
|
@ -37,6 +37,7 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -44,7 +45,7 @@ import java.util.UUID;
|
||||||
*/
|
*/
|
||||||
public class SpellAbility extends ActivatedAbilityImpl {
|
public class SpellAbility extends ActivatedAbilityImpl {
|
||||||
|
|
||||||
private SpellAbilityType spellAbilityType;
|
protected SpellAbilityType spellAbilityType;
|
||||||
|
|
||||||
public SpellAbility(ManaCost cost, String cardName) {
|
public SpellAbility(ManaCost cost, String cardName) {
|
||||||
this(cost, cardName, Zone.HAND);
|
this(cost, cardName, Zone.HAND);
|
||||||
|
@ -102,7 +103,13 @@ public class SpellAbility extends ActivatedAbilityImpl {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Alternate spell abilities (Flashback, Overload) can't be cast with no mana to pay option
|
||||||
|
if (getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) {
|
||||||
|
Player player = game.getPlayer(playerId);
|
||||||
|
if (player != null && getSourceId().equals(player.getCastSourceIdWithoutMana())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (costs.canPay(this, sourceId, controllerId, game)) {
|
if (costs.canPay(this, sourceId, controllerId, game)) {
|
||||||
if (getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
|
if (getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
|
||||||
SplitCard splitCard = (SplitCard) game.getCard(getSourceId());
|
SplitCard splitCard = (SplitCard) game.getCard(getSourceId());
|
||||||
|
|
|
@ -63,7 +63,6 @@ import mage.players.Player;
|
||||||
*/
|
*/
|
||||||
public class FlashbackAbility extends SpellAbility {
|
public class FlashbackAbility extends SpellAbility {
|
||||||
|
|
||||||
private SpellAbilityType spellAbilityType;
|
|
||||||
private String abilityName;
|
private String abilityName;
|
||||||
|
|
||||||
public FlashbackAbility(Cost cost, TimingRule timingRule) {
|
public FlashbackAbility(Cost cost, TimingRule timingRule) {
|
||||||
|
@ -74,7 +73,7 @@ public class FlashbackAbility extends SpellAbility {
|
||||||
this.addCost(cost);
|
this.addCost(cost);
|
||||||
this.timing = timingRule;
|
this.timing = timingRule;
|
||||||
this.usesStack = false;
|
this.usesStack = false;
|
||||||
this.spellAbilityType = SpellAbilityType.BASE;
|
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
||||||
this.addEffect(new CreateDelayedTriggeredAbilityEffect(new FlashbackTriggeredAbility()));
|
this.addEffect(new CreateDelayedTriggeredAbilityEffect(new FlashbackTriggeredAbility()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.costs.mana.ManaCosts;
|
import mage.abilities.costs.mana.ManaCosts;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
import mage.constants.SpellAbilityType;
|
||||||
import mage.constants.TimingRule;
|
import mage.constants.TimingRule;
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,6 +62,7 @@ public class OverloadAbility extends SpellAbility {
|
||||||
|
|
||||||
public OverloadAbility(Card card,Effect effect, ManaCosts costs) {
|
public OverloadAbility(Card card,Effect effect, ManaCosts costs) {
|
||||||
this(card, effect, costs, TimingRule.INSTANT);
|
this(card, effect, costs, TimingRule.INSTANT);
|
||||||
|
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OverloadAbility(Card card,Effect effect, ManaCosts costs, TimingRule timingRule) {
|
public OverloadAbility(Card card,Effect effect, ManaCosts costs, TimingRule timingRule) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ package mage.constants;
|
||||||
*/
|
*/
|
||||||
public enum SpellAbilityType {
|
public enum SpellAbilityType {
|
||||||
BASE("Basic SpellAbility"),
|
BASE("Basic SpellAbility"),
|
||||||
|
BASE_ALTERNATE("Basic SpellAbility Alternate"), // used for Overload, Flashback to know they must be handled as Alternate casting costs
|
||||||
SPLIT("Split SpellAbility"),
|
SPLIT("Split SpellAbility"),
|
||||||
SPLIT_FUSED("Split SpellAbility"),
|
SPLIT_FUSED("Split SpellAbility"),
|
||||||
SPLIT_LEFT("LeftSplit SpellAbility"),
|
SPLIT_LEFT("LeftSplit SpellAbility"),
|
||||||
|
@ -13,7 +14,7 @@ public enum SpellAbilityType {
|
||||||
MODE("Mode SpellAbility"),
|
MODE("Mode SpellAbility"),
|
||||||
SPLICE("Spliced SpellAbility");
|
SPLICE("Spliced SpellAbility");
|
||||||
|
|
||||||
private String text;
|
private final String text;
|
||||||
|
|
||||||
SpellAbilityType(String text) {
|
SpellAbilityType(String text) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
|
|
Loading…
Reference in a new issue