From 989eca5c1b6c9c9da11a0e0ac2ac82e647c6a93e Mon Sep 17 00:00:00 2001 From: InsightfulParasite Date: Wed, 15 Nov 2023 23:58:51 -0500 Subject: [PATCH] Update lc13_adventuredatum.dm --- ModularTegustation/lc13_adventuredatum.dm | 239 +++++++++++++++------- ModularTegustation/lc13_machinery.dm | 5 +- 2 files changed, 173 insertions(+), 71 deletions(-) diff --git a/ModularTegustation/lc13_adventuredatum.dm b/ModularTegustation/lc13_adventuredatum.dm index af2a3170bb09..c029ac3a8692 100644 --- a/ModularTegustation/lc13_adventuredatum.dm +++ b/ModularTegustation/lc13_adventuredatum.dm @@ -18,7 +18,11 @@ //Health? var/virtual_integrity = 100 //Coins for flipping. - var/virtual_coins = 1 + var/virtual_coins = 0 + //Event progress so that your not stuck with nothing but null events. + var/program_progress = 0 + //Damage in battle senarios. Based on dice values. + var/virtual_damage = "1d6" //Variable for when they last logged in. Used in StatCatchup() var/last_logged_time = 0 //What we are currently displaying. @@ -27,8 +31,6 @@ var/travel_mode = ADVENTURE_MODE_TRAVEL //Temp text for occasional informative text on the UI. var/temp_text = "" - //Event progress so that your not stuck with nothing but null events. - var/program_progress = 0 //Currently Selected Event var/datum/adventure_event/event_data //Used in the adventure mechanics. Generated paths will be put here until they are walked. @@ -36,19 +38,21 @@ //Events we can choose from. var/list/event_options = list() //list of all events. - var/list/events = list() + var/static/list/events = list() //Battle Mode Variables var/enemy_integrity = 0 + //Enemy flavor text. Currently this is the way we register that a enemy currently exists and it is cleared after battle. var/enemy_desc + //Enemy damage dice var/enemy_damage = "1d6" + //Coins rewarded after defeating the enemy var/enemy_coin = 0 //One day maybe we will have proper enemies but for now this will suffice. -IP var/list/enemy_descriptions = list( - "Recorded Clerk: A familiar looking humanoid. They wear ragged clothes and a L corp armband. You swear you used to know their name.
", - "Recorded Rat: A low life from the backstreets. Their face is disfigured beyond recognition, all you can make out are their eyes.
", - "Digital Reflection: Its you! Well it looks LIKE you. They dont show any aggression \ - or emotion and simply block your way.
", + "Recorded Clerk:A familiar looking humanoid. They wear ragged clothes and a L corp armband. You swear you used to know their name.
", + "Recorded Rat:A low life from the backstreets. Their face is disfigured beyond recognition, all you can make out are their eyes.
", + "Digital Reflection:Its you! Well it looks LIKE you.
", ) /datum/adventure_layout/New() @@ -56,7 +60,7 @@ if(!events.len) //Later on this may become very heavy on processing when a new adventure profile is made. for(var/_event in subtypesof(/datum/adventure_event)) - events += new _event() + events += _event /*---------------\ |Return Visual UI| @@ -72,9 +76,15 @@ //Dispaly Event Data if(event_data) . += event_data.Event(src, caller, H) + if(!event_data) + //Emergency Exit because the event can lead to a empty screen due to the event deleting itself. + GENERAL_BUTTON(REF(caller),"set_display",ADVENTURE_MODE_TRAVEL,"RETURN TO MAIN PROGRAM") else - //Stats - . = "|USER:[H.name]|HP:[virtual_integrity]|COINS:[virtual_coins]|
" + //STATS! ARE HERE + . = "\ + |USER:[uppertext(H.name)]|HP:[virtual_integrity]|COINS:[virtual_coins]|
\ + |DAMAGE_DICE:[virtual_damage]|EVENT_CHANCE:[program_progress]|
\ +
" //From highest menu define to lowest. -IP for(var/mode_option = NORMAL_TEXT_DISPLAY to EVENT_OPTION_TEXT_DISPLAY) . += "[mode_option == display_mode ? "[nameMenu(mode_option)]" : "[nameMenu(mode_option)]"]" @@ -82,32 +92,50 @@ . += "
\ [DisplayUI(caller, H)]
\ ~~~~~~~~~~
[pick("THE RUINS ARE CLOSING IN","THEY ALL MARCH OUTWARDS
LEAVING THE CITY BEHIND",\ - "IS THAT YOU","I REMEMBER ALL THEIR NAMES","I WILL MEND THIS SHATTERED WORLD","WHAT CANT THE BEHOLDERS SEE",\ - "THE CITY IS STARVING")]
" + "IS THAT YOU","I REMEMBER ALL THEIR NAMES","WHAT CANT THE BEHOLDERS SEE",\ + "YOUR CITY IS STARVING","YOUR LEADERS PLAN TO SACRIFICE YOU WHILE YOU WORK")]" //The seperation of this from the Adventure proc was mostly due to how messy the Adventure proc currently is. /datum/adventure_layout/proc/DisplayUI(obj/machinery/interfacer, mob/living/carbon/human/viewer) switch(display_mode) if(NORMAL_TEXT_DISPLAY) - . += "~~~~~~~~~~
Welcome User
\ - Your last registered entry was [round((last_logged_time - world.time) / (1 SECONDS))] seconds ago.
\ - You recover 1 health every 10 seconds based on your last registered entry.
\ - " + . += "~~~~~~~~~~
WELCOME [uppertext(viewer.name)]
\ + YOUR LAST REGISTERED ENTRY WAS [round((world.time - last_logged_time)/(1 SECONDS))] SECONDS AGO.

\ + NOTE_ENTRY:The purpose of this program is to dicipher recorded information about
\ + abnormalities. Any information unrelated to abnormalities or the enkanaphlin
\ + process is to be considered a flaw in the program.

\ + The process of deciphering abnormality data used to be a arduous task that
\ + exposed many to unforeseen mind warping effects. In order to alliviate the
\ + mental strain the process has been redesigned into a 'game'. Abnormal effects
\ + should be relagated to the occasional glitch
\ + How to Play
\ + At the top of the screen you will see your stats. When your HP or program
\ + stability reaches 0 you will be unable to continue playing until it
\ + increases above 0. You recover 1 health every 10 seconds based on the
\ + time of your last action on the program.Coins seem to be only used in
\ + some obscure situations such as events. Coins are gained from battle.
\ + A dice is used to determine damage when you encounter a battle event.
\ + The value of this die can be used to reduce damage with block or inflict
\ + damage with fight. I did not say this was a great game. Event chance is
\ + the programs chance to present a event to you. Event chance increases the
\ + more you interact with the program. When traveling down paths in the
\ + adventure tab you will gain 3% additive chance to find a event. Winning
\ + battles will grant you a 10% increased chance. These events are generally
\ + related to abnormalities that you have within your facility. At the end of
\ + your shift a report will be expected on the events you encounter.
" if(ADVENTURE_TEXT_DISPLAY) - . += "~~~~~~~~~~
\ - [TravelUI(interfacer)]\ -
~~~~~~~~~~
" + . += "[TravelUI(interfacer)]" if(EVENT_OPTION_TEXT_DISPLAY) . += "~~~~~~~~~~
CHOOSE AN ADVENTURE
~~~~~~~~~~
" for(var/_option in events) var/datum/adventure_event/A = _option - if(A.require_abno) - if(!locate(A.require_abno) in GLOB.abnormality_mob_list) + if(initial(A.require_abno)) + if(!locate(initial(A.require_abno)) in GLOB.abnormality_mob_list) continue - GENERAL_BUTTON(REF(interfacer),"adventure",REF(A),A.name) - . += "[A.desc]
" + GENERAL_BUTTON(REF(interfacer),"adventure",initial(A),initial(A.name)) + . += "[initial(A.desc)]
" /datum/adventure_layout/proc/TravelUI(obj/machinery/call_machine) switch(travel_mode) @@ -117,31 +145,34 @@ . += BattleModeDisplay(call_machine) if(ADVENTURE_MODE_TRAVEL) if(!paths_to_tread.len) - GeneratePaths() + GeneratePaths(3) . += TravelModeDisplay(call_machine) /datum/adventure_layout/proc/BattleModeDisplay(obj/machinery/call_machine) // placed for monospaced formatting. . += "\ ENEMY DESCRIPTION: [enemy_desc]\ -
" - if(temp_text) - . += "[temp_text]" - . += "
" +

\ + [temp_text]\ +
" GENERAL_BUTTON(REF(call_machine),"travel",1,"BLOCK") . += "|" GENERAL_BUTTON(REF(call_machine),"travel",2,"FIGHT") . += "|" + GENERAL_BUTTON(REF(call_machine),"travel",3,"LOOK") + . += "|" /datum/adventure_layout/proc/TravelModeDisplay(obj/machinery/call_machine) + if(virtual_integrity <= 0) + return "ERROR:INTEGRITY FAILURE" // placed for monospaced formatting. . += "\ - You have 3 paths to travel.\ -
" - if(temp_text) - . += "[temp_text]" - . += "
" + You have 3 paths to travel.
\ + [DescribePaths()]\ +

\ + [temp_text]\ +
" GENERAL_BUTTON(REF(call_machine),"travel",1,"FIRST PATH") . += "|
" @@ -173,13 +204,15 @@ 10/5 = 2, 14/5 = 2 -IP */ enemy_coin = round((temp_sides * temp_dice)/5) -/datum/adventure_layout/proc/GeneratePaths() - switch(roll("1d6")) - if(2 to 3) - paths_to_tread += ADVENTURE_MODE_BATTLE - if(5) - //This is a bit weird so i have to change this later. -IP +/datum/adventure_layout/proc/GeneratePaths(max_paths) + for(var/i=1 to max_paths) + //Unsure if i should put in a check in order to prevent 3% chance events.-IP + if(prob(program_progress) && program_progress > 25) paths_to_tread += ADVENTURE_MODE_EVENT + continue + if(prob(program_progress * 2)) + paths_to_tread += ADVENTURE_MODE_BATTLE + continue else paths_to_tread += ADVENTURE_MODE_TRAVEL @@ -189,10 +222,12 @@ //Reaction from machine of adventure choices. Chosen path reactions. /datum/adventure_layout/proc/AdventureModeReact(num) + temp_text = "" switch(travel_mode) if(ADVENTURE_MODE_TRAVEL) TravelModeReact(num) - program_progress += 1 + //Every step is 3 more progress to the event. + AdjustProgress(3) if(ADVENTURE_MODE_BATTLE) BattleModeReact(num) @@ -200,37 +235,47 @@ //Reactions for adventure based on mode. /datum/adventure_layout/proc/TravelModeReact(path_tread_num) if(paths_to_tread[path_tread_num] == ADVENTURE_MODE_EVENT) + //Reset event chance. + program_progress = 0 //The event list except all events we already have are removed. var/list/new_events = events - event_options for(var/_option in new_events) var/datum/adventure_event/A = _option - if(A.require_abno) - if(!locate(A.require_abno) in GLOB.abnormality_mob_list) + if(initial(A.require_abno)) + if(!locate(initial(A.require_abno)) in GLOB.abnormality_mob_list) continue - event_options += A - event_data = pick(event_options) - travel_mode = ADVENTURE_MODE_TRAVEL + event_options += A + var/new_event = pick(event_options) + event_data = new new_event() paths_to_tread.Cut() + travel_mode = ADVENTURE_MODE_TRAVEL return travel_mode = paths_to_tread[path_tread_num] paths_to_tread.Cut() /datum/adventure_layout/proc/BattleModeReact(battle_num) - temp_text = "" if(enemy_integrity > 0 && virtual_integrity > 0) switch(battle_num) if(1) - DoBattle(roll("1d6"), TRUE) + DoBattle(roll(virtual_damage), TRUE) if(2) - DoBattle(roll("1d6")) - return TRUE + DoBattle(roll(virtual_damage)) + if(3) + DoBattle(0) + temp_text += "HP:[enemy_integrity]
DAMAGE:[enemy_damage]
YOUR WELCOME
" + return TRUE //Everything past this is what happens if you or the enemy reach 0 health. paths_to_tread.Cut() enemy_desc = null travel_mode = ADVENTURE_MODE_TRAVEL if(enemy_integrity <= 0) - temp_text += "OBSTACLE CLEARED
[enemy_coin] COINS GAINED" + temp_text += "OBSTACLE CLEARED
[enemy_coin] COINS GAINED
EVENT PROGRESS +5" virtual_coins += enemy_coin + AdjustProgress(10) + else + temp_text += "PROGRAM UNSTABLE
1 COIN LOST
EVENT PROGRESS -2" + virtual_coins-- + AdjustProgress(-2) //Battle Reactions /datum/adventure_layout/proc/DoBattle(hit_num, BLOCKING = FALSE) @@ -255,9 +300,40 @@ /datum/adventure_layout/proc/AdjustHP(num) virtual_integrity += round(num) +// This may be too many adjustment procs. +/datum/adventure_layout/proc/AdjustProgress(num) + program_progress += num + /*---------\ |Misc Procs| \---------*/ +//Describes details about the path ahead. +/datum/adventure_layout/proc/DescribePaths() + var/path_descs = list() + for(var/i in paths_to_tread) + . += "PATH:" + switch(i) + if(ADVENTURE_MODE_BATTLE) + path_descs = list( + "THIS PATH IS STREWN WITH BROKEN TREES", + "YOU SEE SOMETHING APPROACHING", + "A BROKEN STRING OF YARN LEADS INTO THIS PATH", + ) + if(ADVENTURE_MODE_EVENT) + //When this is more formed i may change these to be the event descriptions. + path_descs = list( + "THIS PATH IS BRIGHT", + "YOU SEE SOMETHING DOWN THE PATH", + "THERE IS A DOOR EMBEDED INTO THE WALL", + ) + else + path_descs = list( + "THIS PATH IS COLD", + "THIS PATH IS SAFE", + "THIS PATH IS DULL", + ) + . += "[pick(path_descs)]
" + //for each catagory please place the number its defined as -IP /datum/adventure_layout/proc/nameMenu(cat) switch(cat) @@ -270,13 +346,18 @@ //Recover Health based on time. I may scrap this because the thought of mobile game stamina makes me feel sick -IP /datum/adventure_layout/proc/StatCatchup() - if(virtual_integrity >= 100) - last_logged_time = world.time - return - var/newhealth = round((world.time - last_logged_time)/(10 SECONDS)) - if(newhealth == 0 || (newhealth > 0 && newhealth < 1)) - return - AdjustHP(WRAP(virtual_integrity + newhealth, -100, 100)) + var/newhealth = 0 + //Your actually missing health and your not currently in battle. + if(virtual_integrity < 100 && travel_mode != ADVENTURE_MODE_BATTLE) + newhealth = round((world.time - last_logged_time)/(10 SECONDS)) + if(newhealth == 0) + return + //To make stat checkup only restore to 50 change the 100's to 50. + var/hp_overload_check = (virtual_integrity + newhealth)-100 + if(hp_overload_check > 0) + //Remove overflow from the health we are adding + newhealth -= hp_overload_check + AdjustHP(newhealth) last_logged_time = world.time /* @@ -296,7 +377,7 @@ var/desc //Where the user is. var/cords = 1 - //If we need a certain abnormality to appear as a option. + //If we need a certain abnormality to appear as a option. If no abnormality is listed this event will occur normally var/mob/living/simple_animal/hostile/abnormality/require_abno //Discriptions of areas. If cords is 2 then B will be displayed for flavor_desc in UI_Display() var/list/adventure_cords = list( @@ -308,7 +389,9 @@ /*This is where most of the choices and effects will appear. After your condition for the choice is made with "if(cords == 2)" remember to add a return if you do not - want the continue button to appear.*/ + want the continue button to appear. Since we have link + to the profile and the user we can use their stats + for checks if we are clever.*/ /datum/adventure_event/proc/EventChoiceFormat(datum/adventure_layout/profile, obj/machinery/M, mob/living/carbon/human/H) if(cords) BUTTON_FORMAT(0,"CONTINUE", M) @@ -316,6 +399,12 @@ /* This proc is called by the adventure datum in order to build the UI. Its like a hub where all other general things are called. */ /datum/adventure_event/proc/Event(datum/adventure_layout/profile, obj/machinery/caller, mob/living/carbon/human/H) + if(!profile) + return "
ERROR:USER PROFILE MISSING" + + if(!caller) + return "
ERROR:INTERFACE MISSING" + if(cords == 0) EventComplete(profile,caller,H) return @@ -324,9 +413,6 @@ . = UI_Display() . += EventChoiceFormat(profile, caller, H) - if(!caller) - return "
ERROR: USERFACE SOURCE MISSING" - /* Formating stuff such as UI display that is returned to the calling userface such as the events name, current cords, and @@ -341,11 +427,29 @@ profile.event_data = null cords = 1 M.updateUsrDialog() + qdel(src) //Called by console after a choice is recieved. /datum/adventure_event/proc/EventReact(new_cords) cords = new_cords + /*---------------------\ + |Profile Variable Edits| + \---------------------*/ +/datum/adventure_event/proc/AdjustHitPoint(datum/adventure_layout/P, add_num) + P.AdjustHP(add_num) + if(add_num <= -1) + temp_text += "[add_num] HP LOST" + if(add_num >= 1) + temp_text += "[add_num] HP GAINED" + +/datum/adventure_event/proc/AdjustCurrency(datum/adventure_layout/P, add_num) + P.AdjustCoins(add_num) + if(add_num <= -1) + temp_text += "[abs(add_num)] COIN[add_num == -1 ? "s" : ""] LOST" + if(add_num >= 1) + temp_text += "[add_num] COIN[add_num == 1 ? "s" : ""] GAINED" + /*------------\ |Unique Events| \------------*/ @@ -398,11 +502,9 @@ BUTTON_FORMAT(3,"REQUEST A MATCH", M) return if(cords == 2) - profile.AdjustHP(3) - . += "3 HP gained" + AdjustHitPoint(profile,10) if(cords == 3) - profile.AdjustCoins(-1) - . += "1 coin lost" + AdjustCurrency(profile,-1) . = ..() /* This event is mostly based on what i THINK the creators of forsaken murderer are trying to say. @@ -430,8 +532,7 @@ BUTTON_FORMAT(3,"LEAVE", M) return if(cords == 2) - profile.AdjustCoins(3) - . += "3 coins gained" + AdjustCurrency(profile,3) . = ..() #undef NORMAL_TEXT_DISPLAY diff --git a/ModularTegustation/lc13_machinery.dm b/ModularTegustation/lc13_machinery.dm index ad526ed1113a..31754203d3ec 100644 --- a/ModularTegustation/lc13_machinery.dm +++ b/ModularTegustation/lc13_machinery.dm @@ -150,7 +150,7 @@ if(!adventure_data) adventure_data = new dat += adventure_data.Adventure(src, user) - var/datum/browser/popup = new(user, "Adventure", "AdventureTest", 440, 640) + var/datum/browser/popup = new(user, "Adventure", "AdventureTest", 500, 600) popup.set_content(dat) popup.open() return @@ -184,7 +184,8 @@ if(href_list["adventure"]) /* There must be a better way of doing this because returning A itself just brings the name instead of the instance. -IP */ - adventure_data.event_data = locate(href_list["adventure"]) in adventure_data.event_options + var/created_event = locate(href_list["adventure"]) in adventure_data.event_options + adventure_data.event_data = new created_event() playsound(get_turf(src), 'sound/machines/uplinkpurchase.ogg', 50, TRUE) updateUsrDialog() return TRUE