

Provides 2 different managers for the community to use:
CurseManager::RemoveAllCurses() and added an additional variant.This manager provides the various utilities needed for using curses.
Any added curses must utilize RegisterCurse() via CustomCard.BuildCard<MyCurse>(cardInfo => { CurseManager.instance.RegisterCurse(cardInfo); });.
Additionally, they should use the curseCategory in order to not be pickable for players.
The curseInteractionCategory can be used to denote cards that should only show up when a player has a curse.
CurseManager instance { get;}
A static reference of the class for accessibility from within static functions.
CardCategory curseCategory { get;}
The card category for every curse. If not utilized, curses may show up for regular picking.
CardCategory curseInteractionCategory { get;}
The card category for cards that interacted with cursed players. When utilized, cards with it will only show up when a player has a curse.
CardCategory curseSpawnerCategory { get;}
The card category for cards that give players curses. Allows for toggling them on and off via settings.
struct CurseRemovalOption
CurseRemovalOption CurseRemovalOption(string optionName, Func<Player, bool> optionCondition, Func<Player, IEnumerator> optionAction)
Creates a Curse Removal Option
optionName The text the player sees for choosing the option. Must be unique.optionCondition A function that takes in a player object as input and outputs a bool. When true the option is available for players.optionAction An IEnumerator that takes in a player object as input. Run when the option is selected. If it wishes to remove a curse, it must do so.var keepCurse = new CurseRemovalOption("Keep Curse", (player) => true, IKeepCurse);
RegisterRemovalOption(keepCurse);
var removeRound = new CurseRemovalOption("-1 round, -1 curse", CondRemoveRound, IRemoveRound);
RegisterRemovalOption(removeRound);
private IEnumerator IKeepCurse(Player player)
{
yield break;
}
private bool CondRemoveRound(Player player)
{
var result = false;
// Only shows up if they have a round point to remove.
if (GameModeManager.CurrentHandler.GetTeamScore(player.teamID).rounds > 0)
{
result = true;
}
return result;
}
private IEnumerator IRemoveRound(Player player)
{
var score = GameModeManager.CurrentHandler.GetTeamScore(player.teamID);
GameModeManager.CurrentHandler.SetTeamScore(player.teamID, new TeamScore(score.points, score.rounds - 1));
var roundCounter = GameObject.Find("/Game/UI/UI_Game/Canvas/RoundCounter").GetComponent<RoundCounter>();
roundCounter.InvokeMethod("ReDraw");
for (var i = player.data.currentCards.Count() - 1; i >= 0; i--)
{
if (instance.IsCurse(player.data.currentCards[i]))
{
ModdingUtils.Utils.Cards.instance.RemoveCardFromPlayer(player, i);
break;
}
}
yield break;
}
CardInfo RandomCurse(Player player)
Returns a random curse that is valid for the target player. Respects card rarity.
player the player to get the curse for.var player = PlayerManager.instance.players[0];
var curse = CurseManager.instance.RandomCurse(player);
void CursePlayer(Player player)
void CursePlayer(Player player, Action<CardInfo> callback)
Adds a random valid curse to the targeted player. Respects card rarity.
player the player to curse.callback an optional action to run with the card info of the added curse.var player = PlayerManager.instance.players[0];
CurseManager.instance.CursePlayer(player, (curse) => { ModdingUtils.Utils.CardBarUtils.instance.ShowImmediate(player, curse); });
void RegisterCurse(CardInfo cardInfo)
Registers a card as a curse with the curse manager. The card still needs to apply curseCategory on its own.
cardInfo the card to register.CustomCard.BuildCard<MyCurse>(cardInfo => { CurseManager.instance.RegisterCurse(cardInfo); });
CardInfo[] GetRaw()
Registers a card as a curse with the curse manager. The card still needs to apply curseCategory on its own.
var curse = CurseManager.instance.GetRaw();
bool HasCurse(Player player)
Returns true if a player has a curse.
player the player to check.var player = PlayerManager.instance.players[0];
var cursed = CurseManager.instance.HasCurse(player);
bool IsCurse(CardInfo cardInfo)
Returns true if the card is a registered curse.
cardInfo the card to check.var card = PlayerManager.instance.players[0].data.currentCards[0];
var isCurse = CurseManager.instance.IsCurse(card);
void RemoveAllCurses(Player player)
void RemoveAllCurses(Player player, Action<CardInfo> callback)
Removes all curses on the target player.
player the player to remove curses from.callback an optional action to run with the card info of the removed curse.
bool CardInfo[] GetAllCursesOnPlayer(Player player)
Returns true if the card is a registered curse.
player the player whose curses to get.
void RegisterRemovalOption(string optionName, Func<Player, bool> optionCondition, Func<Player, IEnumerator> optionAction)
void RegisterRemovalOption(CurseRemovalOption option)
Initiates any rerolls in the queue.
optionName The text the player sees for choosing the option. Must be unique.optionCondition A function that takes in a player object as input and outputs a bool. When true the option is available for players.optionAction An IEnumerator that takes in a player object as input. Run when the option is selected. If it wishes to remove a curse, it must do so.or
option The curse removal option to implement.RegisterRemovalOption("Keep Curse", (player) => true, IKeepCurse);
var removeRound = new CurseRemovalOption("-1 round, -1 curse", CondRemoveRound, IRemoveRound);
RegisterRemovalOption(removeRound);
private IEnumerator IKeepCurse(Player player)
{
yield break;
}
private bool CondRemoveRound(Player player)
{
var result = false;
// Only shows up if they have a round point to remove.
if (GameModeManager.CurrentHandler.GetTeamScore(player.teamID).rounds > 0)
{
result = true;
}
return result;
}
private IEnumerator IRemoveRound(Player player)
{
var score = GameModeManager.CurrentHandler.GetTeamScore(player.teamID);
GameModeManager.CurrentHandler.SetTeamScore(player.teamID, new TeamScore(score.points, score.rounds - 1));
var roundCounter = GameObject.Find("/Game/UI/UI_Game/Canvas/RoundCounter").GetComponent<RoundCounter>();
roundCounter.InvokeMethod("ReDraw");
for (var i = player.data.currentCards.Count() - 1; i >= 0; i--)
{
if (instance.IsCurse(player.data.currentCards[i]))
{
ModdingUtils.Utils.Cards.instance.RemoveCardFromPlayer(player, i);
break;
}
}
yield break;
}
This manager provides the various utilities for rerolling a player's cards.
RerollManager instance { get;}
A static reference of the class for accessibility from within static functions.
CardCategory NoFlip { get;}
The card category for cards that should not be given out after a table flip.
Player flippingPlayer
The player responsible for the tableflip. Used to add the table flip card to the player.
bool tableFlipped
When set to true, a table flip will be initiated at the next end of a player's pick. Initiate the FlipTable() method if you wish to flip before then.
CardInfo tableFlipCard
The table flip card itself. It's automatically given out to the flipping player after a table flip.
List<Player> rerollPlayers
A list of players to reroll when the next reroll is initiated.
bool reroll
When set to true, a reroll will be initiated at the next end of a player's pick. Initiate the Reroll() method if you wish to reroll before then.
CardInfo rerollCard
The reroll card itself. It's automatically given out to the rerolling player after a table flip.
IEnumerator FlipTable(bool addCard = true)
Initiates a table flip for all players.
addCard whether the flipping player (if one exists) shoul be given the Table Flip Card (if it exists).
IEnumerator InitiateRerolls(bool addCard = true)
Initiates any rerolls in the queue.
addCard whether a player should be given the Reroll card after they reroll.
IEnumerator Reroll(Player player, bool addCard = true)
Initiates any rerolls in the queue.
player the player whose cards to rerolladdCard whether the player should be given the Reroll card afterwards.