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]

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 Aug 31, 2024
1 parent fd0f45f commit 9779745
Show file tree
Hide file tree
Showing 26 changed files with 313 additions and 772 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
32 changes: 11 additions & 21 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@

/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)
var/datum/antagonist/vampire/g_vamp = has_antag_datum(/datum/antagonist/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>"
Expand Down Expand Up @@ -457,7 +457,7 @@
. += _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 @@ -1615,7 +1615,7 @@
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)]")
Expand All @@ -1624,7 +1624,7 @@
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>")
Expand All @@ -1638,7 +1638,7 @@
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)
var/datum/antagonist/vampire/goon_vampire/g_vamp = has_antag_datum(/datum/antagonist/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].")
Expand All @@ -1652,7 +1652,7 @@
if(isnull(new_total) || new_total < 0)
return

var/datum/antagonist/goon_vampire/g_vamp = has_antag_datum(/datum/antagonist/goon_vampire)
var/datum/antagonist/vampire/goon_vampire/g_vamp = has_antag_datum(/datum/antagonist/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
Expand All @@ -1664,7 +1664,7 @@
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)
var/datum/antagonist/vampire/g_vamp = has_antag_datum(/datum/antagonist/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)]")
Expand All @@ -1685,7 +1685,7 @@
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>")
Expand Down Expand Up @@ -1862,9 +1862,8 @@
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 +2715,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 +2816,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 +2887,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
37 changes: 17 additions & 20 deletions code/game/objects/items/weapons/holy_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
var/datum/antagonist/vampire/vamp = target.mind?.has_antag_datum(/datum/antagonist/vampire)
if(ishuman(user) && vamp && !vamp.get_ability(/datum/vampire_passive/full) && user.mind.isholy)
to_chat(target, span_warning("The nullrod's power interferes with your own!"))
vamp.adjust_nullification(30 + sanctify_force, 15 + sanctify_force)
return .
switch(vamp.nullification)
if(OLD_NULLIFICATION)
vamp.base_nullification()

var/datum/antagonist/goon_vampire/g_vamp = target.mind?.has_antag_datum(/datum/antagonist/goon_vampire)
if(ishuman(user) && g_vamp && !g_vamp.get_ability(/datum/goon_vampire_passive/full))
to_chat(target, span_warning("The nullrod's power interferes with your own!"))
g_vamp.nullified = max(5, g_vamp.nullified + 2)
if(NEW_NULLIFICATION)
vamp.adjust_nullification(30 + sanctify_force, 15 + sanctify_force)
return .


/obj/item/nullrod/pickup(mob/living/user)
Expand Down Expand Up @@ -553,6 +553,7 @@
)

praying = TRUE

if(!do_after(user, 15 SECONDS, target))
to_chat(user, span_notice("Your prayer to [SSticker.Bible_deity_name] was interrupted."))
praying = FALSE
Expand All @@ -567,18 +568,16 @@
SSticker.mode.remove_clocker(target.mind)
praying = FALSE
return .|ATTACK_CHAIN_SUCCESS

var/datum/antagonist/vampire/vamp = target.mind?.has_antag_datum(/datum/antagonist/vampire)
if(vamp && !vamp.get_ability(/datum/vampire_passive/full)) // Getting a full prayer off on a vampire will interrupt their powers for a large duration.
vamp.adjust_nullification(120, 50)
to_chat(target, span_userdanger("[user]'s prayer to [SSticker.Bible_deity_name] has interfered with your power!"))
praying = FALSE
return .|ATTACK_CHAIN_SUCCESS
switch(vamp.nullification)
if(OLD_NULLIFICATION)
vamp.adjust_nullification(120, 120)

var/datum/antagonist/goon_vampire/g_vamp = target.mind?.has_antag_datum(/datum/antagonist/goon_vampire)
if(g_vamp && !g_vamp.get_ability(/datum/goon_vampire_passive/full))
g_vamp.nullified = max(120, g_vamp.nullified + 120)
to_chat(target, span_userdanger("[user]'s prayer to [SSticker.Bible_deity_name] has interfered with your power!"))
if(NEW_NULLIFICATION)
vamp.adjust_nullification(120, 50)
to_chat(target, "<span class='userdanger'>[user]'s prayer to [SSticker.Bible_deity_name] has interfered with your power!</span>")
praying = FALSE
return .|ATTACK_CHAIN_SUCCESS

Expand All @@ -603,15 +602,13 @@
var/mob/living/carbon/human/holder = loc
if(!holder.l_hand == src && !holder.r_hand == src) // Holding this in your hand will
return

for(var/mob/living/carbon/human/target in range(5, loc))
var/datum/antagonist/goon_vampire/g_vamp = target.mind?.has_antag_datum(/datum/antagonist/goon_vampire)
if(g_vamp && !g_vamp.get_ability(/datum/goon_vampire_passive/full))
g_vamp.nullified = max(5, g_vamp.nullified + 2)
var/datum/antagonist/vampire/vamp = target.mind?.has_antag_datum(/datum/antagonist/vampire)
if(vamp && vamp.nullification == OLD_NULLIFICATION && !vamp.get_ability(/datum/vampire_passive/full))
vamp.adjust_nullification(5, 2)
if(prob(10))
to_chat(target, "<span class='userdanger'>Being in the presence of [holder]'s [src] is interfering with your powers!</span>")


/obj/item/nullrod/salt
name = "Holy Salt"
icon = 'icons/obj/food/containers.dmi'
Expand Down
4 changes: 0 additions & 4 deletions code/modules/admin/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,6 @@ GLOBAL_VAR_INIT(nologevent, 0)
antag_list += "Changeling"
if(M.mind in SSticker.mode.abductors)
antag_list += "Abductor"
if(M.mind.has_antag_datum(/datum/antagonist/goon_vampire))
antag_list += "Goon Vampire"
if(M.mind.has_antag_datum(/datum/antagonist/mindslave/goon_thrall))
antag_list += "Goon Vampire Thrall"
if(M.mind.has_antag_datum(/datum/antagonist/vampire))
antag_list += "Vampire"
if(M.mind.has_antag_datum(/datum/antagonist/mindslave/thrall))
Expand Down
Loading

0 comments on commit 9779745

Please sign in to comment.