Skip to content

Commit

Permalink
Critical hits
Browse files Browse the repository at this point in the history
Update he.dm

adds critical hits

Update item_attack.dm

Revert "Critical hits"

This reverts commit 6e3abc0.
  • Loading branch information
Kitsunemitsu committed Feb 1, 2025
1 parent a03f647 commit 9941e64
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 3 deletions.
13 changes: 12 additions & 1 deletion code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,22 @@
/mob/living/attacked_by(obj/item/I, mob/living/user)
send_item_attack_message(I, user)
if(I.force)
var/crit_bonus = 1
var/justice_mod = 1 + (get_modified_attribute_level(user, JUSTICE_ATTRIBUTE)/100)
var/damage = I.force * justice_mod
var/crit_chance = get_modified_attribute_level(user, PRUDENCE_ATTRIBUTE)/50 //prudence is crit chance, It's a very small percentage that maxes out at 2.6%

if(prob(crit_chance * I.crit_multiplier)) //Crit multiplier is by default 1.
new /obj/effect/temp_visual/crit(get_turf(user))
crit_bonus += get_modified_attribute_level(user, FORTITUDE_ATTRIBUTE)/100 //fortitude is crit bonus damage, bonus scaling off fortitude
if(istype(I, /obj/item/ego_weapon))
var/obj/item/ego_weapon/critting = I
critting.CritEffect(src, user)

var/damage = I.force * justice_mod * crit_bonus
if(istype(I, /obj/item/ego_weapon))
var/obj/item/ego_weapon/theweapon = I
damage *= theweapon.force_multiplier

apply_damage(damage, I.damtype, white_healable = TRUE)
if(I.damtype in list(RED_DAMAGE, BLACK_DAMAGE, PALE_DAMAGE))
if(prob(33))
Expand Down
5 changes: 5 additions & 0 deletions code/game/objects/effects/temporary_visuals/miscellaneous.dm
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,11 @@
pixel_y = 0
pixel_x = -16

/obj/effect/temp_visual/crit
icon_state = "critical"
layer = ABOVE_ALL_MOB_LAYER
duration = 15

/obj/effect/temp_visual/healing
icon_state = "healing"
layer = ABOVE_ALL_MOB_LAYER
Expand Down
13 changes: 13 additions & 0 deletions code/game/objects/items/ego_weapons/_ego_weapon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
//Is there a bonus to equipping this?
var/equip_bonus = 0

//Crits are here, multiplicative chance
crit_multiplier = 1
var/crit_info

/obj/item/ego_weapon/attack(mob/living/target, mob/living/user)
if(!CanUseEgo(user))
return FALSE
Expand Down Expand Up @@ -72,6 +76,12 @@
if(reach>1)
. += span_notice("This weapon has a reach of [reach].")

if(crit_multiplier!=1)
. += span_notice("This weapon has a crit rate of [crit_multiplier]x normal.")

if(crit_info)
. += span_notice("[crit_info]")

if(throwforce>force)
. += span_notice("This weapon deals [throwforce] [damtype] damage when thrown.")

Expand Down Expand Up @@ -149,6 +159,9 @@
/obj/item/ego_weapon/proc/SpecialGearRequirements()
return

/obj/item/ego_weapon/proc/CritEffect(mob/living/target, mob/living/user)
return

/obj/item/ego_weapon/proc/EgoAttackInfo(mob/user)
if(force_multiplier != 1)
return span_notice("It deals [round(force * force_multiplier, 0.1)] [damtype] damage. (+ [(force_multiplier - 1) * 100]%)")
Expand Down
5 changes: 5 additions & 0 deletions code/game/objects/items/ego_weapons/aleph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
TEMPERANCE_ATTRIBUTE = 80,
JUSTICE_ATTRIBUTE = 100
)
crit_multiplier = 0 //No crits for you, you have the combo system.

var/combo = 0
/// Maximum world.time after which combo is reset
Expand Down Expand Up @@ -122,6 +123,7 @@
TEMPERANCE_ATTRIBUTE = 80,
JUSTICE_ATTRIBUTE = 80
)
crit_multiplier = 0 //No crits for you, you have the combo system.

var/combo = 0 // I am copy-pasting justitia "combo" system and nobody can stop me
var/combo_time
Expand Down Expand Up @@ -211,6 +213,7 @@
TEMPERANCE_ATTRIBUTE = 120,
JUSTICE_ATTRIBUTE = 120
)
crit_multiplier = 0 //It's twlilight

/obj/item/ego_weapon/twilight/attack(mob/living/M, mob/living/user)
if(!CanUseEgo(user))
Expand Down Expand Up @@ -241,6 +244,7 @@
var/goldrush_damage = 140
var/finisher_on = TRUE //this is for a subtype, it should NEVER be false on this item.
damtype = RED_DAMAGE
crit_multiplier = 0 //Can't crit anyways.

