mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +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.card.ability.AbilityUtils;
|
||||
import forge.card.ability.SpellAbilityEffect;
|
||||
import forge.card.spellability.AbilitySub;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.zone.PlayerZone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.gui.GuiChoose;
|
||||
import forge.gui.GuiDialog;
|
||||
|
||||
/**
|
||||
* PeeakAndReveal is a simplified why of handling something that could
|
||||
@@ -32,7 +29,6 @@ public class PeekAndRevealEffect extends SpellAbilityEffect {
|
||||
public void resolve(SpellAbility sa) {
|
||||
//RevealValid$ Card.sharesCreatureTypeWith | RevealOptional$ True | RememberRevealed$ True
|
||||
Card source = sa.getSourceCard();
|
||||
boolean revealOptional = sa.hasParam("RevealOptional");
|
||||
boolean rememberRevealed = sa.hasParam("RememberRevealed");
|
||||
String revealValid = sa.hasParam("RevealValid") ? sa.getParam("RevealValid") : "Card";
|
||||
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());
|
||||
boolean doReveal = !sa.hasParam("NoReveal") && !revealableCards.isEmpty();
|
||||
|
||||
//peekingPlayer.showCards(peekCards)
|
||||
if (peekingPlayer.isHuman()) {
|
||||
if (!sa.hasParam("NoPeek")) {
|
||||
GuiChoose.one(source + "Revealing cards from library", peekCards);
|
||||
}
|
||||
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);
|
||||
}
|
||||
peekingPlayer.getController().reveal(source + "Revealing cards from library", peekCards, ZoneType.Library, peekingPlayer);
|
||||
}
|
||||
|
||||
if( doReveal && sa.hasParam("RevealOptional") )
|
||||
doReveal = peekingPlayer.getController().confirmAction(sa, null, "Reveal cards to other players?");
|
||||
|
||||
if (doReveal) {
|
||||
if (!peekingPlayer.isHuman()) {
|
||||
GuiChoose.one(source + "Revealing cards from library", revealableCards);
|
||||
}
|
||||
peekingPlayer.getGame().getAction().reveal(revealableCards, peekingPlayer);
|
||||
|
||||
// Singletons.getModel().getGameAction().revealCardsToOtherPlayers(peekingPlayer, revealableCards);
|
||||
if (rememberRevealed) {
|
||||
for(Card c : revealableCards) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import forge.card.spellability.SpellAbility;
|
||||
import forge.game.GameState;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.gui.GuiDialog;
|
||||
import forge.util.Expressions;
|
||||
|
||||
public class RepeatEffect extends SpellAbilityEffect {
|
||||
@@ -124,16 +123,7 @@ public class RepeatEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (sa.hasParam("RepeatOptional")) {
|
||||
if (sa.getActivatingPlayer().isComputer()) {
|
||||
//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 sa.getActivatingPlayer().getController().confirmAction(sa, null, "Do you want to repeat this process again?");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -39,6 +39,7 @@ import forge.card.ability.ApiType;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.card.cost.CostDiscard;
|
||||
import forge.card.cost.CostPart;
|
||||
import forge.card.spellability.AbilitySub;
|
||||
import forge.card.spellability.Spell;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.card.spellability.SpellPermanent;
|
||||
@@ -724,6 +725,15 @@ public class AiController {
|
||||
Card topc = player.getZone(ZoneType.Library).get(0);
|
||||
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:
|
||||
}
|
||||
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