Esempio n. 1
0
thinkofgrapples()
{
	register int n, l, friendly;

	for (n=0; n < scene[game].vessels; n++){
		if (!scene[game].ship[n].file -> captain[0] && pos[n].dir){
			for (l=0; l < scene[game].vessels; l++){
				if ((friendly = scene[game].ship[l].file -> captured) < 0)
					friendly = scene[game].ship[n].nationality == scene[game].ship[l].nationality;
				else
					friendly = scene[game].ship[n].nationality == scene[game].ship[friendly].nationality;
				if (!friendly){
					if (range(n,l) == 1 && !scene[game].ship[n].file -> struck && scene[game].ship[n].file -> captured < 0){
						if (grapple(n,l))
							if (toughmelee(n,l,0,0))
								ungrap(n, l);
							else
								grap(n, l);
						else if (couldwin(n,l)){
							grap(n, l);
							loadwith[n] = GRAPE;
						}
					}
				}
				else
					ungrap(n,l);
			}
		}
	}
}
Esempio n. 2
0
File: dr_2.c Progetto: gburd/wsim
void
thinkofgrapples()
{
	struct ship *sp, *sq;
	char friendly;

	foreachship(sp) {
		if (sp->file->captain[0] || sp->file->dir == 0)
			continue;
		foreachship(sq) {
			friendly = sp->nationality == capship(sq)->nationality;
			if (!friendly) {
				if (sp->file->struck || sp->file->captured != 0)
					continue;
				if (range(sp, sq) != 1)
					continue;
				if (grappled2(sp, sq))
					if (toughmelee(sp, sq, 0, 0))
						ungrap(sp, sq);
					else
						grap(sp, sq);
				else if (couldwin(sp, sq)) {
					grap(sp, sq);
					sp->file->loadwith = L_GRAPE;
				}
			} else
				ungrap(sp, sq);
		}
	}
}
Esempio n. 3
0
unfoul()
{
	register struct ship *sp;
	struct ship *to;
	register int nat;
	register i;

	foreachship(sp) {
		if (sp->file->captain[0])
			continue;
		nat = capship(sp)->nationality;
		foreachship(to) {
			if (nat != capship(to)->nationality &&
			    !toughmelee(sp, to, 0, 0))
				continue;
			for (i = fouled2(sp, to); --i >= 0;)
				if (die() <= 2)
					cleanfoul(sp, to, 0);
		}
	}
}