Skip to content

Commit

Permalink
tweak/refactor: goon vampire and new vampire now has common code (#5604
Browse files Browse the repository at this point in the history
…) [testmerge][ba48526]

commit ba48526
Author: dageavtobusnick <[email protected]>
Date:   Sun Sep 1 20:03:25 2024 +0500

     Concat vampire and goonvampire category in TP

    Removing the "gun vampire" category in the trainer panel. Adding Vampire Gunas as an option for the Vampire category. Displaying the role of the vampire gunas in the "vampire" category.

commit 7325545
Merge: fa10613 ef8e620
Author: dageavtobusnick <[email protected]>
Date:   Thu Aug 29 03:02:21 2024 +0500

    Merge remote-tracking branch 'upstream/master220' into vampires_refactor

commit fa10613
Author: dageavtobusnick <[email protected]>
Date:   Thu Aug 22 03:58:39 2024 +0500

    fix

commit 1f77938
Merge: b096b26 a8f41a4
Author: dageavtobusnick <[email protected]>
Date:   Thu Aug 22 03:52:58 2024 +0500

    Merge remote-tracking branch 'upstream/master220' into vampires_refactor

commit b096b26
Merge: 1dd9b76 420e015
Author: dageavtobusnick <[email protected]>
Date:   Fri Aug 16 01:22:43 2024 +0500

    Merge branch 'master220' into vampires_refactor

commit 1dd9b76
Merge: 4e3bcdf cddb76a
Author: dageavtobusnick <[email protected]>
Date:   Sun Aug 4 15:11:06 2024 +0500

    Merge remote-tracking branch 'upstream/master220' into vampires_refactor

commit 4e3bcdf
Author: dageavtobusnick <[email protected]>
Date:   Tue Jul 30 21:22:29 2024 +0500

    refactor fixes

commit 115cf1e
Merge: 4dcd91e 05a2c39
Author: dageavtobusnick <[email protected]>
Date:   Tue Jul 30 15:24:19 2024 +0500

    Merge remote-tracking branch 'upstream/master220' into vampires_refactor

commit 4dcd91e
Merge: ba0843b 744f341
Author: Aziz Chynaliev <[email protected]>
Date:   Mon Jul 29 16:32:54 2024 +0600

    Merge branch 'master220' into vampires_refactor

commit ba0843b
Merge: 5552e89 756845b
Author: Aziz Chynaliev <[email protected]>
Date:   Mon Jul 29 16:28:37 2024 +0600

    Merge branch 'master220' into vampires_refactor

commit 5552e89
Merge: d6b32b4 970d95a
Author: Aziz Chynaliev <[email protected]>
Date:   Mon Jul 29 16:21:55 2024 +0600

    Merge branch 'master220' into vampires_refactor

commit d6b32b4
Author: dageavtobusnick <[email protected]>
Date:   Mon Jul 29 04:10:16 2024 +0500

    some_fixes

commit 5b6a21e
Merge: e9d76f0 4c1bb60
Author: dageavtobusnick <[email protected]>
Date:   Mon Jul 29 01:52:42 2024 +0500

    Merge remote-tracking branch 'upstream/master220' into vampires_refactor

commit e9d76f0
Author: dageavtobusnick <[email protected]>
Date:   Mon Jul 29 01:36:03 2024 +0500

    refactor: goon vampire and new vampire now has general code
  • Loading branch information
Bizzonium committed Sep 29, 2024
1 parent 9ffd4c3 commit a3fe014
Show file tree
Hide file tree
Showing 26 changed files with 320 additions and 847 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/vampire_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@

#define VAMPIRE_NULLIFICATION_CAP 120 // the maximum amount a vampire can be nullified naturally.
#define VAMPIRE_COMPLETE_NULLIFICATION 100 // the point of nullification where vampires can no longer use abilities.

#define NEW_NULLIFICATION 1 //nulifiaction like the new vampires
#define OLD_NULLIFICATION 2 //nulifiaction like the goon vampires
114 changes: 18 additions & 96 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -415,27 +415,11 @@
. += _memory_edit_role_enabled(ROLE_CHANGELING)


