Skip to content
Open
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
6 changes: 5 additions & 1 deletion code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
/// If the mob won't drop items held in face slot when downed
#define TRAIT_IRON_TEETH "t_iron_teeth"

// -- ability traits --
// -- general ability traits --
/// Xenos with this trait cannot have plasma transferred to them
#define TRAIT_ABILITY_NO_PLASMA_TRANSFER "t_ability_no_plasma_transfer"
/// Shows that the xeno queen is on ovi
Expand All @@ -267,6 +267,10 @@
#define TRAIT_ABILITY_BURROWED "t_ability_burrowed"
/// Xenos with this trait can toggle long sight while resting.
#define TRAIT_ABILITY_SIGHT_IGNORE_REST "t_ability_sight_ignore_rest"


// -- specific ability traits --
#define TRAIT_ABILITY_SHED_SPIKES "t_ability_shed_spikes"
/// Used by shielder to check stance.
#define TRAIT_ABILITY_ENCLOSED_PLATES "t_ability_enclosed_plates"
/// Used by shielder for reflective plates.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,6 @@
var/ammo_type = /datum/ammo/xeno/bone_chips/spread
var/shrapnel_amount = 40

var/shard_lock_duration = 15 SECONDS
var/shard_lock_speed_mod = 0.45

Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@
var/shards_per_projectile = 10
var/shards_per_slash = 15
var/armor_buff_per_fifty_shards = 2.50
var/shard_lock_duration = 150
var/shard_lock_speed_mod = 0.45

// Shard state
var/shards = 0
var/shards_locked = FALSE //are we locked at 0 shards?

// Armor buff state
var/times_armor_buffed = 0
Expand All @@ -49,46 +46,21 @@
. += "Bone Shards: [shards]/[max_shards]"
. += "Shards Armor Bonus: [times_armor_buffed*armor_buff_per_fifty_shards]"

/datum/behavior_delegate/ravager_hedgehog/proc/lock_shards()

if (!bound_xeno)
return

to_chat(bound_xeno, SPAN_XENODANGER("You have shed your spikes and cannot gain any more for [shard_lock_duration/10] seconds!"))

bound_xeno.speed_modifier -= shard_lock_speed_mod
bound_xeno.recalculate_speed()

shards = 0
shards_locked = TRUE
addtimer(CALLBACK(src, PROC_REF(unlock_shards)), shard_lock_duration)

/datum/behavior_delegate/ravager_hedgehog/proc/unlock_shards()

if (!bound_xeno)
return

to_chat(bound_xeno, SPAN_XENODANGER("You feel your ability to gather shards return!"))

bound_xeno.speed_modifier += shard_lock_speed_mod
bound_xeno.recalculate_speed()
shards_locked = FALSE

// Return true if we have enough shards, false otherwise
/datum/behavior_delegate/ravager_hedgehog/proc/check_shards(amount)
if (!amount)
if(!amount)
return FALSE
else
return (shards >= amount)

/datum/behavior_delegate/ravager_hedgehog/proc/use_shards(amount)
if (!amount)
if(!amount)
return
shards = max(0, shards - amount)

/datum/behavior_delegate/ravager_hedgehog/on_life()

if (!shards_locked)
if(!HAS_TRAIT(bound_xeno, TRAIT_ABILITY_SHED_SPIKES))
shards = min(max_shards, shards + shard_gain_onlife)

var/armor_buff_count = shards/50 //0-6
Expand All @@ -110,7 +82,6 @@
bound_xeno.small_explosives_stun = TRUE
bound_xeno.remove_filter("hedge_unstunnable", 1, list("type" = "outline", "color" = "#421313", "size" = 1))


return


Expand All @@ -119,27 +90,23 @@
holder.overlays.Cut()

/datum/behavior_delegate/ravager_hedgehog/on_hitby_projectile()
if (!shards_locked)
if(!HAS_TRAIT(bound_xeno, TRAIT_ABILITY_SHED_SPIKES))
shards = min(max_shards, shards + shards_per_projectile)
return

/datum/behavior_delegate/ravager_hedgehog/melee_attack_additional_effects_self()
if (!shards_locked)
if(!HAS_TRAIT(bound_xeno, TRAIT_ABILITY_SHED_SPIKES))
shards = min(max_shards, shards + shards_per_slash)
return


/datum/action/xeno_action/onclick/spike_shield/use_ability(atom/target)
/datum/action/xeno_action/onclick/spike_shield/use_ability(atom/target_atom)
var/mob/living/carbon/xenomorph/xeno = owner

if (!action_cooldown_check())
return

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

var/datum/behavior_delegate/ravager_hedgehog/behavior = xeno.behavior_delegate
if (!behavior.check_shards(shard_cost))
if(!behavior.check_shards(shard_cost))
to_chat(xeno, SPAN_DANGER("Not enough shards! We need [shard_cost - behavior.shards] more!"))
return
behavior.use_shards(shard_cost)
Expand All @@ -148,7 +115,7 @@

