From bddb43787296906d763a31f5c59eab13490723f0 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Mon, 18 Nov 2019 18:30:46 +0100
Subject: [PATCH] It works now.
---
code/game/objects/items/melee/misc.dm | 5 +-
code/game/objects/items/robot/robot_items.dm | 8 +-
code/game/objects/items/stunbaton.dm | 8 +-
.../abductor/equipment/abduction_gear.dm | 8 +-
.../mob/living/carbon/alien/alien_defense.dm | 25 ++---
.../carbon/alien/humanoid/caste/hunter.dm | 7 +-
.../carbon/alien/humanoid/humanoid_defense.dm | 4 +-
.../carbon/alien/larva/larva_defense.dm | 3 +
.../mob/living/carbon/carbon_defense.dm | 44 ++++-----
.../mob/living/carbon/human/human_defense.dm | 98 +++++++------------
.../mob/living/carbon/monkey/combat.dm | 21 ++--
.../living/carbon/monkey/monkey_defense.dm | 74 ++++++++------
code/modules/mob/living/living_defense.dm | 67 ++++++++++---
.../mob/living/silicon/robot/robot_defense.dm | 29 +++---
.../mob/living/silicon/silicon_defense.dm | 17 ++--
.../living/simple_animal/animal_defense.dm | 7 +-
.../simple_animal/guardian/types/charger.dm | 6 +-
.../mob/living/simple_animal/slime/slime.dm | 35 +++----
.../living/silicon/robot/dogborg_equipment.dm | 7 +-
19 files changed, 244 insertions(+), 229 deletions(-)
diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm
index d7c2f7f4f6..1120e1856d 100644
--- a/code/game/objects/items/melee/misc.dm
+++ b/code/game/objects/items/melee/misc.dm
@@ -216,10 +216,11 @@
return
else
if(last_hit < world.time)
+ if(target.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK))
+ playsound(target, 'sound/weapons/genhit.ogg', 50, 1)
+ return
if(ishuman(target))
var/mob/living/carbon/human/H = target
- if (H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK))
- return
if(check_martial_counter(H, user))
return
playsound(get_turf(src), 'sound/effects/woodhit.ogg', 75, 1, -1)
diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm
index 77bc7ed810..c09f5b1b65 100644
--- a/code/game/objects/items/robot/robot_items.dm
+++ b/code/game/objects/items/robot/robot_items.dm
@@ -11,11 +11,9 @@
var/charge_cost = 30
/obj/item/borg/stun/attack(mob/living/M, mob/living/user)
- if(ishuman(M))
- var/mob/living/carbon/human/H = M
- if(H.check_shields(src, 0, "[M]'s [name]", MELEE_ATTACK))
- playsound(M, 'sound/weapons/genhit.ogg', 50, 1)
- return FALSE
+ if(M.check_shields(src, 0, "[M]'s [name]", MELEE_ATTACK))
+ playsound(M, 'sound/weapons/genhit.ogg', 50, 1)
+ return FALSE
if(iscyborg(user))
var/mob/living/silicon/robot/R = user
if(!R.cell.use(charge_cost))
diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm
index 47d9af2795..e1e599b1b6 100644
--- a/code/game/objects/items/stunbaton.dm
+++ b/code/game/objects/items/stunbaton.dm
@@ -168,11 +168,9 @@
/obj/item/melee/baton/proc/baton_stun(mob/living/L, mob/user)
- if(ishuman(L))
- var/mob/living/carbon/human/H = L
- if(H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that
- playsound(L, 'sound/weapons/genhit.ogg', 50, 1)
- return FALSE
+ if(L.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that
+ playsound(L, 'sound/weapons/genhit.ogg', 50, 1)
+ return FALSE
var/stunpwr = stunforce
var/obj/item/stock_parts/cell/our_cell = get_cell()
if(!our_cell)
diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm
index 37652d1887..ee5000a3b8 100644
--- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm
+++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm
@@ -482,11 +482,9 @@
user.do_attack_animation(L)
- if(ishuman(L))
- var/mob/living/carbon/human/H = L
- if(H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK))
- playsound(L, 'sound/weapons/genhit.ogg', 50, 1)
- return 0
+ if(L.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK))
+ playsound(L, 'sound/weapons/genhit.ogg', 50, 1)
+ return 0
switch (mode)
if(BATON_STUN)
diff --git a/code/modules/mob/living/carbon/alien/alien_defense.dm b/code/modules/mob/living/carbon/alien/alien_defense.dm
index 839239a888..bdc691ce49 100644
--- a/code/modules/mob/living/carbon/alien/alien_defense.dm
+++ b/code/modules/mob/living/carbon/alien/alien_defense.dm
@@ -17,8 +17,9 @@ In all, this is a lot like the monkey code. /N
*/
/mob/living/carbon/alien/attack_alien(mob/living/carbon/alien/M)
. = ..()
+ if(!.) // the attack was blocked or was help/grab intent
+ return
switch(M.a_intent)
-
if (INTENT_HELP)
if(!recoveringstam)
resting = 0
@@ -27,10 +28,7 @@ In all, this is a lot like the monkey code. /N
AdjustUnconscious(-60)
AdjustSleeping(-100)
visible_message("[M.name] nuzzles [src] trying to wake [p_them()] up!")
-
if(INTENT_DISARM, INTENT_HARM)
- if(!.) // the attack was blocked or was help/grab intent
- return
if(health > 0)
M.do_attack_animation(src, ATTACK_EFFECT_BITE)
playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1)
@@ -69,7 +67,8 @@ In all, this is a lot like the monkey code. /N
/mob/living/carbon/alien/attack_paw(mob/living/carbon/monkey/M)
- if(..())
+ . = ..()
+ if(.) //successful monkey bite.
var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected))
apply_damage(rand(1, 3), BRUTE, affecting)
@@ -93,13 +92,15 @@ In all, this is a lot like the monkey code. /N
adjustStaminaLoss(damage)
/mob/living/carbon/alien/attack_slime(mob/living/simple_animal/slime/M)
- if(..()) //successful slime attack
- var/damage = rand(5, 35)
- if(M.is_adult)
- damage = rand(10, 40)
- adjustBruteLoss(damage)
- log_combat(M, src, "attacked")
- updatehealth()
+ . = ..()
+ if(!.) //unsuccessful slime attack
+ return
+ var/damage = rand(5, 35)
+ if(M.is_adult)
+ damage = rand(10, 40)
+ adjustBruteLoss(damage)
+ log_combat(M, src, "attacked")
+ updatehealth()
/mob/living/carbon/alien/ex_act(severity, target, origin)
if(origin && istype(origin, /datum/spacevine_mutation) && isvineimmune(src))
diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm
index fe682b5c99..d1ed09665b 100644
--- a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm
+++ b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm
@@ -63,12 +63,7 @@
if(A)
if(isliving(A))
var/mob/living/L = A
- var/blocked = FALSE
- if(ishuman(A))
- var/mob/living/carbon/human/H = A
- if(H.check_shields(src, 0, "the [name]", attack_type = LEAP_ATTACK))
- blocked = TRUE
- if(!blocked)
+ if(!L.check_shields(src, 0, "the [name]", attack_type = LEAP_ATTACK))
L.visible_message("[src] pounces on [L]!", "[src] pounces on you!")
L.Knockdown(100)
sleep(2)//Runtime prevention (infinite bump() calls on hulks)
diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm
index 468abf251a..1d613db07a 100644
--- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm
+++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm
@@ -42,7 +42,7 @@
log_combat(M, src, "attacked")
else
playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
- visible_message("[M] has attempted to punch [src]!", \
+ visible_message("[M] has attempted to punch [src]!", \
"[M] has attempted to punch [src]!", null, COMBAT_MESSAGE_RANGE)
if (INTENT_DISARM)
@@ -61,7 +61,7 @@
"[M] has disarmed [src]!", null, COMBAT_MESSAGE_RANGE)
else
playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
- visible_message("[M] has attempted to disarm [src]!",\
+ visible_message("[M] has attempted to disarm [src]!",\
"[M] has attempted to disarm [src]!", null, COMBAT_MESSAGE_RANGE)
/mob/living/carbon/alien/humanoid/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect)
diff --git a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm
index 88c34f4387..7dabcf5abf 100644
--- a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm
+++ b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm
@@ -25,6 +25,9 @@
. = ..(user, TRUE)
if(.)
return
+ playsound(loc, "punch", 25, 1, -1)
+ visible_message("[user] has pummeled [src]!", \
+ "[user] has pummeled [src]!", null, COMBAT_MESSAGE_RANGE)
adjustBruteLoss(5 + rand(1,9))
new /datum/forced_movement(src, get_step_away(user,src, 30), 1)
return 1
diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm
index d045e5361d..815b0a909b 100644
--- a/code/modules/mob/living/carbon/carbon_defense.dm
+++ b/code/modules/mob/living/carbon/carbon_defense.dm
@@ -62,10 +62,6 @@
throw_mode_off()
return TRUE
-/mob/living/carbon/can_embed(obj/item/I)
- if(I.get_sharpness() || is_pointed(I) || is_type_in_typecache(I, GLOB.can_embed_types))
- return TRUE
-
/mob/living/carbon/embed_item(obj/item/I)
throw_alert("embeddedobject", /obj/screen/alert/embeddedobject)
var/obj/item/bodypart/L = pick(bodyparts)
@@ -170,7 +166,8 @@
help_shake_act(M)
return 0
- if(..()) //successful monkey bite.
+ . = ..()
+ if(.) //successful monkey bite.
for(var/thing in M.diseases)
var/datum/disease/D = thing
ForceContractDisease(D)
@@ -178,26 +175,27 @@
/mob/living/carbon/attack_slime(mob/living/simple_animal/slime/M)
- if(..()) //successful slime attack
- if(M.powerlevel > 0)
- var/stunprob = M.powerlevel * 7 + 10 // 17 at level 1, 80 at level 10
- if(prob(stunprob))
- M.powerlevel -= 3
- if(M.powerlevel < 0)
- M.powerlevel = 0
+ . = ..()
+ if(!.)
+ return
+ if(M.powerlevel > 0)
+ var/stunprob = M.powerlevel * 7 + 10 // 17 at level 1, 80 at level 10
+ if(prob(stunprob))
+ M.powerlevel -= 3
+ if(M.powerlevel < 0)
+ M.powerlevel = 0
- visible_message("The [M.name] has shocked [src]!", \
- "The [M.name] has shocked [src]!")
+ visible_message("The [M.name] has shocked [src]!", \
+ "The [M.name] has shocked [src]!")
- do_sparks(5, TRUE, src)
- var/power = M.powerlevel + rand(0,3)
- Knockdown(power*20)
- if(stuttering < power)
- stuttering = power
- if (prob(stunprob) && M.powerlevel >= 8)
- adjustFireLoss(M.powerlevel * rand(6,10))
- updatehealth()
- return 1
+ do_sparks(5, TRUE, src)
+ var/power = M.powerlevel + rand(0,3)
+ Knockdown(power*20)
+ if(stuttering < power)
+ stuttering = power
+ if (prob(stunprob) && M.powerlevel >= 8)
+ adjustFireLoss(M.powerlevel * rand(6,10))
+ updatehealth()
/mob/living/carbon/proc/dismembering_strike(mob/living/attacker, dam_zone)
if(!attacker.limb_destroyer)
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index 7e7cb18d37..a8d1eb8180 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -61,40 +61,12 @@
P.setAngle(rand(0, 360))//SHING
return FALSE
- if(!(P.original == src && P.firer == src)) //can't block or reflect when shooting yourself
- if(P.is_reflectable)
- if(check_reflect(def_zone)) // Checks if you've passed a reflection% check
- visible_message("The [P.name] gets reflected by [src]!", \
- "The [P.name] gets reflected by [src]!")
- // Find a turf near or on the original location to bounce to
- if(P.starting)
- var/new_x = P.starting.x + pick(0, 0, 0, 0, 0, -1, 1, -2, 2)
- var/new_y = P.starting.y + pick(0, 0, 0, 0, 0, -1, 1, -2, 2)
- var/turf/curloc = get_turf(src)
-
- // redirect the projectile
- P.original = locate(new_x, new_y, P.z)
- P.starting = curloc
- P.firer = src
- P.yo = new_y - curloc.y
- P.xo = new_x - curloc.x
- var/new_angle_s = P.Angle + rand(120,240)
- while(new_angle_s > 180) // Translate to regular projectile degrees
- new_angle_s -= 360
- P.setAngle(new_angle_s)
-
- return -1 // complete projectile permutation
-
return ..()
-/mob/living/carbon/human/proc/check_reflect(def_zone) //Reflection checks for anything in your l_hand, r_hand, or wear_suit based on the reflection chance of the object
- if(wear_suit)
- if(wear_suit.IsReflect(def_zone) == 1)
- return 1
- for(var/obj/item/I in held_items)
- if(I.IsReflect(def_zone) == 1)
- return 1
- return 0
+/mob/living/carbon/human/check_reflect(def_zone)
+ if(wear_suit?.IsReflect(def_zone))
+ return TRUE
+ return ..()
/mob/living/carbon/human/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0)
. = ..()
@@ -111,6 +83,11 @@
return TRUE
return FALSE
+/mob/living/carbon/human/can_embed(obj/item/I)
+ if(I.get_sharpness() || is_pointed(I) || is_type_in_typecache(I, GLOB.can_embed_types))
+ return TRUE
+ return FALSE
+
/mob/living/carbon/human/proc/check_block()
if(mind)
if(mind.martial_art && prob(mind.martial_art.block_chance) && mind.martial_art.can_use(src) && in_throw_mode && !incapacitated(FALSE, TRUE))
@@ -179,8 +156,7 @@
if(!affecting)
affecting = get_bodypart(BODY_ZONE_CHEST)
if(M.a_intent == INTENT_HELP)
- ..() //shaking
- return 0
+ return ..() //shaking
if(M.a_intent == INTENT_DISARM) //Always drop item in hand, if no item, get stunned instead.
var/obj/item/I = get_active_held_item()
@@ -247,26 +223,23 @@
"[M] has tackled down [src]!")
/mob/living/carbon/human/attack_larva(mob/living/carbon/alien/larva/L)
-
- if(..()) //successful larva bite.
- var/damage = rand(1, 3)
- if(check_shields(L, damage, "the [L.name]"))
- return 0
- if(stat != DEAD)
- L.amount_grown = min(L.amount_grown + damage, L.max_grown)
- var/obj/item/bodypart/affecting = get_bodypart(ran_zone(L.zone_selected))
- if(!affecting)
- affecting = get_bodypart(BODY_ZONE_CHEST)
- var/armor_block = run_armor_check(affecting, "melee")
- apply_damage(damage, BRUTE, affecting, armor_block)
+ . = ..()
+ if(!.) //unsuccessful larva bite.
+ return
+ var/damage = rand(1, 3)
+ if(stat != DEAD)
+ L.amount_grown = min(L.amount_grown + damage, L.max_grown)
+ var/obj/item/bodypart/affecting = get_bodypart(ran_zone(L.zone_selected))
+ if(!affecting)
+ affecting = get_bodypart(BODY_ZONE_CHEST)
+ var/armor_block = run_armor_check(affecting, "melee")
+ apply_damage(damage, BRUTE, affecting, armor_block)
/mob/living/carbon/human/attack_animal(mob/living/simple_animal/M)
. = ..()
if(.)
var/damage = rand(M.melee_damage_lower, M.melee_damage_upper)
- if(check_shields(M, damage, "the [M.name]", MELEE_ATTACK, M.armour_penetration))
- return FALSE
var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
if(!dam_zone) //Dismemberment successful
return TRUE
@@ -278,23 +251,22 @@
/mob/living/carbon/human/attack_slime(mob/living/simple_animal/slime/M)
- if(..()) //successful slime attack
- var/damage = rand(5, 25)
- if(M.is_adult)
- damage = rand(10, 35)
+ . = ..()
+ if(!.) //unsuccessful slime attack
+ return
+ var/damage = rand(5, 25)
+ if(M.is_adult)
+ damage = rand(10, 35)
- if(check_shields(M, damage, "the [M.name]"))
- return 0
+ var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
+ if(!dam_zone) //Dismemberment successful
+ return 1
- var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
- if(!dam_zone) //Dismemberment successful
- return 1
-
- var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone))
- if(!affecting)
- affecting = get_bodypart(BODY_ZONE_CHEST)
- var/armor_block = run_armor_check(affecting, "melee")
- apply_damage(damage, BRUTE, affecting, armor_block)
+ var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone))
+ if(!affecting)
+ affecting = get_bodypart(BODY_ZONE_CHEST)
+ var/armor_block = run_armor_check(affecting, "melee")
+ apply_damage(damage, BRUTE, affecting, armor_block)
/mob/living/carbon/human/mech_melee_attack(obj/mecha/M)
diff --git a/code/modules/mob/living/carbon/monkey/combat.dm b/code/modules/mob/living/carbon/monkey/combat.dm
index 59f694e0f6..30afa491c5 100644
--- a/code/modules/mob/living/carbon/monkey/combat.dm
+++ b/code/modules/mob/living/carbon/monkey/combat.dm
@@ -372,20 +372,15 @@
retaliate(M)
return ..()
+/mob/living/carbon/monkey/attack_larva(mob/living/carbon/alien/larva/L)
+ if(L.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB))
+ retaliate(user)
+ return ..()
+
/mob/living/carbon/monkey/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE)
- if(user.a_intent == INTENT_HARM)
- if(prob(MONKEY_RETALIATE_HARM_PROB))
- retaliate(user)
- . = ..(user, TRUE)
- if(.)
- return
- var/hulk_verb = pick("smash","pummel")
- playsound(loc, user.dna.species.attack_sound, 25, 1, -1)
- var/message = "[user] has [hulk_verb]ed [src]!"
- visible_message("[message]", \
- "[message]")
- adjustBruteLoss(15)
- return 1
+ if(user.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB))
+ retaliate(user)
+ return ..()
/mob/living/carbon/monkey/attack_paw(mob/living/L)
if(L.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB))
diff --git a/code/modules/mob/living/carbon/monkey/monkey_defense.dm b/code/modules/mob/living/carbon/monkey/monkey_defense.dm
index 6d2d7bcbcf..32e3d21ee2 100644
--- a/code/modules/mob/living/carbon/monkey/monkey_defense.dm
+++ b/code/modules/mob/living/carbon/monkey/monkey_defense.dm
@@ -6,25 +6,41 @@
..()
/mob/living/carbon/monkey/attack_paw(mob/living/M)
- if(..()) //successful monkey bite.
- var/dam_zone = pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
- var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone))
- if(!affecting)
- affecting = get_bodypart(BODY_ZONE_CHEST)
- if(M.limb_destroyer)
- dismembering_strike(M, affecting.body_zone)
- var/dmg = rand(1, 5)
- apply_damage(dmg, BRUTE, affecting)
+ . = ..()
+ if(!.) //unsuccessful monkey bite.
+ return
+ var/dam_zone = pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
+ var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone))
+ if(!affecting)
+ affecting = get_bodypart(BODY_ZONE_CHEST)
+ if(M.limb_destroyer)
+ dismembering_strike(M, affecting.body_zone)
+ var/dmg = rand(1, 5)
+ apply_damage(dmg, BRUTE, affecting)
/mob/living/carbon/monkey/attack_larva(mob/living/carbon/alien/larva/L)
- if(..()) //successful larva bite.
- var/damage = rand(1, 3)
- if(stat != DEAD)
- L.amount_grown = min(L.amount_grown + damage, L.max_grown)
- var/obj/item/bodypart/affecting = get_bodypart(ran_zone(L.zone_selected))
- if(!affecting)
- affecting = get_bodypart(BODY_ZONE_CHEST)
- apply_damage(damage, BRUTE, affecting)
+ . = ..()
+ if(!.) //unsuccessful larva bite
+ return
+ var/damage = rand(1, 3)
+ if(stat != DEAD)
+ L.amount_grown = min(L.amount_grown + damage, L.max_grown)
+ var/obj/item/bodypart/affecting = get_bodypart(ran_zone(L.zone_selected))
+ if(!affecting)
+ affecting = get_bodypart(BODY_ZONE_CHEST)
+ apply_damage(damage, BRUTE, affecting)
+
+/mob/living/carbon/monkey/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE)
+ . = ..(user, TRUE)
+ if(.)
+ return
+ var/hulk_verb = pick("smash","pummel")
+ playsound(loc, user.dna.species.attack_sound, 25, 1, -1)
+ var/message = "[user] has [hulk_verb]ed [src]!"
+ visible_message("[message]", \
+ "[message]")
+ adjustBruteLoss(15)
+ return TRUE
/mob/living/carbon/monkey/attack_hand(mob/living/carbon/human/M)
. = ..()
@@ -135,17 +151,19 @@
apply_damage(damage, M.melee_damage_type, affecting)
/mob/living/carbon/monkey/attack_slime(mob/living/simple_animal/slime/M)
- if(..()) //successful slime attack
- var/damage = rand(5, 35)
- if(M.is_adult)
- damage = rand(20, 40)
- var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
- if(!dam_zone) //Dismemberment successful
- return 1
- var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone))
- if(!affecting)
- affecting = get_bodypart(BODY_ZONE_CHEST)
- apply_damage(damage, BRUTE, affecting)
+ . = ..()
+ if(!.) //unsuccessful slime attack
+ return
+ var/damage = rand(5, 35)
+ if(M.is_adult)
+ damage = rand(20, 40)
+ var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
+ if(!dam_zone) //Dismemberment successful
+ return 1
+ var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone))
+ if(!affecting)
+ affecting = get_bodypart(BODY_ZONE_CHEST)
+ apply_damage(damage, BRUTE, affecting)
/mob/living/carbon/monkey/acid_act(acidpwr, acid_volume, bodyzone_hit)
. = 1
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index d4f07e531e..e95e994734 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -45,10 +45,41 @@
return TRUE
return FALSE
+/mob/living/proc/check_reflect(def_zone) //Reflection checks for anything in your hands, based on the reflection chance of the object(s)
+ for(var/obj/item/I in held_items)
+ if(I.IsReflect(def_zone))
+ return TRUE
+ return FALSE
+
+/mob/living/proc/reflect_bullet_check(obj/item/projectile/P, def_zone)
+ if(P.is_reflectable && check_reflect(def_zone)) // Checks if you've passed a reflection% check
+ visible_message("The [P.name] gets reflected by [src]!", \
+ "The [P.name] gets reflected by [src]!")
+ // Find a turf near or on the original location to bounce to
+ if(P.starting)
+ var/new_x = P.starting.x + pick(0, 0, 0, 0, 0, -1, 1, -2, 2)
+ var/new_y = P.starting.y + pick(0, 0, 0, 0, 0, -1, 1, -2, 2)
+ var/turf/curloc = get_turf(src)
+ // redirect the projectile
+ P.original = locate(new_x, new_y, P.z)
+ P.starting = curloc
+ P.firer = src
+ P.yo = new_y - curloc.y
+ P.xo = new_x - curloc.x
+ var/new_angle_s = P.Angle + rand(120,240)
+ while(new_angle_s > 180) // Translate to regular projectile degrees
+ new_angle_s -= 360
+ P.setAngle(new_angle_s)
+ return TRUE
+ return FALSE
+
/mob/living/bullet_act(obj/item/projectile/P, def_zone)
- if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration))
- P.on_hit(src, 100, def_zone)
- return 2
+ if(P.original != src || P.firer != src) //try to block or reflect the bullet, can't do so when shooting oneself
+ if(reflect_bullet_check(P, def_zone))
+ return -1 // complete projectile permutation
+ if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration))
+ P.on_hit(src, 100, def_zone)
+ return 2
var/armor = run_armor_check(def_zone, P.flag, null, null, P.armour_penetration, null)
if(!P.nodamage)
apply_damage(P.damage, P.damage_type, def_zone, armor)
@@ -279,6 +310,12 @@
to_chat(M, "You don't want to hurt anyone!")
return FALSE
+ var/damage = rand(5, 35)
+ if(M.is_adult)
+ damage = rand(20, 40)
+ if(check_shields(M, damage, "the [M.name]"))
+ return FALSE
+
if (stat != DEAD)
log_combat(M, src, "attacked")
M.do_attack_animation(src)
@@ -295,7 +332,8 @@
if(HAS_TRAIT(M, TRAIT_PACIFISM))
to_chat(M, "You don't want to hurt anyone!")
return FALSE
-
+ if(check_shields(M, rand(M.melee_damage_lower, M.melee_damage_upper), "the [M.name]", MELEE_ATTACK, M.armour_penetration))
+ return FALSE
if(M.attack_sound)
playsound(loc, M.attack_sound, 50, 1, 1)
M.do_attack_animation(src)
@@ -306,10 +344,6 @@
/mob/living/attack_paw(mob/living/carbon/monkey/M)
- if(isturf(loc) && istype(loc.loc, /area/start))
- to_chat(M, "No attacking people at spawn, you jackass.")
- return FALSE
-
if (M.a_intent == INTENT_HARM)
if(HAS_TRAIT(M, TRAIT_PACIFISM))
to_chat(M, "You don't want to hurt anyone!")
@@ -334,15 +368,16 @@
/mob/living/attack_larva(mob/living/carbon/alien/larva/L)
switch(L.a_intent)
- if("help")
+ if(INTENT_HELP)
visible_message("[L.name] rubs its head against [src].")
return FALSE
else
if(HAS_TRAIT(L, TRAIT_PACIFISM))
to_chat(L, "You don't want to hurt anyone!")
- return
-
+ return FALSE
+ if(L != src && check_shields(L, rand(1, 3), "the [L.name]"))
+ return FALSE
L.do_attack_animation(src)
if(prob(90))
log_combat(L, src, "attacked")
@@ -353,7 +388,6 @@
else
visible_message("[L.name] has attempted to bite [src]!", \
"[L.name] has attempted to bite [src]!", null, COMBAT_MESSAGE_RANGE)
- return FALSE
/mob/living/attack_alien(mob/living/carbon/alien/humanoid/M)
if((M != src) && M.a_intent != INTENT_HELP && check_shields(M, 0, "the [M.name]"))
@@ -361,7 +395,8 @@
return FALSE
switch(M.a_intent)
if (INTENT_HELP)
- visible_message("[M] caresses [src] with its scythe like arm.")
+ if(!isalien(src)) //I know it's ugly, but the alien vs alien attack_alien behaviour is a bit different.
+ visible_message("[M] caresses [src] with its scythe like arm.")
return FALSE
if (INTENT_GRAB)
grabbedby(M)
@@ -370,10 +405,12 @@
if(HAS_TRAIT(M, TRAIT_PACIFISM))
to_chat(M, "You don't want to hurt anyone!")
return FALSE
- M.do_attack_animation(src)
+ if(!isalien(src))
+ M.do_attack_animation(src)
return TRUE
if(INTENT_DISARM)
- M.do_attack_animation(src, ATTACK_EFFECT_DISARM)
+ if(!isalien(src))
+ M.do_attack_animation(src, ATTACK_EFFECT_DISARM)
return TRUE
/mob/living/ex_act(severity, target, origin)
diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm
index ddf2da2343..7e06c66eff 100644
--- a/code/modules/mob/living/silicon/robot/robot_defense.dm
+++ b/code/modules/mob/living/silicon/robot/robot_defense.dm
@@ -13,6 +13,15 @@
spark_system.start()
return ..()
+/mob/living/silicon/robot/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE)
+ . = ..()
+ if(.)
+ spark_system.start()
+ spawn(0)
+ step_away(src,user,15)
+ sleep(3)
+ step_away(src,user,15)
+
/mob/living/silicon/robot/attack_alien(mob/living/carbon/alien/humanoid/M)
. = ..()
if(!.) // the attack was blocked or was help/grab intent
@@ -35,19 +44,17 @@
playsound(loc, 'sound/weapons/pierce.ogg', 50, 1, -1)
/mob/living/silicon/robot/attack_slime(mob/living/simple_animal/slime/M)
- if(..()) //successful slime shock
- flash_act()
- var/stunprob = M.powerlevel * 7 + 10
- if(prob(stunprob) && M.powerlevel >= 8)
- adjustBruteLoss(M.powerlevel * rand(6,10))
-
- var/damage = rand(1, 3)
-
+ . = ..()
+ if(!.) //unsuccessful slime shock
+ return
+ var/stunprob = M.powerlevel * 7 + 10
+ var/damage = M.powerlevel * rand(6,10)
+ if(prob(stunprob) && M.powerlevel >= 8)
+ flash_act(affect_silicon = TRUE) //my borg eyes!
if(M.is_adult)
- damage = rand(20, 40)
+ damage += rand(10, 20)
else
- damage = rand(5, 35)
- damage = round(damage / 2) // borgs receive half damage
+ damage += rand(2, 17)
adjustBruteLoss(damage)
updatehealth()
diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm
index 80a5058ed4..ca8ad25713 100644
--- a/code/modules/mob/living/silicon/silicon_defense.dm
+++ b/code/modules/mob/living/silicon/silicon_defense.dm
@@ -52,10 +52,6 @@
/mob/living/silicon/attack_paw(mob/living/user)
return attack_hand(user)
-/mob/living/silicon/attack_larva(mob/living/carbon/alien/larva/L)
- if(L.a_intent == INTENT_HELP)
- visible_message("[L.name] rubs its head against [src].")
-
/mob/living/silicon/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE)
if(user.a_intent == INTENT_HARM)
. = ..(user, TRUE)
@@ -65,8 +61,8 @@
playsound(loc, "punch", 25, 1, -1)
visible_message("[user] has punched [src]!", \
"[user] has punched [src]!")
- return 1
- return 0
+ return TRUE
+ return FALSE
/mob/living/silicon/attack_hand(mob/living/carbon/human/M)
. = ..()
@@ -115,9 +111,12 @@
flash_act(affect_silicon = 1)
/mob/living/silicon/bullet_act(obj/item/projectile/P, def_zone)
- if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration))
- P.on_hit(src, 100, def_zone)
- return 2
+ if(P.original != src || P.firer != src) //try to block or reflect the bullet, can't do so when shooting oneself
+ if(reflect_bullet_check(P, def_zone))
+ return -1 // complete projectile permutation
+ if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration))
+ P.on_hit(src, 100, def_zone)
+ return 2
if((P.damage_type == BRUTE || P.damage_type == BURN))
adjustBruteLoss(P.damage)
if(prob(P.damage*1.5))
diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm
index 4542f140d4..0dfa126e79 100644
--- a/code/modules/mob/living/simple_animal/animal_defense.dm
+++ b/code/modules/mob/living/simple_animal/animal_defense.dm
@@ -41,7 +41,8 @@
return TRUE
/mob/living/simple_animal/attack_paw(mob/living/carbon/monkey/M)
- if(..()) //successful monkey bite.
+ . = ..()
+ if(.) //successful larva bite
var/damage = rand(1, 3)
attack_threshold_check(damage)
return 1
@@ -50,7 +51,6 @@
visible_message("[M.name] [response_help] [src].")
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
-
/mob/living/simple_animal/attack_alien(mob/living/carbon/alien/humanoid/M)
. = ..()
if(!.) // the attack was blocked or was help/grab intent
@@ -83,7 +83,8 @@
return attack_threshold_check(damage, M.melee_damage_type)
/mob/living/simple_animal/attack_slime(mob/living/simple_animal/slime/M)
- if(..()) //successful slime attack
+ . = ..()
+ if(.) //successful slime shock
var/damage = rand(15, 25)
if(M.is_adult)
damage = rand(20, 35)
diff --git a/code/modules/mob/living/simple_animal/guardian/types/charger.dm b/code/modules/mob/living/simple_animal/guardian/types/charger.dm
index 3ece5d4e27..3719861d63 100644
--- a/code/modules/mob/living/simple_animal/guardian/types/charger.dm
+++ b/code/modules/mob/living/simple_animal/guardian/types/charger.dm
@@ -54,10 +54,8 @@
var/blocked = FALSE
if(hasmatchingsummoner(A)) //if the summoner matches don't hurt them
blocked = TRUE
- if(ishuman(A))
- var/mob/living/carbon/human/H = A
- if(H.check_shields(src, 90, "[name]", attack_type = THROWN_PROJECTILE_ATTACK))
- blocked = TRUE
+ if(L.check_shields(src, 90, "[name]", attack_type = THROWN_PROJECTILE_ATTACK))
+ blocked = TRUE
if(!blocked)
L.drop_all_held_items()
L.visible_message("[src] slams into [L]!", "[src] slams into you!")
diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm
index 4deb62aac2..affb476534 100644
--- a/code/modules/mob/living/simple_animal/slime/slime.dm
+++ b/code/modules/mob/living/simple_animal/slime/slime.dm
@@ -252,33 +252,34 @@
return
/mob/living/simple_animal/slime/attack_slime(mob/living/simple_animal/slime/M)
- if(..()) //successful slime attack
- if(M == src)
- return
- if(buckled)
- Feedstop(silent = TRUE)
- visible_message("[M] pulls [src] off!")
- return
- attacked += 5
- if(nutrition >= 100) //steal some nutrition. negval handled in life()
- nutrition -= (50 + (40 * M.is_adult))
- M.add_nutrition(50 + (40 * M.is_adult))
- if(health > 0)
- M.adjustBruteLoss(-10 + (-10 * M.is_adult))
- M.updatehealth()
+ . = ..()
+ if(!. || M == src) //unsuccessful slime shock
+ return
+ if(buckled)
+ Feedstop(silent = TRUE)
+ visible_message("[M] pulls [src] off!")
+ return
+ attacked += 5
+ if(nutrition >= 100) //steal some nutrition. negval handled in life()
+ nutrition -= (50 + (40 * M.is_adult))
+ M.add_nutrition(50 + (40 * M.is_adult))
+ if(health > 0)
+ M.adjustBruteLoss(-10 + (-10 * M.is_adult))
+ M.updatehealth()
/mob/living/simple_animal/slime/attack_animal(mob/living/simple_animal/M)
. = ..()
if(.)
attacked += 10
-
/mob/living/simple_animal/slime/attack_paw(mob/living/carbon/monkey/M)
- if(..()) //successful monkey bite.
+ . = ..()
+ if(.)//successful monkey bite.
attacked += 10
/mob/living/simple_animal/slime/attack_larva(mob/living/carbon/alien/larva/L)
- if(..()) //successful larva bite.
+ . = ..()
+ if(.) //successful larva bite.
attacked += 10
/mob/living/simple_animal/slime/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0)
diff --git a/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm b/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm
index 99ba9ad3e2..6f73d5ae84 100644
--- a/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm
+++ b/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm
@@ -400,12 +400,7 @@ SLEEPER CODE IS IN game/objects/items/devices/dogborg_sleeper.dm !
if(A)
if(isliving(A))
var/mob/living/L = A
- var/blocked = 0
- if(ishuman(A))
- var/mob/living/carbon/human/H = A
- if(H.check_shields(0, "the [name]", src, attack_type = LEAP_ATTACK))
- blocked = 1
- if(!blocked)
+ if(!L.check_shields(0, "the [name]", src, attack_type = LEAP_ATTACK))
L.visible_message("[src] pounces on [L]!", "[src] pounces on you!")
L.Knockdown(iscarbon(L) ? 60 : 45, override_stamdmg = CLAMP(pounce_stamloss, 0, pounce_stamloss_cap-L.getStaminaLoss())) // Temporary. If someone could rework how dogborg pounces work to accomodate for combat changes, that'd be nice.
playsound(src, 'sound/weapons/Egloves.ogg', 50, 1)