mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
removed more calls to isHuman/isComputer
This commit is contained in:
@@ -8,13 +8,10 @@ import forge.CardLists;
|
|||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
import forge.card.ability.AbilityUtils;
|
import forge.card.ability.AbilityUtils;
|
||||||
import forge.card.ability.SpellAbilityEffect;
|
import forge.card.ability.SpellAbilityEffect;
|
||||||
import forge.card.spellability.AbilitySub;
|
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiChoose;
|
|
||||||
import forge.gui.GuiDialog;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PeeakAndReveal is a simplified why of handling something that could
|
* PeeakAndReveal is a simplified why of handling something that could
|
||||||
@@ -32,7 +29,6 @@ public class PeekAndRevealEffect extends SpellAbilityEffect {
|
|||||||
public void resolve(SpellAbility sa) {
|
public void resolve(SpellAbility sa) {
|
||||||
//RevealValid$ Card.sharesCreatureTypeWith | RevealOptional$ True | RememberRevealed$ True
|
//RevealValid$ Card.sharesCreatureTypeWith | RevealOptional$ True | RememberRevealed$ True
|
||||||
Card source = sa.getSourceCard();
|
Card source = sa.getSourceCard();
|
||||||
boolean revealOptional = sa.hasParam("RevealOptional");
|
|
||||||
boolean rememberRevealed = sa.hasParam("RememberRevealed");
|
boolean rememberRevealed = sa.hasParam("RememberRevealed");
|
||||||
String revealValid = sa.hasParam("RevealValid") ? sa.getParam("RevealValid") : "Card";
|
String revealValid = sa.hasParam("RevealValid") ? sa.getParam("RevealValid") : "Card";
|
||||||
String peekAmount = sa.hasParam("PeekAmount") ? sa.getParam("PeekAmount") : "1";
|
String peekAmount = sa.hasParam("PeekAmount") ? sa.getParam("PeekAmount") : "1";
|
||||||
@@ -53,29 +49,16 @@ public class PeekAndRevealEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
List<Card> revealableCards = CardLists.getValidCards(peekCards, revealValid, sa.getActivatingPlayer(), sa.getSourceCard());
|
List<Card> revealableCards = CardLists.getValidCards(peekCards, revealValid, sa.getActivatingPlayer(), sa.getSourceCard());
|
||||||
boolean doReveal = !sa.hasParam("NoReveal") && !revealableCards.isEmpty();
|
boolean doReveal = !sa.hasParam("NoReveal") && !revealableCards.isEmpty();
|
||||||
|
|
||||||
//peekingPlayer.showCards(peekCards)
|
|
||||||
if (peekingPlayer.isHuman()) {
|
|
||||||
if (!sa.hasParam("NoPeek")) {
|
if (!sa.hasParam("NoPeek")) {
|
||||||
GuiChoose.one(source + "Revealing cards from library", peekCards);
|
peekingPlayer.getController().reveal(source + "Revealing cards from library", peekCards, ZoneType.Library, peekingPlayer);
|
||||||
}
|
|
||||||
if (doReveal && revealOptional) {
|
|
||||||
StringBuilder question = new StringBuilder();
|
|
||||||
question.append("Reveal cards to other players?");
|
|
||||||
doReveal = GuiDialog.confirm(source, question.toString());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (doReveal && revealOptional) {
|
|
||||||
// If
|
|
||||||
AbilitySub subAb = sa.getSubAbility();
|
|
||||||
doReveal = subAb != null && subAb.getAi().chkDrawbackWithSubs(peekingPlayer, subAb);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( doReveal && sa.hasParam("RevealOptional") )
|
||||||
|
doReveal = peekingPlayer.getController().confirmAction(sa, null, "Reveal cards to other players?");
|
||||||
|
|
||||||
if (doReveal) {
|
if (doReveal) {
|
||||||
if (!peekingPlayer.isHuman()) {
|
peekingPlayer.getGame().getAction().reveal(revealableCards, peekingPlayer);
|
||||||
GuiChoose.one(source + "Revealing cards from library", revealableCards);
|
|
||||||
}
|
|
||||||
// Singletons.getModel().getGameAction().revealCardsToOtherPlayers(peekingPlayer, revealableCards);
|
// Singletons.getModel().getGameAction().revealCardsToOtherPlayers(peekingPlayer, revealableCards);
|
||||||
if (rememberRevealed) {
|
if (rememberRevealed) {
|
||||||
for(Card c : revealableCards) {
|
for(Card c : revealableCards) {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import forge.card.spellability.SpellAbility;
|
|||||||
import forge.game.GameState;
|
import forge.game.GameState;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiDialog;
|
|
||||||
import forge.util.Expressions;
|
import forge.util.Expressions;
|
||||||
|
|
||||||
public class RepeatEffect extends SpellAbilityEffect {
|
public class RepeatEffect extends SpellAbilityEffect {
|
||||||
@@ -124,16 +123,7 @@ public class RepeatEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("RepeatOptional")) {
|
if (sa.hasParam("RepeatOptional")) {
|
||||||
if (sa.getActivatingPlayer().isComputer()) {
|
return sa.getActivatingPlayer().getController().confirmAction(sa, null, "Do you want to repeat this process again?");
|
||||||
//TODO add logic to have computer make better choice (ArsenalNut)
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
final StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Do you want to repeat this process again?");
|
|
||||||
if (!GuiDialog.confirm(sa.getSourceCard(), sb.toString())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import forge.card.ability.ApiType;
|
|||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
import forge.card.cost.CostDiscard;
|
import forge.card.cost.CostDiscard;
|
||||||
import forge.card.cost.CostPart;
|
import forge.card.cost.CostPart;
|
||||||
|
import forge.card.spellability.AbilitySub;
|
||||||
import forge.card.spellability.Spell;
|
import forge.card.spellability.Spell;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.card.spellability.SpellPermanent;
|
import forge.card.spellability.SpellPermanent;
|
||||||
@@ -724,6 +725,15 @@ public class AiController {
|
|||||||
Card topc = player.getZone(ZoneType.Library).get(0);
|
Card topc = player.getZone(ZoneType.Library).get(0);
|
||||||
return topc.isInstant() || topc.isSorcery();
|
return topc.isInstant() || topc.isSorcery();
|
||||||
|
|
||||||
|
case Repeat:
|
||||||
|
//TODO add logic to have computer make better choice (ArsenalNut)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
case PeekAndReveal:
|
||||||
|
AbilitySub subAb = sa.getSubAbility();
|
||||||
|
return subAb != null && subAb.getAi().chkDrawbackWithSubs(player, subAb);
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
String exMsg = String.format("AI confirmAction does not know what to decide about %s API with %s mode.", api, mode);
|
String exMsg = String.format("AI confirmAction does not know what to decide about %s API with %s mode.", api, mode);
|
||||||
|
|||||||
Reference in New Issue
Block a user