Files
nevimer baf3837ae8 Merge remote-tracking branch 'tgstation/master' into upstream-2025-11-29
# Conflicts:
#	_maps/RandomRuins/SpaceRuins/derelict_sulaco.dmm
#	_maps/RandomRuins/SpaceRuins/garbagetruck2.dmm
#	_maps/map_files/CatwalkStation/CatwalkStation_2023.dmm
#	_maps/map_files/tramstation/tramstation.dmm
#	code/_onclick/hud/new_player.dm
#	code/datums/components/squashable.dm
#	code/datums/diseases/advance/symptoms/heal.dm
#	code/datums/diseases/chronic_illness.dm
#	code/datums/status_effects/buffs.dm
#	code/datums/status_effects/debuffs/drunk.dm
#	code/datums/status_effects/debuffs/stamcrit.dm
#	code/game/machinery/computer/crew.dm
#	code/game/objects/items/devices/scanners/health_analyzer.dm
#	code/game/objects/items/wall_mounted.dm
#	code/game/turfs/closed/indestructible.dm
#	code/modules/admin/view_variables/filterrific.dm
#	code/modules/antagonists/heretic/influences.dm
#	code/modules/cargo/orderconsole.dm
#	code/modules/client/preferences.dm
#	code/modules/events/space_vines/vine_mutations.dm
#	code/modules/mob/dead/new_player/new_player.dm
#	code/modules/mob/living/carbon/human/death.dm
#	code/modules/mob/living/carbon/human/species_types/jellypeople.dm
#	code/modules/mob/living/damage_procs.dm
#	code/modules/mob/living/living.dm
#	code/modules/mob_spawn/ghost_roles/mining_roles.dm
#	code/modules/mob_spawn/mob_spawn.dm
#	code/modules/projectiles/ammunition/energy/laser.dm
#	code/modules/projectiles/guns/ballistic/launchers.dm
#	code/modules/projectiles/guns/energy/laser.dm
#	code/modules/reagents/chemistry/machinery/chem_dispenser.dm
#	code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm
#	code/modules/reagents/chemistry/reagents/drinks/alcohol_reagents.dm
#	code/modules/reagents/chemistry/reagents/medicine_reagents.dm
#	code/modules/surgery/healing.dm
#	code/modules/unit_tests/designs.dm
#	icons/mob/inhands/items_lefthand.dmi
#	icons/mob/inhands/items_righthand.dmi
#	tgui/packages/tgui/interfaces/ChemDispenser.tsx
2025-11-29 22:49:21 -05:00

230 lines
8.4 KiB
Plaintext

