Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reopens #4583 (Experimental Tackle Changes) #5712

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions code/modules/mob/living/carbon/xenomorph/XenoProcs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -554,22 +554,22 @@
if(pipe)
handle_ventcrawl(pipe)

/mob/living/carbon/xenomorph/proc/attempt_tackle(mob/M, tackle_mult = 1, tackle_min_offset = 0, tackle_max_offset = 0, tackle_bonus = 0)
var/datum/tackle_counter/TC = LAZYACCESS(tackle_counter, M)
/mob/living/carbon/xenomorph/proc/attempt_tackle(mob/living/carbon/human/tackled_mob, tackle_min_offset = 0, tackle_max_offset = 0)
var/datum/tackle_counter/TC = LAZYACCESS(tackle_counter, tackled_mob)
if(!TC)
TC = new(tackle_min + tackle_min_offset, tackle_max + tackle_max_offset, tackle_chance*tackle_mult)
LAZYSET(tackle_counter, M, TC)
RegisterSignal(M, COMSIG_LIVING_SET_BODY_POSITION, PROC_REF(tackle_handle_lying_changed))
TC = new(tackled_mob, tackle_min + tackle_min_offset, tackle_max + tackle_max_offset)
LAZYSET(tackle_counter, tackled_mob, TC)
RegisterSignal(tackled_mob, COMSIG_LIVING_SET_BODY_POSITION, PROC_REF(tackle_handle_lying_changed))

if (TC.tackle_reset_id)
deltimer(TC.tackle_reset_id)
TC.tackle_reset_id = null

. = TC.attempt_tackle(tackle_bonus)
if (!. || (M.status_flags & XENO_HOST))
TC.tackle_reset_id = addtimer(CALLBACK(src, PROC_REF(reset_tackle), M), 4 SECONDS, TIMER_UNIQUE | TIMER_STOPPABLE)
. = TC.attempt_tackle()
if (!. || (tackled_mob.status_flags & XENO_HOST))
TC.tackle_reset_id = addtimer(CALLBACK(src, PROC_REF(reset_tackle), tackled_mob), 4 SECONDS, TIMER_UNIQUE | TIMER_STOPPABLE)
else
reset_tackle(M)
reset_tackle(tackled_mob)

/mob/living/carbon/xenomorph/proc/tackle_handle_lying_changed(mob/living/M, body_position)
SIGNAL_HANDLER
Expand Down
9 changes: 2 additions & 7 deletions code/modules/mob/living/carbon/xenomorph/Xenomorph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@
var/can_hivemind_speak = TRUE

// Tackles
var/tackle_min = 2
var/tackle_max = 6
var/tackle_chance = 35
var/tackle_min = 3
var/tackle_max = 7
var/tacklestrength_min = 2
var/tacklestrength_max = 3

Expand Down Expand Up @@ -194,7 +193,6 @@
var/explosivearmor_modifier = 0
var/plasmapool_modifier = 1
var/plasmagain_modifier = 0
var/tackle_chance_modifier = 0
var/regeneration_multiplier = 1
var/speed_modifier = 0
var/phero_modifier = 0
Expand Down Expand Up @@ -843,9 +841,6 @@
/mob/living/carbon/xenomorph/proc/recalculate_tackle()
tackle_min = caste.tackle_min
tackle_max = caste.tackle_max
tackle_chance = caste.tackle_chance + tackle_chance_modifier
tacklestrength_min = caste.tacklestrength_min
tacklestrength_max = caste.tacklestrength_max

/mob/living/carbon/xenomorph/proc/recalculate_health()
var/new_max_health = nocrit ? health_modifier + maxHealth : health_modifier + caste.max_health
Expand Down
8 changes: 3 additions & 5 deletions code/modules/mob/living/carbon/xenomorph/attack_alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,13 @@
return XENO_ATTACK_ACTION
M.flick_attack_overlay(src, "disarm")

var/tackle_mult = 1
var/tackle_min_offset = 0
var/tackle_max_offset = 0
if (isyautja(src))
tackle_mult = 0.2
tackle_min_offset += 2
tackle_max_offset += 2
tackle_min_offset += 3
tackle_max_offset += 3

if(M.attempt_tackle(src, tackle_mult, tackle_min_offset, tackle_max_offset))
if(M.attempt_tackle(src, tackle_min_offset, tackle_max_offset))
playsound(loc, 'sound/weapons/alien_knockdown.ogg', 25, 1)
var/strength = rand(M.tacklestrength_min, M.tacklestrength_max)
Stun(strength)
Expand Down
3 changes: 1 addition & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Boiler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
// 3x fire damage
fire_vulnerability_mult = FIRE_MULTIPLIER_DEADLY

tackle_min = 2
tackle_min = 3
tackle_max = 6
tackle_chance = 25
tacklestrength_min = 3
tacklestrength_max = 4

Expand Down
3 changes: 1 addition & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Burrower.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
behavior_delegate_type = /datum/behavior_delegate/burrower_base

tackle_min = 3
tackle_max = 5
tackle_chance = 40
tackle_max = 6
tacklestrength_min = 4
tacklestrength_max = 5

Expand Down
5 changes: 2 additions & 3 deletions code/modules/mob/living/carbon/xenomorph/castes/Carrier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
huggers_max = 16
eggs_max = 8

tackle_min = 2
tackle_max = 4
tackle_chance = 50
tackle_min = 3
tackle_max = 5
tacklestrength_min = 4
tacklestrength_max = 5

Expand Down
3 changes: 1 addition & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Crusher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@

minimum_evolve_time = 15 MINUTES

tackle_min = 2
tackle_min = 3
tackle_max = 6
tackle_chance = 25

