Skip to content

Commit

Permalink
Improved wizard & survivor scoreboard and a few other things (#36633)
Browse files Browse the repository at this point in the history
* the things

* I didn't use these

* Now covers one-use spellbooks

* fixes conflicts
  • Loading branch information
boy2mantwicethefam authored Jun 17, 2024
1 parent 3f20501 commit 788f048
Show file tree
Hide file tree
Showing 8 changed files with 611 additions and 325 deletions.
33 changes: 22 additions & 11 deletions code/datums/gamemode/role/summonsurvivors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
default_admin_voice = "Common Sense"
admin_voice_style = "warning"
var/survivor_type = "survivor"
var/summons_received
var/list/summons_received = list()

/datum/role/survivor/crusader
id = CRUSADER
Expand All @@ -35,9 +35,13 @@
AppendObjective(S)

/datum/role/survivor/GetBought()
if(!summons_received)
return ""
return "The [name] received the following as a result of a summoning spell: [summons_received]<BR>"
var/dat
dat += "<BR>The [name] received the following as a result of a summoning spell after becoming a [name]:<BR>"
for(var/list/L in summons_received)
var/item = L["item_name"]
var/item_image = L["icon"]
dat += "[item_image] [item]<BR>"
return dat

//Note this is a wizard subtype

Expand All @@ -60,9 +64,13 @@
return TRUE

/datum/role/wizard/summon_magic/GetBought()
if(!summons_received)
return ""
return "The [name] received the following as a result of a summoning spell: [summons_received]<BR>"
var/dat
dat += "<BR>The [name] received the following as a result of a summoning spell after becoming a [name]:<BR>"
for(var/list/L in summons_received)
var/item = L["item_name"]
var/item_image = L["icon"]
dat += "[item_image] [item]<BR>"
return dat

/datum/role/wizard/summon_magic/artifact
name = MAGICIAN_ARTIFACT
Expand Down Expand Up @@ -91,7 +99,10 @@
return TRUE

/datum/role/wizard/summon_potions/GetBought()
if(!summons_received)
return ""
return "The [name] received the following as a result of a summoning spell: [summons_received]<BR>"

var/dat
dat += "<BR>The [name] received the following as a result of a summoning spell after becoming a [name]:<BR>"
for(var/list/L in summons_received)
var/item = L["item_name"]
var/item_image = L["icon"]
dat += "[item_image] [item]<BR>"
return dat
66 changes: 60 additions & 6 deletions code/datums/gamemode/role/wizard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
admin_voice_style = "notice"

stat_datum_type = /datum/stat/role/wizard
shows_spells = TRUE
//Lists used so that the spells will still show up at round-end even if the apprentice has been destroyed.
//Can get lost through absorbing
var/list/spells_from_spellbook = list()
var/list/spells_from_absorb = list()
//Does not show spells because the scoreboard code overrides it

var/list/artifacts_bought = list()
var/list/potions_bought = list()
Expand Down Expand Up @@ -76,13 +80,63 @@
//Transfer the spell without doing on_added() or on_removed(), instead doing on_transfer()
transfer_spell(new_character, old_character, S)

/datum/role/wizard/GetBought()
/datum/role/wizard/GetScoreboard()
. = ..()
if((artifacts_bought?.len) || (potions_bought?.len))
. += "<BR>[. != "" ? "Additionally, t" : "T"]he wizard brought:<BR>"
if(!disallow_job) //It's a survivor wizzie
return
var/mob/living/carbon/human/H = antag.current
var/has_nothing = TRUE //No spells, no potions, no artifacts

if(spells_from_spellbook.len)
has_nothing = FALSE
. += "<BR>[has_nothing ? "T" : "Additionally, t"]he wizard learned:<BR>"
for(var/spell/S in spells_from_spellbook)
var/icon/tempimage
if(S.override_icon != "")
tempimage = icon(S.override_icon, S.hud_state)
else
tempimage = icon('icons/mob/screen_spells.dmi', S.hud_state)
. += "<img class='icon' src='data:image/png;base64,[iconsouth2base64(tempimage)]'> [S.name]<BR>"

//Spells that are learned through absorbing them from other mages
if(spells_from_absorb.len)
. += "<BR>[has_nothing ? "T" : "Additionally, t"]he wizard absorbed:<BR>"
has_nothing = FALSE
for(var/spell/S in spells_from_absorb)
var/icon/tempimage
if(S.override_icon != "")
tempimage = icon(S.override_icon, S.hud_state)
else
tempimage = icon('icons/mob/screen_spells.dmi', S.hud_state)
. += "<img class='icon' src='data:image/png;base64,[iconsouth2base64(tempimage)]'> [S.name]<BR>"

//Spells that the wizard somehow got their hands on. Must be wizard spells
var/list/dummy_list = H.spell_list - (spells_from_spellbook + spells_from_absorb)
if(dummy_list.len)
var/has_an_uncategorized_wizard_spell = FALSE
for(var/spell/S in H.spell_list)
if(S.is_wizard_spell())
has_an_uncategorized_wizard_spell = TRUE
has_nothing = FALSE
break
if(has_an_uncategorized_wizard_spell)
//This implies adminbus or other shenanigans that could grant wizard spells
. += "<BR>[has_nothing ? "T" : "Additionally, t"]he wizard somehow knew, through divine help or other means:<BR>"
for(var/spell/S in dummy_list)
var/icon/tempimage
if(S.override_icon != "")
tempimage = icon(S.override_icon, S.hud_state)
else
tempimage = icon('icons/mob/screen_spells.dmi', S.hud_state)
. += "<img class='icon' src='data:image/png;base64,[iconsouth2base64(tempimage)]'> [S.name]<BR>"

//Artifacts and potions, if the wizard bought any
if(artifacts_bought.len || potions_bought.len)
has_nothing = FALSE
. += "<BR>[has_nothing ? "T" : "Additionally, t"]he wizard brought:<BR>"
for(var/entry in artifacts_bought)
. += "[entry]<BR>"
for(var/entry in potions_bought)
. += "[entry]<BR>"
else if(. == "")
return "The wizard used only the magic of charisma this round."
if(has_nothing)
. += "The wizard used only the magic of charisma this round."
45 changes: 42 additions & 3 deletions code/datums/gamemode/role/wizard_apprentice.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
id = WIZAPP
disallow_job = TRUE
logo_state = "apprentice-logo"
//Lists used so that the spells will still show up at round-end even if the apprentice has been destroyed.
//Can get lost through absorbing
//Apprentices can't actually learn spells from spellbooks but their starting spells will still count as such
var/list/spells_from_spellbook = list()
var/list/spells_from_absorb = list()

var/apprentice_type = "Normal" //Name used for scoreboard as to what kind of apprentice they were

/datum/role/wizard_apprentice/OnPostSetup()
. = ..()
Expand Down Expand Up @@ -39,7 +46,39 @@
if (!(S.spell_flags & LOSE_IN_TRANSFER))
transfer_spell(new_character, old_character, S)

/datum/role/wizard_apprentice/GetBought()
/datum/role/wizard_apprentice/GetScoreboard()
. = ..()
if(. == "")
return "The apprentice somehow forgot everything he learned in magic school."
var/mob/living/carbon/human/H = antag.current
var/has_wizard_spell = FALSE
//Spells that are learned from spellbooks. They cannot use the normal spellbook but they can use the one-time use ones.
if(spells_from_spellbook.len)
has_wizard_spell = TRUE
. += "<BR>The [apprentice_type] apprentice learned:<BR>"
for(var/spell/S in spells_from_spellbook)
var/icon/tempimage = icon('icons/mob/screen_spells.dmi', S.hud_state)
. += "<img class='icon' src='data:image/png;base64,[iconsouth2base64(tempimage)]'> [S.name]<BR>"
//Spells that are learned through absorbing them from other mages
if(spells_from_absorb.len)
has_wizard_spell = TRUE
. += "<BR>The [apprentice_type] apprentice absorbed:<BR>"
for(var/spell/S in spells_from_absorb)
var/icon/tempimage = icon('icons/mob/screen_spells.dmi', S.hud_state)
. += "<img class='icon' src='data:image/png;base64,[iconsouth2base64(tempimage)]'> [S.name]<BR>"
//Spells that the wizard somehow got their hands on. Must be wizard spells
var/list/dummy_list = H.spell_list - (spells_from_spellbook + spells_from_absorb)
if(dummy_list.len)
var/has_an_uncategorized_wizard_spell = FALSE
for(var/spell/S in H.spell_list)
if(S.is_wizard_spell())
has_an_uncategorized_wizard_spell = TRUE
has_wizard_spell = TRUE
break
if(has_an_uncategorized_wizard_spell)
//This implies adminbus or other shenanigans that could grant wizard spells
. += "<BR>The [apprentice_type] apprentice somehow knew, through divine help or other means:<BR>"
for(var/spell/S in dummy_list)
var/icon/tempimage = icon('icons/mob/screen_spells.dmi', S.hud_state)
. += "<img class='icon' src='data:image/png;base64,[iconsouth2base64(tempimage)]'> [S.name]<BR>"
//Zero wizard spells known at all, could have been absorbed by someone else
if(!has_wizard_spell)
. += "The [apprentice_type] apprentice somehow forgot everything he learned in magic school."
12 changes: 8 additions & 4 deletions code/game/gamemodes/wizard/apprentice_contract.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ var/list/wizard_apprentice_setups_by_name = list()

/datum/wizard_apprentice_setup/proc/give_spells(mob/target)
for(var/spell_path in spells)
target.add_spell(spell_path)
target.add_spell(spell_path, iswizard = TRUE)
var/datum/role/wizard_apprentice/WA = target.mind.GetRole(WIZAPP)
if(istype(WA))
WA.spells_from_spellbook += spell_path

/datum/wizard_apprentice_setup/destruction
name = "Destruction"
Expand All @@ -24,21 +27,21 @@ var/list/wizard_apprentice_setups_by_name = list()
)

/datum/wizard_apprentice_setup/bluespace_manipulation
name = "Bluespace manipulation"
name = "Bluespace Manipulation"
spells = list(
/spell/targeted/ethereal_jaunt,
/spell/area_teleport,
)

/datum/wizard_apprentice_setup/clown_magic
name = "Clown magic"
name = "Clown Magic"
spells = list(
/spell/targeted/equip_item/clowncurse,
/spell/targeted/shoesnatch,
)

/datum/wizard_apprentice_setup/muscle_magic
name = "Muscle magic"
name = "Muscle Magic"
spells = list(
/spell/targeted/genetic/mutate,
/spell/targeted/genetic/blind,
Expand Down Expand Up @@ -190,6 +193,7 @@ var/list/wizard_apprentice_setups_by_name = list()
apprentice.fully_replace_character_name(apprentice.real_name, forced_apprentice_name)
else
name_wizard(apprentice, "Wizard's Apprentice")
apprentice_role.apprentice_type = chosen_setup.name //Set their type
update_faction_icons()
visible_message("<span class='notice'>\The [src] folds back on itself as the apprentice appears!</span>")
set_light(0)
Expand Down
Loading

0 comments on commit 788f048

Please sign in to comment.