mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 15:17:01 +01:00
Cleans up some code in _harm(). Makes sure stagger combos are happening at the right health thresholds. (#89565)
This commit is contained in:
@@ -183,6 +183,8 @@ GLOBAL_LIST_INIT(shove_disarming_types, typecacheof(list(
|
||||
//The define for base unarmed miss chance
|
||||
#define UNARMED_MISS_CHANCE_BASE 20
|
||||
#define UNARMED_MISS_CHANCE_MAX 80
|
||||
//Minimum value used to determine if a punched target can be affected by a stagger combo from a punch
|
||||
#define UNARMED_COMBO_HIT_HEALTH_BASE 40
|
||||
|
||||
//Combat object defines
|
||||
/// The minimum value of an item's throw_speed for it to embed (Unless it has embedded_ignore_throwspeed_threshold set to 1)
|
||||
|
||||
@@ -886,37 +886,38 @@ GLOBAL_LIST_EMPTY(features_by_species)
|
||||
user.do_attack_animation(target, atk_effect)
|
||||
|
||||
//has our target been shoved recently? If so, they're staggered and we get an easy hit.
|
||||
var/staggered = FALSE
|
||||
var/staggered = target.has_status_effect(/datum/status_effect/staggered)
|
||||
|
||||
//Someone in a grapple is much more vulnerable to being harmed by punches.
|
||||
var/grappled = FALSE
|
||||
|
||||
if(target.get_timed_status_effect_duration(/datum/status_effect/staggered))
|
||||
staggered = TRUE
|
||||
|
||||
if(target.pulledby && target.pulledby.grab_state >= GRAB_AGGRESSIVE)
|
||||
grappled = TRUE
|
||||
var/grappled = (target.pulledby && target.pulledby.grab_state >= GRAB_AGGRESSIVE)
|
||||
|
||||
var/damage = rand(attacking_bodypart.unarmed_damage_low, attacking_bodypart.unarmed_damage_high)
|
||||
var/limb_accuracy = attacking_bodypart.unarmed_effectiveness
|
||||
|
||||
//Get our puncher's combined brute and burn damage.
|
||||
var/puncher_brute_and_burn = (user.getFireLoss() + user.getBruteLoss())
|
||||
|
||||
//Get our targets combined brute and burn damage.
|
||||
var/target_brute_and_burn = (target.getFireLoss() + target.getBruteLoss())
|
||||
|
||||
// In a brawl, drunkenness can make you swing more wildly and with more force, and thus catch your opponent off guard, but it could also totally throw you off if you're too intoxicated
|
||||
// But god is it going to make you sick moving too much while drunk
|
||||
var/user_drunkenness = user.get_drunk_amount()
|
||||
|
||||
if(user_drunkenness && HAS_TRAIT(user, TRAIT_DRUNKEN_BRAWLER)) // Drunken brawlers only need to be intoxicated, doesn't matter how much
|
||||
limb_accuracy += clamp((user.getFireLoss() + user.getBruteLoss()) * 0.5, 10, 200)
|
||||
damage += damage * clamp((user.getFireLoss() + user.getBruteLoss()) / 100, 0.3, 2) //Basically a multiplier of how much extra damage you get based on how low your health is overall. A floor of about a 30%.
|
||||
var/drunken_martial_descriptor = pick("Drunken", "Intoxicated", "Tipsy", "Inebriated", "Delirious", "Day-Drinker's", "Firegut", "Blackout")
|
||||
atk_verb = "[drunken_martial_descriptor] [atk_verb]"
|
||||
if(user_drunkenness)
|
||||
if(HAS_TRAIT(user, TRAIT_DRUNKEN_BRAWLER)) // Drunken brawlers only need to be intoxicated, doesn't matter how much
|
||||
limb_accuracy += clamp(puncher_brute_and_burn / 2, 10, 200)
|
||||
damage += damage * clamp(puncher_brute_and_burn / 100, 0.3, 2) //Basically a multiplier of how much extra damage you get based on how low your health is overall. A floor of about a 30%.
|
||||
var/drunken_martial_descriptor = pick("Drunken", "Intoxicated", "Tipsy", "Inebriated", "Delirious", "Day-Drinker's", "Firegut", "Blackout")
|
||||
atk_verb = "[drunken_martial_descriptor] [atk_verb]"
|
||||
|
||||
else if(user_drunkenness > 30 && user_drunkenness < 60)
|
||||
limb_accuracy *= 1.2
|
||||
user.adjust_disgust(2)
|
||||
else if(user_drunkenness >= 60)
|
||||
limb_accuracy = -limb_accuracy // good luck landing a punch now, you drunk fuck
|
||||
user.adjust_disgust(5)
|
||||
|
||||
else if(user_drunkenness >= 60)
|
||||
limb_accuracy = -limb_accuracy // good luck landing a punch now, you drunk fuck
|
||||
user.adjust_disgust(5)
|
||||
else if(user_drunkenness >= 30)
|
||||
limb_accuracy *= 1.2
|
||||
user.adjust_disgust(2)
|
||||
|
||||
var/obj/item/bodypart/affecting = target.get_bodypart(target.get_random_valid_zone(user.zone_selected))
|
||||
|
||||
@@ -925,7 +926,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
|
||||
if((target.body_position == LYING_DOWN) || HAS_TRAIT(user, TRAIT_PERFECT_ATTACKER) || staggered || user_drunkenness && HAS_TRAIT(user, TRAIT_DRUNKEN_BRAWLER)) //kicks and attacks against staggered targets never miss (provided your species deals more than 0 damage). Drunken brawlers while drunk also don't miss
|
||||
miss_chance = 0
|
||||
else
|
||||
miss_chance = clamp(UNARMED_MISS_CHANCE_BASE - limb_accuracy + (user.getFireLoss()*0.5 + user.getBruteLoss()*0.5), 0, UNARMED_MISS_CHANCE_MAX) //Limb miss chance + various damage. capped at 80 so there is at least a chance to land a hit.
|
||||
miss_chance = clamp(UNARMED_MISS_CHANCE_BASE - limb_accuracy + (puncher_brute_and_burn / 2), 0, UNARMED_MISS_CHANCE_MAX) //Limb miss chance + various damage. capped at 80 so there is at least a chance to land a hit.
|
||||
|
||||
if(!damage || !affecting || prob(miss_chance))//future-proofing for species that have 0 damage/weird cases where no zone is targeted
|
||||
playsound(target.loc, attacking_bodypart.unarmed_miss_sound, 25, TRUE, -1)
|
||||
@@ -940,16 +941,18 @@ GLOBAL_LIST_EMPTY(features_by_species)
|
||||
// In a brawl, drunkenness is a boon if you're a bit drunk but not too much. Else you're easier to hit.
|
||||
// But, generally, getting hit while drunk is probably a good way to start throwing up
|
||||
var/target_drunkenness = target.get_drunk_amount()
|
||||
if(target_drunkenness && HAS_TRAIT(target, TRAIT_DRUNKEN_BRAWLER)) // Drunken brawlers only need to be intoxicated, doesn't matter how much
|
||||
armor_block += 20
|
||||
|
||||
else if(target_drunkenness > 30 && target_drunkenness < 60)
|
||||
armor_block += 10
|
||||
target.adjust_disgust(2)
|
||||
if(target_drunkenness)
|
||||
if(HAS_TRAIT(target, TRAIT_DRUNKEN_BRAWLER)) // Drunken brawlers only need to be intoxicated, doesn't matter how much
|
||||
armor_block += 20
|
||||
|
||||
else if(target_drunkenness >= 60)
|
||||
armor_block *= 0.5
|
||||
target.adjust_disgust(5)
|
||||
else if(target_drunkenness >= 60)
|
||||
armor_block *= 0.5
|
||||
target.adjust_disgust(5)
|
||||
|
||||
else if(target_drunkenness >= 30)
|
||||
armor_block += 10
|
||||
target.adjust_disgust(2)
|
||||
|
||||
playsound(target.loc, attacking_bodypart.unarmed_attack_sound, 25, TRUE, -1)
|
||||
|
||||
@@ -985,8 +988,9 @@ GLOBAL_LIST_EMPTY(features_by_species)
|
||||
if(HAS_TRAIT(target, TRAIT_BRAWLING_KNOCKDOWN_BLOCKED) || target.stat == DEAD) //If our target is dead or has specailized armor, there is no way to inflict these effects.
|
||||
return
|
||||
|
||||
// If our target is staggered, the target's armor, minus our limb effectiveness sets the minimum necessary amount of damage sustained to cause an effect. Minimum 40, max 200 for sanity reasons
|
||||
if(staggered && (target.getFireLoss()*0.5 + target.getBruteLoss()*0.5) >= min(armor_block - limb_accuracy, 40, 200))
|
||||
// If our target is staggered, the target's armor, minus our limb effectiveness sets the minimum necessary amount of damage sustained to cause an effect. We clamp the value for sanity reasons.
|
||||
var/effective_armor = max(armor_block, UNARMED_COMBO_HIT_HEALTH_BASE) - limb_accuracy
|
||||
if(staggered && target_brute_and_burn >= clamp(effective_armor, 0, 200))
|
||||
stagger_combo(user, target, atk_verb, limb_accuracy, armor_block)
|
||||
|
||||
/// Handles the stagger combo effect of our punch. Follows the same logic as the above proc, target is our owner, user is our attacker.
|
||||
|
||||
Reference in New Issue
Block a user