// CF Jab reverse engineer void do_jab( CHAR_DATA *ch) { CHAR_DATA *victim; int chance; OBJ_DATA *wield; bool balance = FALSE; bool brutaljab = FALSE; bool canjab = FALSE; int dt = TYPE_UNDEFINED; if ((chance = get_skill(ch,gsn_jab) ) == 0 || (ch->level < skill_table[gsn_jab].skill_level[ch->class]) ) { send_to_char("You don't know how to jab.\n\r",ch); return; } victim = ch->fighting; if (victim == NULL) { send_to_char("But you aren't fighting anyone!\n\r",ch); return; } wield = get_eq_char(ch,WEAR_WIELD); // I don't know the real function name, obviously. // But we need to know if they have balance of the sisters. balance = has_legacy(ch, "balance"); // If they're not mainhaind a sword and don't have balance, they can't jab. // If they aren't mainhanding a sword, but do have balance and aren't offhanding a sword, they can't jab. if ((wield != NULL) && (( wield->value[0] == WEAPON_SWORD))) { // We're mainhanding a sword, we can jab. canjab = TRUE; } else if (balance) { // We weren't mainhanding a sword, but we have balance of the sisters. wield = get_eq_char(ch,WEAR_DUAL_WIELD); if ((wield != NULL) && (( wield->value[0] == WEAPON_SWORD))) { // We have balance and are offhanding a sword, we can jab. canjab = TRUE; // We need to know that we're jabbing with offhand. dt = gsn_dual_wield; } } if (!canjab) { send_to_char("You must be wielding a sword to jab.\n\r",ch); return; } // Ok we're wielding a sword and can jab, let's calculate our chances which start at our skill level. // This part is totally made up, but is somewhere in the vicinity of how it works. brutaljab = has_edge(ch, 'brutaljab'); chance -= 25; // Reduce base chance to 75% // Add bonus (or penalty) for strength difference if you have brutal jab. if (brutaljab) chance += (get_curr_stat(ch,STAT_STR) - get_curr_stat(victim,STAT_STR)); chance += get_curr_stat(ch,STAT_DEX); // Dexy chars succeed more often. // It's a good bet the chances are somewhat more complicated than above, but that's not the point. if (number_percent() < chance) { check_improve(ch,gsn_jab,TRUE,1); WAIT_STATE(ch,skill_table[gsn_jab].beats); one_hit_new(victim,ch,dt,HIT_NOSPECIALS,HIT_UNBLOCKABLE,HIT_NOADD,100,"jab"); } else { check_improve(ch,gsn_jab,FALSE,1); WAIT_STATE(ch,skill_table[gsn_lunge].beats); one_hit_new(victim,ch,dt,HIT_NOSPECIALS,HIT_UNBLOCKABLE,HIT_NOADD,0,"jab"); } return; }