Skip to content

Commit

Permalink
Fixed -1 runeChance in reworked GetCardEx
Browse files Browse the repository at this point in the history
- Properly handle the case of -1 runeChance in the new GetCardEx
- Removed a duplicate operation that added RUNE_SHARD to the RunePool
  • Loading branch information
Guantol-Lemat committed Sep 12, 2024
1 parent 3137a4c commit 4d743c5
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions repentogon/Patches/CardsExtras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,6 @@ namespace Cards_EX
const auto itemConfig = g_Manager->GetItemConfig();
const auto cardList = itemConfig->GetCards();

CardPool& runePool = cardPools[CARDPOOL_RUNE];
if ((runePool.cardList.size() != 0 || onlyRunes))
{
while (runePool.cardList.size() < 6)
{
runePool.AddCard(CARD_NULL, 1.0f);
}
}

RNG rng = RNG();
rng.SetSeed(seed, 21);

Expand Down Expand Up @@ -456,7 +447,9 @@ HOOK_METHOD(ItemConfig_Card, IsAvailable, () -> bool)

HOOK_STATIC(ItemPool, GetCardEx, (int seed, int specialChance, int runeChance, int suitChance, bool allowNonCards) -> int, __stdcall)
{
return Cards_EX::GetCard(seed, specialChance, runeChance, suitChance, runeChance == -1, allowNonCards);
bool onlyRunes = runeChance == -1;
runeChance = runeChance == -1 ? 1 : runeChance;
return Cards_EX::GetCard(seed, specialChance, runeChance, suitChance, onlyRunes, allowNonCards);
}

// Edit the vanilla function so that when OnlyRunes is set to true the RuneChance is set to -1 instead of 1
Expand Down

0 comments on commit 4d743c5

Please sign in to comment.