mirror of
https://github.com/magefree/mage.git
synced 2026-01-23 19:59:54 -08:00
[C15] Added Scourge of Nel Toth.
This commit is contained in:
parent
bfb54ca112
commit
7044e58231
12 changed files with 179 additions and 21 deletions
|
|
@ -44,6 +44,8 @@ import mage.abilities.Modes;
|
|||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.costs.AlternativeSourceCosts;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.Costs;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
|
|
@ -756,19 +758,23 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
void cleanUpOnMatchEnd();
|
||||
|
||||
/**
|
||||
* If the next cast spell has the set sourceId, the spell will be cast
|
||||
* without mana.
|
||||
* If the next spell cast has the set sourceId, the spell will be cast
|
||||
* without mana (null) or the mana set to manaCosts instead of its normal
|
||||
* mana costs.
|
||||
*
|
||||
* @param sourceId the source that can be cast without mana
|
||||
* @param manaCosts alternate ManaCost, null if it can be cast without mana
|
||||
* cost
|
||||
* @param costs alternate other costs you need to pay
|
||||
*/
|
||||
void setCastSourceIdWithAlternateMana(UUID sourceId, ManaCosts manaCosts);
|
||||
void setCastSourceIdWithAlternateMana(UUID sourceId, ManaCosts<ManaCost> manaCosts, mage.abilities.costs.Costs costs);
|
||||
|
||||
UUID getCastSourceIdWithAlternateMana();
|
||||
|
||||
ManaCosts getCastSourceIdManaCosts();
|
||||
|
||||
Costs<Cost> getCastSourceIdCosts();
|
||||
|
||||
// permission handling to show hand cards
|
||||
void addPermissionToShowHandCards(UUID watcherUserId);
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ import mage.abilities.costs.AlternativeCost;
|
|||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.AlternativeSourceCosts;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.Costs;
|
||||
import mage.abilities.costs.OptionalAdditionalSourceCosts;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
|
|
@ -222,7 +223,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
// indicates that the spell with the set sourceId can be cast with an alternate mana costs (can also be no mana costs)
|
||||
protected UUID castSourceIdWithAlternateMana;
|
||||
protected ManaCosts castSourceIdManaCosts;
|
||||
protected ManaCosts<ManaCost> castSourceIdManaCosts;
|
||||
protected Costs<Cost> castSourceIdCosts;
|
||||
|
||||
// indicates that the player is in mana payment phase
|
||||
protected boolean payManaMode = false;
|
||||
|
|
@ -326,6 +328,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
this.castSourceIdWithAlternateMana = player.castSourceIdWithAlternateMana;
|
||||
this.castSourceIdManaCosts = player.castSourceIdManaCosts;
|
||||
this.castSourceIdCosts = player.castSourceIdCosts;
|
||||
this.payManaMode = player.payManaMode;
|
||||
}
|
||||
|
||||
|
|
@ -388,6 +391,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.reachedNextTurnAfterLeaving = player.hasReachedNextTurnAfterLeaving();
|
||||
this.castSourceIdWithAlternateMana = player.getCastSourceIdWithAlternateMana();
|
||||
this.castSourceIdManaCosts = player.getCastSourceIdManaCosts();
|
||||
this.castSourceIdCosts = player.getCastSourceIdCosts();
|
||||
|
||||
// Don't restore!
|
||||
// this.storedBookmark
|
||||
|
|
@ -453,6 +457,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
this.castSourceIdWithAlternateMana = null;
|
||||
this.castSourceIdManaCosts = null;
|
||||
this.castSourceIdCosts = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -476,6 +481,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.alternativeSourceCosts.clear();
|
||||
this.castSourceIdWithAlternateMana = null;
|
||||
this.castSourceIdManaCosts = null;
|
||||
this.castSourceIdCosts = null;
|
||||
this.getManaPool().clearEmptyManaPoolRules();
|
||||
}
|
||||
|
||||
|
|
@ -684,6 +690,12 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param amount
|
||||
* @param source
|
||||
* @param game
|
||||
*/
|
||||
@Override
|
||||
public void discard(int amount, Ability source, Game game) {
|
||||
discard(amount, false, source, game);
|
||||
|
|
@ -917,9 +929,10 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setCastSourceIdWithAlternateMana(UUID sourceId, ManaCosts manaCosts) {
|
||||
public void setCastSourceIdWithAlternateMana(UUID sourceId, ManaCosts manaCosts, mage.abilities.costs.Costs costs) {
|
||||
castSourceIdWithAlternateMana = sourceId;
|
||||
castSourceIdManaCosts = manaCosts;
|
||||
castSourceIdCosts = costs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -927,6 +940,11 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return castSourceIdWithAlternateMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Costs<Cost> getCastSourceIdCosts() {
|
||||
return castSourceIdCosts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManaCosts getCastSourceIdManaCosts() {
|
||||
return castSourceIdManaCosts;
|
||||
|
|
@ -950,20 +968,25 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
Zone fromZone = game.getState().getZone(card.getMainCard().getId());
|
||||
card.cast(game, fromZone, ability, playerId);
|
||||
Spell spell = game.getStack().getSpell(ability.getId());
|
||||
// some effects set sourceId to cast without paying mana costs
|
||||
// some effects set sourceId to cast without paying mana costs or other costs
|
||||
if (ability.getSourceId().equals(getCastSourceIdWithAlternateMana())) {
|
||||
ManaCosts alternateCosts = getCastSourceIdManaCosts();
|
||||
Ability spellAbility = spell.getSpellAbility();
|
||||
ManaCosts alternateCosts = getCastSourceIdManaCosts();
|
||||
Costs<Cost> costs = getCastSourceIdCosts();
|
||||
if (alternateCosts == null) {
|
||||
noMana = true;
|
||||
} else {
|
||||
spellAbility.getManaCosts().clear();
|
||||
spellAbility.getManaCosts().add(alternateCosts.copy());
|
||||
spellAbility.getManaCostsToPay().clear();
|
||||
spellAbility.getManaCosts().add(alternateCosts.copy());
|
||||
spellAbility.getManaCostsToPay().add(alternateCosts.copy());
|
||||
}
|
||||
spellAbility.getCosts().clear();
|
||||
if (costs != null) {
|
||||
spellAbility.getCosts().addAll(costs);
|
||||
}
|
||||
}
|
||||
setCastSourceIdWithAlternateMana(null, null);
|
||||
setCastSourceIdWithAlternateMana(null, null, null);
|
||||
GameEvent event = GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, spell.getSpellAbility().getId(), spell.getSpellAbility().getSourceId(), playerId);
|
||||
game.fireEvent(event);
|
||||
if (spell.activate(game, noMana)) {
|
||||
|
|
@ -984,12 +1007,14 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SpellAbility chooseSpellAbilityForCast(SpellAbility ability, Game game, boolean noMana) {
|
||||
public SpellAbility chooseSpellAbilityForCast(SpellAbility ability, Game game, boolean noMana
|
||||
) {
|
||||
return ability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playLand(Card card, Game game) {
|
||||
public boolean playLand(Card card, Game game
|
||||
) {
|
||||
// Check for alternate casting possibilities: e.g. land with Morph
|
||||
ActivatedAbility playLandAbility = null;
|
||||
boolean found = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue