Skip to content

Commit 3695d45

Browse files
tool4EvErtool4EvEr
authored andcommitted
Minor cleanup
1 parent 15442cd commit 3695d45

File tree

6 files changed

+14
-80
lines changed

6 files changed

+14
-80
lines changed

forge-ai/src/main/java/forge/ai/ability/UntapAi.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ protected AiAbilityDecision checkApiLogic(Player ai, SpellAbility sa) {
5757
if (sa.usesTargeting()) {
5858
if (untapPrefTargeting(ai, sa, false)) {
5959
return new AiAbilityDecision(100, AiPlayDecision.WillPlay);
60-
} else {
61-
return new AiAbilityDecision(0, AiPlayDecision.TargetingFailed);
6260
}
61+
return new AiAbilityDecision(0, AiPlayDecision.TargetingFailed);
6362
}
6463

6564
final List<Card> pDefined = AbilityUtils.getDefinedCards(source, sa.getParam("Defined"), sa);
@@ -85,17 +84,14 @@ protected AiAbilityDecision doTriggerNoCost(Player ai, SpellAbility sa, boolean
8584
} else {
8685
return new AiAbilityDecision(0, AiPlayDecision.MissingNeededCards);
8786
}
88-
} else {
89-
if (untapPrefTargeting(ai, sa, mandatory)) {
90-
return new AiAbilityDecision(100, AiPlayDecision.WillPlay);
91-
} else if (mandatory) {
92-
// not enough preferred targets, but mandatory so keep going:
93-
if (untapUnpreferredTargeting(sa, mandatory)) {
94-
return new AiAbilityDecision(50, AiPlayDecision.MandatoryPlay);
95-
} else {
96-
return new AiAbilityDecision(0, AiPlayDecision.CantPlayAi);
97-
}
87+
} else if (untapPrefTargeting(ai, sa, mandatory)) {
88+
return new AiAbilityDecision(100, AiPlayDecision.WillPlay);
89+
} else if (mandatory) {
90+
// not enough preferred targets, but mandatory so keep going:
91+
if (untapUnpreferredTargeting(sa, mandatory)) {
92+
return new AiAbilityDecision(50, AiPlayDecision.MandatoryPlay);
9893
}
94+
return new AiAbilityDecision(0, AiPlayDecision.CantPlayAi);
9995
}
10096

10197
return new AiAbilityDecision(0, AiPlayDecision.CantPlayAi);
@@ -466,8 +462,6 @@ private boolean doPoolExtraManaLogic(final Player ai, final SpellAbility sa) {
466462
// maybe we'll serendipitously untap into something like a removal spell or burn spell that'll help
467463
return ph.getNextTurn() == ai
468464
&& (ph.is(PhaseType.COMBAT_DECLARE_BLOCKERS) || ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS));
469-
470-
// haven't found any immediate playable options
471465
}
472466

473467
@Override

forge-game/src/main/java/forge/game/spellability/SpellAbilityRestriction.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,6 @@ public final void setRestrictions(final Map<String, String> params) {
148148
this.setGameTypes(GameType.listValueOf(params.get("ActivationGameTypes")));
149149
}
150150

