Modified the way collectables are dropped.

I've made a couple of improvements here:

1. There is now a limit to how much value can be in a single
   collectable. This means, most importantly, that there will be
   no more 1000 plasma collectables or anything else ridiculous
   like that. It also means that bosses now tend to drop a ton of
   different collectable objects.

2. Collectables dropped by ships now live longer if a lot of
   collectables were dropped. In practice, this only affects bosses;
   no normal enemy drops enough to trigger this.

The combined results of these changes are that you're less likely
to get stuck with a useless item when you kill a boss (such as
plasma you don't need) rather than money, and you are more capable
of collecting the huge wads of cash left behind by the bosses that
drop more.
This commit is contained in:
onpon4 2016-11-28 00:21:11 -05:00
parent bf9605387d
commit 49c3260dcc
1 changed files with 3 additions and 3 deletions

View File

@ -1825,7 +1825,7 @@ void alien_destroy(Object *alien, Object *attacker)
mission_updateRequirements(M_DESTROY_TARGET_TYPE, alien->classDef, 1); mission_updateRequirements(M_DESTROY_TARGET_TYPE, alien->classDef, 1);
mission_updateRequirements(M_PROTECT_TARGET, alien->classDef, 1); mission_updateRequirements(M_PROTECT_TARGET, alien->classDef, 1);
if (rand() % 100 <= alien->collectChance) if (CHANCE(alien->collectChance / 100.))
{ {
int value; int value;
@ -1834,10 +1834,10 @@ void alien_destroy(Object *alien, Object *attacker)
while (alien->collectValue > 0) while (alien->collectValue > 0)
{ {
value = (10 + (rand() % alien->collectValue)); value = RANDRANGE(10, 100);
if (value > alien->collectValue) if (value > alien->collectValue)
value = alien->collectValue; value = alien->collectValue;
collectable_add(alien->x, alien->y, alien->collectType, value, 600); collectable_add(alien->x, alien->y, alien->collectType, value, MAX(600, 2 * alien->collectValue));
alien->collectValue -= value; alien->collectValue -= value;
} }
} }