willuwontu-WillsWackyManagers icon

WillsWackyManagers

Various managers for community usage.

Last updated 2 weeks ago
Total downloads 19498
Total rating 1 
Categories Utilities
Dependency string willuwontu-WillsWackyManagers-1.2.2
Dependants 5 other mods depend on this mod

This mod requires the following mods to function

willis81808-UnboundLib-2.6.2 icon
willis81808-UnboundLib

This is a helpful utility for ROUNDS modders aimed at simplifying common tasks.

Preferred version: 2.6.2
willis81808-MMHook-1.0.0 icon
willis81808-MMHook

MonoMod Runtime Hooks generated for ROUNDS

Preferred version: 1.0.0
BepInEx-BepInExPack_ROUNDS-5.4.1100 icon
BepInEx-BepInExPack_ROUNDS

BepInEx pack for ROUNDS. Preconfigured and ready to use.

Preferred version: 5.4.1100
Pykess-PlayerJumpPatch-0.0.2 icon
Pykess-PlayerJumpPatch

Patches the erroneous PlayerJump.Jump function in the base game

Preferred version: 0.0.2
Pykess-CardChoiceSpawnUniqueCardPatch-0.1.2 icon
Pykess-CardChoiceSpawnUniqueCardPatch

Patches erroneous logic in the base game CardChoice method SpawnUniqueCard

Preferred version: 0.1.2
Pykess-ModdingUtils-0.1.3 icon
Pykess-ModdingUtils

Utilities aimed at making modding easier and more accessible

Preferred version: 0.1.3
olavim-RoundsWithFriends-1.3.9 icon
olavim-RoundsWithFriends

ROUNDS multiplayer extension

Preferred version: 1.3.9

README

Wills Wacky Managers

Provides 2 different managers for the community to use:

  • CurseManager
  • RerollManager

v 1.2.2

  • Fixed an issue where curse cards would cause following players to get null cards.

v 1.2.1

  • Fixes some issues with lag when taking hex and other curse granting cards.

v 1.2.0

  • Migrated the reroll cards over to WWM
  • Added the option for table flip to become an uncommon, but only be able to appear when one player has at least half the rounds needed to win.
  • Added the option to Enable or Disable cards that spawn curses. This is enabled by default.
  • Added a timeout functionality to the Curse Removal Options. It take a minute to do so, but it is there.

v 1.1.2

  • Some patches that will hopefully help high lag players from initiating perpetual table flips and rerolls.

v 1.1.1

  • Fixed a bug where reroll would cause itself to trigger the next round, causing it to continue going off the rest of the game. (Thank you BYZE for finding this bug for me.)

v 1.1.0

  • Functionality has been added to allow for methods of removing cards outside of other cards, this has been opened up as an API for other modders to add their own methods. More information is available in the documentation below or on the github which has references to the default methods.
  • A curse removal method requires 3 things:
    • The name of the method, this is what's displayed when the option is presented to the player.
    • A condition under which the method should be shown to the player.
    • The action to take when the method is chosen.
  • By default this functionality is turned off, but there is a toggle to turn it on.
  • By default there are 4 methods available:
    • Keep Curse: You opt to keep any curses you have. Always shows up.
    • Lose 1 round, lose 1 curse: Only shows up if you've won at least 1 round. Your number of won rounds is reduced by 1 and the newest curse incurred is removed.
    • Lose 1 Curse, give enemies an uncommon: Only shows up if you have more cards than at least 1 other player. Removes a curse and gives you enemies an uncommon.
    • Lose all cards, lose all curses: Only shows up if you have 5 or more curses. Removes all cards and curses that you have.

v 1.0.3

  • Added 3 new functions to the curse manager and documented them.

v 1.0.2

  • Fixed an issue where a curse may not always return when cursing someone.

v 1.0.1

  • Fixed an error in reroll's logic that would cause it to stop after rerolling a player.

CurseManager

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.

Properties

instance

CurseManager instance { get;}

Description

A static reference of the class for accessibility from within static functions.

curseCategory

CardCategory curseCategory { get;}

Description

The card category for every curse. If not utilized, curses may show up for regular picking.

curseInteractionCategory

CardCategory curseInteractionCategory { get;}

Description

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.

curseSpawnerCategory

CardCategory curseSpawnerCategory { get;}

Description

The card category for cards that give players curses. Allows for toggling them on and off via settings.

Classes

CurseRemovalOption

struct CurseRemovalOption

Fields

  • readonly string name;
  • readonly Func<Player, bool> condition;
  • readonly Func<Player, IEnumerator> action;

Constructors

CurseRemovalOption()

CurseRemovalOption CurseRemovalOption(string optionName, Func<Player, bool> optionCondition, Func<Player, IEnumerator> optionAction)

Description

Creates a Curse Removal Option

Parameters

  • string optionName The text the player sees for choosing the option. Must be unique.
  • Func<Player, bool> optionCondition A function that takes in a player object as input and outputs a bool. When true the option is available for players.
  • Func<Player, IEnumerator> 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.

Example Usage

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;
}
Functions

RandomCurse()

CardInfo RandomCurse(Player player)

Description

Returns a random curse that is valid for the target player. Respects card rarity.

Parameters

  • Player player the player to get the curse for.

Example Usage

var player = PlayerManager.instance.players[0];
var curse = CurseManager.instance.RandomCurse(player);

