mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
* Can't cast prevention effects - fixed that UI marked affected cards as playable, but they're not;
This commit is contained in:
parent
4ad29abdd7
commit
f0ff8154f3
1 changed files with 43 additions and 9 deletions
|
@ -3286,12 +3286,25 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
boolean isPlayLand = (ability instanceof PlayLandAbility);
|
boolean isPlayLand = (ability instanceof PlayLandAbility);
|
||||||
|
|
||||||
// as original controller
|
// as original controller
|
||||||
// land restrictions
|
|
||||||
|
// play land restrictions
|
||||||
if (isPlayLand && game.getContinuousEffects().preventedByRuleModification(
|
if (isPlayLand && game.getContinuousEffects().preventedByRuleModification(
|
||||||
GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(),
|
GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(),
|
||||||
ability.getSourceId(), this.getId()), ability, game, true)) {
|
ability.getSourceId(), this.getId()), ability, game, true)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// cast spell restrictions 1
|
||||||
|
if (isPlaySpell && game.getContinuousEffects().preventedByRuleModification(
|
||||||
|
GameEvent.getEvent(EventType.CAST_SPELL, ability.getSourceId(),
|
||||||
|
ability.getSourceId(), this.getId()), ability, game, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// cast spell restrictions 2
|
||||||
|
if (isPlaySpell && game.getContinuousEffects().preventedByRuleModification(
|
||||||
|
GameEvent.getEvent(EventType.CAST_SPELL_LATE, ability.getSourceId(),
|
||||||
|
ability.getSourceId(), this.getId()), ability, game, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
MageObjectReference permittingObject;
|
MageObjectReference permittingObject;
|
||||||
if (isPlaySpell || isPlayLand) {
|
if (isPlaySpell || isPlayLand) {
|
||||||
|
@ -3307,6 +3320,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|| (fromZone == Zone.GRAVEYARD && canPlayCardsFromGraveyard());
|
|| (fromZone == Zone.GRAVEYARD && canPlayCardsFromGraveyard());
|
||||||
|
|
||||||
// as affected controller
|
// as affected controller
|
||||||
|
|
||||||
UUID savedControllerId = ability.getControllerId();
|
UUID savedControllerId = ability.getControllerId();
|
||||||
ability.setControllerId(this.getId());
|
ability.setControllerId(this.getId());
|
||||||
try {
|
try {
|
||||||
|
@ -3351,19 +3365,37 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean fromAll = fromZone.equals(Zone.ALL);
|
boolean fromAll = fromZone.equals(Zone.ALL);
|
||||||
|
|
||||||
if (hidden && (fromAll || fromZone == Zone.HAND)) {
|
if (hidden && (fromAll || fromZone == Zone.HAND)) {
|
||||||
for (Card card : hand.getCards(game)) {
|
for (Card card : hand.getCards(game)) {
|
||||||
for (Ability ability : card.getAbilities(game)) { // gets this activated ability from hand? (Morph?)
|
for (Ability ability : card.getAbilities(game)) { // gets this activated ability from hand? (Morph?)
|
||||||
if (ability.getZone().match(Zone.HAND)) {
|
if (ability.getZone().match(Zone.HAND)) {
|
||||||
|
boolean isPlaySpell = (ability instanceof SpellAbility);
|
||||||
|
boolean isPlayLand = (ability instanceof PlayLandAbility);
|
||||||
|
|
||||||
|
// play land restrictions
|
||||||
|
if (isPlayLand && game.getContinuousEffects().preventedByRuleModification(
|
||||||
|
GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(),
|
||||||
|
ability.getSourceId(), this.getId()), ability, game, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// cast spell restrictions 1
|
||||||
|
if (isPlaySpell && game.getContinuousEffects().preventedByRuleModification(
|
||||||
|
GameEvent.getEvent(EventType.CAST_SPELL, ability.getSourceId(),
|
||||||
|
ability.getSourceId(), this.getId()), ability, game, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// cast spell restrictions 2
|
||||||
|
if (isPlaySpell && game.getContinuousEffects().preventedByRuleModification(
|
||||||
|
GameEvent.getEvent(EventType.CAST_SPELL_LATE, ability.getSourceId(),
|
||||||
|
ability.getSourceId(), this.getId()), ability, game, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if have alternative cost
|
||||||
if (ability instanceof ActivatedAbility) {
|
if (ability instanceof ActivatedAbility) {
|
||||||
if (!(ability instanceof PlayLandAbility)
|
// normal ability
|
||||||
|| !game.getContinuousEffects().preventedByRuleModification(
|
if (canPlay((ActivatedAbility) ability, availableMana, card, game)) {
|
||||||
GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(),
|
playable.add(ability);
|
||||||
ability.getSourceId(), playerId), ability, game, true)) {
|
|
||||||
if (canPlay((ActivatedAbility) ability, availableMana, card, game)) {
|
|
||||||
playable.add(ability);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (ability instanceof AlternativeSourceCosts) {
|
} else if (ability instanceof AlternativeSourceCosts) {
|
||||||
if (card.isLand()) {
|
if (card.isLand()) {
|
||||||
|
@ -3377,6 +3409,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// unknown type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue