Melee Stagger (#11443)

* combat refactoring

* i hate this

* mobility flags part 2 time xd

* whew

* stuff

* a

* ok

* changes

* Wew

* k

* add flags

* FUCKYOUVORE

* fixes

* typo

* no using this in hard stamcrit

* update icon

* woopsy

* . = ..()

* sigh

* Update living_combat.dm

* wew

* wups

* fix

* wack

* animation is now shorter

* linter save me

* i hate you

* k

* k

* k

* i hate you

* wrong button

* k

* ok

* bet

* bet

* bet

* Update item_attack.dm

* k

* Update code/modules/mob/living/living_combat.dm

Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com>

* Update code/modules/mob/living/living_combat.dm

Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com>

* Update code/modules/mob/living/living_combat.dm

Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com>

* early returns

* skreee

* agony

* k

* k

* k

* k

* wack

* compile

* wack

* fix

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
kevinz000
2020-03-25 10:37:39 -07:00
committed by GitHub
parent 66c3f6e1be
commit cbb5d52ca1
8 changed files with 40 additions and 2 deletions
+29 -1
View File
@@ -50,7 +50,6 @@
user.changeNext_move(CLICK_CD_MELEE)
return I.attack(src, user)
/obj/item/proc/attack(mob/living/M, mob/living/user)
if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, M, user) & COMPONENT_ITEM_NO_ATTACK)
return
@@ -117,6 +116,7 @@
if(user != src && check_shields(I, totitemdamage, "the [I.name]", MELEE_ATTACK, I.armour_penetration))
return FALSE
send_item_attack_message(I, user)
I.do_stagger_action(src, user)
if(I.force)
apply_damage(totitemdamage, I.damtype) //CIT CHANGE - replaces I.force with totitemdamage
if(I.damtype == BRUTE && !HAS_TRAIT(src, TRAIT_NOMARROW))
@@ -166,5 +166,33 @@
playsound(src, 'sound/weapons/dink.ogg', 30, 1)
return 1
/// How much stamina this takes to swing this is not for realism purposes hecc off.
/obj/item/proc/getweight()
return total_mass || w_class * 1.25
/// How long this staggers for. 0 and negatives supported.
/obj/item/proc/melee_stagger_duration()
if(!isnull(stagger_force))
return stagger_force
/// totally not an untested, arbitrary equation.
return clamp((1.5 + (w_class/7.5)) * (force / 2), 0, 10 SECONDS)
/obj/item/proc/do_stagger_action(mob/living/target, mob/living/user)
if(!CHECK_BITFIELD(target.status_flags, CANSTAGGER))
return FALSE
if(target.combat_flags & COMBAT_FLAG_SPRINT_ACTIVE)
target.do_staggered_animation()
var/duration = melee_stagger_duration()
if(!duration) //0
return FALSE
else if(duration > 0)
target.Stagger(duration)
else //negative
target.AdjustStaggered(duration)
return TRUE
/mob/proc/do_staggered_animation()
set waitfor = FALSE
animate(src, pixel_x = -2, pixel_y = -2, time = 1, flags = ANIMATION_RELATIVE | ANIMATION_PARALLEL)
animate(pixel_x = 4, pixel_y = 4, time = 1, flags = ANIMATION_RELATIVE)
animate(pixel_x = -2, pixel_y = -2, time = 0.5, flags = ANIMATION_RELATIVE)