From 0a36f9fbb57c12a4c861f80f1bea2377f9c6dae7 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Tue, 4 Aug 2020 22:40:28 -0700 Subject: [PATCH] changes --- code/__DEFINES/_flags/item_flags.dm | 6 +-- code/__DEFINES/combat.dm | 30 ------------- code/__DEFINES/combat/stamina_combat.dm | 37 +++++++++++++++ code/__DEFINES/skills/defines.dm | 1 - code/_onclick/item_attack.dm | 45 +++++++------------ code/game/objects/items.dm | 4 +- code/game/objects/items/powerfist.dm | 2 +- code/game/objects/items/tools/screwdriver.dm | 2 +- code/modules/mob/living/carbon/carbon.dm | 2 +- .../mob/living/carbon/human/species.dm | 5 ++- code/modules/mob/living/carbon/life.dm | 6 --- code/modules/projectiles/gun.dm | 4 ++ tgstation.dme | 2 - 13 files changed, 66 insertions(+), 80 deletions(-) diff --git a/code/__DEFINES/_flags/item_flags.dm b/code/__DEFINES/_flags/item_flags.dm index 26e764c45b..7da71e22cb 100644 --- a/code/__DEFINES/_flags/item_flags.dm +++ b/code/__DEFINES/_flags/item_flags.dm @@ -22,12 +22,10 @@ #define SURGICAL_TOOL (1<<10) ///Can be worn on certain slots (currently belt and id) that would otherwise require an uniform. #define NO_UNIFORM_REQUIRED (1<<11) -///Damage when attacking people is not affected by combat mode. -#define NO_COMBAT_MODE_FORCE_MODIFIER (1<<12) /// This item can be used to parry. Only a basic check used to determine if we should proceed with parry chain at all. -#define ITEM_CAN_PARRY (1<<13) +#define ITEM_CAN_PARRY (1<<12) /// This item can be used in the directional blocking system. Only a basic check used to determine if we should proceed with directional block handling at all. -#define ITEM_CAN_BLOCK (1<<14) +#define ITEM_CAN_BLOCK (1<<13) // Flags for the clothing_flags var on /obj/item/clothing diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm index b73f95f975..0679c7a3fc 100644 --- a/code/__DEFINES/combat.dm +++ b/code/__DEFINES/combat.dm @@ -243,36 +243,6 @@ GLOBAL_LIST_INIT(shove_disarming_types, typecacheof(list( //We will round to this value in damage calculations. #define DAMAGE_PRECISION 0.01 -//items total mass, used to calculate their attacks' stamina costs. If not defined, the cost will be (w_class * 1.25) -#define TOTAL_MASS_TINY_ITEM 1.25 -#define TOTAL_MASS_SMALL_ITEM 2.5 -#define TOTAL_MASS_NORMAL_ITEM 3.75 -#define TOTAL_MASS_BULKY_ITEM 5 -#define TOTAL_MASS_HUGE_ITEM 6.25 -#define TOTAL_MASS_GIGANTIC_ITEM 7.5 - -#define TOTAL_MASS_HAND_REPLACEMENT 5 //standard punching stamina cost. most hand replacements are huge items anyway. -#define TOTAL_MASS_MEDIEVAL_WEAPON 3.6 //very, very generic average sword/warpick/etc. weight in pounds. -#define TOTAL_MASS_TOY_SWORD 1.5 - -//stamina cost defines. -#define STAM_COST_ATTACK_OBJ_MULT 1.2 -#define STAM_COST_ATTACK_MOB_MULT 1 -#define STAM_COST_BATON_MOB_MULT 1 -#define STAM_COST_NO_COMBAT_MULT 1.25 -#define STAM_COST_W_CLASS_MULT 1.25 -#define STAM_COST_THROW_MULT 2 -#define STAM_COST_THROW_MOB 2.5 //multiplied by (mob size + 1)^2. - -///Multiplier of the (STAMINA_NEAR_CRIT - user current stamina loss) : (STAMINA_NEAR_CRIT - STAMINA_SOFTCRIT) ratio used in damage penalties when stam soft-critted. -#define STAM_CRIT_ITEM_ATTACK_PENALTY 0.66 -/// changeNext_move penalty multiplier of the above. -#define STAM_CRIT_ITEM_ATTACK_DELAY 1.75 -/// Damage penalty when fighting prone. -#define LYING_DAMAGE_PENALTY 0.7 -/// Added delay when firing guns stam-softcritted. Summed with a hardset CLICK_CD_RANGE delay, similar to STAM_CRIT_DAMAGE_DELAY otherwise. -#define STAM_CRIT_GUN_DELAY 2.75 - //stamina recovery defines. Blocked if combat mode is on. #define STAM_RECOVERY_STAM_CRIT -7.5 #define STAM_RECOVERY_RESTING -6 diff --git a/code/__DEFINES/combat/stamina_combat.dm b/code/__DEFINES/combat/stamina_combat.dm index 7d1e9d75c0..09dbc7253b 100644 --- a/code/__DEFINES/combat/stamina_combat.dm +++ b/code/__DEFINES/combat/stamina_combat.dm @@ -8,5 +8,42 @@ +// Standard amounts for stamina usage +// Multipliers +/// Base stamina cost for an item of a certain w_class without total_mass set. +#define STAM_COST_W_CLASS_MULT 1.25 +// Flat amounts +/// Usage for eyestabbing with a screwdriver +#define STAMINA_COST_ITEM_EYESTAB 7.5 +/// Usage for shoving yourself off the ground instantly +#define STAMINA_COST_SHOVE_UP 10 + +//items total mass, used to calculate their attacks' stamina costs. If not defined, the cost will be (w_class * 1.25) +#define TOTAL_MASS_TINY_ITEM 1.25 +#define TOTAL_MASS_SMALL_ITEM 2.5 +#define TOTAL_MASS_NORMAL_ITEM 3.75 +#define TOTAL_MASS_BULKY_ITEM 5 +#define TOTAL_MASS_HUGE_ITEM 6.25 +#define TOTAL_MASS_GIGANTIC_ITEM 7.5 + +#define TOTAL_MASS_HAND_REPLACEMENT 5 //standard punching stamina cost. most hand replacements are huge items anyway. +#define TOTAL_MASS_MEDIEVAL_WEAPON 3.6 //very, very generic average sword/warpick/etc. weight in pounds. +#define TOTAL_MASS_TOY_SWORD 1.5 + +//stamina cost defines. +#define STAM_COST_ATTACK_OBJ_MULT 1.2 +#define STAM_COST_ATTACK_MOB_MULT 1 +#define STAM_COST_BATON_MOB_MULT 1 +#define STAM_COST_THROW_MULT 2 +#define STAM_COST_THROW_MOB 2.5 //multiplied by (mob size + 1)^2. + +///Multiplier of the (STAMINA_NEAR_CRIT - user current stamina loss) : (STAMINA_NEAR_CRIT - STAMINA_SOFTCRIT) ratio used in damage penalties when stam soft-critted. +#define STAM_CRIT_ITEM_ATTACK_PENALTY 0.66 +/// changeNext_move penalty multiplier of the above. +#define STAM_CRIT_ITEM_ATTACK_DELAY 1.75 +/// Damage penalty when fighting prone. +#define LYING_DAMAGE_PENALTY 0.7 +/// Added delay when firing guns stam-softcritted. Summed with a hardset CLICK_CD_RANGE delay, similar to STAM_CRIT_DAMAGE_DELAY otherwise. +#define STAM_CRIT_GUN_DELAY 2.75 diff --git a/code/__DEFINES/skills/defines.dm b/code/__DEFINES/skills/defines.dm index 47aaeeb1dc..a0b34895df 100644 --- a/code/__DEFINES/skills/defines.dm +++ b/code/__DEFINES/skills/defines.dm @@ -40,7 +40,6 @@ #define SKILL_TRAIN_ATTACK_OBJ "train_attack_obj" #define SKILL_STAMINA_COST "stamina_cost" //Influences the stamina cost from weapon usage. #define SKILL_THROW_STAM_COST "throw_stam_cost" -#define SKILL_COMBAT_MODE "combat_mode" //The user must have combat mode on. #define SKILL_SANITY "sanity" //Is the skill affected by (in)sanity. #define SKILL_INTELLIGENCE "intelligence" //Is the skill affected by brain damage? diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 6a26a6f116..307b476e2b 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -85,6 +85,9 @@ if(force && damtype != STAMINA && HAS_TRAIT(user, TRAIT_PACIFISM)) to_chat(user, "You don't want to harm other living beings!") return + + if(!UseStaminaBufferStandard(user, STAM_COST_ATTACK_MOB_MULT, null, TRUE)) + return DISCARD_LAST_ACTION if(!force) playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1) @@ -100,10 +103,6 @@ log_combat(user, M, "attacked", src.name, "(INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])") add_fingerprint(user) - var/weight = getweight(user, STAM_COST_ATTACK_MOB_MULT) //CIT CHANGE - makes attacking things cause stamina loss - if(weight) - user.adjustStaminaLossBuffered(weight) - // CIT SCREENSHAKE if(force >= 15) shake_camera(user, ((force - 10) * 0.01 + 1), ((force - 10) * 0.01)) @@ -120,28 +119,23 @@ if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_OBJ, O, user) & COMPONENT_NO_ATTACK_OBJ) return if(item_flags & NOBLUDGEON) - return + return DISCARD_LAST_ACTION + if(!UseStaminaBufferStandard(user, STAM_COST_ATTACK_OBJ_MULT, warn = TRUE)) + return DISCARD_LAST_ACTION user.do_attack_animation(O) O.attacked_by(src, user) - var/weight = getweight(user, STAM_COST_ATTACK_OBJ_MULT) - if(weight) - user.adjustStaminaLossBuffered(weight)//CIT CHANGE - makes attacking things cause stamina loss /atom/movable/proc/attacked_by() return /obj/attacked_by(obj/item/I, mob/living/user, attackchain_flags = NONE, damage_multiplier = 1) var/totitemdamage = I.force * damage_multiplier - var/bad_trait var/stamloss = user.getStaminaLoss() if(stamloss > STAMINA_NEAR_SOFTCRIT) //The more tired you are, the less damage you do. var/penalty = (stamloss - STAMINA_NEAR_SOFTCRIT)/(STAMINA_NEAR_CRIT - STAMINA_NEAR_SOFTCRIT)*STAM_CRIT_ITEM_ATTACK_PENALTY totitemdamage *= 1 - penalty - if(SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE)) - bad_trait = SKILL_COMBAT_MODE //blacklist combat skills. - if(I.used_skills && user.mind) if(totitemdamage) totitemdamage = user.mind.item_action_skills_mod(I, totitemdamage, I.skill_difficulty, SKILL_ATTACK_OBJ, bad_trait) @@ -196,19 +190,10 @@ stam_mobility_mult = LYING_DAMAGE_PENALTY . *= stam_mobility_mult - var/bad_trait - if(!(I.item_flags & NO_COMBAT_MODE_FORCE_MODIFIER)) - if(SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE)) - bad_trait = SKILL_COMBAT_MODE //blacklist combat skills. - if(SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_ACTIVE)) - . *= 0.8 - else if(SEND_SIGNAL(src, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE)) - . *= 1.2 - if(!user.mind || !I.used_skills) return if(.) - . = user.mind.item_action_skills_mod(I, ., I.skill_difficulty, SKILL_ATTACK_MOB, bad_trait) + . = user.mind.item_action_skills_mod(I, ., I.skill_difficulty, SKILL_ATTACK_MOB) for(var/skill in I.used_skills) if(!(SKILL_TRAIN_ATTACK_MOB in I.used_skills[skill])) continue @@ -264,14 +249,16 @@ . = (total_mass || w_class * STAM_COST_W_CLASS_MULT) * multiplier if(!user) return - var/bad_trait - if(SEND_SIGNAL(user, COMSIG_COMBAT_MODE_CHECK, COMBAT_MODE_INACTIVE)) - . *= STAM_COST_NO_COMBAT_MULT - bad_trait = SKILL_COMBAT_MODE if(used_skills && user.mind) - . = user.mind.item_action_skills_mod(src, ., skill_difficulty, trait, bad_trait, FALSE) - var/total_health = user.getStaminaLoss() - . = clamp(., 0, STAMINA_NEAR_CRIT - total_health) + . = user.mind.item_action_skills_mod(src, ., skill_difficulty, trait, null, FALSE) + +/** + * Uses the amount of stamina required for a standard hit + */ +/obj/item/proc/UseStaminaBufferStandard(mob/living/user, multiplier = 1, trait = SKILL_STAMINA_COST, warn = TRUE) + ASSERT(user) + var/cost = getweight(user, multiplier, trait) + return user.UseStaminaBuffer(cost, warn) /// How long this staggers for. 0 and negatives supported. /obj/item/proc/melee_stagger_duration(force_override) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 5870c8a780..2617ba2768 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -565,7 +565,7 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb to_chat(user, "You cannot locate any organic eyes on this brain!") return - if(IS_STAMCRIT(user))//CIT CHANGE - makes eyestabbing impossible if you're in stamina softcrit + if(IS_STAMCRIT(user) || !user.UseStaminaBuffer(STAMINA_COST_ITEM_EYESTAB, warn = TRUR))//CIT CHANGE - makes eyestabbing impossible if you're in stamina softcrit to_chat(user, "You're too exhausted for that.")//CIT CHANGE - ditto return //CIT CHANGE - ditto @@ -575,8 +575,6 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb user.do_attack_animation(M) - user.adjustStaminaLossBuffered(10)//CIT CHANGE - makes eyestabbing cost stamina - if(M != user) M.visible_message("[user] has stabbed [M] in the eye with [src]!", \ "[user] stabs you in the eye with [src]!") diff --git a/code/game/objects/items/powerfist.dm b/code/game/objects/items/powerfist.dm index 349236fc2a..1e8668b6e2 100644 --- a/code/game/objects/items/powerfist.dm +++ b/code/game/objects/items/powerfist.dm @@ -6,7 +6,7 @@ lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/melee_righthand.dmi' flags_1 = CONDUCT_1 - item_flags = NEEDS_PERMIT | NO_COMBAT_MODE_FORCE_MODIFIER //To avoid ambushing and oneshotting healthy crewmembers on force setting 3. + item_flags = NEEDS_PERMIT attack_verb = list("whacked", "fisted", "power-punched") force = 20 throwforce = 10 diff --git a/code/game/objects/items/tools/screwdriver.dm b/code/game/objects/items/tools/screwdriver.dm index e9f517a9f1..523c5b951b 100644 --- a/code/game/objects/items/tools/screwdriver.dm +++ b/code/game/objects/items/tools/screwdriver.dm @@ -155,4 +155,4 @@ item_state = "screwdriver_nuke" usesound = 'sound/items/pshoom.ogg' toolspeed = 0.2 - random_color = FALSE \ No newline at end of file + random_color = FALSE diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 9d02e7f2f7..3638e50fdc 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -623,7 +623,7 @@ filters -= CIT_FILTER_STAMINACRIT update_mobility() update_health_hud() - + /mob/living/carbon/update_sight() if(!client) return diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 3984688303..ffa1aa989a 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1593,7 +1593,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) return FALSE else if(aim_for_mouth && ( target_on_help || target_restrained || target_aiming_for_mouth)) - if(!UseStaminaBuffer(3, warn = TRUE)) + if(!user.UseStaminaBuffer(3, warn = TRUE)) return playsound(target.loc, 'sound/weapons/slap.ogg', 50, 1, -1) @@ -1874,9 +1874,10 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) if(CHECK_MOBILITY(user, MOBILITY_STAND)) to_chat(user, "You can only force yourself up if you're on the ground.") return + if(!user.UseStaminaBuffer(STAMINA_COST_SHOVE_UP, TRUE)) + return user.visible_message("[user] forces [p_them()]self up to [p_their()] feet!", "You force yourself up to your feet!") user.set_resting(FALSE, TRUE) - user.adjustStaminaLossBuffered(user.stambuffer) //Rewards good stamina management by making it easier to instantly get up from resting playsound(user, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) /datum/species/proc/altdisarm(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index e29c6b9ffe..925172df49 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -531,12 +531,6 @@ GLOBAL_LIST_INIT(ballmer_windows_me_msg, list("Yo man, what if, we like, uh, put incomingstammult = max(0.01, incomingstammult) incomingstammult = min(1, incomingstammult*2) - //CIT CHANGES START HERE. STAMINA BUFFER STUFF - if(bufferedstam && world.time > stambufferregentime) - var/drainrate = max((bufferedstam*(bufferedstam/(5)))*0.1,1) - bufferedstam = max(bufferedstam - drainrate, 0) - //END OF CIT CHANGES - var/restingpwr = 1 + 4 * !CHECK_MOBILITY(src, MOBILITY_STAND) //Dizziness diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index a05f88eca1..a176bf8149 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -594,6 +594,9 @@ update_icon() /obj/item/gun/proc/getinaccuracy(mob/living/user, bonus_spread, stamloss) + return 0 // Replacement TBD: Exponential curved aim instability system. + +/* if(inaccuracy_modifier == 0) return bonus_spread var/base_inaccuracy = weapon_weight * 25 * inaccuracy_modifier @@ -610,6 +613,7 @@ if(mult < 0) //accurate weapons should provide a proper bonus with negative inaccuracy. the opposite is true too. mult *= 1/inaccuracy_modifier return max(bonus_spread + (base_inaccuracy * mult), 0) //no negative spread. +*/ /obj/item/gun/proc/getstamcost(mob/living/carbon/user) . = recoil diff --git a/tgstation.dme b/tgstation.dme index 7ea90680c7..b51c21fe2d 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -128,7 +128,6 @@ #include "code\__DEFINES\_flags\shields.dm" #include "code\__DEFINES\admin\keybindings.dm" #include "code\__DEFINES\chemistry\reactions.dm" -#include "code\__DEFINES\combat\aim_instability.dm" #include "code\__DEFINES\combat\attack_types.dm" #include "code\__DEFINES\combat\block.dm" #include "code\__DEFINES\combat\block_parry.dm" @@ -2384,7 +2383,6 @@ #include "code\modules\mob\dead\observer\observer_movement.dm" #include "code\modules\mob\dead\observer\orbit.dm" #include "code\modules\mob\dead\observer\say.dm" -#include "code\modules\mob\living\aim_instability.dm" #include "code\modules\mob\living\blood.dm" #include "code\modules\mob\living\bloodcrawl.dm" #include "code\modules\mob\living\clickdelay.dm"