|
| 1 | +/obj/item/melee/tonfa/proc/check_martial_counter(mob/living/carbon/human/target, mob/living/carbon/human/user) |
| 2 | + if(target.check_block()) |
| 3 | + target.visible_message(span_danger("[target.name] blocks [src] and twists [user]'s arm behind [user.p_their()] back!"), |
| 4 | + span_userdanger("You block the attack!")) |
| 5 | + user.Stun(15) |
| 6 | + return TRUE |
| 7 | + |
| 8 | +//tonfa |
| 9 | +/obj/item/melee/tonfa |
| 10 | + name = "police tonfa" |
| 11 | + desc = "A traditional police baton for gaining the submission of an uncooperative target without the use of lethal-force. \ |
| 12 | + As with all traditional weapons, the target will find themselves bruised, but alive. It has proven to be effective in preventing \ |
| 13 | + repeat offenses and has brought employment to lawyers for decades." |
| 14 | + icon = 'modular_meta/features/security_extended/icons/baton.dmi' |
| 15 | + icon_state = "beater" |
| 16 | + worn_icon_state = "classic_baton" |
| 17 | + lefthand_file = 'modular_meta/features/security_extended/icons/inhands/lefthand.dmi' |
| 18 | + righthand_file = 'modular_meta/features/security_extended/icons/inhands/righthand.dmi' |
| 19 | + force = 12 |
| 20 | + throwforce = 7 |
| 21 | + slot_flags = ITEM_SLOT_BELT |
| 22 | + w_class = WEIGHT_CLASS_HUGE |
| 23 | + hitsound = 'sound/effects/woodhit.ogg' |
| 24 | + custom_price = PAYCHECK_COMMAND |
| 25 | + /// Damage dealt while on help intent |
| 26 | + var/non_harm_force = 3 |
| 27 | + /// Stamina damage dealt |
| 28 | + var/stamina_force = 25 |
| 29 | + |
| 30 | +/obj/item/melee/tonfa/attack(mob/living/target, mob/living/user) |
| 31 | + var/target_zone = user.log_manual_zone_selected_update(target) |
| 32 | + var/armour_level = target.getarmor(target_zone, STAMINA, penetration = armour_penetration - 15) |
| 33 | + |
| 34 | + add_fingerprint(user) |
| 35 | + if((HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50)) |
| 36 | + to_chat(user, span_danger("You hit yourself over the head.")) |
| 37 | + user.adjust_stamina_loss(stamina_force) |
| 38 | + |
| 39 | + // Deal full damage |
| 40 | + force = initial(force) |
| 41 | + if(ishuman(user)) |
| 42 | + var/mob/living/carbon/human/H = user |
| 43 | + H.apply_damage(2*force, BRUTE, BODY_ZONE_HEAD) |
| 44 | + else |
| 45 | + user.take_bodypart_damage(2*force) |
| 46 | + return |
| 47 | + if(!isliving(target)) |
| 48 | + return ..() |
| 49 | + if(iscyborg(target)) |
| 50 | + if (!user.combat_mode) |
| 51 | + playsound(get_turf(src), hitsound, 75, 1, -1) |
| 52 | + user.do_attack_animation(target) // The attacker cuddles the Cyborg, awww. No damage here. |
| 53 | + return |
| 54 | + if (!user.combat_mode) |
| 55 | + force = non_harm_force |
| 56 | + else |
| 57 | + force = initial(force) |
| 58 | + if(ishuman(target)) |
| 59 | + var/mob/living/carbon/human/H = target |
| 60 | + if (H.check_block(src, 0, "[user]'s [name]", MELEE_ATTACK)) |
| 61 | + return |
| 62 | + if(check_martial_counter(H, user)) |
| 63 | + log_combat(user, target, "attempted to attack", src, "(blocked by martial arts)") |
| 64 | + return |
| 65 | + |
| 66 | + target.visible_message("[user] strikes [target] in the [parse_zone(target_zone)].", "You strike [target] in the [parse_zone(target_zone)].") |
| 67 | + log_combat(user, target, "attacked", src) |
| 68 | + |
| 69 | + // If the target has a lot of stamina loss, knock them down |
| 70 | + if ((user.log_manual_zone_selected_update(BODY_ZONE_L_LEG) || user.log_manual_zone_selected_update(BODY_ZONE_R_LEG)) && target.get_stamina_loss() > 22) |
| 71 | + var/effectiveness = CLAMP01((target.get_stamina_loss() - 22) / 50) |
| 72 | + log_combat(user, target, "knocked-down", src, "(additional effect)") |
| 73 | + // Move the target back upon knockdown, to give them some time to recover |
| 74 | + var/shove_dir = get_dir(user.loc, target.loc) |
| 75 | + var/turf/target_shove_turf = get_step(target.loc, shove_dir) |
| 76 | + var/mob/living/carbon/human/target_collateral_human = locate(/mob/living/carbon) in target_shove_turf.contents |
| 77 | + if (target_collateral_human && target_shove_turf != get_turf(user)) |
| 78 | + target.Knockdown(max(0.5 SECONDS, effectiveness * 4 SECONDS * (100-armour_level)/100)) |
| 79 | + target_collateral_human.Knockdown(0.5 SECONDS) |
| 80 | + else |
| 81 | + target.Knockdown(effectiveness * 4 SECONDS * (100-armour_level)/100) |
| 82 | + target.Move(target_shove_turf, shove_dir) |
| 83 | + if (user.log_manual_zone_selected_update(BODY_ZONE_L_LEG) || user.log_manual_zone_selected_update(BODY_ZONE_R_LEG) || user.log_manual_zone_selected_update(BODY_ZONE_L_ARM) || user.log_manual_zone_selected_update(BODY_ZONE_R_ARM)) |
| 84 | + // 4-5 hits on an unarmoured target |
| 85 | + target.apply_damage(stamina_force*0.6, STAMINA, target_zone, armour_level) |
| 86 | + else |
| 87 | + // 4-5 hits on an unarmoured target |
| 88 | + target.apply_damage(stamina_force, STAMINA, target_zone, armour_level) |
| 89 | + |
| 90 | + return ..() |
0 commit comments