Skip to content

Commit

Permalink
Merge pull request #3609 from TalkingCactus/DPS
Browse files Browse the repository at this point in the history
displays DPS alongside the regular damage when examining a weapon's stats
  • Loading branch information
Tk420634 authored Oct 27, 2023
2 parents 292e93c + 3634666 commit 6811262
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
10 changes: 10 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -549,3 +549,13 @@ GLOBAL_LIST_INIT(pda_reskins, list(PDA_SKIN_CLASSIC = 'icons/obj/pda.dmi'))
#define SHOES_KNOTTED 2

#define WANTED_FILE "wanted_message.json"



//Maximum weight allowed for dual wielding.
#define DUAL_WIELDING_MAX_WEIGHT_ALLOWED WEIGHT_CLASS_NORMAL

#define DUAL_WIELDING_FALLBACK_FORCE 0.66
#define DUAL_WIELDING_AGILE_FORCE 0.75
#define DUAL_WIELDING_ENCUMBERED_FORCE 0.50
#define DUAL_WIELDING_SPEED_DIVIDER 3
24 changes: 18 additions & 6 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
if(!special_transform && transform != initial(transform))
special_transform = transform

/// CB Dual Wielding
if(force != 0)
if(w_class < DUAL_WIELDING_MAX_WEIGHT_ALLOWED)
dual_wielded_mult = DUAL_WIELDING_AGILE_FORCE
else if(w_class >= DUAL_WIELDING_MAX_WEIGHT_ALLOWED)
dual_wielded_mult = DUAL_WIELDING_ENCUMBERED_FORCE

/obj/item/Destroy()
item_flags &= ~DROPDEL //prevent reqdels
if(ismob(loc))
Expand Down Expand Up @@ -347,16 +354,21 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
. = ..()

if(href_list["list_melee"])
var/InitialF = initial(force)
var/InitialFW = initial(force_wielded)
var/InitialFUW = initial(force_unwielded)
var/InitialAS = initial(attack_speed)
//dual_wield_mult is funky, don't instantiate it
var/list/readout = list("<span class='notice'><u><b>MELEE STATISTICS</u></b>")
if(force_unwielded > 0)
readout += "\nONE HANDED [force_unwielded]"
readout += "\nTWO HANDED [force_wielded]"
readout += "\nDUAL WIELD [force_unwielded*dual_wielded_mult]"
readout += "\nONE HANDED [InitialFUW] | (DPS [round(InitialFUW * (10/InitialAS), 0.1)])"
readout += "\nTWO HANDED [InitialFW] | (DPS [round(InitialFW * (10/InitialAS), 0.1)])"
readout += "\nDUAL WIELD [InitialFUW * dual_wielded_mult] | (DPS [round((InitialFUW * dual_wielded_mult) * (10/(InitialAS / DUAL_WIELDING_SPEED_DIVIDER)), 0.1)])"
else
readout += "\nDAMAGE [force]"
readout += "\nDUAL WIELD [force*dual_wielded_mult]"
readout += "\nDAMAGE [InitialF] | (DPS [round(InitialF * (10/InitialAS), 0.1)])"
readout += "\nDUAL WIELD [InitialF * dual_wielded_mult] | (DPS [round((InitialF * dual_wielded_mult) * (10/(InitialAS / DUAL_WIELDING_SPEED_DIVIDER)), 0.1)])"
readout += "\nTHROW DAMAGE [throwforce]"
readout += "\nATTACKS / SECOND [10 / attack_speed]"
readout += "\nATTACKS / SECOND [round(10 / InitialAS, 0.1)] | DUAL WIELD [round(10/(InitialAS / DUAL_WIELDING_SPEED_DIVIDER), 0.1)]"
readout += "\nBLOCK CHANCE [block_chance]"
readout += "</span>"

Expand Down
9 changes: 0 additions & 9 deletions modular_coyote/eris/code/dual_wielding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
//leonzrygin, yell at me
//<--

//Maximum weight allowed for dual wielding.
#define DUAL_WIELDING_MAX_WEIGHT_ALLOWED WEIGHT_CLASS_NORMAL

#define DUAL_WIELDING_FALLBACK_FORCE 0.66
#define DUAL_WIELDING_AGILE_FORCE 0.75
#define DUAL_WIELDING_ENCUMBERED_FORCE 0.50
#define DUAL_WIELDING_SPEED_DIVIDER 3


/obj/item
var/is_dual_wielded = FALSE
var/sound_dualwield_start = 'sound/weapons/blade_unsheathing.ogg'
Expand Down
10 changes: 2 additions & 8 deletions modular_coyote/eris/code/wielding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,8 @@
return
else if(I && J) //Dual wielding starts here, see {dual_wielding.dm}
if(I.force != 0 || J.force != 0) //at least one of these two item needs to be dangerous
if( (I.w_class <= DUAL_WIELDING_MAX_WEIGHT_ALLOWED && J.w_class < DUAL_WIELDING_MAX_WEIGHT_ALLOWED) || \
(I.w_class < DUAL_WIELDING_MAX_WEIGHT_ALLOWED && J.w_class <= DUAL_WIELDING_MAX_WEIGHT_ALLOWED))
attempt_dual_wield(usr, I, J, DUAL_WIELDING_AGILE_FORCE) //actually initiate dual wielding!
return
if(I.w_class <= DUAL_WIELDING_MAX_WEIGHT_ALLOWED && J.w_class <= DUAL_WIELDING_MAX_WEIGHT_ALLOWED)
attempt_dual_wield(usr, I, J, DUAL_WIELDING_ENCUMBERED_FORCE) //actually initiate dual wielding! but for wielding 2 swords we are doing less damage
return

attempt_dual_wield(usr, I, J, min(I.dual_wielded_mult, J.dual_wielded_mult)) //actually initiate dual wielding! uses the worst damage multiplier between your two weapons
return
I.attempt_wield(src)

/obj/item/proc/unwield(mob/living/user)
Expand Down

0 comments on commit 6811262

Please sign in to comment.