/datum/mind/proc/memory_edit_goon_vampire(mob/living/carbon/human/H)
. = _memory_edit_header("goonvampire")
var/datum/antagonist/goon_vampire/g_vamp = has_antag_datum(/datum/antagonist/goon_vampire)
if(g_vamp)
. += "<b><font color='red'>GOON VAMPIRE</font></b>|<a href='byond://?src=[UID()];goonvampire=clear'>no</a>"
. += "<br>Usable blood: <a href='byond://?src=[UID()];goonvampire=edit_usable_blood'>[g_vamp.bloodusable]</a>"
. += " | Total blood: <a href='byond://?src=[UID()];goonvampire=edit_total_blood'>[g_vamp.bloodtotal]</a>"

if(!length(g_vamp.objectives))
. += "<br>Objectives are empty! <a href='byond://?src=[UID()];goonvampire=autoobjectives'>Randomize!</a>"
else if(!isvampire(src))
. += "<a href='byond://?src=[UID()];goonvampire=goonvampire'>goon vampire</a>|<b>NO</b>"

. += _memory_edit_role_enabled(ROLE_VAMPIRE)


/datum/mind/proc/memory_edit_vampire(mob/living/carbon/human/H)
. = _memory_edit_header("vampire", list("traitorvamp"))
var/datum/antagonist/vampire/vamp = has_antag_datum(/datum/antagonist/vampire)
if(vamp)
. += "<b><font color='red'>VAMPIRE</font></b>|<a href='byond://?src=[UID()];vampire=clear'>no</a>"
. += "<b><font color='red'>[is_goon_vampire(src)? "GOON VAMPIRE" : "VAMPIRE" ]</font></b>|<a href='byond://?src=[UID()];vampire=clear'>no</a>"
. += "<br>Usable blood: <a href='byond://?src=[UID()];vampire=edit_usable_blood'>[vamp.bloodusable]</a>"
. += " | Total blood: <a href='byond://?src=[UID()];vampire=edit_total_blood'>[vamp.bloodtotal]</a>"
var/has_subclass = !QDELETED(vamp.subclass)
Expand All @@ -452,12 +436,13 @@
if(!length(vamp.objectives))
. += "<br>Objectives are empty! <a href='byond://?src=[UID()];vampire=autoobjectives'>Randomize!</a>"
else
. += "<a href='byond://?src=[UID()];vampire=vampire'>vampire</a>|<b>NO</b>"
. += "<a href='byond://?src=[UID()];vampire=vampire'>vampire</a>|"
. += "<a href='byond://?src=[UID()];vampire=goonvampire'>goon vampire</a>|<b>NO</b>"

. += _memory_edit_role_enabled(ROLE_VAMPIRE)
/** Enthralled ***/
. += "<br><b><i>enthralled</i></b>: "
if(has_antag_datum(/datum/antagonist/mindslave/thrall) || has_antag_datum(/datum/antagonist/mindslave/goon_thrall))
if(has_antag_datum(/datum/antagonist/mindslave/thrall))
. += "<b><font color='red'>THRALL</font></b>|<a href='byond://?src=[UID()];vampthrall=clear'>no</a>"
else
. += "thrall|<b>NO</b>"
Expand Down Expand Up @@ -720,7 +705,6 @@
"clockwork",
"wizard",
"changeling", // "traitorchan", "thiefchan", "changelingthief",
"goonvampire",
"vampire", // "traitorvamp", "thiefvamp", "vampirethief",
"nuclear",
"traitor",
Expand All @@ -739,8 +723,6 @@
sections["wizard"] = memory_edit_wizard(H)
/** CHANGELING ***/
sections["changeling"] = memory_edit_changeling(H)
/** GOON VAMPIRE ***/
sections["goonvampire"] = memory_edit_goon_vampire(H)
/** VAMPIRE ***/
sections["vampire"] = memory_edit_vampire(H)
/** NUCLEAR ***/
Expand Down Expand Up @@ -1609,87 +1591,37 @@
log_admin("[key_name(usr)] has reset [key_name(current)]'s DNA")
message_admins("[key_name_admin(usr)] has reset [key_name_admin(current)]'s DNA")

else if(href_list["goonvampire"])
switch(href_list["goonvampire"])
else if(href_list["vampire"])
switch(href_list["vampire"])
if("clear")
if(!isvampire(src))
return

remove_goon_vampire_role()
remove_vampire_role()
to_chat(current, "<FONT color='red' size = 3><B>Вы ослабли и потеряли свои силы! Вы больше не вампир и теперь останетесь в своей текущей форме!</B></FONT>")
log_admin("[key_name(usr)] has de-goon-vampired [key_name(current)]")
message_admins("[key_name_admin(usr)] has de-goon-vampired [key_name_admin(current)]")
log_admin("[key_name(usr)] has de-vampired [key_name(current)]")
message_admins("[key_name_admin(usr)] has de-vampired [key_name_admin(current)]")

