コード例 #1
0
ファイル: obj-info.c プロジェクト: mjdrinen/FAangband
static bool describe_combat(textblock *tb, const object_type *o_ptr,
		oinfo_detail_t mode)
{
    bool combat = FALSE;

    /* Print melee damage info */
    if ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM)
	|| (o_ptr->tval == TV_HAFTED) || (o_ptr->tval == TV_DIGGING))
	combat = describe_weapon_damage(tb, o_ptr, mode);

    /* Print range damage info */
    if (is_missile(o_ptr) || of_has(o_ptr->flags_obj, OF_THROWING))
	combat = describe_ammo_damage(tb, o_ptr, mode) || combat;

    return combat;
}
コード例 #2
0
ファイル: obj-info.c プロジェクト: NickMcConnell/FAangband
/**
 * Display the ammo damage done with a multiplier
 */
static void output_ammo_dam(textblock * tb, player_state * state,
							const object_type * o_ptr, int mult,
							const char *against, bool * first,
							bool perfect, oinfo_detail_t mode)
{
	object_type *b_ptr = &p_ptr->inventory[INVEN_BOW];

	int dam, die_average, add = 0, i, deadliness, crit, chance, dice =
		o_ptr->dd;

	/* Throwing weapon, or launched missile? */
	bool thrown = !is_missile(o_ptr);
	bool full = mode & OINFO_FULL;

	/* Average damage for one standard side (x10) */
	die_average = (10 * (o_ptr->ds + 1)) / 2;

	/* Apply the launcher multiplier. */
	if (!thrown)
		die_average *= p_ptr->state.ammo_mult;

	/* Multiply by slay or brand (x10) */
	die_average *= mult;

	/* Record the addend */
	if (mult > 10)
		add = (mult - 10);

	/* Multiply by deadliness (x100) */
	deadliness = state->dis_to_d;
	if (if_has(o_ptr->id_other, IF_TO_D) || full)
		deadliness += o_ptr->to_d;
	if (if_has(b_ptr->id_other, IF_TO_D) || full)
		deadliness += b_ptr->to_d;
	if (deadliness > 150)
		deadliness = 150;
	if (deadliness < -150)
		deadliness = -150;
	if (deadliness >= 0)
		die_average *= (100 + deadliness_conversion[deadliness]);
	else {
		i = deadliness_conversion[ABS(deadliness)];
		if (i >= 100)
			die_average = 0;
		else
			die_average *= (100 - i);
	}

	/* Get critical chance (x 10) */
	chance = state->skills[SKILL_TO_HIT_BOW] + state->dis_to_h;
	if (if_has(o_ptr->id_other, IF_TO_H) || full)
		chance += o_ptr->to_h;
	if ((!thrown) && (if_has(b_ptr->id_other, IF_TO_H) || full))
		chance += b_ptr->to_h;
	if (thrown)
		chance = chance * 3 / 2;
	chance = (100 * chance) / (chance + 360);
	if (player_has(PF_MARKSMAN))
		chance = 100 - (83 * (100 - chance)) / 100;
	crit = 116 * chance;
	crit /= 1000;

	/* Increase dice */
	if (thrown && perfect)
		dice *= 2;
	dice = dice * 10 + crit;
	if (thrown)
		dice *= 2 + p_ptr->lev / 12;

	/* Multiply by number of sides */
	dam = die_average * dice;

	CHECK_FIRST("", *first);
	if ((dam > 50000) || (add > 0))
		textblock_append_c(tb, TERM_L_GREEN, "%d", add + dam / 100000);
	else
		textblock_append_c(tb, TERM_L_RED, "0");
	textblock_append(tb, " against %s", against);
}