For some reason my melee_crit_damage is not factoring into the fight.
In the provided screenshot my character is a level 40 berserker with melee crit damage of 20%
Code:
int adjust_damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype, bool critical_hit, int crit_multiplier)
{
int perk_mod = 0, activator = 0, wbranch;
//DAMAGE INCREASORS GO HERE
if ((HAPPY_DMG >= .0001) && ((!IS_NPC(ch)) || (AFF_FLAGGED(ch, AFF_CHARM))))
dam += ((int)((float)((dam * HAPPY_DMG)/100)));
if (critical_hit) {
if (!IS_NPC(ch)) {
if (WIELDED_WEAPON(ch) && GET_OBJ_TYPE(WIELDED_WEAPON(ch)) == ITEM_WEAPON) {
wbranch = (GET_OBJ_VAL(WIELDED_WEAPON(ch), 0));
for (int i = 0; i < NUM_PERK_SLOTS; i++) {
if (GET_PERK_SLOTS(ch, i) == 85) {
if (wbranch == SKILL_WP_SLASH)
perk_mod += 20;
}
if (GET_PERK_SLOTS(ch, i) == 86) {
if (wbranch == SKILL_WP_BLUDGEON)
perk_mod += 20;
}
if (GET_PERK_SLOTS(ch, i) == 87) {
if (wbranch == SKILL_WP_PIERCE)
perk_mod += 20;
}
if (GET_PERK_SLOTS(ch, i) == 114) {
if (wbranch == SKILL_WP_SPECIAL)
perk_mod += 20;
}
if (GET_PERK_SLOTS(ch, i) == 128) {
if (wbranch == SKILL_WP_SLASH)
perk_mod += 20;
}
}
}
}
// Print statement to see value of get_melee_crit_dmg_bonus
int melee_crit_dmg_bonus = get_melee_crit_dmg_bonus(ch);
send_to_char(ch, "Melee Crit Damage Bonus: %d\n", melee_crit_dmg_bonus);
if ((con_app[GET_TOT_CON(ch)].crit_resist) > 0) {
dam += ((dam * ((melee_crit_dmg_bonus + perk_mod) / 100)) * ((100 - ((float)(con_app[GET_TOT_CON(ch)].crit_resist))) / ((float)100)));
send_to_char(ch, "Total Dam: %d\n", dam);
} else {
dam += (dam * ((melee_crit_dmg_bonus + perk_mod) / 100));
send_to_char(ch, "Total Dam: %d\n", dam);
}
}