Added a preference for giving the player needed items.
This commit is contained in:
parent
d7dc0844c8
commit
72cb75fb7e
|
@ -38,6 +38,19 @@ void collectable_add(float x, float y, int type, int value, int life)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
Collectable *collectable;
|
Collectable *collectable;
|
||||||
|
int plasma_useless, shield_useless, rockets_useless;
|
||||||
|
|
||||||
|
plasma_useless = (((weapons[W_PLAYER_WEAPON].reload[0] >= rate2reload[game.minPlasmaRate]) &&
|
||||||
|
(weapons[W_PLAYER_WEAPON].ammo[0] <= game.minPlasmaOutput) &&
|
||||||
|
(weapons[W_PLAYER_WEAPON].damage <= game.minPlasmaDamage)) ||
|
||||||
|
(player.ammo[0] >= game.maxPlasmaAmmo));
|
||||||
|
|
||||||
|
shield_useless = ((game.difficulty == DIFFICULTY_NIGHTMARE) ||
|
||||||
|
(player.shield >= player.maxShield));
|
||||||
|
|
||||||
|
rockets_useless = ((player.weaponType[1] == W_CHARGER) ||
|
||||||
|
(player.weaponType[1] == W_LASER) || (game.maxRocketAmmo <= 0) ||
|
||||||
|
(player.ammo[1] >= game.maxRocketAmmo));
|
||||||
|
|
||||||
if (type == P_ANYTHING)
|
if (type == P_ANYTHING)
|
||||||
{
|
{
|
||||||
|
@ -48,14 +61,58 @@ void collectable_add(float x, float y, int type, int value, int life)
|
||||||
switch (r)
|
switch (r)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
if ((game.difficulty == DIFFICULTY_ORIGINAL) ||
|
||||||
|
(game.difficulty == DIFFICULTY_NIGHTMARE))
|
||||||
|
{
|
||||||
type = P_PLASMA_AMMO;
|
type = P_PLASMA_AMMO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((!shield_useless) &&
|
||||||
|
(CHANCE(2 * (player.maxShield - player.shield) / player.maxShield)))
|
||||||
|
{
|
||||||
|
type = P_SHIELD;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ((!rockets_useless) && (game.maxRocketAmmo > 0) &&
|
||||||
|
(CHANCE((game.maxRocketAmmo - player.ammo[1]) / game.maxRocketAmmo)))
|
||||||
|
{
|
||||||
|
type = P_ROCKET;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
type = P_PLASMA_AMMO;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
type = P_SHIELD;
|
type = P_SHIELD;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
if ((game.difficulty == DIFFICULTY_ORIGINAL) ||
|
||||||
|
(game.difficulty == DIFFICULTY_NIGHTMARE))
|
||||||
|
{
|
||||||
type = P_ROCKET;
|
type = P_ROCKET;
|
||||||
value /= 10;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((!shield_useless) &&
|
||||||
|
(CHANCE(2 * (player.maxShield - player.shield) / player.maxShield)))
|
||||||
|
{
|
||||||
|
type = P_SHIELD;
|
||||||
|
}
|
||||||
|
else if ((!plasma_useless) && (game.maxPlasmaAmmo > 0) &&
|
||||||
|
(CHANCE((game.maxPlasmaAmmo - player.ammo[0]) / game.maxPlasmaAmmo)))
|
||||||
|
{
|
||||||
|
type = P_PLASMA_AMMO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
type = P_ROCKET;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,9 +154,7 @@ void collectable_add(float x, float y, int type, int value, int life)
|
||||||
// upgraded! Give them money instead. (Except in Classic difficulty.)
|
// upgraded! Give them money instead. (Except in Classic difficulty.)
|
||||||
if ((type == P_PLASMA_AMMO) && (game.difficulty != DIFFICULTY_ORIGINAL))
|
if ((type == P_PLASMA_AMMO) && (game.difficulty != DIFFICULTY_ORIGINAL))
|
||||||
{
|
{
|
||||||
if ((weapons[W_PLAYER_WEAPON].reload[0] >= rate2reload[game.minPlasmaRate]) &&
|
if (plasma_useless)
|
||||||
(weapons[W_PLAYER_WEAPON].ammo[0] <= game.minPlasmaOutput) &&
|
|
||||||
(weapons[W_PLAYER_WEAPON].damage <= game.minPlasmaDamage))
|
|
||||||
{
|
{
|
||||||
type = P_CASH;
|
type = P_CASH;
|
||||||
}
|
}
|
||||||
|
@ -113,12 +168,17 @@ void collectable_add(float x, float y, int type, int value, int life)
|
||||||
{
|
{
|
||||||
type = P_CASH;
|
type = P_CASH;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value /= 10;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shield bonus is useless in Nightmare difficulty; give cash instead.
|
// Shield bonus is useless if you can't heal; give cash instead.
|
||||||
if (type == P_SHIELD)
|
if ((type == P_SHIELD) && (game.difficulty != DIFFICULTY_ORIGINAL))
|
||||||
{
|
{
|
||||||
if (game.difficulty == DIFFICULTY_NIGHTMARE)
|
if ((game.difficulty == DIFFICULTY_NIGHTMARE) ||
|
||||||
|
(player.shield >= player.maxShield))
|
||||||
{
|
{
|
||||||
type = P_CASH;
|
type = P_CASH;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue