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

Ravager: replaces single letter vars #4928

Merged
merged 1 commit into from
Nov 16, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -118,30 +118,30 @@
return FALSE

// Supplemental behavior for our charge
/datum/action/xeno_action/activable/pounce/charge/additional_effects(mob/living/L)
/datum/action/xeno_action/activable/pounce/charge/additional_effects(mob/living/living)

var/mob/living/carbon/human/H = L
var/mob/living/carbon/xenomorph/X = owner
if(X.mutation_type != RAVAGER_NORMAL)
var/mob/living/carbon/human/human = living
var/mob/living/carbon/xenomorph/xeno = owner
if(xeno.mutation_type != RAVAGER_NORMAL)
return
var/datum/behavior_delegate/ravager_base/BD = X.behavior_delegate
if(BD.empower_targets < BD.super_empower_threshold)
var/datum/behavior_delegate/ravager_base/behavior = xeno.behavior_delegate
if(behavior.empower_targets < behavior.super_empower_threshold)
return
X.visible_message(SPAN_XENODANGER("The [X] uses its shield to bash [H] as it charges at them!"), SPAN_XENODANGER("You use your shield to bash [H] as you charge at them!"))
H.apply_effect(BD.knockdown_amount, WEAKEN)
H.attack_alien(X, rand(X.melee_damage_lower, X.melee_damage_upper))
xeno.visible_message(SPAN_XENODANGER("The [xeno] uses its shield to bash [human] as it charges at them!"), SPAN_XENODANGER("You use your shield to bash [human] as you charge at them!"))
human.apply_effect(behavior.knockdown_amount, WEAKEN)
human.attack_alien(xeno, rand(xeno.melee_damage_lower, xeno.melee_damage_upper))

var/facing = get_dir(X, H)
var/turf/T = X.loc
var/turf/temp = X.loc
var/facing = get_dir(xeno, human)
var/turf/turf = xeno.loc
var/turf/temp = xeno.loc

for(var/x in 0 to BD.fling_distance-1)
temp = get_step(T, facing)
for(var/step in 0 to behavior.fling_distance-1)
temp = get_step(turf, facing)
if (!temp)
break
T = temp
turf = temp

H.throw_atom(T, BD.fling_distance, SPEED_VERY_FAST, X, TRUE)
human.throw_atom(turf, behavior.fling_distance, SPEED_VERY_FAST, xeno, TRUE)

/datum/action/xeno_action/activable/scissor_cut/use_ability(atom/target_atom)
var/mob/living/carbon/xenomorph/ravager_user = owner
Expand All @@ -164,12 +164,12 @@
var/list/turf/target_turfs = list()

var/facing = Get_Compass_Dir(ravager_user, target_atom)
var/turf/T = ravager_user.loc
var/turf/turf = ravager_user.loc
var/turf/temp = ravager_user.loc
var/list/telegraph_atom_list = list()

for (var/x in 0 to 3)
temp = get_step(T, facing)
for (var/step in 0 to 3)
temp = get_step(turf, facing)
if(facing in diagonals) // check if it goes through corners
var/reverse_face = reverse_dir[facing]
var/turf/back_left = get_step(temp, turn(reverse_face, 45))
Expand All @@ -182,23 +182,23 @@
var/blocked = FALSE
for(var/obj/structure/structure_blocker in temp)
if(istype(structure_blocker, /obj/structure/window/framed))
var/obj/structure/window/framed/W = structure_blocker
if(!W.unslashable)
W.deconstruct(disassembled = FALSE)
var/obj/structure/window/framed/framed_window = structure_blocker
if(!framed_window.unslashable)
framed_window.deconstruct(disassembled = FALSE)

if(structure_blocker.opacity)
blocked = TRUE
break
if(blocked)
break

T = temp
target_turfs += T
telegraph_atom_list += new /obj/effect/xenomorph/xeno_telegraph/red(T, 0.25 SECONDS)
turf = temp
target_turfs += turf
telegraph_atom_list += new /obj/effect/xenomorph/xeno_telegraph/red(turf, 0.25 SECONDS)

// Extract our 'optimal' turf, if it exists
if (target_turfs.len >= 2)
ravager_user.animation_attack_on(target_turfs[target_turfs.len], 15)
if (length(target_turfs) >= 2)
ravager_user.animation_attack_on(target_turfs[length(target_turfs)], 15)

// Hmm today I will kill a marine while looking away from them
ravager_user.face_atom(target_atom)
Expand All @@ -218,141 +218,141 @@
playsound(get_turf(carbon_target), "alien_claw_flesh", 30, TRUE)