if("goonvampire")
if(isvampire(src))
return

var/datum/antagonist/goon_vampire/g_vamp = new()
var/datum/antagonist/vampire/goon_vampire/g_vamp = new()
g_vamp.give_objectives = FALSE
add_antag_datum(g_vamp)
to_chat(usr, "<span class='notice'>У вампира [key] отсутствуют задания. Вы можете добавить их вручную или сгенерировать случайный набор, кнопкой <b>Randomize!</b></span>")
to_chat(usr, span_notice("У вампира [key] отсутствуют цели. Вы можете добавить их вручную или сгенерировать случайный набор, кнопкой <b>Randomize!</b>"))
log_admin("[key_name(usr)] has goon-vampired [key_name(current)]")
message_admins("[key_name_admin(usr)] has goon-vampired [key_name_admin(current)]")

if("edit_usable_blood")
if(!isvampire(src))
return

var/new_usable = input(usr, "Select a new value:", "Modify usable blood") as null|num
if(isnull(new_usable) || new_usable < 0)
return
var/datum/antagonist/goon_vampire/g_vamp = has_antag_datum(/datum/antagonist/goon_vampire)
g_vamp.bloodusable = new_usable
current.update_action_buttons_icon()
log_admin("[key_name(usr)] has set [key_name(current)]'s usable blood to [new_usable].")
message_admins("[key_name_admin(usr)] has set [key_name_admin(current)]'s usable blood to [new_usable].")

if("edit_total_blood")
if(!isvampire(src))
return

var/new_total = input(usr, "Select a new value:", "Modify total blood") as null|num
if(isnull(new_total) || new_total < 0)
return

var/datum/antagonist/goon_vampire/g_vamp = has_antag_datum(/datum/antagonist/goon_vampire)
if(new_total < g_vamp.bloodtotal)
if(alert(usr, "Note that reducing the vampire's total blood may remove some active powers. Continue?", "Confirm New Total", "Yes", "No") == "No")
return
g_vamp.remove_all_powers()

g_vamp.bloodtotal = new_total
g_vamp.check_vampire_upgrade()
log_admin("[key_name(usr)] has set [key_name(current)]'s total blood to [new_total].")
message_admins("[key_name_admin(usr)] has set [key_name_admin(current)]'s total blood to [new_total].")

if("autoobjectives")
var/datum/antagonist/goon_vampire/g_vamp = has_antag_datum(/datum/antagonist/goon_vampire)
g_vamp.give_objectives()
to_chat(usr, "<span class='notice'>Для вампира [key] сгенерированы задания. Вы можете отредактировать и объявить их вручную.</span>")
log_admin("[key_name(usr)] has automatically forged objectives for [key_name(current)]")
message_admins("[key_name_admin(usr)] has automatically forged objectives for [key_name_admin(current)]")

else if(href_list["vampire"])
switch(href_list["vampire"])
if("clear")
if(!isvampire(src))
return

remove_vampire_role()
to_chat(current, "<FONT color='red' size = 3><B>You grow weak and lose your powers! You are no longer a vampire and are stuck in your current form!</B></FONT>")
log_admin("[key_name(usr)] has de-vampired [key_name(current)]")
message_admins("[key_name_admin(usr)] has de-vampired [key_name_admin(current)]")

if("vampire")
if(isvampire(src))
return

var/datum/antagonist/vampire/vamp = new()
var/datum/antagonist/vampire/new_vampire/vamp = new()
vamp.give_objectives = FALSE
add_antag_datum(vamp)
to_chat(usr, "<span class='notice'>Vampire [key] has no objectives. You can add custom ones or generate random set by using <b>Randomize!</b> button.</span>")
to_chat(current, "<B><font color='red'>Your powers have awoken. Your lust for blood grows... You are a Vampire!</font></B>")
to_chat(usr, span_notice("У вампира [key] отсутствуют цели. Вы можете добавить их вручную или сгенерировать случайный набор, кнопкой <b>Randomize!</b>"))
to_chat(current, "<B><font color='red'>Ваши силы пробудились. Ваша жажда крови растет... Вы вампир!</font></B>")
log_admin("[key_name(usr)] has vampired [key_name(current)]")
message_admins("[key_name_admin(usr)] has vampired [key_name_admin(current)]")

Expand Down Expand Up @@ -1855,16 +1787,15 @@

