mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-11 01:13:18 +00:00
* destroy proc holder pt1 - change proc_holder/spell to action/cooldown/spell - docs all the spell vars, renames some of them - removes some useless vars - start with pointed spells, as they're easy * kill proc_holder pt2 - kill a buncha vars and replace it with flags - convert a ton over - general code improvements * kill proc_holders pt3 - convert a good few more spells - rename some signals - handle statpanel - better docs * kiill proc_holder pt4: - restructure the file system of action.dm, separating a good amount of item actions and miscellaneous garbage into files where they belong slightly better. Also splits off item actions, cooldown actions, innate actions, etc. into their own files, overlal making it much better to work with - converts touch attacks to actions - converts blood crawl, jaunt subtype * kills proc_holder pt5 - clears up some icon issues so all the currently converted pages don't have errors - shapeshift - some more action cleanup * kills proc_holder pt5.5: - some documentation - reworks feedback to prevent oversight with teleports and stuff * kills proc_holder pt6: - converted cult spells - converted magic missile - converted mime spells - chipped away at the errors - removed some vars which were too general, replaced them with more locally applicable vars. for example "range" which could mean "projectile range" or "aoe radius" or whatever - instead of having a broad net which everyone applies to in a confusing matter, instead lets each spell delegate on their own. - merged magic/spell and magic/aoe, as the comment intended - more unified behavior for spell levelling * kill proc_holders pt 6.5: - replacing a buncha old proc_holders that have been updated to reduce some errors. sub 900 baby * kills proc_holder pt 6.75: - minor fixes * kills proc_holder pt7: - cuts down on some errors - refactors some wiz events * kills proc_holder pt 7.5: - malf ranged modules - some minor errors * kills proc_holder pt 7.75: - mor eminor error handling, cleaning up changes * kill proc_holder pt8: - refactors spell book - refactors spell implant - some more minor error fixing * kill proc_holder pt 8.5: - scan ability * Adds some robust documentation * kill proc_holder pt9: - converts some / most mutations over * kill proc_holder pt10: - sort out all the granters - refactor them slightly - fix some compile errors * Some set-unset sanity - going to need to test removing Share() * Removes transfer actions. It doesn't seem to do anything. - Transfer_actions was called when current = new_character so locially speaking the early return in Grant() should cause it to NOOP. Test this in the future though * Removes sharing from actions, docs actions better * Some better documentation for spell and spell components * Kills proc_holder pt11: - Finally finishes ALL THE SPELLS IN THE SPELL FOLDER - Fixes some more errors * kills proc_holder pt11.5: - minor error fixing and sanity * Method of sharing actions. Can be improved in the future, needs testing * Implements a way to update the stat panel entry for a spell. Also gets rid of VV stuff, as you can update the bigflags directly in VV now. * Curse of madness bug I put in. * kills proc_holder pt12: - sub 500 errors! - converts cytology mobs - converts and refactors spiders slightly - some minor fixing around the place as usual * kill proc_holder pt13 - Finishes heretic spells - Sub 300 errors! - some touch refactoring to account for mansus grasp * kills proc_holder pt14: - revenant - minor bugfixing for heretic stuff * kills proc_holder pt14.5: - some missed stuff for revenant + heretic * kills proc_holder pt15: - alien abilities - more minor fixing - sub 100 errors. The end is nigh * kill proc_holder pt16? 17: - Finishes cult spells - sub 50 errors! - refactors the way charge works - renames / moves some signals * kills proc_holder pt final: - sdql spells - no more errors! * Bugfixes round 1 * Various bugfixing - documentation done - give spell works - can cast spell gives feedback conditionally - is available takes into account casting ability * Some accidental reversions + fixes * Unit tests * Completely refactors jaunting - All bloodcrawling is now handled on the action itself instead of across various living procs - slaughter demons have their own blood crawls - jaunting dummies don't have side effects on destroy() anymore * Wizard spell logging and even more refactoring
240 lines
8.5 KiB
Plaintext
240 lines
8.5 KiB
Plaintext
/datum/mutation
|
|
|
|
var/name
|
|
|
|
/datum/mutation/human
|
|
name = "mutation"
|
|
/// Description of the mutation
|
|
var/desc = "A mutation."
|
|
/// Is this mutation currently locked?
|
|
var/locked
|
|
/// Quality of the mutation
|
|
var/quality
|
|
/// Message given to the user upon gaining this mutation
|
|
var/text_gain_indication = ""
|
|
/// Message given to the user upon losing this mutation
|
|
var/text_lose_indication = ""
|
|
/// Visual indicators upon the character of the owner of this mutation
|
|
var/static/list/visual_indicators = list()
|
|
/// The path of action we grant to our user on mutation gain
|
|
var/datum/action/cooldown/spell/power_path
|
|
/// Which mutation layer to use
|
|
var/layer_used = MUTATIONS_LAYER
|
|
/// To restrict mutation to only certain species
|
|
var/list/species_allowed
|
|
/// Minimum health required to acquire the mutation
|
|
var/health_req
|
|
/// Required limbs to acquire this mutation
|
|
var/limb_req
|
|
/// The owner of this mutation's DNA
|
|
var/datum/dna/dna
|
|
/// Owner of this mutation
|
|
var/mob/living/carbon/human/owner
|
|
/// Instability the holder gets when the mutation is not native
|
|
var/instability = 0
|
|
/// Amount of those big blocks with gene sequences
|
|
var/blocks = 4
|
|
/// Amount of missing sequences. Sometimes it removes an entire pair for 2 points
|
|
var/difficulty = 8
|
|
/// Time between mutation creation and removal. If this exists, we have a timer
|
|
var/timeout
|
|
/// 'Mutation #49', decided every round to get some form of distinction between undiscovered mutations
|
|
var/alias
|
|
/// Whether we can read it if it's active. To avoid cheesing with mutagen
|
|
var/scrambled = FALSE
|
|
/// The class of mutation (MUT_NORMAL, MUT_EXTRA, MUT_OTHER)
|
|
var/class
|
|
/**
|
|
* any mutations that might conflict.
|
|
* put mutation typepath defines in here.
|
|
* make sure to enter it both ways (so that A conflicts with B, and B with A)
|
|
*/
|
|
var/list/conflicts
|
|
|
|
/**
|
|
* can we take chromosomes?
|
|
* 0: CHROMOSOME_NEVER never
|
|
* 1: CHROMOSOME_NONE yeah
|
|
* 2: CHROMOSOME_USED no, already have one
|
|
*/
|
|
var/can_chromosome = CHROMOSOME_NONE
|
|
/// Name of the chromosome
|
|
var/chromosome_name
|
|
/// Has the chromosome been modified
|
|
var/modified = FALSE //ugly but we really don't want chromosomes and on_acquiring to overlap and apply double the powers
|
|
/// Is this mutation mutadone proof
|
|
var/mutadone_proof = FALSE
|
|
|
|
//Chromosome stuff - set to -1 to prevent people from changing it. Example: It'd be a waste to decrease cooldown on mutism
|
|
/// genetic stability coeff
|
|
var/stabilizer_coeff = 1
|
|
/// Makes the mutation hurt the user less
|
|
var/synchronizer_coeff = -1
|
|
/// Boosts mutation strength
|
|
var/power_coeff = -1
|
|
/// Lowers mutation cooldown
|
|
var/energy_coeff = -1
|
|
/// List of strings of valid chromosomes this mutation can accept.
|
|
var/list/valid_chrom_list = list()
|
|
|
|
/datum/mutation/human/New(class = MUT_OTHER, timer, datum/mutation/human/copymut)
|
|
. = ..()
|
|
src.class = class
|
|
if(timer)
|
|
addtimer(CALLBACK(src, .proc/remove), timer)
|
|
timeout = timer
|
|
if(copymut && istype(copymut, /datum/mutation/human))
|
|
copy_mutation(copymut)
|
|
update_valid_chromosome_list()
|
|
|
|
/datum/mutation/human/proc/on_acquiring(mob/living/carbon/human/acquirer)
|
|
if(!acquirer || !istype(acquirer) || acquirer.stat == DEAD || (src in acquirer.dna.mutations))
|
|
return TRUE
|
|
if(species_allowed && !species_allowed.Find(acquirer.dna.species.id))
|
|
return TRUE
|
|
if(health_req && acquirer.health < health_req)
|
|
return TRUE
|
|
if(limb_req && !acquirer.get_bodypart(limb_req))
|
|
return TRUE
|
|
for(var/datum/mutation/human/mewtayshun as anything in acquirer.dna.mutations) //check for conflicting powers
|
|
if(!(mewtayshun.type in conflicts) && !(type in mewtayshun.conflicts))
|
|
continue
|
|
to_chat(acquirer, span_warning("You feel your genes resisting something."))
|
|
return TRUE
|
|
owner = acquirer
|
|
dna = acquirer.dna
|
|
dna.mutations += src
|
|
if(text_gain_indication)
|
|
to_chat(owner, text_gain_indication)
|
|
if(visual_indicators.len)
|
|
var/list/mut_overlay = list(get_visual_indicator())
|
|
if(owner.overlays_standing[layer_used])
|
|
mut_overlay = owner.overlays_standing[layer_used]
|
|
mut_overlay |= get_visual_indicator()
|
|
owner.remove_overlay(layer_used)
|
|
owner.overlays_standing[layer_used] = mut_overlay
|
|
owner.apply_overlay(layer_used)
|
|
grant_power() //we do checks here so nothing about hulk getting magic
|
|
if(!modified)
|
|
addtimer(CALLBACK(src, .proc/modify, 0.5 SECONDS)) //gonna want children calling ..() to run first
|
|
|
|
/datum/mutation/human/proc/get_visual_indicator()
|
|
return
|
|
|
|
/datum/mutation/human/proc/on_life(delta_time, times_fired)
|
|
return
|
|
|
|
/datum/mutation/human/proc/on_losing(mob/living/carbon/human/owner)
|
|
if(!istype(owner) || !(owner.dna.mutations.Remove(src)))
|
|
return TRUE
|
|
. = FALSE
|
|
if(text_lose_indication && owner.stat != DEAD)
|
|
to_chat(owner, text_lose_indication)
|
|
if(visual_indicators.len)
|
|
var/list/mut_overlay = list()
|
|
if(owner.overlays_standing[layer_used])
|
|
mut_overlay = owner.overlays_standing[layer_used]
|
|
owner.remove_overlay(layer_used)
|
|
mut_overlay.Remove(get_visual_indicator())
|
|
owner.overlays_standing[layer_used] = mut_overlay
|
|
owner.apply_overlay(layer_used)
|
|
if(power_path)
|
|
// Any powers we made are linked to our mutation datum,
|
|
// so deleting ourself will also delete it and remove it
|
|
// ...Why don't all mutations delete on loss? Not sure.
|
|
qdel(src)
|
|
|
|
/mob/living/carbon/proc/update_mutations_overlay()
|
|
return
|
|
|
|
/mob/living/carbon/human/update_mutations_overlay()
|
|
for(var/datum/mutation/human/mutation in dna.mutations)
|
|
if(mutation.species_allowed && !mutation.species_allowed.Find(dna.species.id))
|
|
dna.force_lose(mutation) //shouldn't have that mutation at all
|
|
continue
|
|
if(mutation.visual_indicators.len == 0)
|
|
continue
|
|
var/list/mut_overlay = list()
|
|
if(overlays_standing[mutation.layer_used])
|
|
mut_overlay = overlays_standing[mutation.layer_used]
|
|
var/mutable_appearance/indicator_to_add = mutation.get_visual_indicator()
|
|
if(!mut_overlay.Find(indicator_to_add)) //either we lack the visual indicator or we have the wrong one
|
|
remove_overlay(mutation.layer_used)
|
|
for(var/mutable_appearance/indicator_to_remove in mutation.visual_indicators[mutation.type])
|
|
mut_overlay.Remove(indicator_to_remove)
|
|
mut_overlay |= indicator_to_add
|
|
overlays_standing[mutation.layer_used] = mut_overlay
|
|
apply_overlay(mutation.layer_used)
|
|
|
|
/**
|
|
* Called when a chromosome is applied so we can properly update some stats
|
|
* without having to remove and reapply the mutation from someone
|
|
*
|
|
* Returns `null` if no modification was done, and
|
|
* returns an instance of a power if modification was complete
|
|
*/
|
|
/datum/mutation/human/proc/modify()
|
|
if(modified || !power_path || !owner)
|
|
return
|
|
var/datum/action/cooldown/spell/modified_power = locate(power_path) in owner.actions
|
|
if(!modified_power)
|
|
CRASH("Genetic mutation [type] called modify(), but could not find a action to modify!")
|
|
modified_power.cooldown_time *= GET_MUTATION_ENERGY(src) // Doesn't do anything for mutations with energy_coeff unset
|
|
return modified_power
|
|
|
|
/datum/mutation/human/proc/copy_mutation(datum/mutation/human/mutation_to_copy)
|
|
if(!mutation_to_copy)
|
|
return
|
|
chromosome_name = mutation_to_copy.chromosome_name
|
|
stabilizer_coeff = mutation_to_copy.stabilizer_coeff
|
|
synchronizer_coeff = mutation_to_copy.synchronizer_coeff
|
|
power_coeff = mutation_to_copy.power_coeff
|
|
energy_coeff = mutation_to_copy.energy_coeff
|
|
mutadone_proof = mutation_to_copy.mutadone_proof
|
|
can_chromosome = mutation_to_copy.can_chromosome
|
|
valid_chrom_list = mutation_to_copy.valid_chrom_list
|
|
|
|
/datum/mutation/human/proc/remove_chromosome()
|
|
stabilizer_coeff = initial(stabilizer_coeff)
|
|
synchronizer_coeff = initial(synchronizer_coeff)
|
|
power_coeff = initial(power_coeff)
|
|
energy_coeff = initial(energy_coeff)
|
|
mutadone_proof = initial(mutadone_proof)
|
|
can_chromosome = initial(can_chromosome)
|
|
chromosome_name = null
|
|
|
|
/datum/mutation/human/proc/remove()
|
|
if(dna)
|
|
dna.force_lose(src)
|
|
else
|
|
qdel(src)
|
|
|
|
/datum/mutation/human/proc/grant_power()
|
|
if(!ispath(power_path) || !owner)
|
|
return FALSE
|
|
|
|
var/datum/action/cooldown/spell/new_power = new power_path(src)
|
|
new_power.background_icon_state = "bg_tech_blue_on"
|
|
new_power.panel = "Genetic"
|
|
new_power.Grant(owner)
|
|
|
|
return new_power
|
|
|
|
// Runs through all the coefficients and uses this to determine which chromosomes the
|
|
// mutation can take. Stores these as text strings in a list.
|
|
/datum/mutation/human/proc/update_valid_chromosome_list()
|
|
valid_chrom_list.Cut()
|
|
|
|
if(can_chromosome == CHROMOSOME_NEVER)
|
|
valid_chrom_list += "none"
|
|
return
|
|
|
|
if(stabilizer_coeff != -1)
|
|
valid_chrom_list += "Stabilizer"
|
|
if(synchronizer_coeff != -1)
|
|
valid_chrom_list += "Synchronizer"
|
|
if(power_coeff != -1)
|
|
valid_chrom_list += "Power"
|
|
if(energy_coeff != -1)
|
|
valid_chrom_list += "Energetic"
|