if(should_sslow)
new /datum/effects/xeno_slow/superslow/(carbon_target, ravager_user, ttl = superslow_duration)
new /datum/effects/xeno_slow/superslow(carbon_target, ravager_user, ttl = superslow_duration)

apply_cooldown()
return ..()


///////////// BERSERKER POWERS

/datum/action/xeno_action/onclick/apprehend/use_ability(atom/A)
var/mob/living/carbon/xenomorph/X = owner
/datum/action/xeno_action/onclick/apprehend/use_ability(atom/affected_atom)
var/mob/living/carbon/xenomorph/xeno = owner

if (!istype(X))
if (!istype(xeno))
return

if (!action_cooldown_check())
return

if (!X.check_state())
if (!xeno.check_state())
return

if (!check_and_use_plasma_owner())
return

var/datum/behavior_delegate/ravager_berserker/BD = X.behavior_delegate
if (istype(BD))
BD.next_slash_buffed = TRUE
var/datum/behavior_delegate/ravager_berserker/behavior = xeno.behavior_delegate
if (istype(behavior))
behavior.next_slash_buffed = TRUE

to_chat(X, SPAN_XENODANGER("Your next slash will slow!"))
to_chat(xeno, SPAN_XENODANGER("Your next slash will slow!"))

addtimer(CALLBACK(src, PROC_REF(unbuff_slash)), buff_duration)

X.speed_modifier -= speed_buff
X.recalculate_speed()
xeno.speed_modifier -= speed_buff
xeno.recalculate_speed()

addtimer(CALLBACK(src, PROC_REF(apprehend_off)), buff_duration, TIMER_UNIQUE)
X.add_filter("apprehend_on", 1, list("type" = "outline", "color" = "#522020ff", "size" = 1)) // Dark red because the berserker is scary in this state
xeno.add_filter("apprehend_on", 1, list("type" = "outline", "color" = "#522020ff", "size" = 1)) // Dark red because the berserker is scary in this state

apply_cooldown()
return ..()

/datum/action/xeno_action/onclick/apprehend/proc/apprehend_off()
var/mob/living/carbon/xenomorph/X = owner
X.remove_filter("apprehend_on")
if (istype(X))
X.speed_modifier += speed_buff
X.recalculate_speed()
to_chat(X, SPAN_XENOHIGHDANGER("You feel your speed wane!"))
var/mob/living/carbon/xenomorph/xeno = owner
xeno.remove_filter("apprehend_on")
if (istype(xeno))
xeno.speed_modifier += speed_buff
xeno.recalculate_speed()
to_chat(xeno, SPAN_XENOHIGHDANGER("You feel your speed wane!"))

/datum/action/xeno_action/onclick/apprehend/proc/unbuff_slash()
var/mob/living/carbon/xenomorph/X = owner
if (!istype(X))
var/mob/living/carbon/xenomorph/xeno = owner
if (!istype(xeno))
return
var/datum/behavior_delegate/ravager_berserker/BD = X.behavior_delegate
if (istype(BD))
var/datum/behavior_delegate/ravager_berserker/behavior = xeno.behavior_delegate
if (istype(behavior))
// In case slash has already landed
if (!BD.next_slash_buffed)
if (!behavior.next_slash_buffed)
return
BD.next_slash_buffed = FALSE
behavior.next_slash_buffed = FALSE

to_chat(X, SPAN_XENODANGER("You have waited too long, your slash will no longer slow enemies!"))
to_chat(xeno, SPAN_XENODANGER("You have waited too long, your slash will no longer slow enemies!"))


/datum/action/xeno_action/activable/clothesline/use_ability(atom/A)
var/mob/living/carbon/xenomorph/X = owner
/datum/action/xeno_action/activable/clothesline/use_ability(atom/affected_atom)
var/mob/living/carbon/xenomorph/xeno = owner

if (!action_cooldown_check())
return

if (!X.check_state())
if (!xeno.check_state())
return

if (!isxeno_human(A) || X.can_not_harm(A))
to_chat(X, SPAN_XENOWARNING("You must target a hostile!"))
if (!isxeno_human(affected_atom) || xeno.can_not_harm(affected_atom))
to_chat(xeno, SPAN_XENOWARNING("You must target a hostile!"))
return

if (!X.Adjacent(A))
to_chat(X, SPAN_XENOWARNING("You must be adjacent to your target!"))
if (!xeno.Adjacent(affected_atom))
to_chat(xeno, SPAN_XENOWARNING("You must be adjacent to your target!"))
return