//Replaces the normal attack with the gigafuck punch
/obj/item/ego_weapon/goldrush/attack(mob/living/target, mob/living/user)
Expand Down Expand Up @@ -541,6 +545,7 @@
attack_verb_continuous = list("cuts", "attacks", "slashes")
attack_verb_simple = list("cut", "attack", "slash")
hitsound = 'sound/weapons/rapierhit.ogg'
crit_multiplier = 0 //does multi-damage
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 80,
PRUDENCE_ATTRIBUTE = 100,
Expand Down
26 changes: 25 additions & 1 deletion code/game/objects/items/ego_weapons/he.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@
desc = "The last legacy of the man who sought wisdom. The rake tilled the human brain instead of farmland."
special = "Use this weapon in your hand to damage every non-human within reach."
icon_state = "harvest"
force = 30
force = 28 //It does have an ability, and therefore needs less damage
damtype = BLACK_DAMAGE
attack_verb_continuous = list("attacks", "bashes", "tills")
attack_verb_simple = list("attack", "bash", "till")
hitsound = 'sound/weapons/ego/harvest.ogg'
attribute_requirements = list(
PRUDENCE_ATTRIBUTE = 40
)
crit_multiplier = 1.6 //it DOES crit more often however
var/can_spin = TRUE
var/spinning = FALSE

Expand Down Expand Up @@ -93,6 +94,7 @@
FORTITUDE_ATTRIBUTE = 40
)
var/rage = FALSE
crit_multiplier = 2 //has a crit effect.

/obj/item/ego_weapon/fury/attack(mob/living/target, mob/living/carbon/human/user)
var/living = FALSE
Expand Down Expand Up @@ -125,12 +127,30 @@
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 40
)
crit_multiplier = 3 //Give a better crit chance.

//ATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATAT
/obj/item/ego_weapon/paw/melee_attack_chain(mob/user, atom/target, params)
..()
hitsound = "sound/weapons/punch[pick(1,2,3,4)].ogg"

/obj/item/ego_weapon/paw/CritEffect(mob/living/target, mob/living/carbon/human/user)
for(var/turf/T in orange(1, user))
new /obj/effect/temp_visual/smash_effect(T)

for(var/mob/living/L in range(1, user))
var/aoe = force
var/userjust = (get_modified_attribute_level(user, JUSTICE_ATTRIBUTE))
var/justicemod = 1 + userjust/100
aoe*=force_multiplier
aoe*=justicemod
if(L == user || ishuman(L))
continue
L.apply_damage(aoe, RED_DAMAGE, null, L.run_armor_check(null, BLACK_DAMAGE), spread_damage = TRUE)




/obj/item/ego_weapon/shield/daredevil
name = "life for a daredevil"
desc = "An ancient sword surrounded in death, yet it's having it in your grasp that makes you feel the most alive."
Expand Down Expand Up @@ -234,6 +254,7 @@
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 40
)

/obj/item/ego_weapon/logging
name = "logging"
desc = "A versatile equipment made to cut down trees and people alike."
Expand Down Expand Up @@ -491,6 +512,7 @@
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 40
)
crit_multiplier = 3 //Knives get better crit.

/obj/item/ego_weapon/mini/alleyway
name = "alleyway"
Expand All @@ -505,6 +527,7 @@
attribute_requirements = list(
PRUDENCE_ATTRIBUTE = 40
)
crit_multiplier = 3 //Knives get better crit.

/obj/item/ego_weapon/shield/giant
name = "giant"
Expand Down Expand Up @@ -937,6 +960,7 @@
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 40
)
crit_multiplier = 2//Double crits

/obj/item/ego_weapon/sanguine/attack(mob/living/target, mob/living/carbon/human/user)
if(!CanUseEgo(user))
Expand Down
8 changes: 7 additions & 1 deletion code/game/objects/items/ego_weapons/teth.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
attack_verb_continuous = list("pokes", "jabs", "tears", "lacerates", "gores")
attack_verb_simple = list("poke", "jab", "tear", "lacerate", "gore")
hitsound = 'sound/weapons/ego/spear1.ogg'
crit_multiplier = 1.5 //Slightly better crits because I feel bad about it

/obj/item/ego_weapon/shield/lutemia
name = "dear lutemia"
Expand All @@ -40,6 +41,7 @@
force = 22
attack_speed = 1
damtype = WHITE_DAMAGE
crit_multiplier = 1.7
attack_verb_continuous = list("pokes", "jabs", "tears", "lacerates", "gores")
attack_verb_simple = list("poke", "jab", "tear", "lacerate", "gore")
hitsound = 'sound/weapons/ego/spear1.ogg'
Expand Down Expand Up @@ -107,6 +109,7 @@
special = "Upon throwing, this weapon returns to the user."
icon_state = "blossoms"
force = 17
crit_multiplier = 1.7
throwforce = 30
throw_speed = 1
throw_range = 7
Expand All @@ -129,6 +132,7 @@
icon_state = "cute"
force = 13
attack_speed = 0.5
crit_multiplier = 2
damtype = RED_DAMAGE
hitsound = 'sound/weapons/slashmiss.ogg'