//Gives you wizard if you land on 20. Fail, and the dice teleports somewhere else.
/obj/item/dice/d20/teleporting_die_of_fate
name = "wizardly die of fate"
desc = "An absurdly magical d20. Land on 20, and get a chance to win a chance to win a prize!"
microwave_riggable = FALSE //lol. lmao
COOLDOWN_DECLARE(roll_cd) //Prevents exploits
var/smite_rng_seed = 1
var/do_teleport = TRUE
var/relocation_timer
var/was_touched = FALSE
var/teleport_delay = 10 MINUTES
var/teleport_delay_pickup = 5 MINUTES
var/uses_left = 20 //The dice will still get consumed if someone gets wizard. Set to a value already less than 0 and it will be infinite.
/obj/item/dice/d20/teleporting_die_of_fate/no_teleport
do_teleport = FALSE
/obj/item/dice/d20/teleporting_die_of_fate/cursed //Always rolls 1. Careful with this, as this is a reliable way to summon a smite. One time use.
rigged = DICE_TOTALLY_RIGGED
rigged_value = 1
do_teleport = FALSE
uses_left = 1
/obj/item/dice/d20/teleporting_die_of_fate/cursed/infinite //Just in case you needed to make (nearly) infinite pain.
uses_left = 1337
/obj/item/dice/d20/teleporting_die_of_fate/blessed //Always rolls 20. This is basically single use since it just makes you wizard and deletes itself.
rigged = DICE_TOTALLY_RIGGED
rigged_value = 20
do_teleport = FALSE
/obj/item/dice/d20/teleporting_die_of_fate/Initialize(mapload)
. = ..()
src.add_filter("dice_glow", 2, list("type" = "outline", "color" = "#AC14FF30", "size" = 4))
src.set_light(5,0.25,"#AC14FF")
smite_rng_seed = rand(1,11) //The only reason I do this is for testing :^). It does have some benefit to not having the same 2 effects occur in a row.
SSpoints_of_interest.make_point_of_interest(src)
if(do_teleport)
create_timer(teleport_delay)
/obj/item/dice/d20/teleporting_die_of_fate/Destroy()
relocation_timer = null //Deleted elsewhere.
. = ..()
/obj/item/dice/d20/teleporting_die_of_fate/proc/create_timer(desired_time = teleport_delay)
relocation_timer = addtimer(CALLBACK(src, PROC_REF(relocate)), desired_time, TIMER_UNIQUE | TIMER_STOPPABLE | TIMER_OVERRIDE)
return relocation_timer
/obj/item/dice/d20/teleporting_die_of_fate/examine(mob/user)
. = ..()
. += span_notice("Roll a 20, and you might become magical...")
. += span_warning("Roll a 1, and you will end up in medical!")
if(relocation_timer && isobserver(user))
. += span_notice("The dice will relocate in [DisplayTimeText(timeleft(relocation_timer),1)]!")
. += span_warning("It has <b>[uses_left]</b> use[uses_left == 1 ? "" : "s"] left...")
/obj/item/dice/d20/teleporting_die_of_fate/equipped(mob/user, slot)
. = ..()
if(!ishuman(user) || !user.mind || IS_WIZARD(user))
to_chat(user, span_warning("You feel the magic of the dice is restricted to ordinary people! You should leave it alone."))
user.dropItemToGround(src)
else if(do_teleport && !was_touched)
create_timer(teleport_delay_pickup)
was_touched = TRUE
/obj/item/dice/d20/teleporting_die_of_fate/diceroll(mob/user, in_hand=FALSE)
if(!COOLDOWN_FINISHED(src, roll_cd))
to_chat(user, span_warning("Hold on, [src] isn't caught up with your last roll!"))
return
. = ..()
if(!ishuman(user) || !user.mind || IS_WIZARD(user))
to_chat(user, span_warning("You feel the magic of the dice is restricted to ordinary people!"))
return
var/turf/current_turf = get_turf(src)
current_turf.visible_message(span_userdanger("[src] flares briefly."))
addtimer(CALLBACK(src, PROC_REF(effect), user, .), 1 SECONDS)
COOLDOWN_START(src, roll_cd, 2.5 SECONDS)
/obj/item/dice/d20/teleporting_die_of_fate/proc/relocate()
var/turf/current_turf = get_turf(src)
if(uses_left > 0)
uses_left--
if(uses_left <= 0)
if(rigged != DICE_TOTALLY_RIGGED)
notify_ghosts(
"[src] was all used up, and was removed from reality.",
source = src
)
current_turf.visible_message(span_warning("[src] phases out of reality..."))
qdel(src)
return
create_timer(teleport_delay)
was_touched = FALSE //Reset
var/turf/desired_turf = get_safe_lucky_player_turf(areas_to_exclude = list(get_area(src)))
if(!desired_turf) //Failsafe.
desired_turf = get_safe_random_station_turf()
if(!desired_turf) //Do nothing as a failsafe for a failsafe.
return
current_turf.visible_message(span_warning("[src] phases out to another location!"))
//Teleport!
src.forceMove(desired_turf)
new/obj/effect/temp_visual/emp/pulse(desired_turf) //Does not cause an EMP :^)
playsound(desired_turf,'sound/effects/magic/magic_missile.ogg',50,8,FALSE)
notify_ghosts(
"[src] has teleported to [desired_turf.loc]!",
source = src
)
/obj/item/dice/d20/teleporting_die_of_fate/proc/effect(mob/living/carbon/human/user,roll)
var/turf/current_turf = get_turf(src)
new/obj/effect/temp_visual/emp/pulse(current_turf) //Does not cause an EMP :^)
playsound(current_turf,'sound/effects/magic/magic_missile.ogg',50,8,FALSE)
if(roll != 20)
if(roll == 1) //lol. lmao
user.emote("scream")
user.investigate_log("has been smited by a wizardly die of fate.", INVESTIGATE_DEATHS)
notify_ghosts(
"[user] got a 1 while rolling [src]! Point and laugh at them!",
source = user
)
addtimer(CALLBACK(src, PROC_REF(apply_random_smite), user), 1 SECONDS)
if(do_teleport)
relocate()
return
user.emote("laugh")
current_turf.visible_message(span_userdanger("Magic flows out of [src] and into [user]!"))
user.drop_everything(del_on_drop = FALSE, force = TRUE, del_if_nodrop = TRUE)
user.mind.make_wizard()
notify_ghosts(
"[user] got a nat 20 while rolling [src]!",
source = user
)
qdel(src)
/obj/item/dice/d20/teleporting_die_of_fate/proc/apply_random_smite(mob/living/carbon/human/target)
switch(smite_rng_seed % 9)
if(0)
//Bad luck.
target.AddComponent(/datum/component/omen/smite, incidents_left = 7) //7 (years) bad luck
to_chat(target, span_warning("You get a bad feeling about this..."))
if(1)
//Drain bamage.
target.adjust_organ_loss(ORGAN_SLOT_BRAIN, BRAIN_DAMAGE_DEATH - 1, BRAIN_DAMAGE_DEATH - 1)
to_chat(target, span_warning("You feel <b>stupid</b> for rolling [src]..."))
if(2)
//Forced to speak a random language.
target.apply_status_effect(/datum/status_effect/tower_of_babel, teleport_delay_pickup)
to_chat(target, span_warning("Come, let us go down and confuse their language there, so that they will not understand one another's speech. It'd be fucking hilarious!"))
if(3)
//Raining fireball.
target.Immobilize(3 SECONDS)
new /obj/effect/temp_visual/target(get_turf(target))
to_chat(target, span_warning("I CAST FIREBALL!"))
if(4)
//Lighting bolt smite.
var/turf/lightning_source = get_turf(src)
lightning_source.Beam(target, icon_state="lightning[rand(1,12)]", time = 5)
target.adjust_fire_loss(LIGHTNING_BOLT_DAMAGE)
playsound(get_turf(target), 'sound/effects/magic/lightningbolt.ogg', 50, TRUE)
target.electrocution_animation(LIGHTNING_BOLT_ELECTROCUTION_ANIMATION_LENGTH)
to_chat(target, span_warning("LIGHTNING BOLT!!"))
if(5)
//Ick Ock Phobia
target.gain_trauma(/datum/brain_trauma/mild/phobia/ocky_icky, TRAUMA_RESILIENCE_SURGERY)
to_chat(target, span_warning("Those damn coders are out to get us!!!"))
if(6)
//A rod comes and fucks you up. And the station.
var/turf/target_turf = get_turf(target)
var/startside = pick(GLOB.cardinals)
var/turf/start_turf = spaceDebrisStartLoc(startside, target_turf.z)
var/turf/end_turf = spaceDebrisFinishLoc(startside, target_turf.z)
if(start_turf && end_turf)
new /obj/effect/immovablerod(start_turf, end_turf, target, FALSE)
to_chat(target, span_warning("Huh. Nothing seems to have happened. I guess I am unstoppable..."))
if(7)
//A pod comes down and slams you.
target.Immobilize(3 SECONDS)
podspawn(list(
"target" = get_turf(target),
"path" = /obj/structure/closet/supplypod/centcompod,
"style" = /datum/pod_style/centcom,
"spawn" = /obj/item/toy/plush/lizard_plushie,
"damage" = 50,
"explosionSize" = list(0, 0, 2, 4),
"effectStun" = TRUE
))
to_chat(target, span_warning("SPECIAL DELIVERY!"))
if(8)
//You turn into a lizard. If you're already a lizard, you're now scared of lizards.
//Can be fixed via SAD.
if(target.dna && !istype(target.dna.species,/datum/species/lizard))
target.set_species(/datum/species/lizard)
to_chat(target, span_warning("You're a lizard, Harry."))
else
target.gain_trauma(/datum/brain_trauma/mild/phobia/lizards, TRAUMA_RESILIENCE_SURGERY)
to_chat(target, span_warning("Wait a minute, I've been a LIZARD THIS WHOLE TIME?"))
smite_rng_seed++