Skip to content

Commit

Permalink
add: added cursed katana from TG (restored version) (ss220-space#4660)
Browse files Browse the repository at this point in the history
* fuuu

* fixes stuff

* restore

* unnecessary args remove pt1

* double retract remove

* ref: move combos into component

* some adds

---------

Co-authored-by: NightDawnFox <[email protected]>
  • Loading branch information
Rerik007 and NightDawnFox authored Apr 23, 2024
1 parent 5688e21 commit 7393fb4
Show file tree
Hide file tree
Showing 15 changed files with 379 additions and 12 deletions.
7 changes: 7 additions & 0 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,10 @@
#define COMSIG_AUTOFIRE_SHOT "autofire_shot"
#define COMPONENT_AUTOFIRE_SHOT_SUCCESS (1<<0)

#define HELP_SLASH "Help"
#define DISARM_SLASH "Disarm"
#define GRAB_SLASH "Grab"
#define HARM_SLASH "Harm"

#define COMBO_STEPS "steps"
#define COMBO_PROC "proc"
2 changes: 2 additions & 0 deletions code/__DEFINES/status_effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@

#define STATUS_EFFECT_SAWBLEED /datum/status_effect/saw_bleed //if the bleed builds up enough, takes a ton of damage

#define STATUS_EFFECT_BLOODLETTING /datum/status_effect/saw_bleed/bloodletting //nerfed version

#define STATUS_EFFECT_STAMINADOT /datum/status_effect/stamina_dot

#define STATUS_EFFECT_BLUESPACESLOWDOWN /datum/status_effect/bluespace_slowdown //Halfs victims next move modifier
Expand Down
13 changes: 13 additions & 0 deletions code/__HELPERS/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1038,3 +1038,16 @@ proc/dd_sortedObjectList(list/incoming)
/proc/sort_list(list/list_to_sort, cmp = /proc/cmp_text_asc)
return sortTim(list_to_sort.Copy(), cmp)

///compare two lists, returns TRUE if they are the same
/proc/compare_list(list/l, list/d)
if(!islist(l) || !islist(d))
return FALSE

if(length(l) != length(d))
return FALSE

for(var/i in 1 to length(l))
if(l[i] != d[i])
return FALSE

return TRUE
5 changes: 3 additions & 2 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
return TRUE
return I.attack(src, user)

/obj/item/proc/attack(mob/living/target, mob/living/user, def_zone)
/obj/item/proc/attack(mob/living/target, mob/living/user, def_zone, add_melee_cooldown = TRUE)
if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, target, user) & COMPONENT_CANCEL_ATTACK_CHAIN)
return TRUE
SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, target, user)
Expand All @@ -68,7 +68,8 @@
target.lastattacker = user.real_name
target.lastattackerckey = user.ckey

user.changeNext_move(CLICK_CD_MELEE)
if(add_melee_cooldown)
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(target)
. = target.attacked_by(src, user, def_zone)

Expand Down
98 changes: 98 additions & 0 deletions code/datums/components/combo_attacks.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/datum/component/combo_attacks
/// Length of combo we allow before resetting.
var/max_combo_length
/// Message when the combo is reset.
var/reset_message
/// ID for the reset combo timer.
var/timerid
/// How much time before the combo resets.
var/leniency_time
/// List of inputs done by user.
var/list/input_list = list()
/// Associative list of all the combo moves. Name of Attack = list(COMBO_STEPS = list(Steps made of HARM_SLASH and DISARM_SLASH), COMBO_PROC = PROC_REF(Proc Name))
var/list/combo_list = list()
/// A list of strings containing the ways to do combos, for examines.
var/list/combo_strings = list()
/// A callback to the proc that checks whether or not we can do combo attacks.
var/datum/callback/can_attack_callback

/datum/component/combo_attacks/Initialize(combos, reset_message, max_combo_length, leniency_time = 5 SECONDS, can_attack_callback)
if(!isitem(parent))
return COMPONENT_INCOMPATIBLE
combo_list = combos
for(var/combo in combo_list)
var/list/combo_specifics = combo_list[combo]
var/step_string = english_list(combo_specifics[COMBO_STEPS])
combo_strings += span_notice("<b>[combo]</b> - [step_string]")
src.reset_message = reset_message
src.max_combo_length = max_combo_length
src.leniency_time = leniency_time
src.can_attack_callback = can_attack_callback

/datum/component/combo_attacks/Destroy(force)
can_attack_callback = null
return ..()

/datum/component/combo_attacks/RegisterWithParent()
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, PROC_REF(on_examine))
RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, PROC_REF(on_attack_self))
RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(on_drop))
RegisterSignal(parent, COMSIG_ITEM_ATTACK, PROC_REF(on_attack))

/datum/component/combo_attacks/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_PARENT_EXAMINE, COMSIG_ITEM_ATTACK_SELF, COMSIG_ITEM_DROPPED, COMSIG_ITEM_ATTACK))

/datum/component/combo_attacks/proc/on_examine(datum/source, mob/user, list/examine_list)
SIGNAL_HANDLER

examine_list += combo_strings

/datum/component/combo_attacks/proc/on_attack_self(obj/item/source, mob/user)
SIGNAL_HANDLER

