Skip to content

Commit

Permalink
block update
Browse files Browse the repository at this point in the history
  • Loading branch information
Blundir committed Jul 23, 2024
1 parent 1030a20 commit c41b225
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
14 changes: 14 additions & 0 deletions code/game/objects/effects/temporary_visuals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,17 @@
transform = matrix().Scale(32 / 1024, 32 / 1024)
animate(src, time = 0.5 * radius * speed, transform=matrix().Scale((32 / 1024) * radius * 1.5, (32 / 1024) * radius * 1.5), easing = easing_type)

//------------------------------------------
//Block
//------------------------------------------

/obj/effect/temp_visual/block //color is white by default, set to whatever is needed
name = "blocking glow"
icon_state = "block"
color = COLOR_YELLOW
duration = 6.7

/obj/effect/temp_visual/block/Initialize(mapload)
. = ..()
pixel_x = rand(-12, 12)
pixel_y = rand(-9, 0)
10 changes: 10 additions & 0 deletions code/modules/mob/living/carbon/human/human_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ Contains most of the procs that are called when a mob is attacked by something
return FALSE

/mob/living/carbon/human/proc/check_shields(damage = 0, attack_text = "the attack", combistick=0)
var/block_effect = /obj/effect/temp_visual/block
var/owner_turf = get_turf(src)
if(l_hand && istype(l_hand, /obj/item/weapon))//Current base is the prob(50-d/3)
if(combistick && istype(l_hand,/obj/item/weapon/yautja/combistick) && prob(66))
var/obj/item/weapon/yautja/combistick/C = l_hand
Expand All @@ -110,12 +112,16 @@ Contains most of the procs that are called when a mob is attacked by something
shield_blocked_l = TRUE

if(shield_blocked_l)
new block_effect(owner_turf)
playsound(src, 'sound/items/block_shield.ogg', 70, vary = TRUE)
visible_message(SPAN_DANGER("<B>[src] blocks [attack_text] with the [l_hand.name]!</B>"), null, null, 5)
return TRUE
// We cannot return FALSE on fail here, because we haven't checked r_hand yet. Dual-wielding shields perhaps!

var/obj/item/weapon/I = l_hand
if(I.IsShield() && !istype(I, /obj/item/weapon/shield) && (prob(50 - floor(damage / 3)))) // 'other' shields, like predweapons. Make sure that item/weapon/shield does not apply here, no double-rolls.
new block_effect(owner_turf)
playsound(src, 'sound/items/parry.ogg', 70, vary = TRUE)
visible_message(SPAN_DANGER("<B>[src] blocks [attack_text] with the [l_hand.name]!</B>"), null, null, 5)
return TRUE

Expand All @@ -135,11 +141,15 @@ Contains most of the procs that are called when a mob is attacked by something
shield_blocked_r = TRUE

if(shield_blocked_r)
new block_effect(owner_turf)
playsound(src, 'sound/items/block_shield.ogg', 70, vary = TRUE)
visible_message(SPAN_DANGER("<B>[src] blocks [attack_text] with the [r_hand.name]!</B>"), null, null, 5)
return TRUE

var/obj/item/weapon/I = r_hand
if(I.IsShield() && !istype(I, /obj/item/weapon/shield) && (prob(50 - floor(damage / 3)))) // other shields. Don't doublecheck activable here.
new block_effect(owner_turf)
playsound(src, 'sound/items/parry.ogg', 70, vary = TRUE)
visible_message(SPAN_DANGER("<B>[src] blocks [attack_text] with the [r_hand.name]!</B>"), null, null, 5)
return TRUE

Expand Down
3 changes: 0 additions & 3 deletions code/modules/mob/living/carbon/xenomorph/attack_alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
if(check_shields(0, attacking_xeno.name)) // Blocking check
attacking_xeno.visible_message(SPAN_DANGER("[attacking_xeno]'s grab is blocked by [src]'s shield!"), \
SPAN_DANGER("Our grab was blocked by [src]'s shield!"), null, 5, CHAT_TYPE_XENO_COMBAT)
playsound(loc, 'sound/weapons/alien_claw_block.ogg', 25, 1) //Feedback
return XENO_ATTACK_ACTION

if(Adjacent(attacking_xeno)) //Logic!
Expand Down Expand Up @@ -64,7 +63,6 @@
if(check_shields(0, attacking_xeno.name)) // Blocking check
attacking_xeno.visible_message(SPAN_DANGER("[attacking_xeno]'s slash is blocked by [src]'s shield!"), \
SPAN_DANGER("Our slash is blocked by [src]'s shield!"), null, 5, CHAT_TYPE_XENO_COMBAT)
playsound(loc, 'sound/weapons/alien_claw_block.ogg', 25, 1) //Feedback
return XENO_ATTACK_ACTION

//From this point, we are certain a full attack will go out. Calculate damage and modifiers
Expand Down Expand Up @@ -186,7 +184,6 @@
if(check_shields(0, attacking_xeno.name)) // Blocking check
attacking_xeno.visible_message(SPAN_DANGER("[attacking_xeno]'s tackle is blocked by [src]'s shield!"), \
SPAN_DANGER("We tackle is blocked by [src]'s shield!"), null, 5, CHAT_TYPE_XENO_COMBAT)
playsound(loc, 'sound/weapons/alien_claw_block.ogg', 25, 1) //Feedback
return XENO_ATTACK_ACTION
attacking_xeno.flick_attack_overlay(src, "disarm")

Expand Down
Binary file modified icons/effects/effects.dmi
Binary file not shown.
Binary file added sound/items/block_shield.ogg
Binary file not shown.
Binary file added sound/items/parry.ogg
Binary file not shown.

0 comments on commit c41b225

Please sign in to comment.