Skip to content
This repository was archived by the owner on Jun 29, 2024. It is now read-only.
Open
16 changes: 7 additions & 9 deletions code/__DEFINES/skills.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
#define GetSkillRef(A) (SSskills.all_skills[A])

//Blacksmith resultant skills
#define BLACKSMITH_LEVEL_MIN -10
#define BLACKSMITH_LEVEL_SPOIL -2 // you can only get this by using spoilt bars and crude skill
#define BLACKSMITH_LEVEL_AWFUL -1 // you can only get this by using poor bars and crude skill (or spoilt bars and rough skill)
#define BLACKSMITH_LEVEL_CRUDE 0
#define BLACKSMITH_LEVEL_ROUGH 1
#define BLACKSMITH_LEVEL_COMPETENT 2
#define BLACKSMITH_LEVEL_FINE 3
#define BLACKSMITH_LEVEL_FLAWLESS 4
#define BLACKSMITH_LEVEL_LEGENDARY 5
#define BLACKSMITH_LEVEL_MIN 0
#define BLACKSMITH_LEVEL_CRUDE 1
#define BLACKSMITH_LEVEL_ROUGH 2
#define BLACKSMITH_LEVEL_COMPETENT 3
#define BLACKSMITH_LEVEL_FINE 4
#define BLACKSMITH_LEVEL_FLAWLESS 5
#define BLACKSMITH_LEVEL_LEGENDARY 6
#define BLACKSMITH_LEVEL_MAX 10

//Forging resultant skills
Expand Down
4 changes: 2 additions & 2 deletions code/modules/hydroponics/roguebin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@
if(!T.hingot.currecipe)
to_chat(user, span_warning("Huh?"))
return
if(T.hingot.currecipe.progress != 100)
to_chat(user, span_warning("It's not finished yet."))
if(T.hingot.currecipe.quality_level < 1)
to_chat(user, "<span class='warning'>It's not even crudely finished yet.</span>")
return
if(!T.hott)
to_chat(user, span_warning("I need to heat it to temper the metal."))
Expand Down
26 changes: 18 additions & 8 deletions code/modules/roguetown/roguejobs/blacksmith/anvil.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
return

if(istype(W, /obj/item/rogueweapon/hammer))
var/obj/item/rogueweapon/hammer/H = W
user.changeNext_move(CLICK_CD_MELEE)
if(!hingot)
return
Expand All @@ -75,17 +76,17 @@
if(carbon_user.domhand)
used_str = carbon_user.get_str_arms(carbon_user.used_hand)
carbon_user.rogfat_add(max(30 - (used_str * 3), 0))
var/total_chance = 7 * user.mind.get_skill_level(hingot.currecipe.appro_skill)
var/total_chance = 7 * (user.mind.get_skill_level(hingot.currecipe.appro_skill)+H.smith_quality)
var/breakthrough = 0
if(prob(1 + total_chance)) //Small chance to flash
if(prob(max(total_chance, 1))) //Small chance to flash
user.flash_fullscreen("whiteflash")
var/datum/effect_system/spark_spread/S = new()
var/turf/front = get_turf(src)
S.set_up(1, 1, front)
S.start()
breakthrough = 1

if(!hingot.currecipe.advance(user, breakthrough))
if(!hingot.currecipe.advance(user, breakthrough, H))
shake_camera(user, 1, 1)
playsound(src,'sound/items/bsmithfail.ogg', 100, FALSE)
playsound(src,pick('sound/items/bsmith1.ogg','sound/items/bsmith2.ogg','sound/items/bsmith3.ogg','sound/items/bsmith4.ogg'), 100, FALSE)
Expand All @@ -103,15 +104,24 @@

return

if(hingot && hingot.currecipe && hingot.currecipe.needed_item && istype(W, hingot.currecipe.needed_item))
hingot.currecipe.item_added(user)
if(hingot?.currecipe?.additional_items_text)
var/datum/anvil_recipe/currentrecipe = hingot.currecipe
var/found_in_list = FALSE
for(var/I_list in currentrecipe.additional_items)
if(istype(W, I_list))
found_in_list = TRUE
currentrecipe.additional_items -= I_list
break
if(!found_in_list)
return
currentrecipe.handle_additional_items(user, W)
if(istype(W, /obj/item/ingot))
var/obj/item/ingot/I = W
hingot.currecipe.material_quality += I.quality
currentrecipe.material_quality += I.quality
previous_material_quality = I.quality
else
hingot.currecipe.material_quality += previous_material_quality
hingot.currecipe.num_of_materials += 1
currentrecipe.material_quality += previous_material_quality
currentrecipe.num_of_materials += 1
qdel(W)
return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
var/name
var/list/additional_items = list()
var/material_quality = 0 // accumulated per added ingot (decided by quality of smelting per ingot)
var/num_of_materials = 1 // why are additional_items and req_bar 2 different things?! THE SLOP!
var/skill_quality = 0 // accumulated per hit, variant on the skill of the smith.
var/num_of_materials = 1
var/median_calculated = FALSE
var/quality_level_text = "awful"
var/quality_level = BLACKSMITH_LEVEL_MIN
var/quality = 0
var/appro_skill = /datum/skill/craft/blacksmithing
var/req_bar
var/created_item
var/craftdiff = 0
var/needed_item
var/needed_item_text
var/additional_items_text
var/quality_mod = 0
var/progress
var/mistakes = 0
var/max_mistakes = 0
var/i_type