var/datum/antagonist/vampire/vamp = has_antag_datum(/datum/antagonist/vampire)
vamp.give_objectives()
to_chat(usr, "<span class='notice'>The objectives for vampire [key] have been generated. You can edit them and announce manually.</span>")
to_chat(usr, span_notice("Для вампира [key] сгенерированы задания. Вы можете отредактировать и объявить их вручную."))
log_admin("[key_name(usr)] has automatically forged objectives for [key_name(current)]")
message_admins("[key_name_admin(usr)] has automatically forged objectives for [key_name_admin(current)]")

else if(href_list["vampthrall"])
switch(href_list["vampthrall"])
if("clear")
if(has_antag_datum(/datum/antagonist/mindslave/thrall) || has_antag_datum(/datum/antagonist/mindslave/goon_thrall))
if(has_antag_datum(/datum/antagonist/mindslave/thrall))
remove_antag_datum(/datum/antagonist/mindslave/thrall)
remove_antag_datum(/datum/antagonist/mindslave/goon_thrall)
log_admin("[key_name(usr)] has de-vampthralled [key_name(current)]")
message_admins("[key_name_admin(usr)] has de-vampthralled [key_name_admin(current)]")

Expand Down Expand Up @@ -2716,14 +2647,6 @@
remove_antag_datum(chan_datum)


/datum/mind/proc/remove_goon_vampire_role()
var/datum/antagonist/goon_vampire/vamp = has_antag_datum(/datum/antagonist/goon_vampire)
if(!vamp)
return

remove_antag_datum(vamp)


/datum/mind/proc/remove_vampire_role()
var/datum/antagonist/vampire/vamp = has_antag_datum(/datum/antagonist/vampire)
if(!vamp)
Expand Down Expand Up @@ -2825,7 +2748,6 @@
remove_clocker_role()
remove_wizard_role()
remove_changeling_role()
remove_goon_vampire_role()
remove_vampire_role()
remove_syndicate_role()
remove_event_role()
Expand Down Expand Up @@ -2897,12 +2819,12 @@

/datum/mind/proc/make_goon_vampire()
if(!isvampire(src))
add_antag_datum(/datum/antagonist/goon_vampire)
add_antag_datum(/datum/antagonist/vampire/goon_vampire)


/datum/mind/proc/make_vampire()
if(!isvampire(src))
add_antag_datum(/datum/antagonist/vampire)
add_antag_datum(/datum/antagonist/vampire/new_vampire)


/datum/mind/proc/make_Nuke()
Expand Down
24 changes: 14 additions & 10 deletions code/datums/spell_handler/vampire_spell_handler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,31 @@

if(isvampirecoffin(user.loc))
if(show_message)
to_chat(user, span_warning("You can't use this ability inside the coffin!"))
to_chat(user, span_warning("Вы не можете использовать эту способность, будучи в гробу!"))
return FALSE

var/fullpower = vampire.get_ability(/datum/vampire_passive/full)

if(user.stat >= DEAD) // TODO check if needed
if(show_message)
to_chat(user, span_warning("Not while you're dead!"))
to_chat(user, span_warning("Но вы же мертвы!"))
return FALSE

if(vampire.nullified >= VAMPIRE_COMPLETE_NULLIFICATION && !fullpower) // above 100 nullification vampire powers are useless
if(((vampire.nullified >= VAMPIRE_COMPLETE_NULLIFICATION) || \
(vampire.nullification == OLD_NULLIFICATION && vampire.nullified)) && !fullpower) // above 100 nullification vampire powers are useless
if(show_message)
to_chat(user, span_warning("Something is blocking your powers!"))
to_chat(user, span_warning("Что-то блокирует ваши силы!"))
return FALSE

if(vampire.bloodusable < required_blood)
if(show_message)
to_chat(user, span_warning("You require at least [required_blood] units of usable blood to do that!"))
to_chat(user, span_warning("Для этого вам потребуется не менее [required_blood] единиц крови!"))
return FALSE

//chapel check
if(is_type_in_typecache(get_area(user), GLOB.holy_areas) && !fullpower)
if(show_message)
to_chat(user, span_warning("Your powers are useless on this holy ground."))
to_chat(user, span_warning("Ваши силы не действуют на этой святой земле."))
return FALSE
return TRUE

Expand All @@ -44,13 +45,13 @@
if(!required_blood || !deduct_blood_on_cast) //don't take the blood yet if this is false!
return

