Files
Bubberstation/code/datums/mind/skills.dm
Ghom db8eca7bf3 The fishing portal generator expansion (plus skill-chip) (#78203)
## About The Pull Request
This is a PR I worked on last month, but had to put on hold while
dealing with some pressing issues with fishing feature, minigame and
other stuff, and because I had to atomize out some of the stuff
previously present here.

I've expanded on the fishing portal generator to do something other than
dispense guppies and goldfishes. It now has multiple settings,
unlockable by performing scanning experiments for fish types, available
from the get go, which also reward a meager amount of techweb points
upon completion. The generator can now be built too. No longer it has to
be ordered from cargo.
It can also be emagged for the syndicate setting, tho right now it only
dispenses donkfish and emulsijack, both otherwise impossible to get
outside of... exodrone adventures.

The advanced fishing rod now comes with an experiment handler component,
specific to the fish scanning experiment, that automatically scans
fished content. The node to get it now requires 2000 points and the
first fish scanning exp to be unock.

A new skillchip has been added, which adds a trait that changes the icon
of the fish shown in the minigame UI, giving some clues on what the
reward will be. The same trait is also gained by reaching the master
(penultimate) level of the fishing skill.

A new fish type has been added, with its own quirks. One of these quirks
included temporarily switching movement direction of the bait.
Currently, it can only be fished in the hyperspace and randomizer
setting of the fishing portal.

Screenshots:
![fuck
yea](https://github.com/tgstation/tgstation/assets/42542238/b4c75951-fa07-44ae-99ee-f602adf8a5a4)

![radial](https://github.com/tgstation/tgstation/assets/42542238/68ff21d8-69fd-4ba5-aa58-9976b6e3282f)

## Why It's Good For The Game
The fishing portal generator is but a stale and underdeveloped prototype
of the fishing feature right now, so much I was thinking of removing it
at first. However, we also have a lot of fishes which are pretty much
unfishable, so I came up with the idea of adding new portal settings
that allow people to actually get them.

As for the skillchip and trait, it's but an extra to both the vending
machine in the library and the fishing skill itself, which has an
overall humble impact on the minigame.

## Changelog

🆑
add: Expanded the fishing portal generator. It now comes with several
portal options that can be unlocked by performing fish scanning
experiments, which also award a modest amount of techweb points.
balance: The fishing portal generator is now buildable and no longer
orderable. The board can be printed from cargo, service and science
lathes.
balance: Advanced fishing tech is no longer a BEPIS design. It now
requires the base fish scanning experiment and 2000 points to be
unlocked.
add: The advanced fishing rod now comes with an incorporated
experiscanner specific for fish scanning.
add: Added a new skillchip that may change the icon of the "fish" shown
in the minigame UI to less generic ones. Reaching master level in
fishing also does that.
qol: The experiment handler UI no longer shows unselectable experiments.
/🆑
2023-10-01 04:11:55 +01:00

79 lines
3.5 KiB
Plaintext

/datum/mind/proc/init_known_skills()
for (var/type in GLOB.skill_types)
known_skills[type] = list(SKILL_LEVEL_NONE, 0)
///Return the amount of EXP needed to go to the next level. Returns 0 if max level
/datum/mind/proc/exp_needed_to_level_up(skill)
var/lvl = update_skill_level(skill)
if (lvl >= length(SKILL_EXP_LIST)) //If we're already past the last exp threshold
return 0
return SKILL_EXP_LIST[lvl+1] - known_skills[skill][SKILL_EXP]
///Adjust experience of a specific skill
/datum/mind/proc/adjust_experience(skill, amt, silent = FALSE, force_old_level = 0)
var/datum/skill/S = GetSkillRef(skill)
var/old_level = force_old_level ? force_old_level : known_skills[skill][SKILL_LVL] //Get current level of the S skill
experience_multiplier = initial(experience_multiplier)
for(var/key in experience_multiplier_reasons)
experience_multiplier += experience_multiplier_reasons[key]
known_skills[skill][SKILL_EXP] = max(0, known_skills[skill][SKILL_EXP] + amt*experience_multiplier) //Update exp. Prevent going below 0
known_skills[skill][SKILL_LVL] = update_skill_level(skill)//Check what the current skill level is based on that skill's exp
if(known_skills[skill][SKILL_LVL] > old_level)
S.level_gained(src, known_skills[skill][SKILL_LVL], old_level, silent)
else if(known_skills[skill][SKILL_LVL] < old_level)
S.level_lost(src, known_skills[skill][SKILL_LVL], old_level, silent)
///Set experience of a specific skill to a number
/datum/mind/proc/set_experience(skill, amt, silent = FALSE)
var/old_level = known_skills[skill][SKILL_EXP]
known_skills[skill][SKILL_EXP] = amt
adjust_experience(skill, 0, silent, old_level) //Make a call to adjust_experience to handle updating level
///Set level of a specific skill
/datum/mind/proc/set_level(skill, newlevel, silent = FALSE)
var/oldlevel = get_skill_level(skill)
var/difference = SKILL_EXP_LIST[newlevel] - SKILL_EXP_LIST[oldlevel]
adjust_experience(skill, difference, silent)
///Check what the current skill level is based on that skill's exp
/datum/mind/proc/update_skill_level(skill)
var/i = 0
for (var/exp in SKILL_EXP_LIST)
i ++
if (known_skills[skill][SKILL_EXP] >= SKILL_EXP_LIST[i])
continue
return i - 1 //Return level based on the last exp requirement that we were greater than
return i //If we had greater EXP than even the last exp threshold, we return the last level
///Gets the skill's singleton and returns the result of its get_skill_modifier
/datum/mind/proc/get_skill_modifier(skill, modifier)
var/datum/skill/S = GetSkillRef(skill)
return S.get_skill_modifier(modifier, known_skills[skill][SKILL_LVL])
///Gets the player's current level number from the relevant skill
/datum/mind/proc/get_skill_level(skill)
return known_skills[skill][SKILL_LVL]
///Gets the player's current exp from the relevant skill
/datum/mind/proc/get_skill_exp(skill)
return known_skills[skill][SKILL_EXP]
/datum/mind/proc/get_skill_level_name(skill)
var/level = get_skill_level(skill)
return SSskills.level_names[level]
/datum/mind/proc/print_levels(user)
var/list/shown_skills = list()
for(var/i in known_skills)
if(known_skills[i][SKILL_LVL] > SKILL_LEVEL_NONE) //Do we actually have a level in this?
shown_skills += i
if(!length(shown_skills))
to_chat(user, span_notice("You don't seem to have any particularly outstanding skills."))
return
var/msg = "[span_info("<EM>Your skills</EM>")]\n<span class='notice'>"
for(var/i in shown_skills)
var/datum/skill/the_skill = i
msg += "[initial(the_skill.name)] - [get_skill_level_name(the_skill)]\n"
msg += "</span>"
to_chat(user, examine_block(msg))