Example #1
0
/**
 * Calculate the damage of a monster spell.
 *
 * \param spell is the spell in question.
 * \param hp is the hp of the casting monster.
 * \param rlev is the level of the casting monster.
 * \param dam_aspect is the damage calc we want (min, max, avg, random).
 */
static int mon_spell_dam(int spell, int hp, int rlev, aspect dam_aspect)
{
	const struct mon_spell *rs_ptr = &mon_spell_table[spell];

	if (rs_ptr->div)
		return hp_dam(spell, hp);
	else
		return nonhp_dam(spell, rlev, dam_aspect);
}
Example #2
0
/**
 * Calculate the damage of a monster spell.
 *
 * \param index is the index of the spell in question.
 * \param hp is the hp of the casting monster.
 * \param race is the race of the casting monster.
 * \param dam_aspect is the damage calc we want (min, max, avg, random).
 */
static int mon_spell_dam(int index, int hp, const struct monster_race *race,
						 aspect dam_aspect)
{
	const struct monster_spell *spell = monster_spell_by_index(index);

	if (monster_spell_is_breath(index))
		return breath_dam(spell->effect->params[0], hp);
	else
		return nonhp_dam(spell, race, dam_aspect);
}