Exemplo n.º 1
0
int
msl_hit(struct plnstr *pp, int hardtarget, int type,
	int news_item, int snews_item, int sublaunch, natid victim)
{
    int hitchance, hit;

    if (nuk_on_plane(pp) >= 0) {
	mpr(pp->pln_own, "\tArming nuclear warheads...\n");
	hit = 1;
    } else {
	hitchance = pln_hitchance(pp, hardtarget, type);
	hit = pct_chance(hitchance);
	mpr(pp->pln_own, "\t%d%% hitchance...%s\n", hitchance,
	    hit ? "HIT!" : "miss");
    }

    if (type != EF_PLANE)
	mpr(victim, "...Incoming %s missile %s\n",
	    sublaunch ? "" : cname(pp->pln_own),
	    hit ? "HIT!\n" : "missed\n");
    if (hit && news_item) {
	if (sublaunch)
	    nreport(victim, snews_item, 0, 1);
	else
	    nreport(pp->pln_own, news_item, victim, 1);
    }
    return hit;
}
Exemplo n.º 2
0
int
pln_identchance(struct plnstr *pp, int hardtarget, int type)
{
    double misschance =
	(100.0 - pln_hitchance(pp, hardtarget, type)) / 100.0;
    return (int)(100 - 100 * misschance * misschance);
}