// Add our shield
var/datum/xeno_shield/hedgehog_shield/shield = xeno.add_xeno_shield(shield_amount, XENO_SHIELD_SOURCE_HEDGE_RAV, /datum/xeno_shield/hedgehog_shield)
if (shield)
if(shield)
shield.owner = xeno
shield.shrapnel_amount = shield_shrapnel_amount
xeno.overlay_shields()
Expand All @@ -162,7 +129,7 @@
return ..()

/datum/action/xeno_action/onclick/spike_shield/action_cooldown_check()
if (shield_active) // If active shield, return FALSE so that this action does not get carried out
if(shield_active) // If active shield, return FALSE so that this action does not get carried out
return FALSE
else if (cooldown_timer_id == TIMER_ID_NULL)
var/mob/living/carbon/xenomorph/xeno = owner
Expand All @@ -173,14 +140,14 @@
/datum/action/xeno_action/onclick/spike_shield/proc/remove_shield()
var/mob/living/carbon/xenomorph/xeno = owner

if (!shield_active)
if(!shield_active)
return

shield_active = FALSE
button.icon_state = "template_xeno"

for (var/datum/xeno_shield/shield in xeno.xeno_shields)
if (shield.shield_source == XENO_SHIELD_SOURCE_HEDGE_RAV)
for(var/datum/xeno_shield/shield in xeno.xeno_shields)
if(shield.shield_source == XENO_SHIELD_SOURCE_HEDGE_RAV)
shield.on_removal()
qdel(shield)
break
Expand All @@ -192,28 +159,27 @@
/datum/action/xeno_action/activable/rav_spikes/use_ability(atom/affected_atom)
var/mob/living/carbon/xenomorph/xeno = owner

if (!action_cooldown_check())
if(!affected_atom || affected_atom.layer >= FLY_LAYER || !isturf(xeno.loc))
return

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

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

xeno.visible_message(SPAN_XENOWARNING("[xeno] fires their spikes at [affected_atom]!"), SPAN_XENOWARNING("We fire our spikes at [affected_atom]!"))

var/turf/target = locate(affected_atom.x, affected_atom.y, affected_atom.z)
var/turf/target_turf = 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/ammo_datum = GLOB.ammo_list[ammo_type]

projectile.generate_bullet(ammo_datum)

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

apply_cooldown()
Expand All @@ -222,7 +188,7 @@
/datum/action/xeno_action/activable/rav_spikes/action_cooldown_check()
if(!owner)
return FALSE
if (cooldown_timer_id == TIMER_ID_NULL)
if(cooldown_timer_id == TIMER_ID_NULL)
var/mob/living/carbon/xenomorph/xeno = owner
if(!istype(xeno))
return FALSE
Expand All @@ -234,18 +200,14 @@
/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 (!xeno.check_state())
return
XENO_ACTION_CHECK(xeno)

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

xeno.visible_message(SPAN_XENOWARNING("[xeno] sheds their spikes, firing them in all directions!"), SPAN_XENOWARNING("We shed our spikes, firing them in all directions!!"))
xeno.spin_circle()
Expand All @@ -256,9 +218,35 @@
return ..()

/datum/action/xeno_action/onclick/spike_shed/action_cooldown_check()
if (cooldown_timer_id == TIMER_ID_NULL)
if(cooldown_timer_id == TIMER_ID_NULL)
var/mob/living/carbon/xenomorph/xeno = owner
var/datum/behavior_delegate/ravager_hedgehog/behavior = xeno.behavior_delegate
return behavior.check_shards(shard_cost)
else
return FALSE

/datum/action/xeno_action/onclick/spike_shed/proc/lock_shards()
var/mob/living/carbon/xenomorph/xeno = owner
if(!xeno)
return

to_chat(xeno, SPAN_XENODANGER("You have shed your spikes and cannot gain any more for [shard_lock_duration/10] seconds!"))

xeno.speed_modifier -= shard_lock_speed_mod
xeno.recalculate_speed()

var/datum/behavior_delegate/ravager_hedgehog/behavior = xeno.behavior_delegate
behavior.shards = 0
ADD_TRAIT(xeno, TRAIT_ABILITY_SHED_SPIKES, TRAIT_SOURCE_ABILITY("shed_spikes"))
addtimer(CALLBACK(src, PROC_REF(unlock_shards)), shard_lock_duration)

/datum/action/xeno_action/onclick/spike_shed/proc/unlock_shards()
var/mob/living/carbon/xenomorph/xeno = owner
if(!xeno)
return

to_chat(xeno, SPAN_XENODANGER("You feel your ability to gather shards return!"))

xeno.speed_modifier += shard_lock_speed_mod
xeno.recalculate_speed()
REMOVE_TRAIT(xeno, TRAIT_ABILITY_SHED_SPIKES, TRAIT_SOURCE_ABILITY("shed_spikes"))