Skip to content

Commit

Permalink
Add Winter Cynical Opportunist (#6325)
Browse files Browse the repository at this point in the history
  • Loading branch information
tehdiplomat authored Oct 14, 2024
1 parent 0fb2db5 commit da712a5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import forge.card.CardStateName;
import forge.card.CardType;
import forge.game.*;
Expand All @@ -27,7 +26,9 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;

import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class ChangeZoneEffect extends SpellAbilityEffect {

Expand Down Expand Up @@ -1085,8 +1086,10 @@ else if (origin.contains(ZoneType.Hand) && player.isOpponentOf(decider)) {
String selectPrompt = sa.hasParam("SelectPrompt") ? sa.getParam("SelectPrompt") : MessageUtil.formatMessage(Localizer.getInstance().getMessage("lblSelectCardFromPlayerZone", "{player's}", Lang.joinHomogenous(origin, ZoneType::getTranslatedName).toLowerCase()), decider, player);
final String totalcmc = sa.getParam("WithTotalCMC");
final String totalpower = sa.getParam("WithTotalPower");
final String totalCardTypes = sa.getParam("WithTotalCardTypes");
int totcmc = AbilityUtils.calculateAmount(source, totalcmc, sa);
int totpower = AbilityUtils.calculateAmount(source, totalpower, sa);
int totCardTypes = AbilityUtils.calculateAmount(source, totalCardTypes, sa);

CardCollection chosenCards = new CardCollection();
if (changeType.startsWith("EACH")) {
Expand Down Expand Up @@ -1160,6 +1163,7 @@ else if (origin.contains(ZoneType.Hand) && player.isOpponentOf(decider)) {
}
}


// If we're choosing multiple cards, only need to show the reveal dialog the first time through.
boolean shouldReveal = (i == 0);
Card c = null;
Expand All @@ -1170,6 +1174,10 @@ else if (origin.contains(ZoneType.Hand) && player.isOpponentOf(decider)) {
c = Aggregates.random(fetchList);
} else if (defined && !chooseFromDef) {
c = Iterables.getFirst(fetchList, null);
} else if (totalCardTypes != null) {
String title = selectPrompt;
title += "\nCard types left: " + Math.max(totCardTypes, 0);
c = decider.getController().chooseSingleCardForZoneChange(destination, origin, sa, fetchList, shouldReveal ? delayedReveal : null, title, !mandatory, decider);
} else {
String title = selectPrompt;
if (changeNum > 1) { //indicate progress if multiple cards being chosen
Expand Down Expand Up @@ -1202,6 +1210,13 @@ else if (origin.contains(ZoneType.Hand) && player.isOpponentOf(decider)) {
if (totalpower != null) {
totpower -= c.getCurrentPower();
}
if (totalCardTypes != null) {
totCardTypes -= Iterables.size(c.getType().getCoreTypes());
}
}

if (totalCardTypes != null && totCardTypes > 0) {
chosenCards.clear();
}
}

Expand Down Expand Up @@ -1537,7 +1552,8 @@ private static boolean allowMultiSelect(Player decider, SpellAbility sa) {
&& !sa.hasParam("AtRandom")
&& (!sa.hasParam("Defined") || sa.hasParam("ChooseFromDefined"))
&& !sa.hasParam("WithTotalCMC")
&& !sa.hasParam("WithTotalPower");
&& !sa.hasParam("WithTotalPower")
&& !sa.hasParam("WithTotalCardTypes");
}

/**
Expand Down
14 changes: 14 additions & 0 deletions forge-gui/res/cardsfolder/w/winter_cynical_opportunist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Name:Winter, Cynical Opportunist
ManaCost:2 B G
Types:Legendary Creature Human Warlock
PT:2/5
K:Deathtouch
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigMill | TriggerDescription$ Whenever NICKNAME attacks, mill three cards.
SVar:TrigMill:DB$ Mill | NumCards$ 3
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | Delirium$ True | TriggerZones$ Battlefield | Execute$ TrigExileDelirium | TriggerDescription$ Delirium — At the beginning of your end step, you may exile any number of cards from your graveyard with four or more card types among them. If you do, put a permanent card from among them onto the battlefield with a finality counter on it.
SVar:TrigExileDelirium:DB$ ChangeZone | Origin$ Graveyard | Destination$ Exile | ChangeType$ Card.YouOwn | ChangeNum$ X | RememberChanged$ True | Hidden$ True | WithTotalCardTypes$ 4 | SubAbility$ DBReturn
SVar:DBReturn:DB$ ChangeZone | Origin$ Exile | Destination$ Battlefield | WithCountersType$ FINALITY | Hidden$ True | ChangeType$ Permanent.YouOwn+IsRemembered | ChangeNum$ 1 | SubAbility$ DBCleanup | Mandatory$ True
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Count$ValidGraveyard Card.YouOwn
AI:RemoveDeck:All
Oracle:Deathtouch\nWhenever Winter attacks, mill three cards.\nDelirium — At the beginning of your end step, you may exile any number of cards from your graveyard with four or more card types among them. If you do, put a permanent card from among them onto the battlefield with a finality counter on it.

0 comments on commit da712a5

Please sign in to comment.