Make depth-charging code and documentation match
Before 4.0.6, depth charges required no guns, one military, did damage like shell fire from two guns, and used two shells. Missions were not quite consistent with that (bug). 4.0.6 changed depth charges to work exactly like shell fire (but without updating documentation accordingly): require guns and gun crew, non-zero firing range, scale damage and ammunition use with guns. Go back to the old model, but with damage like three guns, to avoid changing the stock game's dd now (three gun damage for two shells). Stock game's af changes from two gun damage for one shell, and nas from four gun damage for two shells. Factor out common depth-charging code into shp_dchrg().
This commit is contained in:
parent
e8595066d1
commit
a3ad623b2a
6 changed files with 112 additions and 72 deletions
|
@ -240,9 +240,6 @@ anti_torp(int f, int ntorping, int vshipown)
|
|||
continue;
|
||||
if (dd.shp_own != vshipown)
|
||||
continue;
|
||||
if (dd.shp_effic < 60)
|
||||
continue;
|
||||
|
||||
if (!canshoot(&dd, &sub))
|
||||
continue;
|
||||
|
||||
|
@ -326,29 +323,29 @@ fire_dchrg(struct shpstr *sp, struct shpstr *targ, int ntargets)
|
|||
int gun;
|
||||
double guneff;
|
||||
|
||||
shells = sp->shp_item[I_SHELL];
|
||||
gun = sp->shp_item[I_GUN];
|
||||
gun = MIN(gun, sp->shp_glim);
|
||||
gun = MIN(gun, sp->shp_item[I_MILIT] / 2);
|
||||
|
||||
shells += supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
|
||||
I_SHELL, (gun + 1) / 2 - shells);
|
||||
|
||||
gun = MIN(gun, shells * 2);
|
||||
if (gun == 0)
|
||||
return;
|
||||
|
||||
/* ok, all set.. now, we shoot */
|
||||
shells -= ldround(gun / 2.0, 1);
|
||||
sp->shp_item[I_SHELL] = shells;
|
||||
putship(sp->shp_uid, sp);
|
||||
|
||||
guneff = seagun(sp->shp_effic, gun);
|
||||
dam = (int)guneff;
|
||||
if (ntargets > 2)
|
||||
dam /= ntargets / 2;
|
||||
|
||||
if ((mchr[(int)targ->shp_type].m_flags & M_SUB) == 0) {
|
||||
shells = sp->shp_item[I_SHELL];
|
||||
gun = sp->shp_item[I_GUN];
|
||||
gun = MIN(gun, sp->shp_glim);
|
||||
gun = MIN(gun, sp->shp_item[I_MILIT] / 2);
|
||||
|
||||
shells += supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
|
||||
I_SHELL, (gun + 1) / 2 - shells);
|
||||
|
||||
gun = MIN(gun, shells * 2);
|
||||
if (gun == 0)
|
||||
return;
|
||||
|
||||
/* ok, all set.. now, we shoot */
|
||||
shells -= ldround(gun / 2.0, 1);
|
||||
sp->shp_item[I_SHELL] = shells;
|
||||
putship(sp->shp_uid, sp);
|
||||
|
||||
guneff = seagun(sp->shp_effic, gun);
|
||||
dam = (int)guneff;
|
||||
if (ntargets > 2)
|
||||
dam /= ntargets / 2;
|
||||
|
||||
pr_beep();
|
||||
pr("Kaboom!!! Incoming shells!\n");
|
||||
if (sp->shp_own != 0)
|
||||
|
@ -359,6 +356,13 @@ fire_dchrg(struct shpstr *sp, struct shpstr *targ, int ntargets)
|
|||
shipdamage(targ, dam);
|
||||
putship(targ->shp_uid, targ);
|
||||
} else {
|
||||
dam = shp_dchrg(sp);
|
||||
putship(sp->shp_uid, sp);
|
||||
if (dam < 0)
|
||||
return;
|
||||
if (ntargets > 2)
|
||||
dam /= ntargets / 2;
|
||||
|
||||
pr("\nCAPTAIN! !!Depth charges!!...\n");
|
||||
if (sp->shp_own != 0)
|
||||
wu(0, sp->shp_own,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue