Skip to content

Commit

Permalink
Fix Bounty Initialization Logic
Browse files Browse the repository at this point in the history
Split up the bounty thinkers from the target selection, as now even without bounty targets, there can still be money dropping and thus the thinkers need to be initialized regardless.
  • Loading branch information
UndeadZeratul committed Feb 17, 2024
1 parent 4ec6f7a commit 2a47b11
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
26 changes: 16 additions & 10 deletions zscript/accensus/merchant/EventHandler.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -292,21 +292,27 @@ class MerchantHandler : EventHandler
PokerTick();
}

if (level.time == 35 && (MoneyMode == 1 || (MoneyMode == 2 && !SpawnedTiberium)))
if (level.time == 35)
{
int count = 1;
for (int i = 0; i < 2; ++i)
InitBounty();

if (MoneyMode == 1 || (MoneyMode == 2 && !SpawnedTiberium))
{
if (random() <= AceCore.GetscaledChance(0, 64, 5, 15 + (5 * i)))
{
count++;
}
else
int count = 1;
for (int i = 0; i < 2; ++i)
{
break;
if (random() <= AceCore.GetscaledChance(0, 64, 5, 15 + (5 * i)))
{
count++;
}
else
{
break;
}
}

InitBountyTargets(count);
}
InitBounty(count);
}
}

Expand Down
5 changes: 4 additions & 1 deletion zscript/accensus/merchant/econ/bounty.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extend class MerchantHandler
{
Array<class<BountyThinker> > bountyThinkers;

private void InitBounty(int count)
private void InitBounty()
{
bountyThinkers.clear();

Expand All @@ -13,7 +13,10 @@ extend class MerchantHandler
bountyThinkers.Push((class<BountyThinker>)(AllClasses[i]));
}
}
}

private void InitBountyTargets(int count)
{
Array<Actor> chosenActors;

ThinkerIterator it = ThinkerIterator.Create('Actor', Thinker.STAT_DEFAULT);
Expand Down

0 comments on commit 2a47b11

Please sign in to comment.