Exemplo n.º 1
0
/**
 * get_hero_KK_best - get the index of the hero with the best KK value
 *
 * Returns the index of the hero with the highest unmodified KK value.
 * The hero must be alive and in the current group.
 */
unsigned short get_hero_KK_best() {
	signed short retval;
	Bit8u *hero_i;
	signed short i;
	signed short kk_val = -1;

	hero_i = get_hero(0);

	for (i = 0; i <= 6; i++, hero_i += 0x6da) {
		if ((host_readb(hero_i + 0x21) != 0) &&
				/* check class */
			(host_readb(hero_i + 0x87) == ds_readb(CURRENT_GROUP)) &&
				/* check if in group */
			(!hero_dead(hero_i)) &&
				/* check if not dead */
			(host_readbs(hero_i + 0x47) > kk_val)) {
				/* check if KK is the highest */

				kk_val = host_readbs(hero_i + 0x47);
				retval = i;
			}
	}

	return retval;
}
Exemplo n.º 2
0
/* dead animal Orvil<->Skjal */
void tevent_063(void)
{
	Bit8u *hero;
	signed short vomiter;
	signed short proof;
	signed short i;
	signed short max;

	max = 9999;

	/* intro message */
	GUI_output(get_city(0xb8));

	hero = get_hero(0);

	for (i = 0; i <= 6; i++, hero += 0x6da) {

		if (host_readb(hero + 0x21) == 0)
			continue;

		if (host_readb(hero + 0x87) != ds_readb(CURRENT_GROUP))
			continue;

		if (hero_dead(hero))
			continue;

		/* MU+0 */
		proof = test_attrib(hero, 0, 0);

		if (proof < max) {
			max = proof;
			vomiter = i;
		}
	}

	hero = get_hero(vomiter);

	sprintf((char*)Real2Host(ds_readd(DTP2)),
		(char*)get_city(0xbc),
		(char*)hero + 0x10);

	/* print who vomits */
	GUI_output(Real2Host(ds_readd(DTP2)));

	/* LE - 2 */
	sub_hero_le(hero, 2);

	i = get_free_mod_slot();

	/* MU -2 for 24 hours */
	set_mod_slot(i, 0x1fa40, hero + 0x35, -2, (signed char)vomiter);

	/* outro message */
	GUI_output(get_city(0xc0));
}
Exemplo n.º 3
0
/**
 * hero_gets_poisoned - poison a hero
 * @hero:	the hero which gets poisoned
 * @poison:	the kind of poison
 */
void hero_gets_poisoned(Bit8u *hero, unsigned short poison) {

	if (!hero_dead(hero)) {

		host_writeb(hero + poison * 5 + 0xd6, 0xff);
		host_writeb(hero + poison * 5 + 0xd7, 0x00);
		host_writeb(hero + poison * 5 + 0xd8, 0x00);
		host_writeb(hero + poison * 5 + 0xd9, 0x00);
		host_writeb(hero + poison * 5 + 0xda, 0x00);
	}
}
Exemplo n.º 4
0
static void move( pos next_pos )
{
    pos monster_pos = get_monster_pos();
    next_pos.on = is_monster_shited() ? BLOCK : get_( next_pos.row, next_pos.column );
    char body = MONSTER;
    if ( is_monster_catched() ) {
        body = DEAD;
        hero_dead();
    }

    play_monstro();
    move_to( monster_pos, next_pos, body );
    if ( is_monster_shited() ) {
        play_wet();
        usleep( 1000000 );
        veiudo.shited = 0;
    }
    set_monster_pos( next_pos );
}
Exemplo n.º 5
0
/**
 * count_heroes_in_group() - counts the heroes in the current group
 *
 * Returns how many alive heros are in the group.
 */
signed short count_heroes_in_group(void)
{
	Bit8u *hero_i;
	signed short i;
	signed short retval;

	retval = 0;

	for (hero_i = get_hero(0), i = 0; i <= 6; i++, hero_i += 0x6da) {
		/* Check class, group and dead */
		if ((host_readb(hero_i + 0x21) != 0) &&
			(host_readb(hero_i + 0x87) == ds_readb(CURRENT_GROUP)) &&
			(!hero_dead(hero_i))) {

			retval++;
		}
	}

	return retval;
}
Exemplo n.º 6
0
/**
 * hero_gets_diseased - diseases a hero
 * @hero:	the hero which gets diseased
 * @disease:	the kind of disease
 */
void hero_gets_diseased(Bit8u *hero, unsigned short disease)
{
#ifdef M302de_ORIGINAL_BUGFIX
	/* not a real BUG, but very useless */
	if (host_readb(hero + 0x21) == 0)
		return;
#endif

	if (!hero_dead(hero)) {
#if !defined(__BORLANDC__)
		D1_INFO("%s erkrankt an %s\n",
			(char*)hero + 0x10,
			(char*)get_ltx((disease + 0x193) * 4));
#endif

		host_writeb(hero + disease * 5 + 0xae, 0xff);
		host_writeb(hero + disease * 5 + 0xaf, 0x00);
		host_writeb(hero + disease * 5 + 0xb0, 0x00);
		host_writeb(hero + disease * 5 + 0xb1, 0x00);
		host_writeb(hero + disease * 5 + 0xb2, 0x00);
	}
}
Exemplo n.º 7
0
/**
 *	check_heros_KK
 *	@val:	value to compare KK with
 *
 *	This function, like hero_check_KK_unused, is buggy!
 *	It does not check if the first slot is a valid hero.
 */
short check_heros_KK(short val) {

	Bit8u *hero;
	signed short sum;

	hero = get_hero(0);

	/* Orig-BUG: not checked if hero is valid */
	sum = host_readbs(hero + 0x47) + host_readbs(hero + 0x48);

	hero = get_hero(1);

	/* check class, group and dead status of hero in slot 2*/
	if (host_readb(hero + 0x21) && host_readb(hero + 0x87) == ds_readb(CURRENT_GROUP) && (!hero_dead(hero))) {
		sum += host_readbs(hero + 0x47) + host_readbs(hero + 0x48);
	}

#if !defined(__BORLANDC__)
	D1_INFO("Pruefe KK der ersten beiden Helden (%d) >= %d: ", sum, val);
	D1_INFO("%s\n", sum >= val ? "gelungen" : "mislungen");
#endif

	return (sum >= val) ? 1 : 0;
}