Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (has_skill(ch, SKILL_ARCHERY))
- offense = number(1, 100) + ch->skills[SKILL_ARCHERY]->learned;
- else
- offense = number(1, 80);
- if (max_cond >= 2.5) {
- // look at weather condition
- for (wn = wn_list; wn; wn = wn->next) {
- // handle ch's room
- if (wn->zone == ch->in_room->zone) {
- max_cond = MAX(max_cond, wn->condition);
- offense -= MAX(0, (wn->condition - 1.5) * 10);
- }
- // if not in same room, other room
- if (ch->in_room != tar_room && wn->zone == tar_room->zone) {
- max_cond = MAX(max_cond, wn->condition);
- offense -= MAX(0, (wn->condition - 1.5) * 10);
- }
- }
- }
- else {
- // if worst condition is stormy, don't also apply wind
- offense -= (weather_info.wind_velocity / 5) * 2;
- }
- offense += agl_app[GET_AGL(ch)].missile;
- defense = number(1, 100) + victim->abilities.def;
- defense += agl_app[GET_AGL(victim)].reaction;
- if (GET_RACE(victim) == RACE_MANTIS)
- defense *= 2;
- if (n > 0)
- offense -= (n * 10);
- if ((GET_RACE(victim) == RACE_GESRA) && (n > 0))
- offense = 0;
- // npcs that aren't marked [archery]
- if (IS_NPC(victim) && !isnamebracketsok("[archery]", MSTR(victim, name))) {
- // more than 1 room away auto-fail
- if (n > 1)
- offense = 0;
- // sentinels always fail
- if (IS_SET(victim->specials.act, CFL_SENTINEL))
- offense = 0;
- }
- WIPE_LDESC(ch);
- if ((dir < DIR_OUT) && (missile_wall_check(ch, arrow, dir, CMD_SHOOT)))
- return;
- prior_hitpoints = GET_HIT(victim);
- #ifdef RANGED_STAMINA_DRAIN
- /* Stamina drain - only on bows. */
- if (!bow->obj_flags.value[2]) {
- staminaCost = number(1, (100 - get_skill_percentage(ch, SKILL_ARCHERY)) / 22 + 2);
- if (GET_STR(ch) - bow->obj_flags.value[1] > 0) {
- staminaCost -= MIN(3, GET_STR(ch) - bow->obj_flags.value[1]);
- } else { /* pulling too heavy of a bow (double penalty) */
- staminaCost -= MAX(-3, GET_STR(ch) - bow->obj_flags.value[1]) * 2;
- }
- /* minimum of 1 cost */
- adjust_move(ch, -MAX(1, staminaCost));
- }
- #endif
- if (ch->specials.fighting && ch->specials.fighting == victim)
- clear_disengage_request(ch);
- if (offense < defense) {
- if (ch->in_room != victim->in_room)
- alive = missile_damage(ch, victim, arrow, dir, 0, TYPE_BOW);
- else
- alive = ws_damage(ch, victim, 0, 0, 0, 0, TYPE_BOW, 0);
- /* high winds without skill, or offense = 0, no gain */
- if (has_skill(ch, SKILL_ARCHERY) && offense > 0
- && max_cond - 1.5 * 10 < get_skill_percentage(ch, SKILL_ARCHERY)) {
- /* if target is asleep or paralyzed, decrease chance of learning */
- if ((!AWAKE(victim) || is_paralyzed(victim)) && !number(0, 11)) {
- /* can only learn up to 40% on sparring dummies */
- if (get_skill_percentage(ch, SKILL_ARCHERY) <= 40)
- gain_skill(ch, SKILL_ARCHERY, 1);
- } else {
- gain_skill(ch, SKILL_ARCHERY, 1);
- }
- }
- } else {
- is_hit = TRUE;
- /* calculate damage */
- if (arrow->obj_flags.type == ITEM_WEAPON) {
- dam =
- dice(arrow->obj_flags.value[1],
- arrow->obj_flags.value[2]) + arrow->obj_flags.value[0];
- } else { /* not a weapon -Morg 3/12/03 */
- dam = dice(1, 2);
- }
- /* strength bonus, limited str */
- if (GET_STR(ch) > bow->obj_flags.value[1] + 1)
- dam += str_app[bow->obj_flags.value[1]].todam;
- /* skill bonus */
- if (ch->skills[SKILL_ARCHERY]) {
- dam += ch->skills[SKILL_ARCHERY]->learned / 7;
- if (number(0, 500) <= ch->skills[SKILL_ARCHERY]->learned)
- dam *= 2;
- }
- if (ch->in_room != victim->in_room)
- alive = missile_damage(ch, victim, arrow, dir, dam, TYPE_BOW);
- else
- alive = ws_damage(ch, victim, dam + 2, 0, 0, dam + 2, TYPE_BOW, 0);
- if (alive && IS_SET(arrow->obj_flags.extra_flags, OFL_POISON)) {
- if (!does_save(victim, SAVING_PARA, 0)) {
- if (prior_hitpoints != GET_HIT(victim)) {
- /* Changed to allow new poison types - Tiernan 4/23 */
- poison_char(victim, arrow->obj_flags.value[5], number(1, (27 - GET_END(ch))),
- 0);
- send_to_char("You feel very sick.\n\r", victim);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement