Adds the ability to create and fetch custom rarities for cards, along with functionality for modifying the relative rarity of a card.
Currently there are 3 known additional rarities for cards:
- Legendary (from this mod)
- Epic (WillsWackyManagers)
- Scarce (WillsWackyManagers)
- If you made a rarity you want added to this list, please DM 『 root 』#9063 on discord. If you do not share a server with us, you can use this link: https://discord.gg/9XWgYUUEzZ
Functions
### AddRarity() ```cs int AddRarity(string name, float relativeRarity, Color color, Color colorOff) ``` #### Description Adds a new rarity for cards to utilize and returns the integer representation of that value.- string
namethe name of the rarity to add. - float
relativeRarityhow rare should it be (Common is 1, Rare is 0.1). - Color
colorwhat color should the rarity be when the card is selected. - Color
colorOffwhat color should the rarity be when the card is not selected.
RarityUtils.AddRarity("Legendary", 0.025f, new Color(1, 1, 0), new Color(0.7f, 0.7f, 0));AddRarity should be utilized in your mod's Awake function, that way the rarities are present before building the cards that need them.
CardInfo.Rarity GetRarity(string rarityName)Returns the rarity with the given name if it exists, otherwise returns Common.
- string
rarityNamethe rarity to fetch.
RarityUtils.GetRarity("Legendary");Rarity GetRarityData(CardInfo.Rarity rarity)Returns the data for a rarity.
- CardInfo.Rarity
raritythe rarity data to fetch.
RarityUtils.GetRarityData(CardInfo.Rarity.Common);float GetCardRarityModifier(CardInfo card)Returns the rarity modifier for a card.
- CardInfo
cardthe rarity data to fetch.
float rarityMod = RarityUtils.GetCardRarityModifier(card);
UnityEngine.Debug.Log(rarityMod);void SetCardRarityModifier(CardInfo card, float modifier)Sets the default rarity modifier for a card.
- CardInfo
cardthe rarity data to fetch. - float
modifierthe new default rarity modifier for the card.
RarityUtils.SetCardRarityModifier(card, 5);void AjustCardRarityModifier(CardInfo card, float add = 0, float mul = 0)Adjusts the rarity modifier for a card.
- CardInfo
cardthe rarity data to fetch. - float
addthe amount the default rarity modifier is adjusted by additively. - float
multhe amount the default rarity modifier is adjusted by multiplicatively. Applies after the additive modifier.
RarityUtils.AjustCardRarityModifier(CardInfo card, 5, 100)Classes
The information about a given card rarity.
- string name
- The name of a rarity.
- float relativeRarity
- How common the rarity is compared to commons.
- float calculatedRarity
- No idea.
- Color color
- The color of the rarity when a card is selected.
- Color colorOff
- The color of the rarity when a card is not selected.
- CardInfo.Rarity value
- The CardInfo rarity of a card rarity.