Skip to content

Commit

Permalink
Warrior: replace single letter vars & remove redundant code (#4921)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->

# About the pull request

- Replaces single letter vars in warrior code.
- Removes redundant abilities.
- Some formatting improvements, single line return etc

# Explain why it's good for the game

<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding, and may discourage maintainers from reviewing or merging
your PR. This section is not strictly required for (non-controversial)
fix PRs or backend PRs. -->


# Testing Photographs and Procedure
<!-- Include any screenshots/videos/debugging steps of the modified code
functioning successfully, ideally including edge cases. -->
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
label your changes in the changelog. Please note that maintainers freely
reserve the right to remove and add tags should they deem it
appropriate. You can attempt to finagle the system all you want, but
it's best to shoot for clear communication right off the bat. -->
<!-- If you add a name after the ':cl', that name will be used in the
changelog. You must add your CKEY after the CL if your GitHub name
doesn't match. Maintainers freely reserve the right to remove and add
tags should they deem it appropriate. -->

:cl:
code: Replaces single letter vars removes redundant abilitiesin warrior
code.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! -->
  • Loading branch information
Birdtalon authored Nov 25, 2023
1 parent 3e16dfd commit 2099a52
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 180 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
// toggle agility
/datum/action/xeno_action/onclick/toggle_agility
name = "Toggle Agility"
action_icon_state = "agility_on"
ability_name = "toggle agility"
macro_path = /datum/action/xeno_action/verb/verb_toggle_agility
action_type = XENO_ACTION_CLICK
xeno_cooldown = 10

/datum/action/xeno_action/onclick/toggle_agility/can_use_action()
var/mob/living/carbon/xenomorph/X = owner
if(X && !X.buckled && !X.is_mob_incapacitated())
return TRUE

// Warrior Fling
/datum/action/xeno_action/activable/fling
name = "Fling"
Expand All @@ -28,7 +14,6 @@
var/weaken_power = 0.5
var/slowdown = 2


// Warrior Lunge
/datum/action/xeno_action/activable/lunge
name = "Lunge"
Expand All @@ -44,8 +29,6 @@
var/click_miss_cooldown = 15
var/twitch_message_cooldown = 0 //apparently this is necessary for a tiny code that makes the lunge message on cooldown not be spammable, doesn't need to be big so 5 will do.

// Warrior Agility

/datum/action/xeno_action/activable/warrior_punch
name = "Punch"
action_icon_state = "punch"
Expand All @@ -60,27 +43,3 @@
var/base_punch_damage_synth = 30
var/base_punch_damage_pred = 25
var/damage_variance = 5

/datum/action/xeno_action/activable/uppercut
name = "Uppercut"
action_icon_state = "rav_clothesline"
ability_name = "uppercut"
macro_path = /datum/action/xeno_action/verb/verb_uppercut
action_type = XENO_ACTION_CLICK
ability_primacy = XENO_PRIMARY_ACTION_3
xeno_cooldown = 100
var/base_damage = 15
var/base_knockback = 40
var/base_knockdown = 0.25
var/knockout_power = 11 // 11 seconds
var/base_healthgain = 5 // in percents of health per ko point

/datum/action/xeno_action/activable/jab
name = "Jab"
action_icon_state = "pounce"
ability_name = "jab"
macro_path = /datum/action/xeno_action/verb/verb_jab
action_type = XENO_ACTION_CLICK
ability_primacy = XENO_PRIMARY_ACTION_2
xeno_cooldown = 40

Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,3 @@
set hidden = TRUE
var/action_name = "Punch"
handle_xeno_macro(src, action_name)

/datum/action/xeno_action/verb/verb_jab()
set category = "Alien"
set name = "Jab"
set hidden = TRUE
var/action_name = "Jab"
handle_xeno_macro(src, action_name)

/datum/action/xeno_action/verb/verb_uppercut()
set category = "Alien"
set name = "Uppercut"
set hidden = TRUE
var/action_name = "Uppercut"
handle_xeno_macro(src, action_name)

/datum/action/xeno_action/verb/verb_toggle_agility()
set category = "Alien"
set name = "Toggle Agility"
set hidden = TRUE
var/action_name = "Toggle Agility"
handle_xeno_macro(src, action_name)
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
/datum/action/xeno_action/activable/lunge/use_ability(atom/A)
var/mob/living/carbon/xenomorph/X = owner
/datum/action/xeno_action/activable/lunge/use_ability(atom/affected_atom)
var/mob/living/carbon/xenomorph/xeno = owner

if (!action_cooldown_check())
if(twitch_message_cooldown < world.time )
X.visible_message(SPAN_XENOWARNING("\The [X]'s claws twitch."), SPAN_XENOWARNING("Your claws twitch as you try to lunge but lack the strength. Wait a moment to try again."))
xeno.visible_message(SPAN_XENOWARNING("[xeno]'s claws twitch."), SPAN_XENOWARNING("Your claws twitch as you try to lunge but lack the strength. Wait a moment to try again."))
twitch_message_cooldown = world.time + 5 SECONDS
return //this gives a little feedback on why your lunge didn't hit other than the lunge button going grey. Plus, it might spook marines that almost got lunged if they know why the message appeared, and extra spookiness is always good.

if (!A)
if (!affected_atom)
return

if (!isturf(X.loc))
to_chat(X, SPAN_XENOWARNING("You can't lunge from here!"))
if (!isturf(xeno.loc))
to_chat(xeno, SPAN_XENOWARNING("You can't lunge from here!"))
return

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

if(X.can_not_harm(A) || !ismob(A))
if(xeno.can_not_harm(affected_atom) || !ismob(affected_atom))
apply_cooldown_override(click_miss_cooldown)
return

var/mob/living/carbon/H = A
if(H.stat == DEAD)
var/mob/living/carbon/carbon = affected_atom
if(carbon.stat == DEAD)
return

if (!check_and_use_plasma_owner())
Expand All @@ -31,165 +31,150 @@
apply_cooldown()
..()

X.visible_message(SPAN_XENOWARNING("\The [X] lunges towards [H]!"), SPAN_XENOWARNING("You lunge at [H]!"))
xeno.visible_message(SPAN_XENOWARNING("[xeno] lunges towards [carbon]!"), SPAN_XENOWARNING("You lunge at [carbon]!"))

X.throw_atom(get_step_towards(A, X), grab_range, SPEED_FAST, X)
xeno.throw_atom(get_step_towards(affected_atom, xeno), grab_range, SPEED_FAST, xeno)

if (X.Adjacent(H))
X.start_pulling(H,1)
if (xeno.Adjacent(carbon))
xeno.start_pulling(carbon,1)
else
X.visible_message(SPAN_XENOWARNING("\The [X]'s claws twitch."), SPAN_XENOWARNING("Your claws twitch as you lunge but are unable to grab onto your target. Wait a moment to try again."))
xeno.visible_message(SPAN_XENOWARNING("[xeno]'s claws twitch."), SPAN_XENOWARNING("Your claws twitch as you lunge but are unable to grab onto your target. Wait a moment to try again."))

return TRUE

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

if (!action_cooldown_check())
return

if (!X.check_state(1))
if (!isxeno_human(affected_atom) || xeno.can_not_harm(affected_atom))
return

X.agility = !X.agility
if (X.agility)
to_chat(X, SPAN_XENOWARNING("You lower yourself to all fours."))
else
to_chat(X, SPAN_XENOWARNING("You raise yourself to stand on two feet."))
X.update_icons()

apply_cooldown()
return ..()

/datum/action/xeno_action/activable/fling/use_ability(atom/target_atom)
var/mob/living/carbon/xenomorph/woyer = owner

if (!action_cooldown_check())
if (!xeno.check_state() || xeno.agility)
return

if (!isxeno_human(target_atom) || woyer.can_not_harm(target_atom))
if (!xeno.Adjacent(affected_atom))
return

if (!woyer.check_state() || woyer.agility)
var/mob/living/carbon/carbon = affected_atom
if(carbon.stat == DEAD)
return

if (!woyer.Adjacent(target_atom))
if(HAS_TRAIT(carbon, TRAIT_NESTED))
return

var/mob/living/carbon/carbone = target_atom
if(carbone.stat == DEAD) return
if(HAS_TRAIT(carbone, TRAIT_NESTED))
return

if(carbone == woyer.pulling)
woyer.stop_pulling()
if(carbon == xeno.pulling)
xeno.stop_pulling()

if(carbone.mob_size >= MOB_SIZE_BIG)
to_chat(woyer, SPAN_XENOWARNING("[carbone] is too big for you to fling!"))
if(carbon.mob_size >= MOB_SIZE_BIG)
to_chat(xeno, SPAN_XENOWARNING("[carbon] is too big for you to fling!"))
return

if (!check_and_use_plasma_owner())
return

woyer.visible_message(SPAN_XENOWARNING("\The [woyer] effortlessly flings [carbone] to the side!"), SPAN_XENOWARNING("You effortlessly fling [carbone] to the side!"))
playsound(carbone,'sound/weapons/alien_claw_block.ogg', 75, 1)
xeno.visible_message(SPAN_XENOWARNING("[xeno] effortlessly flings [carbon] to the side!"), SPAN_XENOWARNING("You effortlessly fling [carbon] to the side!"))
playsound(carbon,'sound/weapons/alien_claw_block.ogg', 75, 1)
if(stun_power)
carbone.apply_effect(get_xeno_stun_duration(carbone, stun_power), STUN)
carbon.apply_effect(get_xeno_stun_duration(carbon, stun_power), STUN)
if(weaken_power)
carbone.apply_effect(weaken_power, WEAKEN)
carbon.apply_effect(weaken_power, WEAKEN)
if(slowdown)
if(carbone.slowed < slowdown)
carbone.apply_effect(slowdown, SLOW)
carbone.last_damage_data = create_cause_data(initial(woyer.caste_type), woyer)
shake_camera(carbone, 2, 1)
if(carbon.slowed < slowdown)
carbon.apply_effect(slowdown, SLOW)
carbon.last_damage_data = create_cause_data(initial(xeno.caste_type), xeno)
shake_camera(carbon, 2, 1)

var/facing = get_dir(woyer, carbone)
var/turf/throw_turf = woyer.loc
var/turf/temp = woyer.loc
var/facing = get_dir(xeno, carbon)
var/turf/throw_turf = xeno.loc
var/turf/temp = xeno.loc

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

// Hmm today I will kill a marine while looking away from them
woyer.face_atom(carbone)
woyer.animation_attack_on(carbone)
woyer.flick_attack_overlay(carbone, "disarm")
carbone.throw_atom(throw_turf, fling_distance, SPEED_VERY_FAST, woyer, TRUE)
xeno.face_atom(carbon)
xeno.animation_attack_on(carbon)
xeno.flick_attack_overlay(carbon, "disarm")
carbon.throw_atom(throw_turf, fling_distance, SPEED_VERY_FAST, xeno, TRUE)

apply_cooldown()
return ..()

/datum/action/xeno_action/activable/warrior_punch/use_ability(atom/target_atom)
var/mob/living/carbon/xenomorph/woyer = owner
/datum/action/xeno_action/activable/warrior_punch/use_ability(atom/affected_atom)
var/mob/living/carbon/xenomorph/xeno = owner

if (!action_cooldown_check())
return

if (!isxeno_human(target_atom) || woyer.can_not_harm(target_atom))
if (!isxeno_human(affected_atom) || xeno.can_not_harm(affected_atom))
return

if (!woyer.check_state() || woyer.agility)
if (!xeno.check_state() || xeno.agility)
return

var/distance = get_dist(woyer, target_atom)
var/distance = get_dist(xeno, affected_atom)

if (distance > 2)
return

var/mob/living/carbon/carbone = target_atom
var/mob/living/carbon/carbon = affected_atom

if (!woyer.Adjacent(carbone))
if (!xeno.Adjacent(carbon))
return

if(carbone.stat == DEAD) return
if(HAS_TRAIT(carbone, TRAIT_NESTED)) return

var/obj/limb/target_limb = carbone.get_limb(check_zone(woyer.zone_selected))
if(carbon.stat == DEAD)
return
if(HAS_TRAIT(carbon, TRAIT_NESTED))
return

if (ishuman(carbone) && (!target_limb || (target_limb.status & LIMB_DESTROYED)))
target_limb = carbone.get_limb("chest")
var/obj/limb/target_limb = carbon.get_limb(check_zone(xeno.zone_selected))

if (ishuman(carbon) && (!target_limb || (target_limb.status & LIMB_DESTROYED)))
target_limb = carbon.get_limb("chest")

if (!check_and_use_plasma_owner())
return

carbone.last_damage_data = create_cause_data(initial(woyer.caste_type), woyer)
carbon.last_damage_data = create_cause_data(initial(xeno.caste_type), xeno)

woyer.visible_message(SPAN_XENOWARNING("\The [woyer] hits [carbone] in the [target_limb? target_limb.display_name : "chest"] with a devastatingly powerful punch!"), \
SPAN_XENOWARNING("You hit [carbone] in the [target_limb? target_limb.display_name : "chest"] with a devastatingly powerful punch!"))
var/S = pick('sound/weapons/punch1.ogg','sound/weapons/punch2.ogg','sound/weapons/punch3.ogg','sound/weapons/punch4.ogg')
playsound(carbone,S, 50, 1)
do_base_warrior_punch(carbone, target_limb)
xeno.visible_message(SPAN_XENOWARNING("[xeno] hits [carbon] in the [target_limb ? target_limb.display_name : "chest"] with a devastatingly powerful punch!"), \
SPAN_XENOWARNING("You hit [carbon] in the [target_limb ? target_limb.display_name : "chest"] with a devastatingly powerful punch!"))
var/sound = pick('sound/weapons/punch1.ogg','sound/weapons/punch2.ogg','sound/weapons/punch3.ogg','sound/weapons/punch4.ogg')
playsound(carbon, sound, 50, 1)
do_base_warrior_punch(carbon, target_limb)
apply_cooldown()
return ..()

/datum/action/xeno_action/activable/warrior_punch/proc/do_base_warrior_punch(mob/living/carbon/carbone, obj/limb/target_limb)
var/mob/living/carbon/xenomorph/woyer = owner
/datum/action/xeno_action/activable/warrior_punch/proc/do_base_warrior_punch(mob/living/carbon/carbon, obj/limb/target_limb)
var/mob/living/carbon/xenomorph/xeno = owner
var/damage = rand(base_damage, base_damage + damage_variance)

if(ishuman(carbone))
if(ishuman(carbon))
if((target_limb.status & LIMB_SPLINTED) && !(target_limb.status & LIMB_SPLINTED_INDESTRUCTIBLE)) //If they have it splinted, the splint won't hold.
target_limb.status &= ~LIMB_SPLINTED
playsound(get_turf(carbone), 'sound/items/splintbreaks.ogg', 20)
to_chat(carbone, SPAN_DANGER("The splint on your [target_limb.display_name] comes apart!"))
carbone.pain.apply_pain(PAIN_BONE_BREAK_SPLINTED)
playsound(get_turf(carbon), 'sound/items/splintbreaks.ogg', 20)
to_chat(carbon, SPAN_DANGER("The splint on your [target_limb.display_name] comes apart!"))
carbon.pain.apply_pain(PAIN_BONE_BREAK_SPLINTED)

if(ishuman_strict(carbon))
carbon.apply_effect(3, SLOW)

if(ishuman_strict(carbone))
carbone.apply_effect(3, SLOW)
if(isyautja(carbone))
if(isyautja(carbon))
damage = rand(base_punch_damage_pred, base_punch_damage_pred + damage_variance)
else if(target_limb.status & (LIMB_ROBOT|LIMB_SYNTHSKIN))
damage = rand(base_punch_damage_synth, base_punch_damage_synth + damage_variance)


carbone.apply_armoured_damage(get_xeno_damage_slash(carbone, damage), ARMOR_MELEE, BRUTE, target_limb? target_limb.name : "chest")
carbon.apply_armoured_damage(get_xeno_damage_slash(carbon, damage), ARMOR_MELEE, BRUTE, target_limb ? target_limb.name : "chest")

// Hmm today I will kill a marine while looking away from them
woyer.face_atom(carbone)
woyer.animation_attack_on(carbone)
woyer.flick_attack_overlay(carbone, "punch")
shake_camera(carbone, 2, 1)
step_away(carbone, woyer, 2)
xeno.face_atom(carbon)
xeno.animation_attack_on(carbon)
xeno.flick_attack_overlay(carbon, "punch")
shake_camera(carbon, 2, 1)
step_away(carbon, xeno, 2)
Loading

0 comments on commit 2099a52

Please sign in to comment.