Expand All @@ -137,6 +141,7 @@
desc = "Imagination is the only weapon in the war with reality."
icon_state = "trick"
force = 16
crit_multiplier = 2
throwforce = 35 //You can only hold 4 so go nuts.
throw_speed = 5
throw_range = 7
Expand Down Expand Up @@ -451,6 +456,7 @@
attack_verb_continuous = list("slices", "slashes", "stabs")
attack_verb_simple = list("slice", "slash", "stab")
hitsound = 'sound/weapons/fixer/generic/knife2.ogg'
crit_multiplier = 0 //This weapon doesn't have crits because of poise being better crits.
var/poise = 0

/obj/item/ego_weapon/mini/fourleaf_clover/examine(mob/user)
Expand Down Expand Up @@ -523,7 +529,7 @@
name = "sanitizer"
desc = "It's very shocking."
icon_state = "sanitizer"
force = 35 //Still less DPS, replaces baseball bat?
force = 35
attack_speed = 1.6
damtype = BLACK_DAMAGE
knockback = KNOCKBACK_LIGHT
Expand Down
13 changes: 13 additions & 0 deletions code/game/objects/items/ego_weapons/waw.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
attribute_requirements = list(
JUSTICE_ATTRIBUTE = 80
)
crit_multiplier = 1.5 //Rapier, little better crits
var/combo = 0
var/combo_time
var/combo_wait = 10
Expand Down Expand Up @@ -108,6 +109,7 @@
FORTITUDE_ATTRIBUTE = 80
)
var/charged = FALSE
crit_multiplier = 0.7 //Less crits for you.

/obj/item/ego_weapon/totalitarianism/attack(mob/living/M, mob/living/user)
..()
Expand Down Expand Up @@ -137,6 +139,7 @@
attribute_requirements = list(
PRUDENCE_ATTRIBUTE = 80
)
crit_multiplier = 1.5 //Slightly better crits
var/charged = FALSE
var/meter = 0
var/meter_counter = 1
Expand Down Expand Up @@ -226,6 +229,7 @@
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 80
)
crit_multiplier = 1.8 //better crits

var/combo = 1
var/combo_time
Expand Down Expand Up @@ -464,6 +468,7 @@
attribute_requirements = list(
PRUDENCE_ATTRIBUTE = 60
)
crit_multiplier = 2.3 //Also better crits
var/hit_count = 0
var/max_count = 16
var/special_cost = 4
Expand Down Expand Up @@ -639,6 +644,7 @@
TEMPERANCE_ATTRIBUTE = 60,
PRUDENCE_ATTRIBUTE = 60
)
crit_multiplier = 2.4

var/combo_on = TRUE
var/sound = FALSE
Expand Down Expand Up @@ -715,6 +721,7 @@
TEMPERANCE_ATTRIBUTE = 60,
PRUDENCE_ATTRIBUTE = 60
)
crit_multiplier = 2.4

var/combo_on = TRUE
var/sound = FALSE
Expand Down Expand Up @@ -876,6 +883,7 @@
attribute_requirements = list(
TEMPERANCE_ATTRIBUTE = 80
)
crit_multiplier = 1.5

/obj/item/ego_weapon/moonlight/attack_self(mob/user)
. = ..()
Expand Down Expand Up @@ -912,6 +920,7 @@
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 80
)
crit_multiplier = 1.5

/obj/item/ego_weapon/heaven/get_clamped_volume()
return 25
Expand Down Expand Up @@ -957,6 +966,7 @@
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 80
)
crit_multiplier = 1.2 //Rapier, better crits

/obj/item/ego_weapon/dipsia/attack(mob/living/target, mob/living/carbon/human/user)
if(!CanUseEgo(user))
Expand Down Expand Up @@ -1125,6 +1135,7 @@
damtype = PALE_DAMAGE
var/mark_damage
var/mark_type = RED_DAMAGE
crit_multiplier = 1.5

//Replaces the normal attack with a mark
/obj/item/ego_weapon/mini/infinity/attack(mob/living/target, mob/living/user)
Expand Down Expand Up @@ -1540,6 +1551,7 @@
FORTITUDE_ATTRIBUTE = 60,
TEMPERANCE_ATTRIBUTE = 60
)
crit_multiplier = 2

/obj/item/ego_weapon/cobalt/attack(mob/living/target, mob/living/user)
if(!..())
Expand Down Expand Up @@ -1675,6 +1687,7 @@
FORTITUDE_ATTRIBUTE = 60,
JUSTICE_ATTRIBUTE = 60
)
crit_multiplier = 1.2

/obj/item/ego_weapon/charge/warring/Initialize()
..()
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
var/set_obj_flags // ONLY FOR MAPPING: Sets flags from a string list, handled in Initialize. Usage: set_obj_flags = "EMAGGED;!CAN_BE_HIT" to set EMAGGED and clear CAN_BE_HIT.

var/damtype = RED_DAMAGE
var/crit_multiplier = 0
var/force = 0

/// How good a given object is at causing wounds on carbons. Higher values equal better shots at creating serious wounds.
Expand Down
Binary file modified icons/effects/effects.dmi
Binary file not shown.

0 comments on commit 9941e64

Please sign in to comment.