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 aa7d4b8 commit 1ff1efd
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 5 deletions.
13 changes: 13 additions & 0 deletions ModularTegustation/ego_weapons/_ego_weapon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
//How long do you stun on hit?
var/stuntime = 0

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

/obj/item/ego_weapon/Initialize()
. = ..()
if(swingstyle == WEAPONSWING_SMALLSWEEP && reach > 1)
Expand Down Expand Up @@ -97,6 +101,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 @@ -193,6 +203,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 ModularTegustation/ego_weapons/melee/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 @@ -123,6 +124,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 @@ -215,6 +217,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 @@ -245,6 +248,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 @@ -553,6 +557,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 ModularTegustation/ego_weapons/melee/he.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
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 = 25
force = 28 //It does have an ability, and therefore needs less damage
damtype = BLACK_DAMAGE
swingstyle = WEAPONSWING_LARGESWEEP
attack_verb_continuous = list("attacks", "bashes", "tills")
Expand All @@ -42,6 +42,7 @@
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 @@ -94,6 +95,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 @@ -127,12 +129,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 @@ -238,6 +258,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 @@ -497,6 +518,7 @@
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 40
)
crit_multiplier = 3 //Knives get better crit.

/obj/item/ego_weapon/mini/alleyway
name = "alleyway"
Expand All @@ -512,6 +534,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 @@ -955,6 +978,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
10 changes: 8 additions & 2 deletions ModularTegustation/ego_weapons/melee/teth.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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 @@ -42,6 +43,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 @@ -109,7 +111,8 @@
desc = "The flesh cleanly cut by a sharp tool creates a grotesque pattern with the bloodstains on the suit."
special = "Upon throwing, this weapon returns to the user."
icon_state = "blossoms"
force = 19 //Slight damage boost due to it being from Cherry Tree
force = 17
crit_multiplier = 1.7
throwforce = 30
throw_speed = 1
throw_range = 7
Expand All @@ -132,6 +135,7 @@
icon_state = "cute"
force = 13
attack_speed = 0.5
crit_multiplier = 2
damtype = RED_DAMAGE
swingstyle = WEAPONSWING_LARGESWEEP
hitsound = 'sound/weapons/slashmiss.ogg'
Expand All @@ -142,6 +146,7 @@
icon_state = "trick"
force = 15
swingstyle = WEAPONSWING_LARGESWEEP
crit_multiplier = 2
throwforce = 35 //You can only hold 4 so go nuts.
throw_speed = 5
throw_range = 7
Expand Down Expand Up @@ -458,6 +463,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 @@ -530,7 +536,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 ModularTegustation/ego_weapons/melee/waw.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,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 @@ -110,6 +111,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 @@ -140,6 +142,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 @@ -230,6 +233,7 @@
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 80
)
crit_multiplier = 1.8 //better crits

var/combo = 1
var/combo_time
Expand Down Expand Up @@ -495,6 +499,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 @@ -670,6 +675,7 @@
TEMPERANCE_ATTRIBUTE = 60,
PRUDENCE_ATTRIBUTE = 60
)
crit_multiplier = 2.4

var/dash_cooldown
var/dash_cooldown_time = 4 SECONDS
Expand Down Expand Up @@ -729,6 +735,7 @@
TEMPERANCE_ATTRIBUTE = 60,
PRUDENCE_ATTRIBUTE = 60
)
crit_multiplier = 2.4

var/dash_cooldown
var/dash_cooldown_time = 4 SECONDS
Expand Down Expand Up @@ -874,6 +881,7 @@
attribute_requirements = list(
TEMPERANCE_ATTRIBUTE = 80
)
crit_multiplier = 1.5

/obj/item/ego_weapon/moonlight/attack_self(mob/user)
. = ..()
Expand Down Expand Up @@ -910,6 +918,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 @@ -1127,6 +1137,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 @@ -1545,6 +1556,7 @@
FORTITUDE_ATTRIBUTE = 60,
TEMPERANCE_ATTRIBUTE = 60
)
crit_multiplier = 2

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

charge = TRUE
ability_type = ABILITY_UNIQUE
Expand Down
17 changes: 15 additions & 2 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,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
damage *= I.force_multiplier
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
18 changes: 18 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,24 @@
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
duration = 8

/obj/effect/temp_visual/healing/Initialize(mapload)
. = ..()
pixel_x = rand(-12, 12)
pixel_y = rand(-9, 0)

/obj/effect/temp_visual/healing/no_dam
icon_state = "no_dam"

/obj/effect/temp_visual/pale_eye_attack
name = "pale particles"
icon_state = "ion_fade_flight"
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 1ff1efd

Please sign in to comment.