reset_inputs(user, deltimer = TRUE)

/datum/component/combo_attacks/proc/on_drop(datum/source, mob/dropper)
SIGNAL_HANDLER

reset_inputs(user = null, deltimer = TRUE)

/datum/component/combo_attacks/proc/check_input(mob/living/target, mob/user)
for(var/combo in combo_list)
var/list/combo_specifics = combo_list[combo]
if(compare_list(input_list, combo_specifics[COMBO_STEPS]))
INVOKE_ASYNC(parent, combo_specifics[COMBO_PROC], target, user)
return TRUE
return FALSE

/datum/component/combo_attacks/proc/reset_inputs(mob/user, deltimer)
input_list.Cut()
if(user)
to_chat(user, reset_message)
if(deltimer && timerid)
deltimer(timerid)

/datum/component/combo_attacks/proc/on_attack(datum/source, mob/living/target, mob/user)
SIGNAL_HANDLER

if(can_attack_callback && !can_attack_callback.Invoke(user, target))
return NONE
if(HAS_TRAIT(user, TRAIT_PACIFISM))
return NONE
switch(user.a_intent)
if(INTENT_HELP)
input_list += HELP_SLASH
if(INTENT_DISARM)
input_list += DISARM_SLASH
if(INTENT_GRAB)
input_list += GRAB_SLASH
if(INTENT_HARM)
input_list += HARM_SLASH
if(length(input_list) > max_combo_length)
reset_inputs(user, deltimer = TRUE)
if(check_input(target, user))
reset_inputs(user = null, deltimer = TRUE)
return COMPONENT_CANCEL_ATTACK_CHAIN
if(leniency_time)
timerid = addtimer(CALLBACK(src, PROC_REF(reset_inputs), user, FALSE), leniency_time, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_STOPPABLE)
return NONE
14 changes: 10 additions & 4 deletions code/datums/status_effects/buffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,24 @@

/datum/status_effect/void_price
id = "void_price"
duration = 300
tick_interval = 30
duration = 30 SECONDS
tick_interval = 3 SECONDS
alert_type = /obj/screen/alert/status_effect/void_price
/// This is how much hp you lose per tick. Each time the buff is refreshed, it increased by 1. Healing too much in a short period of time will cause your swift demise
var/price = 3

/obj/screen/alert/status_effect/void_price
name = "Void Price"
desc = "Black tendrils cinch tightly against you, digging wicked barbs into your flesh."
icon_state = "shadow_mend"

/datum/status_effect/void_price/tick()
playsound(owner, 'sound/weapons/bite.ogg', 50, 1)
owner.adjustBruteLoss(3)
playsound(owner, 'sound/weapons/bite.ogg', 50, TRUE)
owner.adjustBruteLoss(price)

/datum/status_effect/void_price/refresh()
price++
return ..()

/datum/status_effect/blooddrunk
id = "blooddrunk"
Expand Down
9 changes: 8 additions & 1 deletion code/datums/status_effects/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
var/delay_before_decay = 5
var/bleed_damage = 200
var/needs_to_bleed = FALSE
var/bleed_cap = 10

/datum/status_effect/saw_bleed/Destroy()
if(owner)
Expand Down Expand Up @@ -128,7 +129,7 @@
owner.underlays -= bleed_underlay
bleed_amount += amount
if(bleed_amount)
if(bleed_amount >= 10)
if(bleed_amount >= bleed_cap)
needs_to_bleed = TRUE
qdel(src)
else
Expand All @@ -152,6 +153,12 @@
else
new /obj/effect/temp_visual/bleed(get_turf(owner))

/datum/status_effect/saw_bleed/bloodletting
id = "bloodletting"
bleed_cap = 7
bleed_damage = 25 //Seems weak (it is) but it also works on humans and bypasses armor SOOOO
bleed_amount = 6

/datum/status_effect/stamina_dot
id = "stamina_dot"
duration = 130
Expand Down
2 changes: 0 additions & 2 deletions code/game/objects/items/weapons/weaponry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@
resistance_flags = FIRE_PROOF
needs_permit = TRUE

/obj/item/katana/cursed
slot_flags = null

/obj/item/katana/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is slitting [user.p_their()] stomach open with [src]! It looks like [user.p_theyre()] trying to commit seppuku.</span>")
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/lavaland/katana_grave.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
icon = 'icons/obj/lavaland/misc.dmi'
icon_state = "grave_katana"
anchored = TRUE
var/obj/item/dropping_item = /obj/item/katana/cursed
var/obj/item/dropping_item = /obj/item/organ/internal/cyberimp/arm/katana //fix

/obj/structure/katana_grave/attack_hand(mob/user)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mining/abandonedcrates.dm
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
new /obj/item/gun/projectile/automatic/pistol(src)
new /obj/item/ammo_box/magazine/m10mm(src)
if(98)
new /obj/item/katana/cursed(src)
new /obj/item/organ/internal/cyberimp/arm/katana(src)
if(99)
new /obj/item/storage/belt/champion(src)
new /obj/item/clothing/mask/luchador(src)
Expand Down
Loading

0 comments on commit 7393fb4

Please sign in to comment.