Merge pull request #16579 from FlattestGuitar/armor-defines

Adds defines for damage flags
This commit is contained in:
variableundefined
2021-09-17 22:10:20 -05:00
committed by GitHub
181 changed files with 458 additions and 450 deletions
@@ -82,7 +82,7 @@
L.visible_message("<span class ='danger'>[src] pounces on [L]!</span>", "<span class ='userdanger'>[src] pounces on you!</span>")
if(ishuman(L))
var/mob/living/carbon/human/H = L
H.apply_effect(5, WEAKEN, H.run_armor_check(null, "melee"))
H.apply_effect(5, WEAKEN, H.run_armor_check(null, MELEE))
else
L.Weaken(5)
sleep(2)//Runtime prevention (infinite bump() calls on hulks)
@@ -222,7 +222,7 @@
var/brute_loss = 0
var/burn_loss = 0
var/bomb_armor = getarmor(null, "bomb")
var/bomb_armor = getarmor(null, BOMB)
var/list/valid_limbs = list("l_arm", "l_leg", "r_arm", "r_leg")
var/limbs_amount = 1
var/limb_loss_chance = 50
@@ -264,7 +264,7 @@
var/obj/item/organ/external/BP = get_organ(X)
if(!BP) //limb already blown off, move to the next one without counting it
continue
if(prob(limb_loss_chance) && !prob(getarmor(BP, "bomb")))
if(prob(limb_loss_chance) && !prob(getarmor(BP, BOMB)))
BP.droplimb(TRUE, DROPLIMB_SHARP, FALSE, TRUE)
limbs_amount--
if(!limbs_amount)
@@ -280,7 +280,7 @@
show_message("<span class='userdanger'>The blob attacks you!</span>")
var/dam_zone = pick("head", "chest", "groin", "l_arm", "l_hand", "r_arm", "r_hand", "l_leg", "l_foot", "r_leg", "r_foot")
var/obj/item/organ/external/affecting = get_organ(ran_zone(dam_zone))
apply_damage(5, BRUTE, affecting, run_armor_check(affecting, "melee"))
apply_damage(5, BRUTE, affecting, run_armor_check(affecting, MELEE))
/mob/living/carbon/human/get_restraining_item()
. = ..()
@@ -445,9 +445,9 @@ emp_act
if(!I.force)
return 0 //item force is zero
var/armor = run_armor_check(affecting, "melee", "<span class='warning'>Your armour has protected your [hit_area].</span>", "<span class='warning'>Your armour has softened hit to your [hit_area].</span>", armour_penetration = I.armour_penetration)
var/armor = run_armor_check(affecting, MELEE, "<span class='warning'>Your armour has protected your [hit_area].</span>", "<span class='warning'>Your armour has softened hit to your [hit_area].</span>", armour_penetration = I.armour_penetration)
var/weapon_sharp = is_sharp(I)
if(weapon_sharp && prob(getarmor(user.zone_selected, "melee")))
if(weapon_sharp && prob(getarmor(user.zone_selected, MELEE)))
weapon_sharp = 0
if(armor >= 100)
return 0
@@ -591,7 +591,7 @@ emp_act
if(stat != DEAD)
L.amount_grown = min(L.amount_grown + damage, L.max_grown)
var/obj/item/organ/external/affecting = get_organ(ran_zone(L.zone_selected))
var/armor_block = run_armor_check(affecting, "melee")
var/armor_block = run_armor_check(affecting, MELEE)
apply_damage(damage, BRUTE, affecting, armor_block)
updatehealth("larva attack")
@@ -610,7 +610,7 @@ emp_act
visible_message("<span class='danger'>[M] has lunged at [src]!</span>")
return 0
var/obj/item/organ/external/affecting = get_organ(ran_zone(M.zone_selected))
var/armor_block = run_armor_check(affecting, "melee", armour_penetration = 10)
var/armor_block = run_armor_check(affecting, MELEE, armour_penetration = 10)
playsound(loc, 'sound/weapons/slice.ogg', 25, TRUE, -1)
visible_message("<span class='danger'>[M] has slashed at [src]!</span>", \
@@ -629,7 +629,7 @@ emp_act
else
var/obj/item/organ/external/affecting = get_organ(ran_zone(M.zone_selected))
playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1)
apply_effect(5, WEAKEN, run_armor_check(affecting, "melee"))
apply_effect(5, WEAKEN, run_armor_check(affecting, MELEE))
add_attack_logs(M, src, "Alien tackled")
visible_message("<span class='danger'>[M] has tackled down [src]!</span>")
@@ -644,7 +644,7 @@ emp_act
if(!affecting)
affecting = get_organ("chest")
affecting.add_autopsy_data(M.name, damage) // Add the mob's name to the autopsy data
var/armor = run_armor_check(affecting, "melee", armour_penetration = M.armour_penetration)
var/armor = run_armor_check(affecting, MELEE, armour_penetration = M.armour_penetration)
apply_damage(damage, M.melee_damage_type, affecting, armor)
updatehealth("animal attack")
@@ -662,7 +662,7 @@ emp_act
var/obj/item/organ/external/affecting = get_organ(ran_zone(dam_zone))
if(!affecting)
affecting = get_organ("chest")
var/armor_block = run_armor_check(affecting, "melee")
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)
@@ -480,7 +480,7 @@
var/obj/item/organ/external/affecting = target.get_organ(ran_zone(user.zone_selected))
var/armor_block = target.run_armor_check(affecting, "melee")
var/armor_block = target.run_armor_check(affecting, MELEE)
playsound(target.loc, attack.attack_sound, 25, 1, -1)
@@ -509,7 +509,7 @@
var/obj/item/organ/external/affecting = target.get_organ(ran_zone(user.zone_selected))
var/randn = rand(1, 100)
if(randn <= 25)
target.apply_effect(2, WEAKEN, target.run_armor_check(affecting, "melee"))
target.apply_effect(2, WEAKEN, target.run_armor_check(affecting, MELEE))
playsound(target.loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
target.visible_message("<span class='danger'>[user] has pushed [target]!</span>")
add_attack_logs(user, target, "Pushed over", ATKLOG_ALL)
@@ -390,7 +390,7 @@
/datum/species/golem/sand/bullet_act(obj/item/projectile/P, mob/living/carbon/human/H)
if(!(P.original == H && P.firer == H))
if(P.flag == "bullet" || P.flag == "bomb")
if(P.flag == BULLET || P.flag == BOMB)
playsound(H, 'sound/effects/shovel_dig.ogg', 70, 1)
H.visible_message("<span class='danger'>[P] sinks harmlessly in [H]'s sandy body!</span>", \
"<span class='userdanger'>[P] sinks harmlessly in [H]'s sandy body!</span>")
+1 -1
View File
@@ -992,7 +992,7 @@
amount -= RAD_BACKGROUND_RADIATION // This will always be at least 1 because of how skin protection is calculated
var/blocked = getarmor(null, "rad")
var/blocked = getarmor(null, RAD)
if(amount > RAD_BURN_THRESHOLD)
apply_damage(RAD_BURN_CURVE(amount), BURN, null, blocked)
+2 -2
View File
@@ -10,7 +10,7 @@
1 - halfblock
2 - fullblock
*/
/mob/living/proc/run_armor_check(def_zone = null, attack_flag = "melee", absorb_text = null, soften_text = null, armour_penetration, penetrated_text)
/mob/living/proc/run_armor_check(def_zone = null, attack_flag = MELEE, absorb_text = null, soften_text = null, armour_penetration, penetrated_text)
var/armor = getarmor(def_zone, attack_flag)
//the if "armor" check is because this is used for everything on /living, including humans
@@ -118,7 +118,7 @@
visible_message("<span class='danger'>[src] is hit by [thrown_item]!</span>", "<span class='userdanger'>You're hit by [thrown_item]!</span>")
if(!thrown_item.throwforce)
return
var/armor = run_armor_check(zone, "melee", "Your armor has protected your [parse_zone(zone)].", "Your armor has softened hit to your [parse_zone(zone)].", thrown_item.armour_penetration)
var/armor = run_armor_check(zone, MELEE, "Your armor has protected your [parse_zone(zone)].", "Your armor has softened hit to your [parse_zone(zone)].", thrown_item.armour_penetration)
apply_damage(thrown_item.throwforce, thrown_item.damtype, zone, armor, is_sharp(thrown_item), thrown_item)
if(QDELETED(src)) //Damage can delete the mob.
return
@@ -76,7 +76,7 @@
damage = rand(20, 35)
return attack_threshold_check(damage)
/mob/living/simple_animal/proc/attack_threshold_check(damage, damagetype = BRUTE, armorcheck = "melee")
/mob/living/simple_animal/proc/attack_threshold_check(damage, damagetype = BRUTE, armorcheck = MELEE)
var/temp_damage = damage
if(!damage_coeff[damagetype])
temp_damage = 0
@@ -101,7 +101,7 @@
if(origin && istype(origin, /datum/spacevine_mutation) && isvineimmune(src))
return
..()
var/bomb_armor = getarmor(null, "bomb")
var/bomb_armor = getarmor(null, BOMB)
switch(severity)
if(1)
if(prob(bomb_armor))
@@ -695,12 +695,12 @@
playsound(loc, 'sound/effects/splat.ogg', 50, 1)
var/damage = rand(5,15)
H.apply_damage(2*damage, BRUTE, "head", run_armor_check("head", "melee"))
H.apply_damage(2*damage, BRUTE, "chest", run_armor_check("chest", "melee"))
H.apply_damage(0.5*damage, BRUTE, "l_leg", run_armor_check("l_leg", "melee"))
H.apply_damage(0.5*damage, BRUTE, "r_leg", run_armor_check("r_leg", "melee"))
H.apply_damage(0.5*damage, BRUTE, "l_arm", run_armor_check("l_arm", "melee"))
H.apply_damage(0.5*damage, BRUTE, "r_arm", run_armor_check("r_arm", "melee"))
H.apply_damage(2*damage, BRUTE, "head", run_armor_check("head", MELEE))
H.apply_damage(2*damage, BRUTE, "chest", run_armor_check("chest", MELEE))
H.apply_damage(0.5*damage, BRUTE, "l_leg", run_armor_check("l_leg", MELEE))
H.apply_damage(0.5*damage, BRUTE, "r_leg", run_armor_check("r_leg", MELEE))
H.apply_damage(0.5*damage, BRUTE, "l_arm", run_armor_check("l_arm", MELEE))
H.apply_damage(0.5*damage, BRUTE, "r_arm", run_armor_check("r_arm", MELEE))
@@ -253,7 +253,7 @@ Difficulty: Hard
to_chat(L, "<span class='userdanger'>[src] rends you!</span>")
playsound(T, attack_sound, 100, TRUE, -1)
var/limb_to_hit = L.get_organ(pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG))
L.apply_damage(10, BRUTE, limb_to_hit, L.run_armor_check(limb_to_hit, "melee", null, null, armour_penetration))
L.apply_damage(10, BRUTE, limb_to_hit, L.run_armor_check(limb_to_hit, MELEE, null, null, armour_penetration))
SLEEP_CHECK_DEATH(3)
/mob/living/simple_animal/hostile/megafauna/bubblegum/proc/bloodgrab(turf/T, handedness)
@@ -288,7 +288,7 @@ Difficulty: Medium
if(M in hit_list)
continue
hit_list += M
M.take_damage(45, BRUTE, "melee", 1)
M.take_damage(45, BRUTE, MELEE, 1)
sleep(1.5)
/mob/living/simple_animal/hostile/megafauna/dragon/proc/swoop_attack(lava_arena = FALSE, atom/movable/manual_target, swoop_cooldown = 30)
@@ -372,7 +372,7 @@ Difficulty: Medium
L.throw_at(throwtarget, 3)
visible_message("<span class='warning'>[L] is thrown clear of [src]!</span>")
for(var/obj/mecha/M in orange(1, src))
M.take_damage(75, BRUTE, "melee", 1)
M.take_damage(75, BRUTE, MELEE, 1)
for(var/mob/M in range(7, src))
shake_camera(M, 15, 1)
@@ -447,7 +447,7 @@ Difficulty: Medium
// deals damage to mechs
for(var/obj/mecha/M in T.contents)
M.take_damage(45, BRUTE, "melee", 1)
M.take_damage(45, BRUTE, MELEE, 1)
// changes turf to lava temporarily
if(!T.density && !istype(T, /turf/simulated/floor/plating/lava))
@@ -674,7 +674,7 @@ Difficulty: Hard
playsound(L,'sound/weapons/sear.ogg', 50, TRUE, -4)
to_chat(L, "<span class='userdanger'>You're struck by a [name]!</span>")
var/limb_to_hit = L.get_organ(pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG))
var/armor = L.run_armor_check(limb_to_hit, "melee", "Your armor absorbs [src]!", "Your armor blocks part of [src]!", 50, "Your armor was penetrated by [src]!")
var/armor = L.run_armor_check(limb_to_hit, MELEE, "Your armor absorbs [src]!", "Your armor blocks part of [src]!", 50, "Your armor was penetrated by [src]!")
L.apply_damage(damage, BURN, limb_to_hit, armor)
if(ishostile(L))
var/mob/living/simple_animal/hostile/H = L //mobs find and damage you...
@@ -41,7 +41,7 @@
damage = 0
damage_type = BURN
nodamage = TRUE
flag = "energy"
flag = ENERGY
temperature = 50
/mob/living/simple_animal/hostile/asteroid/basilisk/GiveTarget(new_target)
@@ -30,7 +30,7 @@
else
// Target prioritization by spider type. BRUTE spiders prioritize lower armor values, POISON spiders prioritize poisonable targets
if(ai_target_method == TS_DAMAGE_BRUTE)
var/theirarmor = C.getarmor(type = "melee")
var/theirarmor = C.getarmor(type = MELEE)
// Example values: Civilian: 2, Engineer w/ Hardsuit: 10, Sec Officer with armor: 19, HoS: 48, Deathsquad: 80
if(theirarmor < 10)
targets1 += C
@@ -491,7 +491,7 @@
var/mob/living/carbon/human/H = parrot_interest
var/obj/item/organ/external/affecting = H.get_organ(ran_zone(pick(parrot_dam_zone)))
H.apply_damage(damage, BRUTE, affecting, H.run_armor_check(affecting, "melee"), sharp = TRUE)
H.apply_damage(damage, BRUTE, affecting, H.run_armor_check(affecting, MELEE), sharp = TRUE)
custom_emote(EMOTE_VISUAL, pick("pecks [H]'s [affecting].", "cuts [H]'s [affecting] with its talons."))
else
L.adjustBruteLoss(damage)
+1 -1
View File
@@ -342,7 +342,7 @@
var/obj/item/clothing/hat = attacker.head
if(istype(hat))
damage += hat.force * 3
affecting.apply_damage(damage*rand(90, 110)/100, BRUTE, "head", affected.run_armor_check(affecting, "melee"))
affecting.apply_damage(damage*rand(90, 110)/100, BRUTE, "head", affected.run_armor_check(affecting, MELEE))
playsound(assailant.loc, "swing_hit", 25, 1, -1)
add_attack_logs(assailant, affecting, "Headbutted")
return