var/mob/living/carbon/H = A
var/mob/living/carbon/carbon = affected_atom
var/heal_amount = base_heal
var/fling_distance = fling_dist_base
var/debilitate = TRUE // Do we apply neg. status effects to the target?

if (H.mob_size >= MOB_SIZE_BIG)
to_chat(X, SPAN_XENOWARNING("This creature is too massive to target"))
if (carbon.mob_size >= MOB_SIZE_BIG)
to_chat(xeno, SPAN_XENOWARNING("This creature is too massive to target"))
return

if (H.stat == DEAD)
if (carbon.stat == DEAD)
return

// All strain-specific behavior
if (X.mutation_type == RAVAGER_BERSERKER)
var/datum/behavior_delegate/ravager_berserker/BD = X.behavior_delegate
if (xeno.mutation_type == RAVAGER_BERSERKER)
var/datum/behavior_delegate/ravager_berserker/behavior = xeno.behavior_delegate

if (BD.rage >= 2)
BD.decrement_rage()
if (behavior.rage >= 2)
behavior.decrement_rage()
heal_amount += additional_healing_enraged
else
to_chat(X, SPAN_XENOWARNING("Your rejuvenation was weaker without rage!"))
to_chat(xeno, SPAN_XENOWARNING("Your rejuvenation was weaker without rage!"))
debilitate = FALSE
fling_distance--

// Damage
var/obj/limb/head/head = H.get_limb("head")
if(ishuman(H) && head)
H.apply_armoured_damage(damage, ARMOR_MELEE, BRUTE, "head")
var/obj/limb/head/head = carbon.get_limb("head")
if(ishuman(carbon) && head)
carbon.apply_armoured_damage(damage, ARMOR_MELEE, BRUTE, "head")
else
H.apply_armoured_damage(get_xeno_damage_slash(H, damage), ARMOR_MELEE, BRUTE) // just for consistency
carbon.apply_armoured_damage(get_xeno_damage_slash(carbon, damage), ARMOR_MELEE, BRUTE) // just for consistency

// Heal
if(!X.on_fire)
X.gain_health(heal_amount)
if(!xeno.on_fire)
xeno.gain_health(heal_amount)

// Fling
var/facing = get_dir(X, H)
var/turf/T = X.loc
var/turf/temp = X.loc
var/facing = get_dir(xeno, carbon)
var/turf/turf = xeno.loc
var/turf/temp = xeno.loc

for (var/x in 0 to fling_distance-1)
temp = get_step(T, facing)
for (var/step in 0 to fling_distance-1)
temp = get_step(turf, facing)
if (!temp)
break
T = temp
turf = temp

H.throw_atom(T, fling_distance, SPEED_VERY_FAST, X, TRUE)
carbon.throw_atom(turf, fling_distance, SPEED_VERY_FAST, xeno, TRUE)

// Negative stat effects
if (debilitate)
H.dazed += daze_amount
carbon.dazed += daze_amount

apply_cooldown()
return ..()

/datum/action/xeno_action/activable/eviscerate/use_ability(atom/A)
/datum/action/xeno_action/activable/eviscerate/use_ability(atom/affected_atom)
var/mob/living/carbon/xenomorph/xeno = owner

if(!action_cooldown_check() || xeno.action_busy)
Expand Down Expand Up @@ -502,33 +502,33 @@
xeno.overlay_shields()
return

/datum/action/xeno_action/activable/rav_spikes/use_ability(atom/A)
var/mob/living/carbon/xenomorph/X = owner
/datum/action/xeno_action/activable/rav_spikes/use_ability(atom/affected_atom)
var/mob/living/carbon/xenomorph/xeno = owner

if (!action_cooldown_check())
return

if(!A || A.layer >= FLY_LAYER || !isturf(X.loc) || !X.check_state())
if(!affected_atom || affected_atom.layer >= FLY_LAYER || !isturf(xeno.loc) || !xeno.check_state())
return

if (X.mutation_type == RAVAGER_HEDGEHOG)
var/datum/behavior_delegate/ravager_hedgehog/BD = X.behavior_delegate
if (!BD.check_shards(shard_cost))
to_chat(X, SPAN_DANGER("Not enough shards! You need [shard_cost - BD.shards] more!"))
if (xeno.mutation_type == RAVAGER_HEDGEHOG)
var/datum/behavior_delegate/ravager_hedgehog/behavior = xeno.behavior_delegate
if (!behavior.check_shards(shard_cost))
to_chat(xeno, SPAN_DANGER("Not enough shards! You need [shard_cost - behavior.shards] more!"))
return
BD.use_shards(shard_cost)
behavior.use_shards(shard_cost)

