New pct_chance(), for clarity, and symmetry with chance()
This commit is contained in:
parent
1cf6b5e6bb
commit
54ddcd0f5a
10 changed files with 34 additions and 22 deletions
|
@ -30,7 +30,7 @@
|
|||
* Dave Pare, 1986
|
||||
* Ken Stevens, 1995
|
||||
* Steve McClure, 1998-2000
|
||||
* Markus Armbruster, 2004-2011
|
||||
* Markus Armbruster, 2004-2012
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -455,7 +455,7 @@ ship_bomb(struct emp_qelem *list, struct sctstr *target)
|
|||
shp_hardtarget(&ship), EF_SHIP);
|
||||
pr("%d%% hitchance...", hitchance);
|
||||
}
|
||||
if (roll(100) <= hitchance) {
|
||||
if (pct_chance(hitchance)) {
|
||||
/* pinbombing is more accurate than normal bombing */
|
||||
dam = 2 * pln_damage(&plp->plane, 'p', 1);
|
||||
} else {
|
||||
|
@ -555,7 +555,7 @@ plane_bomb(struct emp_qelem *list, struct sctstr *target)
|
|||
hitchance = pln_hitchance(&plp->plane, 0, EF_PLANE);
|
||||
pr("%d%% hitchance...", hitchance);
|
||||
}
|
||||
if (roll(100) <= hitchance) {
|
||||
if (pct_chance(hitchance)) {
|
||||
/* pinbombing is more accurate than normal bombing */
|
||||
dam = 2 * pln_damage(&plp->plane, 'p', 1);
|
||||
} else {
|
||||
|
@ -664,7 +664,7 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
|
|||
lnd_hardtarget(&land), EF_LAND);
|
||||
pr("%d%% hitchance...", hitchance);
|
||||
}
|
||||
if (roll(100) <= hitchance) {
|
||||
if (pct_chance(hitchance)) {
|
||||
dam = 2 * pln_damage(&plp->plane, 'p', 1);
|
||||
} else {
|
||||
pr("thud\n");
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* Known contributors to this file:
|
||||
* Jim Griffith, 1989
|
||||
* Ken Stevens, 1995
|
||||
* Markus Armbruster, 2004-2012
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -250,8 +251,8 @@ plane_sona(struct emp_qelem *plane_list, int x, int y,
|
|||
tmcp = &mchr[(int)targ->shp_type];
|
||||
if (!(tmcp->m_flags & M_SUB))
|
||||
continue;
|
||||
if (roll(100) > pln_identchance(pp, shp_hardtarget(targ),
|
||||
EF_SHIP))
|
||||
if (!pct_chance(pln_identchance(pp, shp_hardtarget(targ),
|
||||
EF_SHIP)))
|
||||
continue;
|
||||
vis = shp_visib(targ);
|
||||
pingrange = MAX(vis, 10) * range / 10;
|
||||
|
@ -276,10 +277,10 @@ plane_sona(struct emp_qelem *plane_list, int x, int y,
|
|||
found = 1;
|
||||
}
|
||||
if (relations_with(targ->shp_own, pp->pln_own) < FRIENDLY &&
|
||||
roll(100) > pln_identchance(pp, shp_hardtarget(targ),
|
||||
EF_SHIP))
|
||||
if (roll(100) > pln_identchance(pp, shp_hardtarget(targ),
|
||||
EF_SHIP))
|
||||
!pct_chance(pln_identchance(pp, shp_hardtarget(targ),
|
||||
EF_SHIP)))
|
||||
if (!pct_chance(pln_identchance(pp, shp_hardtarget(targ),
|
||||
EF_SHIP)))
|
||||
pr("sub #%d %s\n", targ->shp_uid,
|
||||
xyas(targ->shp_x, targ->shp_y, player->cnum));
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue