Skip to content

Commit

Permalink
Adventure Console Combat Dice Update
Browse files Browse the repository at this point in the history
## About The Pull Request
Adds the long awaited combat dice update.
You can buy combat dice from the shop menu in the adventure console. These upgrades should make battles more tolerable and makes combat dice upgrades a unique reward for events.
## Changelog
:cl:
tweak: Combat Dice Upgrades to Adventure_Console
/:cl:
  • Loading branch information
InsightfulParasite committed Jan 3, 2025
1 parent dfc2181 commit f2bcf83
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* ADVENTURE CONSOLE V1.1
* TEXT BASED ADVENTURES
* Adventures that are mostly predefined paths.
* This was difficult to finalize since i havent made a text based adventure before.
Expand Down Expand Up @@ -89,7 +90,30 @@
new /datum/data/extraction_cargo("SOME AHN", /obj/item/stack/spacecash/c500, 10) = 1,
new /datum/data/extraction_cargo("POSITIVE ENKEPHALIN", /obj/item/rawpe, 20) = 1,
)
var/list/exchange_upgrade_list = list(
//DICE
new /datum/data/adventure_upgrade("COMBAT DICE UPGRADE 1-8","1d8", 1, "DICE") = 1,
new /datum/data/adventure_upgrade("COMBAT DICE UPGRADE 2-12","2d6", 3, "DICE") = 1,
//Health
new /datum/data/adventure_upgrade("RESTORE 7 HEALTH ", 7, 1, "HP") = 1,
)

/*-----------------\
|Stat Upgrade Datum|
\-----------------*/
/datum/data/adventure_upgrade
var/stuff_name = "ERROR"
var/stat_value = 0
var/cost = 0
var/trade_type = "HP"

/datum/data/adventure_upgrade/New(name, stat_amt, cost, trading_type)
src.stuff_name = name
src.stat_value = stat_amt
src.cost = cost
src.trade_type = trading_type

//---
/datum/adventure_layout/New(set_debug_menu = FALSE)
. = ..()
if(!events.len)
Expand Down Expand Up @@ -196,7 +220,11 @@
PHYSICAL_MERCHANDISE<br>"
//Code taken from fish_market.dm
for(var/datum/data/extraction_cargo/A in exchange_shop_list)
. += " <A href='byond://?src=[REF(interfacer)];purchase=[REF(A)]'>[A.equipment_name]([A.cost] Points)</A><br>"
. += " <A href='byond://?src=[REF(interfacer)];purchase=[REF(A)]'>[A.equipment_name]([A.cost] Coins)</A><br>"
. += "<tt>--------------------| </tt><br> \
STAT UPGRADES<br>"
for(var/datum/data/adventure_upgrade/U in exchange_upgrade_list)
. += " <A href='byond://?src=[REF(interfacer)];upgrade=[REF(U)]'>[U.stuff_name]([U.cost] Coins)</A><br>"
. += "<tt>--------------------| </tt><br>"

/datum/adventure_layout/proc/TravelUI(obj/machinery/call_machine)
Expand Down Expand Up @@ -377,6 +405,11 @@
/*-----------------------\
|Numerical Variable Edits|
\-----------------------*/
/datum/adventure_layout/proc/ChangeDice(dice)
if(!istext(dice))
return FALSE
virtual_damage = dice
return dice

/datum/adventure_layout/proc/AdjustCoins(num)
virtual_coins += round(num)
Expand All @@ -391,6 +424,21 @@
/datum/adventure_layout/proc/AdjustProgress(num)
program_progress += num

// Easy proc for buying stats. Possibly redundant and should be two seperate procs.
/datum/adventure_layout/proc/BuyStats(cost = 0, value, type)
if(!value || !type)
return FALSE
switch(type)
if("HP")
if(virtual_integrity >= 100)
return FALSE
AdjustHP(value)
if("DICE")
if(virtual_damage == value)
return FALSE
ChangeDice(value)
AdjustCoins(cost)

/*---------\
|Misc Procs|
\---------*/
Expand Down
18 changes: 17 additions & 1 deletion ModularTegustation/lc13_obj/_adventure_console/console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
if(href_list["purchase"])
var/datum/data/extraction_cargo/product_datum = locate(href_list["purchase"]) in adventure_data.exchange_shop_list //The href_list returns the individual number code and only works if we have it in the first column. -IP
if(!product_datum)
to_chat(usr, span_warning("ERROR."))
to_chat(usr, span_warning("ERROR PRODUCT MISS"))
return FALSE
if(adventure_data.virtual_coins < product_datum.cost)
to_chat(usr, span_warning("ERROR: INSUFFICENT CURRENCY."))
Expand All @@ -168,6 +168,22 @@
updateUsrDialog()
return TRUE

//Exchange Shop for exchanging coins for stats
if(href_list["upgrade"])
var/datum/data/adventure_upgrade/product_datum = locate(href_list["upgrade"]) in adventure_data.exchange_upgrade_list
if(!product_datum)
to_chat(usr, span_warning("ERROR UPGRADE MISS"))
return FALSE
if(adventure_data.virtual_coins < product_datum.cost)
to_chat(usr, span_warning("ERROR: INSUFFICENT CURRENCY."))
playsound(get_turf(src), 'sound/machines/terminal_prompt_deny.ogg', 50, TRUE)
return FALSE

adventure_data.BuyStats(-1 * product_datum.cost, product_datum.stat_value, product_datum.trade_type)
playsound(get_turf(src), 'sound/machines/terminal_prompt_confirm.ogg', 50, TRUE)
updateUsrDialog()
return TRUE

/obj/machinery/text_adventure_console/proc/ProfileMenu(href, href_list)
. = "<tt>\
-------------------<br>\
Expand Down

0 comments on commit f2bcf83

Please sign in to comment.