X-Git-Url: http://git.pond.sub.org/?p=empserver;a=blobdiff_plain;f=src%2Flib%2Fsubs%2Fmslsub.c;h=a25f28f68e44e83e5a4af4e94b50c17a83f99f21;hp=55d4aaedfcce73bceb60bb058a64df996285111e;hb=0b46e31d60f5b60f4dfca7df60574264f6713a3b;hpb=ea94ec2f183c82a65be76f385e62bfbfe24a3f3c diff --git a/src/lib/subs/mslsub.c b/src/lib/subs/mslsub.c index 55d4aaedf..a25f28f68 100644 --- a/src/lib/subs/mslsub.c +++ b/src/lib/subs/mslsub.c @@ -1,6 +1,6 @@ /* * Empire - A multi-player, client/server Internet based war game. - * Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak, + * Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak, * Ken Stevens, Steve McClure, Markus Armbruster * * Empire is free software: you can redistribute it and/or modify @@ -29,19 +29,20 @@ * Known contributors to this file: * Ken Stevens, 1995 * Steve McClure, 1996-2000 - * Markus Armbruster, 2004-2010 + * Markus Armbruster, 2004-2021 */ #include #include -#include "file.h" +#include "chance.h" #include "misc.h" #include "nat.h" #include "news.h" #include "nsc.h" #include "nuke.h" #include "optlist.h" +#include "plague.h" #include "plane.h" #include "prototypes.h" #include "queue.h" @@ -112,7 +113,7 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y, struct sctstr sect; int dam; - dam = pln_damage(pp, 'p', 0) / 2; + dam = pln_damage(pp, 'p', NULL) / 2; if (pp->pln_ship >= 0) { shipdamage(&ship, dam); putship(ship.shp_uid, &ship); @@ -161,8 +162,8 @@ msl_hit(struct plnstr *pp, int hardtarget, int type, hit = 1; } else { hitchance = pln_hitchance(pp, hardtarget, type); - hit = (roll(100) <= hitchance); - mpr(pp->pln_own, "\t%d%% hitchance...%s\n", hitchance, + hit = pct_chance(hitchance); + mpr(pp->pln_own, "\t%d%% hit chance...%s\n", hitchance, hit ? "HIT!" : "miss"); } @@ -224,6 +225,7 @@ msl_sel(struct emp_qelem *list, coord x, coord y, natid victim, /* got a valid interceptor */ irv = malloc(sizeof(*irv)); irv->load = 0; + irv->pstage = PLG_HEALTHY; irv->pcp = &plchr[(int)plane.pln_type]; irv->plane = plane; emp_insque(&irv->queue, list); @@ -255,7 +257,7 @@ msl_intercept(struct plnstr *msl, struct sctstr *sp, int sublaunch, pp = &ip->plane; if (pp->pln_own != sp->sct_own) continue; - if (mission_pln_equip(ip, NULL, 'i') < 0) { + if (mission_pln_equip(ip, NULL, 0) < 0) { emp_remque(qp); free(qp); continue; @@ -273,7 +275,7 @@ msl_intercept(struct plnstr *msl, struct sctstr *sp, int sublaunch, next = qp->q_forw; ip = (struct plist *)qp; pp = &ip->plane; - if (mission_pln_equip(ip, NULL, 'i') < 0) { + if (mission_pln_equip(ip, NULL, 0) < 0) { emp_remque(qp); free(qp); continue; @@ -363,7 +365,7 @@ msl_abm_intercept(struct plnstr *msl, coord x, coord y, int sublaunch) struct emp_qelem irvlist; getsect(x, y, §); - msl_sel(&irvlist, x, y, msl->pln_own, P_N, P_O, 0); + msl_sel(&irvlist, x, y, msl->pln_own, P_N, 0, 0); return msl_intercept(msl, §, sublaunch, &irvlist, "warhead", "abm", sublaunch ? N_NUKE_SSTOP : N_NUKE_STOP);