var/datum/parent
Expand All @@ -20,95 +23,89 @@
parent = P
. = ..()

/datum/anvil_recipe/proc/advance(mob/user, breakthrough = FALSE)
if(progress == 100)
to_chat(user, span_info("It's ready."))
user.visible_message(span_warning("[user] strikes the bar!"))
/datum/anvil_recipe/proc/advance(mob/user, breakthrough = FALSE, var/obj/item/rogueweapon/hammer/H)
if(handle_additional_items(user, FALSE))
return FALSE
if(needed_item)
to_chat(user, span_info("Now it's time to add a [needed_item_text]."))
user.visible_message(span_warning("[user] strikes the bar!"))
return FALSE
var/moveup = 1
var/proab = 3
max_mistakes = 2+num_of_materials
if(!median_calculated) // has the median material quality been calculated?
material_quality = floor(material_quality/num_of_materials)
median_calculated = TRUE
var/current_mistake = FALSE
var/proab = 72
var/skill_level
if(user.mind)
skill_level = user.mind.get_skill_level(appro_skill)
moveup += round((skill_level * 6) * (breakthrough == 1 ? 1.5 : 1))
moveup -= 3 * craftdiff
proab = 72*skill_quality
if(!user.mind.get_skill_level(appro_skill))
proab = 23
proab = 26
if(prob(proab))
moveup = 0
progress = min(progress + moveup, 100)
if(progress == 100 && additional_items.len)
needed_item = pick(additional_items)
var/obj/item/I = new needed_item()
needed_item_text = I.name
qdel(I)
additional_items -= needed_item
progress = 0
if(!moveup)
if(prob(round(proab/2)))
user.visible_message(span_warning("[user] spoils the bar!"))
current_mistake = TRUE
if(current_mistake)
mistakes += 1
if(mistakes >= max_mistakes)
user.visible_message("<span class='warning'>Has made too many mistakes! [user]'s bar falls apart!</span>")
if(parent)
var/obj/item/P = parent
qdel(P)
return FALSE
else
user.visible_message(span_warning("[user] fumbles with the bar!"))
user.visible_message("<span class='warning'>[user] works a mistake into the bar!</span>", "<span class='warning'>You work a mistake into the bar! ([max_mistakes-mistakes] more mistakes until it falls apart!)</span>")
return FALSE
else
var/quality_change = ((breakthrough ? 20 : 15)+(material_quality-2-num_of_materials+1)*2)
quality += quality_change
if(user.mind && isliving(user))
skill_quality += (rand(skill_level*8, skill_level*17)*moveup)
var/mob/living/L = user
var/boon = user.mind.get_learning_boon(appro_skill)
var/amt2raise = L.STAINT/2 // (L.STAINT+L.STASTR)/4 optional: add another stat that isn't int
var/amt2raise = L.STAINT/4 // (L.STAINT+L.STASTR)/4 optional: add another stat that isn't int
//i feel like leveling up takes forever regardless, this would just make it faster
if(amt2raise > 0)
user.mind.adjust_experience(appro_skill, amt2raise * boon, FALSE)
if(quality >= 70 && quality_level <= 6)
quality_level += 1
quality -= 70
switch(quality_level)
if(BLACKSMITH_LEVEL_CRUDE)
quality_level_text = "crude"
if(BLACKSMITH_LEVEL_ROUGH)
quality_level_text = "rough"
if(BLACKSMITH_LEVEL_COMPETENT)
quality_level_text = "normal"
if(BLACKSMITH_LEVEL_FINE)
quality_level_text = "fine"
if(BLACKSMITH_LEVEL_FLAWLESS)
quality_level_text = "flawless"
if(BLACKSMITH_LEVEL_LEGENDARY to BLACKSMITH_LEVEL_MAX)
quality_level_text = "legendary"
to_chat(user, "<span class='info'>You advance the smith item to [quality_level_text] quality level!</span>")
if(breakthrough)
user.visible_message(span_warning("[user] strikes the bar!"))
user.visible_message("<span class='warning'>[user] strikes the bar!</span>", "<span class='warning'>You strike the bar! (you're roughly [70-quality] work from the next level)</span>")
else
user.visible_message(span_info("[user] strikes the bar!"))
user.visible_message("<span class='info'>[user] strikes the bar!</span>", "<span class='info'>You strike the bar! (you're roughly [70-quality] work from the next level)</span>")
return TRUE

