Baseball!

This commit is contained in:
Couls
2019-07-10 21:12:35 -04:00
parent 9288cab0ba
commit a8a9e8e022
5 changed files with 54 additions and 4 deletions
@@ -460,6 +460,12 @@
desc = "Here's your chance, do your dance at the Space Jam."
w_class = WEIGHT_CLASS_BULKY //Stops people from hiding it in their bags/pockets
/obj/item/beach_ball/holoball/baseball
icon_state = "baseball"
name = "baseball"
item_state = "baseball"
desc = "Take me out to the ball game."
/obj/structure/holohoop
name = "basketball hoop"
desc = "Boom, Shakalaka!"
+15 -4
View File
@@ -157,6 +157,8 @@
icon = 'icons/obj/items.dmi'
icon_state = "baseball_bat"
item_state = "baseball_bat"
var/deflectmode = FALSE // deflect small/medium thrown objects
var/lastdeflect
force = 10
throwforce = 12
attack_verb = list("beat", "smacked")
@@ -171,12 +173,18 @@
/obj/item/melee/baseball_bat/attack_self(mob/user)
if(!homerun_able)
..()
return
if(!deflectmode && world.time >= lastdeflect)
to_chat(user, "<span class='notice'>You prepare to deflect objects thrown at you, You cannot attack during this time.</span>")
deflectmode = TRUE
else if(deflectmode && world.time >= lastdeflect)
to_chat(user, "<span class='notice'>You no longer deflect objects thrown at you, You can attack during this time</span>")
deflectmode = FALSE
else
to_chat(user, "<span class='warning'>You need to wait until you can deflect again. The ability will be ready in [time2text(lastdeflect - world.time, "m:ss")]</span>")
return ..()
if(homerun_ready)
to_chat(user, "<span class='notice'>You're already ready to do a home run!</span>")
..()
return
return ..()
to_chat(user, "<span class='warning'>You begin gathering strength...</span>")
playsound(get_turf(src), 'sound/magic/lightning_chargeup.ogg', 65, 1)
if(do_after(user, 90, target = user))
@@ -185,6 +193,9 @@
..()
/obj/item/melee/baseball_bat/attack(mob/living/target, mob/living/user)
if(deflectmode)
to_chat(user, "<span class='warning'>You cannot attack in deflect mode!</span>")
return
. = ..()
var/atom/throw_target = get_edge_target_turf(target, user.dir)
if(homerun_ready)
@@ -311,6 +311,39 @@ emp_act
throwpower = I.throwforce
if(I.thrownby == src) //No throwing stuff at yourself to trigger reactions
return ..()
if(I.w_class <= WEIGHT_CLASS_NORMAL || istype(I, /obj/item/beach_ball)) // baseball bat deflecting
var/obj/item/melee/baseball_bat/B
if(l_hand && istype(l_hand, /obj/item/melee/baseball_bat))
B = l_hand
else if(r_hand && istype(r_hand, /obj/item/melee/baseball_bat))
B = r_hand
if(B && B.deflectmode)
if(prob(10))
visible_message("<span class='warning'><b>[src] Deflects the [I] directly back at the thrower! It's a home run!</b></span>", "<span class='warning'><b>You deflects the [I] directly back at the thrower!, It's a home run!</b></span>")
playsound(get_turf(src), 'sound/weapons/homerun.ogg', 100, 1)
do_attack_animation(I, ATTACK_EFFECT_DISARM)
I.throw_at(I.thrownby, 20, 20, src)
B.deflectmode = FALSE
if(!istype(I, /obj/item/beach_ball))
B.lastdeflect = world.time + 3000
return TRUE
else if(prob(30))
visible_message("<span class='warning'>[src] swings! And he misses! How embarassing.</span>", "<span class='warning'>You swing! You miss! Oh no!</span>")
playsound(get_turf(src), 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
do_attack_animation(get_step(src,pick(alldirs)), ATTACK_EFFECT_DISARM)
B.deflectmode = FALSE
if(!istype(I, /obj/item/beach_ball))
B.lastdeflect = world.time + 3000
return ..()
else
visible_message("<span class='warning'>[src] swings and deflects the [I]!</span>", "<span class='warning'>You swing and deflect the [I]!</span>")
playsound(get_turf(src), 'sound/weapons/baseball_hit.ogg', 50, 1, -1)
do_attack_animation(I, ATTACK_EFFECT_DISARM)
I.throw_at(get_edge_target_turf(src,pick(alldirs)), rand(8,10), 14, src)
B.deflectmode = FALSE
if(!istype(I, /obj/item/beach_ball))
B.lastdeflect = world.time + 3000
return TRUE
if(check_shields(throwpower, "\the [AM.name]", AM, THROWN_PROJECTILE_ATTACK))
hitpush = 0
skipcatch = 1
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.