evolution_allowed = FALSE
deevolves_to = list(XENO_CASTE_WARRIOR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
available_strains = list(/datum/xeno_strain/steel_crest)
behavior_delegate_type = /datum/behavior_delegate/defender_base

tackle_min = 2
tackle_min = 3
tackle_max = 4

minimum_evolve_time = 4 MINUTES
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/xenomorph/castes/Drone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
weed_level = WEED_LEVEL_STANDARD
max_build_dist = 1

tackle_min = 2
tackle_min = 3
tackle_max = 4
tacklestrength_min = 3
tacklestrength_max = 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

tackle_min = 4
tackle_max = 5
tackle_chance = 40
tacklestrength_min = 4
tacklestrength_max = 4

Expand Down
3 changes: 1 addition & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Hivelord.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
behavior_delegate_type = /datum/behavior_delegate/hivelord_base
max_build_dist = 1

tackle_min = 2
tackle_min = 3
tackle_max = 4
tackle_chance = 45
tacklestrength_min = 4
tacklestrength_max = 5

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/xenomorph/castes/Lurker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
)
claw_type = CLAW_TYPE_SHARP

tackle_min = 2
tackle_min = 4
tackle_max = 6

icon_xeno = 'icons/mob/xenos/lurker.dmi'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
aura_strength = 3
spit_delay = 20

tackle_min = 2
tackle_min = 3
tackle_max = 5
tackle_chance = 45

available_strains = list(
/datum/xeno_strain/dancer,
Expand Down
3 changes: 1 addition & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Queen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@

spit_delay = 25

tackle_min = 2
tackle_min = 3
tackle_max = 6
tackle_chance = 55

aura_strength = 4
tacklestrength_min = 5
Expand Down
5 changes: 2 additions & 3 deletions code/modules/mob/living/carbon/xenomorph/castes/Ravager.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
speed = XENO_SPEED_TIER_3
heal_standing = 0.66

tackle_min = 2
tackle_max = 5
tackle_chance = 35
tackle_min = 3
tackle_max = 6
tacklestrength_min = 4
tacklestrength_max = 5

Expand Down
5 changes: 1 addition & 4 deletions code/modules/mob/living/carbon/xenomorph/castes/Runner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
deevolves_to = list("Larva")

tackle_min = 4
tackle_max = 5
tackle_chance = 40
tacklestrength_min = 4
tacklestrength_max = 4
tackle_max = 6

heal_resting = 1.75

Expand Down
3 changes: 1 addition & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Sentinel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
acid_level = 1

tackle_min = 4
tackle_max = 4
tackle_chance = 50
tackle_max = 5
tacklestrength_min = 4
tacklestrength_max = 4

Expand Down
3 changes: 1 addition & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Spitter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@

spit_delay = 2.5 SECONDS

tackle_min = 2
tackle_min = 3
tackle_max = 6
tackle_chance = 45
tacklestrength_min = 4
tacklestrength_max = 5

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/xenomorph/castes/Warrior.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
caste_desc = "A powerful front line combatant."
can_vent_crawl = 0

tackle_min = 2
tackle_max = 4
tackle_min = 3
tackle_max = 6

agility_speed_increase = -0.9

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@
var/caste_desc = null

// Tackles
var/tackle_min = 2
var/tackle_max = 6
var/tackle_chance = 35
var/tackle_min = 3
var/tackle_max = 7
var/tacklestrength_min = 2
var/tacklestrength_max = 3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
max_build_dist = 1

tackle_min = 4
tackle_max = 5
tackle_max = 6

aura_strength = 1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
drone.phero_modifier += XENO_PHERO_MOD_LARGE
drone.plasma_types += PLASMA_PHEROMONE
drone.damage_modifier -= XENO_DAMAGE_MOD_VERY_SMALL
drone.tackle_chance_modifier -= 5

drone.max_placeable = 3
drone.available_fruits = list(/obj/effect/alien/resin/fruit)
Expand Down
25 changes: 19 additions & 6 deletions code/modules/mob/living/carbon/xenomorph/xeno_tackle_counter.dm
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
/datum/tackle_counter
var/mob/living/carbon/human/tackled_mob
var/tackle_count = 0
var/min_tackles
var/max_tackles
var/tackle_chance
var/tackle_reset_id

/datum/tackle_counter/New(min, max, chance)
/datum/tackle_counter/New(mob/living/carbon/human/tackle_mob, min, max)
tackled_mob = tackle_mob
min_tackles = min
max_tackles = max
tackle_chance = chance

/datum/tackle_counter/proc/attempt_tackle(tackle_bonus = 0)
#define TACKLE_HEALTH_CONSIDERATION_CAP 20
#define TACKLE_DAMAGE_CONSIDERATION_MAX 70

/datum/tackle_counter/proc/attempt_tackle()
tackle_count++

if (tackle_count >= max_tackles)
return TRUE
else if (tackle_count < min_tackles)

if (tackle_count < min_tackles)
return FALSE
else if (prob(tackle_chance + tackle_bonus))

var/tackle_mob_damage = 100 - max(tackled_mob.health, TACKLE_HEALTH_CONSIDERATION_CAP)
var/tackle_tier_cut_offs = TACKLE_DAMAGE_CONSIDERATION_MAX / (max_tackles - min_tackles)
var/tackle_tier_diff = tackle_mob_damage / tackle_tier_cut_offs
var/tackles_required = max_tackles - tackle_tier_diff

if(tackle_count >= tackles_required)
return TRUE

return FALSE

#undef TACKLE_HEALTH_CONSIDERATION_CAP
#undef TACKLE_DAMAGE_CONSIDERATION_MAX
Loading