var/datum/antagonist/vampire/vampire = user.mind.has_antag_datum(/datum/antagonist/vampire)
var/datum/antagonist/vampire/vampire = user?.mind?.has_antag_datum(/datum/antagonist/vampire)

vampire.bloodusable -= calculate_blood_cost(vampire)
vampire?.bloodusable -= calculate_blood_cost(vampire)


/datum/spell_handler/vampire/proc/calculate_blood_cost(datum/antagonist/vampire/vampire)
var/blood_cost_modifier = 1 + vampire.nullified / 100
var/blood_cost_modifier = 1 + (vampire.nullification == OLD_NULLIFICATION)? 0 : vampire.nullified / 100
var/blood_cost = round(required_blood * blood_cost_modifier)
return clamp(blood_cost, 0, vampire.bloodusable)

Expand All @@ -63,6 +64,9 @@
var/datum/antagonist/vampire/vampire = user?.mind?.has_antag_datum(/datum/antagonist/vampire)
if(!vampire)
return
to_chat(user, span_boldnotice("You have [vampire.bloodusable] blood left to use."))
to_chat(user, span_boldnotice("У Вас осталось [vampire.bloodusable] единиц крови."))
SSblackbox.record_feedback("tally", "vampire_powers_used", 1, "[spell]") // Only log abilities which require blood

/datum/spell_handler/vampire/goon/revert_cast(mob/living/carbon/user, obj/effect/proc_holder/spell/spell)
var/datum/antagonist/vampire/vampire = user?.mind?.has_antag_datum(/datum/antagonist/vampire)
vampire?.bloodusable += required_blood
4 changes: 2 additions & 2 deletions code/game/gamemodes/antag_paradise/antag_paradise.dm
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@
log_and_message_admins("[antag] was not assigned for AI role. Report this to coders.")

if(ROLE_VAMPIRE)
antag.add_antag_datum(/datum/antagonist/vampire)
antag.add_antag_datum(/datum/antagonist/vampire/new_vampire)
if(ROLE_CHANGELING)
antag.add_antag_datum(/datum/antagonist/changeling)
if(ROLE_TRAITOR)
Expand All @@ -330,7 +330,7 @@
for(var/datum/mind/antag as anything in pre_double_antags)
switch(pre_double_antags[antag])
if(ROLE_VAMPIRE)
antag.add_antag_datum(/datum/antagonist/vampire)
antag.add_antag_datum(/datum/antagonist/vampire/new_vampire)
if(ROLE_CHANGELING)
antag.add_antag_datum(/datum/antagonist/changeling)

Expand Down
4 changes: 0 additions & 4 deletions code/game/gamemodes/objective.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1142,10 +1142,6 @@ GLOBAL_LIST_EMPTY(admin_objective_list)
if(vampire && (vampire.bloodtotal >= target_amount))
return TRUE

var/datum/antagonist/goon_vampire/g_vampire = player.has_antag_datum(/datum/antagonist/goon_vampire)
if(g_vampire && (g_vampire.bloodtotal >= target_amount))
return TRUE

return FALSE


Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/vampire/goon_vampire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

/datum/game_mode/goon_vampire/post_setup()
for(var/datum/mind/vampire in pre_vampires)
vampire.add_antag_datum(/datum/antagonist/goon_vampire)
vampire.add_antag_datum(/datum/antagonist/vampire/goon_vampire)
..()


Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/vampire/thief_vamp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@

/datum/game_mode/thief/vampire/post_setup()
for(var/datum/mind/vampire in pre_vampires)
vampire.add_antag_datum(/datum/antagonist/vampire)
vampire.add_antag_datum(/datum/antagonist/vampire/new_vampire)
..()
2 changes: 1 addition & 1 deletion code/game/gamemodes/vampire/traitor_vamp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@

/datum/game_mode/traitor/vampire/post_setup()
for(var/datum/mind/vampire in pre_vampires)
vampire.add_antag_datum(/datum/antagonist/vampire)
vampire.add_antag_datum(/datum/antagonist/vampire/new_vampire)
..()

2 changes: 1 addition & 1 deletion code/game/gamemodes/vampire/vampire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

/datum/game_mode/vampire/post_setup()
for(var/datum/mind/vampire in pre_vampires)
vampire.add_antag_datum(/datum/antagonist/vampire)
vampire.add_antag_datum(/datum/antagonist/vampire/new_vampire)
..()


Expand Down
Loading

0 comments on commit a3fe014

Please sign in to comment.