CursePlayer()

void CursePlayer(Player player)
void CursePlayer(Player player, Action<CardInfo> callback)

Description

Adds a random valid curse to the targeted player. Respects card rarity.

Parameters

  • Player player the player to curse.
  • Action<CardInfo> callback an optional action to run with the card info of the added curse.

Example Usage

var player = PlayerManager.instance.players[0];
CurseManager.instance.CursePlayer(player, (curse) => { ModdingUtils.Utils.CardBarUtils.instance.ShowImmediate(player, curse); });

RegisterCurse()

void RegisterCurse(CardInfo cardInfo)

Description

Registers a card as a curse with the curse manager. The card still needs to apply curseCategory on its own.

Parameters

  • CardInfo cardInfo the card to register.

Example Usage

CustomCard.BuildCard<MyCurse>(cardInfo => { CurseManager.instance.RegisterCurse(cardInfo); });

GetRaw()

CardInfo[] GetRaw()

Description

Registers a card as a curse with the curse manager. The card still needs to apply curseCategory on its own.

Parameters

Example Usage

var curse = CurseManager.instance.GetRaw();

HasCurse()

bool HasCurse(Player player)

Description

Returns true if a player has a curse.

Parameters

  • Player player the player to check.

Example Usage

var player = PlayerManager.instance.players[0];
var cursed = CurseManager.instance.HasCurse(player);

IsCurse()

bool IsCurse(CardInfo cardInfo)

Description

Returns true if the card is a registered curse.

Parameters

  • CardInfo cardInfo the card to check.

Example Usage

var card = PlayerManager.instance.players[0].data.currentCards[0];
var isCurse = CurseManager.instance.IsCurse(card);

RemoveAllCurses()

void RemoveAllCurses(Player player)
void RemoveAllCurses(Player player, Action<CardInfo> callback)

Description

Removes all curses on the target player.

Parameters

  • Player player the player to remove curses from.
  • Action<CardInfo> callback an optional action to run with the card info of the removed curse.

Example Usage


GetAllCursesOnPlayer()

bool CardInfo[] GetAllCursesOnPlayer(Player player)

Description

Returns true if the card is a registered curse.

Parameters

  • Player player the player whose curses to get.

Example Usage


RegisterRemovalOption()

void RegisterRemovalOption(string optionName, Func<Player, bool> optionCondition, Func<Player, IEnumerator> optionAction)
void RegisterRemovalOption(CurseRemovalOption option)

Description

Initiates any rerolls in the queue.

Parameters

  • string optionName The text the player sees for choosing the option. Must be unique.
  • Func<Player, bool> optionCondition A function that takes in a player object as input and outputs a bool. When true the option is available for players.
  • Func<Player, IEnumerator> 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

  • CurseRemovalOption option The curse removal option to implement.

Example Usage

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;
}

RerollManager

This manager provides the various utilities for rerolling a player's cards.

Properties

instance

RerollManager instance { get;}

Description

A static reference of the class for accessibility from within static functions.

NoFlip

CardCategory NoFlip { get;}

Description

The card category for cards that should not be given out after a table flip.

flippingPlayer

Player flippingPlayer

Description

The player responsible for the tableflip. Used to add the table flip card to the player.

tableFlipped

bool tableFlipped

Description

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.

tableFlipCard

CardInfo tableFlipCard

Description

The table flip card itself. It's automatically given out to the flipping player after a table flip.

rerollPlayers

List<Player> rerollPlayers

Description

A list of players to reroll when the next reroll is initiated.

reroll

bool reroll

Description

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.

rerollCard

CardInfo rerollCard

Description

The reroll card itself. It's automatically given out to the rerolling player after a table flip.

Functions

FlipTable()

IEnumerator FlipTable(bool addCard = true)

Description

Initiates a table flip for all players.

Parameters

  • bool addCard whether the flipping player (if one exists) shoul be given the Table Flip Card (if it exists).

Example Usage



InitiateRerolls()

IEnumerator InitiateRerolls(bool addCard = true)

Description

Initiates any rerolls in the queue.

Parameters

  • bool addCard whether a player should be given the Reroll card after they reroll.

Example Usage



Reroll()

IEnumerator Reroll(Player player, bool addCard = true)

Description

Initiates any rerolls in the queue.

Parameters

  • Player player the player whose cards to reroll
  • bool addCard whether the player should be given the Reroll card afterwards.

Example Usage



Available versions

Please note that the install buttons only work if you have compatible client software installed, such as the Thunderstore Mod Manager. Otherwise use the zip download links instead.

Upload date Version number Downloads Download link  
2021-11-22 1.2.2 4121 Version 1.2.2 Install
2021-11-21 1.2.1 762 Version 1.2.1 Install
2021-11-20 1.2.0 882 Version 1.2.0 Install
2021-11-19 1.1.2 720 Version 1.1.2 Install
2021-11-15 1.1.1 1251 Version 1.1.1 Install
2021-11-2 1.1.0 4323 Version 1.1.0 Install
2021-10-22 1.0.3 4303 Version 1.0.3 Install
2021-10-18 1.0.2 1746 Version 1.0.2 Install
2021-10-17 1.0.1 752 Version 1.0.1 Install
2021-10-15 1.0.0 638 Version 1.0.0 Install