Added usage of plasma ammo by the charger cannon.

This should add some much-needed depth to the tacticality of the
weapon. It's not much: it takes 5 plasma cells to fully charge the
cannon. But it does eliminate the previous effect where the charger
was always preferable over plasma bullets; it's still preferable in
a lot of circumstances, but for smaller ships, it's now typically
better to use plain old plasma ammo. It also limits the amount of
times the charger can be used.
This commit is contained in:
onpon4 2016-01-06 21:47:17 -05:00
parent cac29f72a2
commit 05e645aeff
3 changed files with 23 additions and 5 deletions

View File

@ -1209,7 +1209,10 @@ static void game_doPlayer()
// With ammo cheat, cause the charge cannon to
// fire at full blast immediately.
if (engine.cheatAmmo)
{
player_chargerAlloc = 200;
player.ammo[1] = 200;
}
if (game.difficulty == DIFFICULTY_ORIGINAL)
{
@ -1217,12 +1220,23 @@ static void game_doPlayer()
}
else
{
LIMIT_ADD(player.ammo[1], 1, 0, 150);
if (player.ammo[1] >= 150)
player.ammo[1] += 1;
if (player.ammo[1] > player_chargerAlloc)
{
ship_fireBullet(&player, 1);
player.ammo[1] = 0;
player_chargerFired = true;
if ((player_chargerAlloc < 150) &&
(player.ammo[0] > 0))
{
player.ammo[0] -= 1;
player_chargerAlloc += 30;
}
else
{
player.ammo[1] = player_chargerAlloc;
ship_fireBullet(&player, 1);
player_chargerAlloc = 0;
player.ammo[1] = 0;
player_chargerFired = true;
}
}
}
}
@ -1231,6 +1245,7 @@ static void game_doPlayer()
{
if (player.ammo[1] > 0)
ship_fireBullet(&player, 1);
player_chargerAlloc = 0;
player.ammo[1] = 0;
player_chargerFired = false;
}

View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h"
object player;
int player_chargerAlloc = 0;
bool player_chargerFired = false;
/*
@ -95,6 +96,7 @@ void player_checkShockDamage(float x, float y)
void exitPlayer()
{
player_chargerAlloc = 0;
player_chargerFired = false;
if ((player.weaponType[1] == W_CHARGER) || (player.weaponType[1] == W_LASER))

View File

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PLAYER_H
extern object player;
extern int player_chargerAlloc;
extern bool player_chargerFired;
extern void initPlayer();