/datum/anvil_recipe/proc/item_added(mob/user)
needed_item = null
user.visible_message(span_info("[user] adds [needed_item_text]"))
needed_item_text = null
/datum/anvil_recipe/proc/handle_additional_items(mob/user, obj/item/W)
if(additional_items.len)
if(!additional_items_text)
for(var/I in additional_items)
var/obj/item/NI = new I
if(additional_items_text)
additional_items_text = "[additional_items_text], [NI.name]"
else
additional_items_text = "[NI.name]"
qdel(NI)
if(W)
user.visible_message("<span class='info'>[user] adds [W]</span>")
else
to_chat(user, "<span class='info'>Before you can smith, you will need to add [additional_items_text].</span>")
return TRUE
else
additional_items_text = null
return FALSE

/datum/anvil_recipe/proc/handle_creation(obj/item/I)
material_quality = floor(material_quality/num_of_materials)-2
skill_quality = floor((skill_quality/num_of_materials)/1500)+material_quality
var/modifier
switch(skill_quality)
if(BLACKSMITH_LEVEL_MIN to BLACKSMITH_LEVEL_SPOIL)
I.name = "spoilt [I.name]"
modifier = 0.3
if(BLACKSMITH_LEVEL_AWFUL)
I.name = "awful [I.name]"
modifier = 0.5
if(BLACKSMITH_LEVEL_CRUDE)
I.name = "crude [I.name]"
modifier = 0.8
if(BLACKSMITH_LEVEL_ROUGH)
I.name = "rough [I.name]"
modifier = 0.9
if(BLACKSMITH_LEVEL_COMPETENT)
I.desc = "[I.desc] It is competently made."
if(BLACKSMITH_LEVEL_FINE)
I.name = "fine [I.name]"
modifier = 1.1
if(BLACKSMITH_LEVEL_FLAWLESS)
I.name = "flawless [I.name]"
modifier = 1.2
if(BLACKSMITH_LEVEL_LEGENDARY to BLACKSMITH_LEVEL_MAX)
I.name = "legendary [I.name]"
modifier = 1.3

if(!modifier)
return
var/modifier = 0.7+(0.1*quality_level)
I.name = "[quality_level_text] [I.name]"
I.obj_integrity *= modifier
I.max_integrity *= modifier
I.sellprice *= modifier
Expand All @@ -125,3 +122,6 @@
C.integrity_failure /= modifier
C.armor = C.armor.multiplymodifyAllRatings(modifier)
C.equip_delay_self *= modifier
if(istype(I, /obj/item/rogueweapon/hammer))
var/obj/item/rogueweapon/hammer/H = I
H.smith_quality = quality_level-3
6 changes: 3 additions & 3 deletions code/modules/roguetown/roguejobs/blacksmith/smelter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
else
var/datum/mind/smelter_mind = user.mind
var/smelter_exp = smelter_mind.get_skill_level(/datum/skill/craft/smelting)
ore[W] = floor(rand(smelter_exp*15, max(63, smelter_exp*25))/25) // (0-25 spoil, 25-50 poor, 50-75, normal, 75-onwards good) no skill = 0, 63, novice = 15, 63, apprentice = 30, 63, skilled = 45, 75, expert = 60, 100, master = 75, 125, legendary = 100, 150, (may want to add a tier above good)
user.visible_message(span_warning("[user] puts something in the smelter."))
ore[W] = min(floor(rand(smelter_exp*15, max(63, smelter_exp*25))/25),3) // (0-25 spoil, 25-50 poor, 50-75, normal, 75-onwards good) no skill = 0, 63, novice = 15, 63, apprentice = 30, 63, skilled = 45, 75, expert = 60, 100, master = 75, 125, legendary = 100, 150, (may want to add a tier above good)
user.visible_message("<span class='warning'>[user] puts something in the smelter.</span>")
cooking = 0
return
else
Expand Down Expand Up @@ -143,7 +143,7 @@
ore_deleted += 1
ore -= I
qdel(I)
floor_mean_quality = floor(floor_mean_quality/ore_deleted)
floor_mean_quality = min(floor(floor_mean_quality/ore_deleted),3)
for(var/i in 1 to maxore)
var/obj/item/R = new alloy(src, floor_mean_quality)
ore += R
Expand Down
1 change: 1 addition & 0 deletions code/modules/roguetown/roguejobs/blacksmith/tools.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

/obj/item/rogueweapon/hammer
force = 21
var/smith_quality = 0
possible_item_intents = list(/datum/intent/mace/strike, /datum/intent/mace/smash)
name = "hammer"
desc = "Each strikes reverberate loudly chanting war!"
Expand Down