X.visible_message(SPAN_XENOWARNING("The [X] fires their spikes at [A]!"), SPAN_XENOWARNING("You fire your spikes at [A]!"))
xeno.visible_message(SPAN_XENOWARNING("The [xeno] fires their spikes at [affected_atom]!"), SPAN_XENOWARNING("You fire your spikes at [affected_atom]!"))

var/turf/target = locate(A.x, A.y, A.z)
var/obj/projectile/P = new /obj/projectile(X.loc, create_cause_data(initial(X.caste_type), X))
var/turf/target = locate(affected_atom.x, affected_atom.y, affected_atom.z)
var/obj/projectile/projectile = new /obj/projectile(xeno.loc, create_cause_data(initial(xeno.caste_type), xeno))

var/datum/ammo/ammoDatum = GLOB.ammo_list[ammo_type]
var/datum/ammo/ammo_datum = GLOB.ammo_list[ammo_type]

P.generate_bullet(ammoDatum)
projectile.generate_bullet(ammo_datum)

P.fire_at(target, X, X, ammoDatum.max_range, ammoDatum.shell_speed)
playsound(X, 'sound/effects/spike_spray.ogg', 25, 1)
projectile.fire_at(target, xeno, xeno, ammo_datum.max_range, ammo_datum.shell_speed)
playsound(xeno, 'sound/effects/spike_spray.ogg', 25, 1)

apply_cooldown()
return ..()
Expand All @@ -537,38 +537,38 @@
if(!owner)
return FALSE
if (cooldown_timer_id == TIMER_ID_NULL)
var/mob/living/carbon/xenomorph/X = owner
if(!istype(X))
var/mob/living/carbon/xenomorph/xeno = owner
if(!istype(xeno))
return FALSE
if (X.mutation_type == RAVAGER_HEDGEHOG)
var/datum/behavior_delegate/ravager_hedgehog/BD = X.behavior_delegate
return BD.check_shards(shard_cost)
if (xeno.mutation_type == RAVAGER_HEDGEHOG)
var/datum/behavior_delegate/ravager_hedgehog/behavior = xeno.behavior_delegate
return behavior.check_shards(shard_cost)

return TRUE
else
return FALSE

/datum/action/xeno_action/onclick/spike_shed/use_ability(atom/A)
var/mob/living/carbon/xenomorph/X = owner
/datum/action/xeno_action/onclick/spike_shed/use_ability(atom/affected_atom)
var/mob/living/carbon/xenomorph/xeno = owner

if (!action_cooldown_check())
return

if (!X.check_state())
if (!xeno.check_state())
return

if (X.mutation_type == RAVAGER_HEDGEHOG)
var/datum/behavior_delegate/ravager_hedgehog/BD = X.behavior_delegate
if (!BD.check_shards(shard_cost))
to_chat(X, SPAN_DANGER("Not enough shards! You need [shard_cost - BD.shards] more!"))
if (xeno.mutation_type == RAVAGER_HEDGEHOG)
var/datum/behavior_delegate/ravager_hedgehog/behavior = xeno.behavior_delegate
if (!behavior.check_shards(shard_cost))
to_chat(xeno, SPAN_DANGER("Not enough shards! You need [shard_cost - behavior.shards] more!"))
return
BD.use_shards(shard_cost)
BD.lock_shards()
behavior.use_shards(shard_cost)
behavior.lock_shards()

X.visible_message(SPAN_XENOWARNING("The [X] sheds their spikes, firing them in all directions!"), SPAN_XENOWARNING("You shed your spikes, firing them in all directions!!"))
X.spin_circle()
create_shrapnel(get_turf(X), shrapnel_amount, null, null, ammo_type, create_cause_data(initial(X.caste_type), owner), TRUE)
playsound(X, 'sound/effects/spike_spray.ogg', 25, 1)
xeno.visible_message(SPAN_XENOWARNING("The [xeno] sheds their spikes, firing them in all directions!"), SPAN_XENOWARNING("You shed your spikes, firing them in all directions!!"))
xeno.spin_circle()
create_shrapnel(get_turf(xeno), shrapnel_amount, null, null, ammo_type, create_cause_data(initial(xeno.caste_type), owner), TRUE)
playsound(xeno, 'sound/effects/spike_spray.ogg', 25, 1)

apply_cooldown()
return ..()
Expand Down
Loading
Loading