From e3323fc0fee3d89358b6783a19ebafe912ac6553 Mon Sep 17 00:00:00 2001 From: Kaga <103199482+Kaga-404@users.noreply.github.com> Date: Tue, 27 Feb 2024 07:26:25 -0800 Subject: [PATCH] Prototype: Aimed Shot Focusing and Current Health Scaling --- code/datums/ammo/bullet/sniper.dm | 80 +++++++++++++++---- .../projectiles/guns/specialist/sniper.dm | 4 +- 2 files changed, 69 insertions(+), 15 deletions(-) diff --git a/code/datums/ammo/bullet/sniper.dm b/code/datums/ammo/bullet/sniper.dm index a900456e434d..10f0d7fc3ac2 100644 --- a/code/datums/ammo/bullet/sniper.dm +++ b/code/datums/ammo/bullet/sniper.dm @@ -107,20 +107,72 @@ damage = 125 shell_speed = AMMO_SPEED_TIER_6 -/datum/ammo/bullet/sniper/anti_materiel/on_hit_mob(mob/M,obj/projectile/P) - if((P.projectile_flags & PROJECTILE_BULLSEYE) && M == P.original) - var/mob/living/L = M - var/size_damage_mod = 0.8 - if(isxeno(M)) - var/mob/living/carbon/xenomorph/target = M - if(target.mob_size >= MOB_SIZE_XENO) - size_damage_mod += 0.6 - if(target.mob_size >= MOB_SIZE_BIG) - size_damage_mod += 0.6 - L.apply_armoured_damage(damage*size_damage_mod, ARMOR_BULLET, BRUTE, null, penetration) - // Base 180% damage to all targets (225), 240% (300) against non-Runner xenos, and 300% against Big xenos (375). -Kaga - // This applies after pen reductions. After hitting 1 other thing, it deals 180/240/300 damage, or 90/120/150 after hitting a dense wall or big xeno. - to_chat(P.firer, SPAN_WARNING("Bullseye!")) +/datum/ammo/bullet/sniper/anti_materiel/on_hit_mob(mob/target_mob,obj/projectile/aimed_projectile) + if((aimed_projectile.projectile_flags & PROJECTILE_BULLSEYE) && target_mob == aimed_projectile.original) + + var/amr_counter = 0 + + if(istype(aimed_projectile.shot_from, /obj/item/weapon/gun/rifle/sniper/XM43E1)) + var/obj/item/weapon/gun/rifle/sniper/XM43E1/amr = aimed_projectile.shot_from + if(target_mob == amr.focused_fire_target) + if(amr.focused_fire_counter < 2) + amr.focused_fire_counter += 1 + else + amr.focused_fire_counter = 2 + else + amr.focused_fire_counter = 0 + + amr_counter = amr.focused_fire_counter + 1 + amr.focused_fire_target = target_mob + + var/mob/living/living_target = target_mob + var/size_damage_mod = 0.8 // 1.8x vs Non-Xenos (225) + var/size_current_health_damage = 0 // % Current Health calculation, only used for Xeno calculations at the moment. + var/focused_fire_active = 0 // Whether to try and use focused fire calculations or not, for that kind of target. + + if(isxeno(target_mob)) + var/mob/living/carbon/xenomorph/target = target_mob + size_damage_mod -= 0.2 // Down to 1.6x damage, 200. + size_current_health_damage = 0.1 // 1.6x Damage + 10% current health (200 + 10%, 223 vs Runners) + + if(target.mob_size >= MOB_SIZE_XENO && (target.caste_type != XENO_CASTE_DEFENDER)) + size_current_health_damage += 0.1 // 1.6x Damage + 20% current health + focused_fire_active = 1 // Focus Fire Required. Only deals 50% bonus damage on a first Aimed Shot, then 75%, then 100%. Resets with a successful aimed shot on another target. + + if(target.mob_size >= MOB_SIZE_BIG && (target.caste_type != XENO_CASTE_DEFENDER)) + size_damage_mod -= 0.6 // Down to 1x Damage. + size_current_health_damage += 0.1 // 1x Damage + 30% current health. + focused_fire_active = 1 + // Most T3s have around 650 to 700 HP, meaning the health modifier grants a MAXIMUM of around 195-210 damage for a total max of 320-335. This is fully focused (3 shots) and at max HP. + // Queen takes around 275 at max health and unfocused, 425 fully focused. Defender only takes 200 damage, even while fortified, but still causes falloff like a Big Xeno. + // At low health, does little more than a normal shot. Does WORSE than a normal shot if unfocused and hitting through blockers, all of which stack to reduce it. + + var/final_xeno_damage = ((damage * size_damage_mod) + ((target.health + damage) * size_current_health_damage)) + + if(focused_fire_active && amr_counter) // If this is a target that needs to be focus-fired and the gun supports it, reduce bonus damage to 50%, then 75%, then 100% + // If amr_counter is 0, then the gun likely doesn't have the tracker functions, so skip this and deal normal damage. + final_xeno_damage *= (0.25 + (0.25 * amr_counter)) + + living_target.apply_armoured_damage((final_xeno_damage), ARMOR_BULLET, BRUTE, null, penetration) + + else + living_target.apply_armoured_damage((damage*size_damage_mod), ARMOR_BULLET, BRUTE, null, penetration) + + // Base 1.8x damage to non-xeno targets (225), 1.6x + 10% current against Runners (223), 1.2x + 20% current health against most non-Runner xenos, and +30% current health against Big xenos. -Kaga + // This applies after pen reductions. After hitting 1 other thing, it deals 80% damage, or 40% after hitting a dense wall or big xeno. + + if(focused_fire_active) + switch(amr_counter) + if(1) + to_chat(aimed_projectile.firer, SPAN_WARNING("One Hit! You begin to carefully track the target's movements.")) + if(2) + to_chat(aimed_projectile.firer, SPAN_WARNING("Two Hits! You're starting to get a good read on the target's patterns.")) + if(3) + to_chat(aimed_projectile.firer, SPAN_WARNING("Bullseye! You're fully focused on the target.")) + else + to_chat(aimed_projectile.firer, SPAN_WARNING("Bullseye!")) + else + to_chat(aimed_projectile.firer, SPAN_WARNING("Bullseye!")) /datum/ammo/bullet/sniper/anti_materiel/set_bullet_traits() . = ..() diff --git a/code/modules/projectiles/guns/specialist/sniper.dm b/code/modules/projectiles/guns/specialist/sniper.dm index 77ce0069cce3..bb44aaf47ade 100644 --- a/code/modules/projectiles/guns/specialist/sniper.dm +++ b/code/modules/projectiles/guns/specialist/sniper.dm @@ -339,13 +339,15 @@ /obj/item/weapon/gun/rifle/sniper/XM43E1 name = "\improper XM43E1 experimental anti-materiel rifle" - desc = "An experimental anti-materiel rifle produced by Armat Systems, recently reacquired from the deep storage of an abandoned prototyping facility. This one in particular is currently undergoing field testing. Chambered in 10x99mm Caseless." + desc = "An experimental anti-materiel rifle produced by Armat Systems, recently reacquired from the deep storage of an abandoned prototyping facility. This one in particular is currently undergoing field testing. Chambered in 10x99mm Caseless.\nThis weapon can punch through metal plating and walls, though it'll lose most of its lethality in the process. It even works for demolitions, with experienced users known to disassemble solid reinforced walls in the field with a single standard magazine in lieu of explosives of an engineer, using each of the 8 shots to break down vital structural support and take the wall apart." icon = 'icons/obj/items/weapons/guns/guns_by_faction/uscm.dmi' icon_state = "xm43e1" item_state = "xm43e1" unacidable = TRUE indestructible = 1 aimed_shot_cooldown_delay = 4 SECONDS + var/focused_fire_counter = 0 + var/mob/focused_fire_target = null fire_sound = 'sound/weapons/sniper_heavy.ogg' current_mag = /obj/item/ammo_magazine/sniper/anti_materiel //Renamed from anti-tank to align with new identity/description. Other references have been changed as well. -Kaga