Skip to content

Commit

Permalink
Adds automatic soul generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
BurgerLUA committed Nov 11, 2024
1 parent 0f056ce commit f9d3775
Show file tree
Hide file tree
Showing 77 changed files with 166 additions and 181 deletions.
56 changes: 55 additions & 1 deletion code/_core/client/verbs/debug.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ var/global/static/list/debug_verbs = list(
/client/verb/get_far_viewers,
/client/verb/get_active_ais_not_in_player_range,
/client/verb/check_value_of_loadouts,
/client/verb/check_unobtainable_items
/client/verb/check_unobtainable_items,
/client/verb/check_soulgem_size
)


Expand Down Expand Up @@ -854,3 +855,56 @@ var/global/static/list/destroy_everything_whitelist = list(
final_list += "[k]: [v]cr<br>"

src << browse("<head><style>[STYLESHEET]</style></head><body>[final_list]</body>","window=loadoutvalue")

/client/verb/check_soulgem_size()

set name = "Check All Soulgem Sizes (DANGER)"
set category = "Debug"

var/desired_choice = input("Are you sure you want to check the soul sizes of all mobs? This involves spawning every mob and then deleting them.","Soul Size Checking","Cancel") as null|anything in list("Yes","No","Cancel")

if(desired_choice != "Yes")
return

var/list/final_list = list()

var/turf/T = get_turf(mob)

for(var/k in subtypesof(/mob/living))
var/mob/living/L = k
if(!initial(L.ai))
continue
if(!initial(L.health))
continue
L = new L(T)
INITIALIZE(L)
GENERATE(L)
FINALIZE(L)
final_list["[L.type]"] = L.soul_size
qdel(L)

sort_tim(final_list,/proc/cmp_numeric_dsc,associative=TRUE)

var/final_output = ""

for(var/k in final_list)
var/v = final_list[k]
final_output += "[k]: [get_soul_size_name(v)]<br>"

src << browse("<head><style>[STYLESHEET]</style></head><body>[final_output]</body>","window=garbage")

/proc/get_soul_size_name(var/soul_size)

if(!soul_size || soul_size <= 0)
return "None"

if(soul_size <= SOUL_SIZE_COMMON)
return "Common"
else if(soul_size <= SOUL_SIZE_UNCOMMON)
return "Uncommon"
else if(soul_size <= SOUL_SIZE_RARE)
return "Rare"
else if(soul_size <= SOUL_SIZE_MYSTIC)
return "Mystic"

return "Godly"
5 changes: 2 additions & 3 deletions code/_core/datum/ai/boss/leaper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@
last_teleport_health_mod = health_mod
return .

if(next_mass_summon <= world.time && prob(10))
if(owner_as_leaper.check_frogs() <= 5)
owner_as_leaper.manifest_frogs()
if(next_mass_summon <= world.time && prob(10) && owner_as_leaper.check_frogs() <= 5)
owner_as_leaper.manifest_frogs()
next_mass_summon = world.time + SECONDS_TO_DECISECONDS(30)*health_mod
return .

Expand Down
26 changes: 21 additions & 5 deletions code/_core/datum/status_effect/soul_trap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,32 @@

/status_effect/soul_trap/can_add_status_effect(var/atom/attacker,var/mob/living/victim)

if(!victim.ai)
if(!victim.can_be_soultrapped())
return FALSE

if(victim.minion_master)
. = ..()

/mob/living/proc/can_be_soultrapped()

if(!ai) //Soulless, pretty much.
return FALSE

if(victim.is_player_controlled())
if(delete_on_death) //Some weird bullshit.
return FALSE

if(!is_simple(victim))
if(minion_master) //Soul belongs to someone else.
return FALSE

. = ..()
if(!soul_size || soul_size <= 0) //Error soul.
return FALSE

if(initial(anchored)) //Likely a machine.
return FALSE

if(is_player_controlled()) //Controlled by a player.
return FALSE

return TRUE

/mob/living/advanced/can_be_soultrapped()
return FALSE
31 changes: 30 additions & 1 deletion code/_core/mob/living/_living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@
var/list/addictions = list() //List of addictions.

var/soul_size = null
var/soul_size_name = "ERROR"

var/list/traits = list() //Assoc list. This is saved.
var/list/traits_by_category = list() //Assoc list. This isn't saved.
Expand Down Expand Up @@ -676,10 +677,12 @@

update_level(TRUE)

QUEUE_HEALTH_UPDATE(src)
calculate_soulgem_size()

update_eyes()

QUEUE_HEALTH_UPDATE(src)

/mob/living/proc/setup_name()
name = "[CHECK_NAME(name)]"
return TRUE
Expand Down Expand Up @@ -770,3 +773,29 @@
caller?.visible_message(span("notice","\The [caller.name] draws some blood from \the [src.name]."),span("notice","You drew [amount_added]u of blood from \the [src.name]."))

return amount_added

/mob/living/proc/calculate_soulgem_size()

if(!health)
soul_size = SOUL_SIZE_COMMON
return

// https://www.desmos.com/calculator/0fm1pfghsb
var/health_bonus = sin( (min(health.health_max,SOUL_SIZE_MYSTIC) / SOUL_SIZE_MYSTIC)*90)*SOUL_SIZE_MYSTIC
var/level_bonus = ((level/100)**3)*SOUL_SIZE_RARE
if(boss)
health_bonus *= 0.25
level_bonus *= 4

soul_size = SOUL_SIZE_COMMON*0.9 + health_bonus + level_bonus

if(soul_size <= SOUL_SIZE_COMMON)
soul_size = SOUL_SIZE_COMMON
else if(soul_size <= SOUL_SIZE_UNCOMMON)
soul_size = SOUL_SIZE_UNCOMMON
else if(soul_size <= SOUL_SIZE_RARE || !boss) //Maximum size of non-boss souls is rare.
soul_size = SOUL_SIZE_RARE
else if(soul_size <= SOUL_SIZE_MYSTIC)
soul_size = SOUL_SIZE_MYSTIC
else
soul_size = SOUL_SIZE_GODLY
2 changes: 1 addition & 1 deletion code/_core/mob/living/advanced/_advanced.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
var/list/protection_cold = TARGETABLE_LIMBS_KV
var/list/protection_pressure = TARGETABLE_LIMBS_KV

health = null
health = /health/mob/living/advanced

value = 500

Expand Down
1 change: 0 additions & 1 deletion code/_core/mob/living/advanced/human/npc/_npc.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/mob/living/advanced/npc/
ai = /ai/advanced/
var/dialogue_id
soul_size = SOUL_SIZE_COMMON

/mob/living/advanced/npc/proc/can_talk_to(var/mob/caller)

Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/advanced/human/npc/abductor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
sex = NEUTER
gender = NEUTER

soul_size = SOUL_SIZE_UNCOMMON

loyalty_tag = "Abductor"
iff_tag = "Abductor"

Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/advanced/human/npc/bandit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

dna = /dna/human

soul_size = SOUL_SIZE_COMMON

ai = /ai/advanced/bandit

loadout = /loadout/bandit/male
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/advanced/human/npc/citizen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

dna = /dna/human

soul_size = SOUL_SIZE_COMMON

ai = /ai/advanced

level = 4
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/advanced/human/npc/deathsquad.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

dialogue_id = /dialogue/npc/soldier

soul_size = SOUL_SIZE_UNCOMMON

loadout = /loadout/deathsquad

level = 60
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/advanced/human/npc/goblin_warrior.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

species = "goblin"

soul_size = SOUL_SIZE_COMMON

pixel_z = 1

iff_tag = "Goblin"
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/advanced/human/npc/monkey.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

species = "monkey"

soul_size = SOUL_SIZE_COMMON

loyalty_tag = "Monkey"

butcher_contents = list(
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/advanced/human/npc/raging_mage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

level = 20

soul_size = SOUL_SIZE_UNCOMMON

loyalty_tag = "Wizard Federation"
iff_tag = "Wizard Federation"

Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/advanced/human/npc/space_soldier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

dialogue_id = /dialogue/npc/soldier/

soul_size = SOUL_SIZE_UNCOMMON

level = 60

loadout = /loadout/space_soldier/assault_rifle
Expand Down
4 changes: 0 additions & 4 deletions code/_core/mob/living/advanced/human/npc/syndicate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@

level = 20

soul_size = SOUL_SIZE_UNCOMMON


/mob/living/advanced/npc/syndicate/wizard
name = "syndicate spellcaster"
Expand All @@ -75,8 +73,6 @@

level = 30

soul_size = SOUL_SIZE_UNCOMMON

/mob/living/advanced/npc/syndicate/stress_test
name = "stress test"
ai = /ai/advanced/syndicate/stress_test
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

var/next_revive = 0

soul_size = SOUL_SIZE_RARE

blood_type = null

level = 70
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@

level = 99

soul_size = SOUL_SIZE_RARE

loadout = /loadout/daddy
dna = /dna/human
2 changes: 1 addition & 1 deletion code/_core/mob/living/health.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
if(ai)
ai.on_damage_received(atom_damaged,attacker,weapon,DT,damage_table,damage_amount,stealthy)

if(dead && time_of_death + 30 <= world.time && (override_butcher || length(butcher_contents)) && is_living(attacker) && get_dist(attacker,src) <= 1)
if(!minion_master && dead && time_of_death + 30 <= world.time && (override_butcher || length(butcher_contents)) && is_living(attacker) && get_dist(attacker,src) <= 1)
var/mob/living/L = attacker
var/blade_damage = length(damage_table) ? SAFENUM(damage_table[BLADE]) + SAFENUM(damage_table[LASER]) : 0

Expand Down
5 changes: 4 additions & 1 deletion code/_core/mob/living/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@

if(minion_master)
minion_master.remove_minion(src)
else if(!delete_on_death && soul_size > 0 && has_status_effect(SOULTRAP) && !is_player_controlled())

if(has_status_effect(SOULTRAP) && can_be_soultrapped())
var/obj/effect/temp/soul/S = new(T,SECONDS_TO_DECISECONDS(20))
S.appearance = src.appearance
S.transform = get_base_transform()
Expand Down Expand Up @@ -110,6 +111,8 @@
DG.update_owner(null)
handle_transform()
update_eyes()
if(ai)
ai.set_active(TRUE)
return TRUE

/mob/living/proc/rejuvenate(var/reset_nutrition = TRUE)
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/minion.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

/mob/living/proc/can_add_minion(var/mob/living/minion_to_add)


return TRUE

/mob/living/proc/add_minion(var/mob/living/minion_to_add)
Expand Down
1 change: 0 additions & 1 deletion code/_core/mob/living/simple/_simple.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/mob/living/simple
//soul_size = SOUL_SIZE_COMMON
ai = /ai/
loyalty_tag = null
iff_tag = null
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/simple/antag.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

size = SIZE_HUMAN

soul_size = SOUL_SIZE_COMMON

level = 4

var/static/list/valid_antag_colors = list(
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/simple/arachnid.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
blood_type = /reagent/blood/arachnid
blood_volume = 2000

soul_size = SOUL_SIZE_UNCOMMON

object_size = 2

level = 19
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/simple/ash_drake.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@
blood_type = /reagent/blood/ancient
blood_volume = 2000

soul_size = SOUL_SIZE_MYSTIC

object_size = 2

respawn_time = SECONDS_TO_DECISECONDS(300)
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/simple/bear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
blood_type = /reagent/blood/bear
blood_volume = 700

soul_size = SOUL_SIZE_UNCOMMON

level = 6

/mob/living/simple/bear/update_overlays()
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/simple/bio_monster.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
blood_volume = 500
blood_type = /reagent/blood/blob

soul_size = SOUL_SIZE_COMMON

level = 7

/mob/living/simple/bio_monster/post_death()
Expand Down
2 changes: 0 additions & 2 deletions code/_core/mob/living/simple/blob_spore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
blood_volume = 100
blood_type = /reagent/blood/blob

soul_size = SOUL_SIZE_COMMON

level = 2

reagents = /reagent_container/blob
Expand Down
Loading

0 comments on commit f9d3775

Please sign in to comment.