From 537496d989b10b265ac061467af34981eddf0d33 Mon Sep 17 00:00:00 2001 From: spaghetti Date: Wed, 18 Dec 2024 23:21:24 +0300 Subject: [PATCH] sharpshooter --- code/__DEFINES/movespeed_modification.dm | 2 + code/__DEFINES/status_effects.dm | 2 + code/datums/status_effects/debuffs.dm | 76 +++++++++++++++++++ .../machinery/vending/marine_vending.dm | 15 +--- .../projectiles/ammo_datums/bullet/rifle.dm | 37 ++++----- code/modules/projectiles/guns/rifles.dm | 9 +-- code/modules/projectiles/magazines/misc.dm | 22 +----- code/modules/projectiles/magazines/rifles.dm | 20 +---- code/modules/reqs/supplypacks/weapons.dm | 13 ++-- 9 files changed, 108 insertions(+), 88 deletions(-) diff --git a/code/__DEFINES/movespeed_modification.dm b/code/__DEFINES/movespeed_modification.dm index 47ba67088f2..86d188b69e8 100644 --- a/code/__DEFINES/movespeed_modification.dm +++ b/code/__DEFINES/movespeed_modification.dm @@ -14,6 +14,8 @@ #define MOVESPEED_ID_HUNTER_DISGUISE "HUNTER_DISGUISE" #define MOVESPEED_ID_SPIDER_VENOM "WIDOW_SPIDER_VENOM" +#define MOVESPEED_ID_SHARPSHOOTER_SLOWDOWN "SHARPSHOOTER_SLOWDOWN" + #define MOVESPEED_ID_MOB_WALK_RUN_CONFIG_SPEED "MOB_WALK_RUN" #define MOVESPEED_ID_MOB_PARACETAMOL_SPEED "MOB_PARACETAMOL_RUN" #define MOVESPEED_ID_MOB_NANITES_SPEED "MOB_NANITES_RUN" diff --git a/code/__DEFINES/status_effects.dm b/code/__DEFINES/status_effects.dm index fde0e074146..0b92bb06167 100644 --- a/code/__DEFINES/status_effects.dm +++ b/code/__DEFINES/status_effects.dm @@ -104,6 +104,8 @@ #define STATUS_EFFECT_SHATTER /datum/status_effect/shatter //widow's ability #define STATUS_EFFECT_SPIDER_VENOM /datum/status_effect/incapacitating/spider_venom +//ar-21 status effect +#define STATUS_EFFECT_SHARPSHOOTER /datum/status_effect/stacking/sharpshooter ///////////// // NEUTRAL // diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index 7458a65f568..bfd3dabc0f1 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -780,6 +780,82 @@ color = "#a7cc00" +// *************************************** +// *********** Sharpshooter +// *************************************** +///amount of slowdown done by the sharpshooter status effect +#define STATUS_EFFECT_SHARPSHOOTER_SLOWDOWN 1.5 + +/datum/status_effect/stacking/sharpshooter + id = "sharpshooter" + tick_interval = 1 SECONDS + max_stacks = 20 + stack_threshold = 15 + stack_decay = 2 + consumed_on_threshold = FALSE + alert_type = /atom/movable/screen/alert/status_effect/sharpshooter + ///Owner of the debuff is limited to carbons. + var/mob/living/carbon/debuff_owner + ///Used for particles. Holds the particles instead of the mob. See particle_holder for documentation. + var/obj/effect/abstract/particle_holder/particle_holder + +/datum/status_effect/stacking/sharpshooter/can_gain_stacks() + if(owner.status_flags & GODMODE) + return FALSE + return ..() + +/datum/status_effect/stacking/sharpshooter/on_creation(mob/living/new_owner, stacks_to_apply) + if(new_owner.status_flags & GODMODE) + qdel(src) + return + + . = ..() + debuff_owner = new_owner + particle_holder = new(debuff_owner, /particles/sharpshooter_status) + particle_holder.particles.spawning = 1 + round(stacks * 0.5) + +/datum/status_effect/stacking/sharpshooter/on_remove() + debuff_owner = null + QDEL_NULL(particle_holder) + return ..() + +/datum/status_effect/stacking/sharpshooter/tick() + . = ..() + if(!debuff_owner) + return + + particle_holder.particles.spawning = 1 + round(stacks * 0.5) + +/datum/status_effect/stacking/sharpshooter/threshold_cross_effect() + . = ..() + debuff_owner.add_movespeed_modifier(MOVESPEED_ID_SHARPSHOOTER_SLOWDOWN, TRUE, 0, NONE, TRUE, STATUS_EFFECT_SHARPSHOOTER_SLOWDOWN) + debuff_owner.balloon_alert_to_viewers("Slowed!") + +/datum/status_effect/stacking/sharpshooter/on_threshold_drop() + debuff_owner.remove_movespeed_modifier(MOVESPEED_ID_SHARPSHOOTER_SLOWDOWN) + +/atom/movable/screen/alert/status_effect/sharpshooter + name = "Sharpshooter" + desc = "You're slowed down and take additional damage!" + icon_state = "default" + +/particles/sharpshooter_status + icon = 'icons/effects/particles/generic_particles.dmi' + icon_state = "down_arrow" + width = 100 + height = 100 + count = 1000 + spawning = 4 + lifespan = 10 + fade = 8 + velocity = list(0, 0) + position = generator(GEN_SPHERE, 16, 16, NORMAL_RAND) + drift = generator(GEN_VECTOR, list(-0.1, 0), list(0.1, 0)) + gravity = list(0, -0.4) + scale = generator(GEN_VECTOR, list(0.3, 0.3), list(1, 1), NORMAL_RAND) + friction = -0.05 + color = "#cdcdcd" + // *************************************** // *********** Shatter // *************************************** diff --git a/code/game/objects/machinery/vending/marine_vending.dm b/code/game/objects/machinery/vending/marine_vending.dm index 8443eaa2e15..d6593658575 100644 --- a/code/game/objects/machinery/vending/marine_vending.dm +++ b/code/game/objects/machinery/vending/marine_vending.dm @@ -29,8 +29,6 @@ /obj/item/ammo_magazine/rifle/type71/hp = -1, /obj/item/weapon/gun/rifle/ar21 = -1, /obj/item/ammo_magazine/rifle/ar21 = -1, - /obj/item/ammo_magazine/rifle/ar21/ap = -1, - /obj/item/ammo_magazine/rifle/ar21/hp = -1, ), "Пистолеты-пулемёты" = list( /obj/item/weapon/gun/smg/vector = -1, @@ -197,12 +195,9 @@ /obj/item/ammo_magazine/packet/p10x24mm/ap = -1, /obj/item/ammo_magazine/packet/p10x24mm/hp = -1, /obj/item/ammo_magazine/packet/p10x25mm = -1, - /obj/item/ammo_magazine/packet/p10x25mm/ap = -1, - /obj/item/ammo_magazine/packet/p10x25mm/hp = -1, /obj/item/ammo_magazine/packet/groza = -1, /obj/item/ammo_magazine/packet/groza/ap = -1, /obj/item/ammo_magazine/packet/groza/hp = -1, - /obj/item/ammo_magazine/packet/p10x25mm = -1, /obj/item/ammo_magazine/packet/p10x26mm = -1, /obj/item/ammo_magazine/packet/p10x27mm = -1, /obj/item/ammo_magazine/packet/p86x70mm = -1, @@ -268,8 +263,6 @@ /obj/item/ammo_magazine/rifle/type71/hp = -1, /obj/item/weapon/gun/rifle/ar21 = -1, /obj/item/ammo_magazine/rifle/ar21 = -1, - /obj/item/ammo_magazine/rifle/ar21/ap = -1, - /obj/item/ammo_magazine/rifle/ar21/hp = -1, /obj/item/weapon/gun/revolver/r44/coltrifle = -1, /obj/item/ammo_magazine/revolver/rifle = -1, @@ -424,12 +417,9 @@ /obj/item/ammo_magazine/packet/p10x24mm/ap = -1, /obj/item/ammo_magazine/packet/p10x24mm/hp = -1, /obj/item/ammo_magazine/packet/p10x25mm = -1, - /obj/item/ammo_magazine/packet/p10x25mm/ap = -1, - /obj/item/ammo_magazine/packet/p10x25mm/hp = -1, /obj/item/ammo_magazine/packet/groza = -1, /obj/item/ammo_magazine/packet/groza/ap = -1, /obj/item/ammo_magazine/packet/groza/hp = -1, - /obj/item/ammo_magazine/packet/p10x25mm = -1, /obj/item/ammo_magazine/packet/p10x26mm = -1, /obj/item/ammo_magazine/packet/p10x27mm = -1, /obj/item/ammo_magazine/packet/p86x70mm = -1, @@ -496,8 +486,7 @@ /obj/item/ammo_magazine/rifle/type71/hp = -1, /obj/item/weapon/gun/rifle/ar21 = -1, /obj/item/ammo_magazine/rifle/ar21 = -1, - /obj/item/ammo_magazine/rifle/ar21/ap = -1, - /obj/item/ammo_magazine/rifle/ar21/hp = -1, + /obj/item/ammo_magazine/rifle/ar21/extended = -1, ), "Пистолеты-пулемёты" = list( /obj/item/weapon/gun/smg/vector = -1, @@ -688,8 +677,6 @@ /obj/item/ammo_magazine/packet/groza/ap = -1, /obj/item/ammo_magazine/packet/groza/hp = -1, /obj/item/ammo_magazine/packet/p10x25mm = -1, - /obj/item/ammo_magazine/packet/p10x25mm/ap = -1, - /obj/item/ammo_magazine/packet/p10x25mm/hp = -1, /obj/item/ammo_magazine/packet/p10x26mm = -1, /obj/item/ammo_magazine/packet/p10x27mm = -1, /obj/item/ammo_magazine/packet/p86x70mm = -1, diff --git a/code/modules/projectiles/ammo_datums/bullet/rifle.dm b/code/modules/projectiles/ammo_datums/bullet/rifle.dm index 084e43752e8..fa7d66c00b8 100644 --- a/code/modules/projectiles/ammo_datums/bullet/rifle.dm +++ b/code/modules/projectiles/ammo_datums/bullet/rifle.dm @@ -56,28 +56,23 @@ penetration = 10 additional_xeno_penetration = 15 -/datum/ammo/bullet/rifle/heavy/hp - name = "hollow-point heavy rifle bullet" - hud_state = "rifle_heavy" - damage = 50 - penetration = 0 - additional_xeno_penetration = -10 - -/datum/ammo/bullet/rifle/heavy/ap - name = "armor-piercing heavy rifle bullet" - damage = 25 - penetration = 25 - additional_xeno_penetration = 20 +/datum/ammo/bullet/rifle/heavy/sharpshooter + damage = 30 + damage_falloff = 2 + penetration = 10 + additional_xeno_penetration = 10 -/datum/ammo/bullet/rifle/heavy/incendiary - name = "incendiaryg heavy rifle bullet" - hud_state = "rifle_fire" - flags_ammo_behavior = AMMO_BALLISTIC|AMMO_INCENDIARY - incendiary_strength = 1 - damage_type = BURN - damage = 20 - penetration = 0 - additional_xeno_penetration = 0 + var/hit_stacks = 2 + +/datum/ammo/bullet/rifle/heavy/sharpshooter/on_hit_mob(mob/M, obj/projectile/proj) + if(istype(M,/mob/living/carbon)) + var/mob/living/carbon/target = M + if(target.has_status_effect(STATUS_EFFECT_SHARPSHOOTER)) + var/datum/status_effect/stacking/sharpshooter/debuff = target.has_status_effect(STATUS_EFFECT_SHARPSHOOTER) + target.apply_damage(debuff.stacks, BRUTE, blocked = BULLET, penetration = additional_xeno_penetration) + debuff.add_stacks(hit_stacks) + return + target.apply_status_effect(STATUS_EFFECT_SHARPSHOOTER, hit_stacks) /datum/ammo/bullet/rifle/repeater name = "heavy impact rifle bullet" diff --git a/code/modules/projectiles/guns/rifles.dm b/code/modules/projectiles/guns/rifles.dm index b2a6f71056e..f594bed0e1d 100644 --- a/code/modules/projectiles/guns/rifles.dm +++ b/code/modules/projectiles/guns/rifles.dm @@ -1760,14 +1760,7 @@ max_shells = 30 //codex force = 20 default_ammo_type = /obj/item/ammo_magazine/rifle/ar21 - allowed_ammo_types = list(/obj/item/ammo_magazine/rifle/ar21) - allowed_ammo_types = list( - /obj/item/ammo_magazine/rifle/ar21, - /obj/item/ammo_magazine/rifle/ar21/extended, - /obj/item/ammo_magazine/rifle/ar21/ap, - /obj/item/ammo_magazine/rifle/ar21/hp, - /obj/item/ammo_magazine/rifle/ar21/incendiary, - ) + allowed_ammo_types = list(/obj/item/ammo_magazine/rifle/ar21, /obj/item/ammo_magazine/rifle/ar21/extended) attachable_allowed = list( /obj/item/attachable/reddot, /obj/item/attachable/b7_scope, diff --git a/code/modules/projectiles/magazines/misc.dm b/code/modules/projectiles/magazines/misc.dm index 401f2426094..e651a3b971d 100644 --- a/code/modules/projectiles/magazines/misc.dm +++ b/code/modules/projectiles/magazines/misc.dm @@ -79,12 +79,12 @@ max_rounds = 100 /obj/item/ammo_magazine/packet/p10x25mm - name = "box of 10x25mm FMJ" + name = "box of 10x25mm" desc = "A box containing 125 rounds of 10x25mm caseless." caliber = CALIBER_10X25_CASELESS icon_state = "box_10x25mm" ammo_band_icon = "box_10x25mm_band" - default_ammo = /datum/ammo/bullet/rifle/heavy + default_ammo = /datum/ammo/bullet/rifle/heavy/sharpshooter current_rounds = 125 max_rounds = 125 @@ -364,24 +364,6 @@ ammo_band_color = AMMO_BAND_COLOR_HOLLOWPOINT default_ammo = /datum/ammo/bullet/rifle/hp -/obj/item/ammo_magazine/packet/p10x25mm/ap - name = "box of 10x25mm AP" - desc = "A box containing 125 armor piercing rounds of 10x25mm caseless." - ammo_band_color = AMMO_BAND_COLOR_AP - default_ammo = /datum/ammo/bullet/rifle/heavy/ap - -/obj/item/ammo_magazine/packet/p10x25mm/hp - name = "box of 10x25mm HP" - desc = "A box containing 125 hollow-point rounds of 10x25mm caseless." - ammo_band_color = AMMO_BAND_COLOR_HOLLOWPOINT - default_ammo = /datum/ammo/bullet/rifle/heavy/hp - -/obj/item/ammo_magazine/packet/p10x25mm/incendiary - name = "box of 10x25mm incendiary" - desc = "A box containing 125 incendiary rounds of 10x25mm caseless." - ammo_band_color = AMMO_BAND_COLOR_INCENDIARY - default_ammo = /datum/ammo/bullet/rifle/heavy/incendiary - /obj/item/ammo_magazine/packet/p10x265mm/ap desc = "A box containing 100 armor piercing rounds of 10x26.5mm caseless." icon_state = "box_10x265mm_ap" diff --git a/code/modules/projectiles/magazines/rifles.dm b/code/modules/projectiles/magazines/rifles.dm index 6bbc909a885..8755c2b0cc6 100644 --- a/code/modules/projectiles/magazines/rifles.dm +++ b/code/modules/projectiles/magazines/rifles.dm @@ -481,7 +481,7 @@ icon_state = "t21" icon_state_mini = "mag_rifle" ammo_band_icon = "t21_band" - default_ammo = /datum/ammo/bullet/rifle/heavy + default_ammo = /datum/ammo/bullet/rifle/heavy/sharpshooter max_rounds = 30 /obj/item/ammo_magazine/rifle/ar21/extended @@ -493,24 +493,6 @@ ammo_band_color = AMMO_BAND_COLOR_EXTENDED bonus_overlay = "t21_ext" -/obj/item/ammo_magazine/rifle/ar21/ap - name = "\improper AR-21 skirmish AP rifle magazine" - desc = "A magazine filled with 10x25mm armor piercing rifle rounds for the AR-21." - ammo_band_color = AMMO_BAND_COLOR_AP - default_ammo = /datum/ammo/bullet/rifle/heavy/ap - -/obj/item/ammo_magazine/rifle/ar21/incendiary - name = "\improper AR-21 skirmish incendiary rifle magazine" - desc = "A magazine filled with 10x25mm incendiary rifle rounds for the AR-21." - ammo_band_color = AMMO_BAND_COLOR_INCENDIARY - default_ammo = /datum/ammo/bullet/rifle/heavy/incendiary - -/obj/item/ammo_magazine/rifle/ar21/hp - name = "\improper AR-21 skirmish HP rifle magazine" - desc = "A magazine filled with 10x25mm armor-piercing rifle rounds for the AR-21." - ammo_band_color = AMMO_BAND_COLOR_HOLLOWPOINT - default_ammo = /datum/ammo/bullet/rifle/heavy/hp - //ALF-51B /obj/item/ammo_magazine/rifle/alf_machinecarbine diff --git a/code/modules/reqs/supplypacks/weapons.dm b/code/modules/reqs/supplypacks/weapons.dm index 234a4b13e08..8817e449c8a 100644 --- a/code/modules/reqs/supplypacks/weapons.dm +++ b/code/modules/reqs/supplypacks/weapons.dm @@ -274,12 +274,6 @@ cost = 45 //150 rounds containertype = /obj/structure/closet/crate/ammo -/datum/supply_packs/weapons/box_10x25mm_incendiary - name = "10x25mm incendiary ammo box" - contains = list(/obj/item/ammo_magazine/packet/p10x25mm/incendiary) - cost = 50 //125 rounds - containertype = /obj/structure/closet/crate/ammo - /datum/supply_packs/weapons/p9mm_incendiary name = "9mm incendiary packet" contains = list(/obj/item/ammo_magazine/packet/p9mm/incendiary) @@ -301,3 +295,10 @@ /datum/supply_packs/weapons/xray_gun contains = list(/obj/item/weapon/gun/energy/lasgun/lasrifle/xray) cost = 500 + +/datum/supply_packs/weapons/ar21_extended + name = "AR-21 extended skirmish rifle magazine" + contains = list(/obj/item/ammo_magazine/rifle/ar21/extended) + cost = 80 + +