mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Fixed Omniscience
This commit is contained in:
parent
9d4714507a
commit
89e025ce9d
1 changed files with 14 additions and 6 deletions
|
@ -35,6 +35,8 @@ import mage.abilities.effects.CostModificationEffectImpl;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.stack.Spell;
|
||||||
|
import mage.game.stack.StackObject;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -87,12 +89,18 @@ class OmniscienceEffect extends CostModificationEffectImpl<OmniscienceEffect> {
|
||||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
if (abilityToModify instanceof SpellAbility) {
|
if (abilityToModify instanceof SpellAbility) {
|
||||||
Card sourceCard = game.getCard(abilityToModify.getSourceId());
|
Card sourceCard = game.getCard(abilityToModify.getSourceId());
|
||||||
if (sourceCard != null && sourceCard.getOwnerId().equals(source.getControllerId())
|
StackObject stackObject = game.getStack().getStackObject(abilityToModify.getSourceId());
|
||||||
&& !sourceCard.getCardType().contains(CardType.LAND)) {
|
if (stackObject != null && stackObject instanceof Spell) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Zone zone = ((Spell)stackObject).getFromZone();
|
||||||
String message = "Cast " + sourceCard.getName() + " without paying its mana costs?";
|
if (zone != null && zone.equals(Zone.HAND)) {
|
||||||
if (player != null && player.chooseUse(outcome, message, game)) {
|
if (sourceCard != null && sourceCard.getOwnerId().equals(source.getControllerId())
|
||||||
return true;
|
&& !sourceCard.getCardType().contains(CardType.LAND)) {
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
String message = "Cast " + sourceCard.getName() + " without paying its mana costs?";
|
||||||
|
if (player != null && player.chooseUse(outcome, message, game)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue