diff --git a/code/game/machinery/computer/HolodeckControl.dm b/code/game/machinery/computer/HolodeckControl.dm index 604ac3f02f3..d3edc588e2d 100644 --- a/code/game/machinery/computer/HolodeckControl.dm +++ b/code/game/machinery/computer/HolodeckControl.dm @@ -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!" diff --git a/code/game/objects/items/weapons/weaponry.dm b/code/game/objects/items/weapons/weaponry.dm index b759139dba6..9bdabbd543d 100644 --- a/code/game/objects/items/weapons/weaponry.dm +++ b/code/game/objects/items/weapons/weaponry.dm @@ -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, "You prepare to deflect objects thrown at you, You cannot attack during this time.") + deflectmode = TRUE + else if(deflectmode && world.time >= lastdeflect) + to_chat(user, "You no longer deflect objects thrown at you, You can attack during this time") + deflectmode = FALSE + else + to_chat(user, "You need to wait until you can deflect again. The ability will be ready in [time2text(lastdeflect - world.time, "m:ss")]") + return ..() if(homerun_ready) to_chat(user, "You're already ready to do a home run!") - ..() - return + return ..() to_chat(user, "You begin gathering strength...") 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, "You cannot attack in deflect mode!") + return . = ..() var/atom/throw_target = get_edge_target_turf(target, user.dir) if(homerun_ready) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index b95920e688b..5dc3710f3b5 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -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("[src] Deflects the [I] directly back at the thrower! It's a home run!", "You deflects the [I] directly back at the thrower!, It's a home run!") + 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("[src] swings! And he misses! How embarassing.", "You swing! You miss! Oh no!") + 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("[src] swings and deflects the [I]!", "You swing and deflect the [I]!") + 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 diff --git a/icons/obj/basketball.dmi b/icons/obj/basketball.dmi index a26c3935719..7b34fda1a32 100644 Binary files a/icons/obj/basketball.dmi and b/icons/obj/basketball.dmi differ diff --git a/sound/weapons/baseball_hit.ogg b/sound/weapons/baseball_hit.ogg new file mode 100644 index 00000000000..6530945b6c1 Binary files /dev/null and b/sound/weapons/baseball_hit.ogg differ