mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 19:13:30 +01:00
Improves Baseball Bat Deflect Mechanics (#31918)
* Improves Baseball Bat Deflect Mechanics * Adjustments * Update code/game/objects/items/weapons/weaponry.dm Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com> Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> * Update code/game/objects/items/weapons/weaponry.dm Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com> Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> * Reorders if chain --------- Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com>
This commit is contained in:
@@ -171,6 +171,8 @@
|
||||
var/homerun_ready = FALSE
|
||||
var/homerun_able = FALSE
|
||||
var/deflectmode = FALSE // deflect small/medium thrown objects
|
||||
/// Is the bat made of metal?
|
||||
var/is_metal = FALSE
|
||||
|
||||
new_attack_chain = TRUE
|
||||
|
||||
@@ -187,9 +189,18 @@
|
||||
if(I.w_class <= WEIGHT_CLASS_NORMAL || istype(I, /obj/item/beach_ball)) // baseball bat deflecting
|
||||
if(!deflectmode)
|
||||
return
|
||||
if(prob(10))
|
||||
visible_message(SPAN_BOLDWARNING("[owner] Deflects [I] directly back at the thrower! It's a home run!"), SPAN_BOLDWARNING("You deflect [I] directly back at the thrower! It's a home run!"))
|
||||
if(prob(5) || homerun_ready)
|
||||
visible_message(SPAN_BOLDWARNING("[owner] deflects [I] far into the air! It's a homerun!"), SPAN_BOLDWARNING("You deflect [I] far into the air! It's a homerun!"))
|
||||
playsound(get_turf(owner), 'sound/weapons/homerun.ogg', 100, TRUE)
|
||||
do_attack_animation(src, ATTACK_EFFECT_DISARM)
|
||||
hit_object(owner, I, TRUE)
|
||||
return TRUE
|
||||
else if(prob(10))
|
||||
visible_message(SPAN_BOLDWARNING("[owner] deflects [I] directly back at the thrower!"), SPAN_BOLDWARNING("You deflect [I] directly back at the thrower!"))
|
||||
var/sound = 'sound/weapons/baseball_hit.ogg'
|
||||
if(is_metal)
|
||||
sound = 'sound/weapons/effects/batreflect1.ogg'
|
||||
playsound(get_turf(owner), sound, 75, TRUE, -1)
|
||||
do_attack_animation(I, ATTACK_EFFECT_DISARM)
|
||||
I.throw_at(locateUID(I.thrownby), 20, 20, owner)
|
||||
deflectmode = FALSE
|
||||
@@ -206,14 +217,31 @@
|
||||
return FALSE
|
||||
else
|
||||
visible_message(SPAN_WARNING("[owner] swings and deflects [I]!"), SPAN_WARNING("You swing and deflect [I]!"))
|
||||
playsound(get_turf(owner), 'sound/weapons/baseball_hit.ogg', 50, TRUE, -1)
|
||||
var/sound = 'sound/weapons/baseball_hit.ogg'
|
||||
if(is_metal)
|
||||
sound = 'sound/weapons/effects/batreflect1.ogg'
|
||||
playsound(get_turf(owner), sound, 75, TRUE, -1)
|
||||
do_attack_animation(src, ATTACK_EFFECT_DISARM)
|
||||
I.throw_at(get_edge_target_turf(owner, pick(GLOB.cardinal)), rand(8,10), 14, owner)
|
||||
deflectmode = FALSE
|
||||
if(!istype(I, /obj/item/beach_ball))
|
||||
COOLDOWN_START(src, last_deflect, deflect_cooldown)
|
||||
hit_object(owner, I)
|
||||
return TRUE
|
||||
|
||||
/obj/item/melee/baseball_bat/proc/hit_object(mob/living/carbon/human/owner, obj/item/I, homerun = FALSE)
|
||||
var/deflect_dir = round(get_angle(owner, I)) + (rand() - 0.5) * 180 // 180 degree angle in front of the user.
|
||||
var/deflect_range = rand(5, 10)
|
||||
if(homerun)
|
||||
deflect_dir = round(get_angle(owner, I)) + (rand() - 0.5) * 120
|
||||
deflect_range = 20
|
||||
I.pass_flags |= PASSMOB
|
||||
addtimer(CALLBACK(PROC_REF(reset_flags), I), 0.3 SECONDS)
|
||||
I.throw_at(get_angle_target_turf(owner, deflect_dir, deflect_range), deflect_range, 14, owner)
|
||||
deflectmode = FALSE
|
||||
homerun_ready = FALSE
|
||||
if(!istype(I, /obj/item/beach_ball))
|
||||
COOLDOWN_START(src, last_deflect, deflect_cooldown)
|
||||
|
||||
/obj/item/melee/baseball_bat/proc/reset_flags(obj/item/I)
|
||||
I.pass_flags = initial(I.pass_flags)
|
||||
|
||||
/obj/item/melee/baseball_bat/activate_self(mob/user)
|
||||
if(..())
|
||||
return
|
||||
@@ -279,6 +307,7 @@
|
||||
icon_state = "baseball_bat_metal"
|
||||
force = 12
|
||||
throwforce = 15
|
||||
is_metal = TRUE
|
||||
|
||||
/obj/item/melee/baseball_bat/ablative/IsReflect()//some day this will reflect thrown items instead of lasers
|
||||
var/picksound = rand(1,2)
|
||||
|
||||
Reference in New Issue
Block a user