151-
if (params.containsKey("ActivationCardsInHand")) {
152-
this.setActivateCardsInHand(Integer.parseInt(params.get("ActivationCardsInHand")));
153-
}
154-
if (params.containsKey("OrActivationCardsInHand")) {
155-
this.setActivateCardsInHand2(Integer.parseInt(params.get("OrActivationCardsInHand")));
156-
}
157-
158151
if (params.containsKey("IsPresent")) {
159152
this.setIsPresent(params.get("IsPresent"));
160153
if (params.containsKey("PresentCompare")) {
@@ -389,17 +382,6 @@ public final boolean checkOtherRestrictions(final Card c, final SpellAbility sa,
389382
return false;
390383
}
391384

392-
if (getCardsInHand() != -1) {
393-
int h = activator.getCardsIn(ZoneType.Hand).size();
394-
if (getCardsInHand2() != -1) {
395-
if (h != getCardsInHand() && h != getCardsInHand2()) {
396-
return false;
397-
}
398-
} else if (h != getCardsInHand()) {
399-
return false;
400-
}
401-
}
402-
403385
if (isHellbent()) {
404386
if (!activator.hasHellbent()) {
405387
return false;

forge-game/src/main/java/forge/game/spellability/SpellAbilityVariables.java

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ public SpellAbilityVariables() {
8383
/** The gameLimitToCheck to check. */
8484
private String gameLimitToCheck = null;
8585

86-
/** The n cards in hand. */
87-
private int cardsInHand = -1;
88-
private int cardsInHand2 = -1;
89-
9086
// Conditional States for Cards
9187
private boolean threshold = false;
9288
private boolean metalcraft = false;
@@ -312,21 +308,6 @@ public final void setGameTypes(final Set<GameType> gameTypes) {
312308
this.gameTypes.addAll(gameTypes);
313309
}
314310

315-
/**
316-
* <p>
317-
* setActivateCardsInHand.
318-
* </p>
319-
*
320-
* @param cards
321-
* a int.
322-
*/
323-
public final void setActivateCardsInHand(final int cards) {
324-
this.setCardsInHand(cards);
325-
}
326-
public final void setActivateCardsInHand2(final int cards) {
327-
this.setCardsInHand2(cards);
328-
}
329-
330311
public final void setHellbent(final boolean bHellbent) {
331312
this.hellbent = bHellbent;
332313
}
@@ -765,31 +746,6 @@ public final boolean isOpponentTurn() {
765746
return this.opponentTurn;
766747
}
767748

768-
/**
769-
* Gets the cards in hand.
770-
*
771-
* @return the cardsInHand
772-
*/
773-
public final int getCardsInHand() {
774-
return this.cardsInHand;
775-
}
776-
public final int getCardsInHand2() {
777-
return this.cardsInHand2;
778-
}
779-
780-
/**
781-
* Sets the cards in hand.
782-
*
783-
* @param cardsInHand0
784-
* the cardsInHand to set
785-
*/
786-
public final void setCardsInHand(final int cardsInHand0) {
787-
this.cardsInHand = cardsInHand0;
788-
}
789-
public final void setCardsInHand2(final int cardsInHand0) {
790-
this.cardsInHand2 = cardsInHand0;
791-
}
792-
793749
/**
794750
* Gets the checks if is present.
795751
*

forge-gui/res/cardsfolder/l/library_of_alexandria.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Name:Library of Alexandria
22
ManaCost:no cost
33
Types:Land
44
A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}.
5-
A:AB$ Draw | Cost$ T | NumCards$ 1 | ActivationCardsInHand$ 7 | SpellDescription$ Draw a card. Activate only if you have exactly seven cards in hand.
5+
A:AB$ Draw | Cost$ T | PresentZone$ Hand | IsPresent$ Card.YouOwn | PresentCompare$ EQ7 | SpellDescription$ Draw a card. Activate only if you have exactly seven cards in hand.
66
Oracle:{T}: Add {C}.\n{T}: Draw a card. Activate only if you have exactly seven cards in hand.

forge-gui/res/cardsfolder/m/magus_of_the_library.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ ManaCost:G G
33
Types:Creature Human Wizard
44
PT:1/1
55
A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}.
6-
A:AB$ Draw | Cost$ T | NumCards$ 1 | ActivationCardsInHand$ 7 | SpellDescription$ Draw a card. Activate only if you have exactly seven cards in hand.
6+
A:AB$ Draw | Cost$ T | PresentZone$ Hand | IsPresent$ Card.YouOwn | PresentCompare$ EQ7 | SpellDescription$ Draw a card. Activate only if you have exactly seven cards in hand.
77
AI:RemoveDeck:Random
88
Oracle:{T}: Add {C}.\n{T}: Draw a card. Activate only if you have exactly seven cards in hand.

forge-gui/res/cardsfolder/t/the_biblioplex.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ Name:The Biblioplex
22
ManaCost:no cost
33
Types:Land
44
A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}.
5-
A:AB$ PeekAndReveal | Cost$ 2 T | PeekAmount$ 1 | RevealValid$ Card.Instant,Card.Sorcery | RevealOptional$ True | RememberRevealed$ True | ActivationCardsInHand$ 0 | OrActivationCardsInHand$ 7 | SubAbility$ DBChangeZone1 | SpellDescription$ Look at the top card of your library. If it's an instant or sorcery card, you may reveal it and put it into your hand. If you don't put the card into your hand, you may put it into your graveyard. Activate only if you have exactly zero or seven cards in hand.
5+
A:AB$ PeekAndReveal | Cost$ 2 T | PeekAmount$ 1 | RevealValid$ Card.Instant,Card.Sorcery | RevealOptional$ True | RememberRevealed$ True | CheckSVar$ X | SubAbility$ DBChangeZone1 | SpellDescription$ Look at the top card of your library. If it's an instant or sorcery card, you may reveal it and put it into your hand. If you don't put the card into your hand, you may put it into your graveyard. Activate only if you have exactly zero or seven cards in hand.
66
SVar:DBChangeZone1:DB$ ChangeZone | Defined$ Remembered | Origin$ Library | Destination$ Hand | SubAbility$ DBChangeZone2 | StackDescription$ None
77
SVar:DBChangeZone2:DB$ ChangeZone | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ EQ0 | Defined$ TopOfLibrary | Origin$ Library | Destination$ Graveyard | Optional$ True | SubAbility$ DBCleanup | StackDescription$ None
88
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
9-
SVar:X:Count$CardsInYourHand
9+
SVar:X:Count$Compare Z EQ7.1.Y
10+
SVar:Y:Count$Compare Z EQ0.1.0
11+
SVar:Z:Count$CardsInYourHand
1012
DeckHas:Ability$Graveyard
1113
DeckNeeds:Type$Instant|Sorcery
1214
Oracle:{T}: Add {C}.\n{2}, {T}: Look at the top card of your library. If it's an instant or sorcery card, you may reveal it and put it into your hand. If you don't put the card into your hand, you may put it into your graveyard. Activate only if you have exactly zero or seven cards in hand.

0 commit comments

Comments
 (0)