Skip to content

Commit

Permalink
Numerous bug fixes, adds restore limbs spell
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorDinamit committed Jan 20, 2024
1 parent c5126de commit b86d9ef
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 64 deletions.
2 changes: 1 addition & 1 deletion baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3152,6 +3152,7 @@
#include "code\modules\spells\aimed\mana_burn.dm"
#include "code\modules\spells\aimed\onrush.dm"
#include "code\modules\spells\aimed\passage.dm"
#include "code\modules\spells\aimed\restore_limbs.dm"
#include "code\modules\spells\aimed\spark_bolt.dm"
#include "code\modules\spells\aimed\spell_steal.dm"
#include "code\modules\spells\aimed\swap.dm"
Expand Down Expand Up @@ -3223,7 +3224,6 @@
#include "code\modules\spells\targeted\projectile\dumbfire.dm"
#include "code\modules\spells\targeted\projectile\magic_missile.dm"
#include "code\modules\spells\targeted\projectile\projectile.dm"
#include "code\modules\spells\targeted\projectile\stuncuff.dm"
#include "code\modules\sprite_accessories\_accessory.dm"
#include "code\modules\sprite_accessories\_accessory_facial.dm"
#include "code\modules\sprite_accessories\_accessory_hair.dm"
Expand Down
9 changes: 7 additions & 2 deletions code/modules/spells/_spell.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,13 @@
if(isliving(holder))
var/mob/living/L = holder
var/datum/mind/M = L.mind
if(istype(M) && M.last_used_spell == src)
M.last_used_spell = null
if(istype(M))
M.learned_spells -= src
if(M.last_used_spell == src)
M.last_used_spell = null
if(L.ability_master)
L.ability_master.remove_ability(L.ability_master.get_ability_by_spell(src))
holder = null
return ..()

/datum/spell/proc/process()
Expand Down
14 changes: 9 additions & 5 deletions code/modules/spells/_spell_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
if(. && ability_master && ability_master.spell_objects)
for(var/obj/screen/ability/spell/screen in ability_master.spell_objects)
var/datum/spell/S = screen.spell
if(!istype(S))
ability_master.remove_ability(screen)
continue
if((!S.connected_button) || !statpanel(S.panel))
continue //Not showing the noclothes spell
continue // Not showing the noclothes spell
switch(S.charge_type)
if(SPELL_RECHARGE)
statpanel(S.panel,"[S.charge_counter/10.0]/[S.charge_max/10]",S.connected_button)
Expand All @@ -35,7 +38,7 @@
if(istype(spell_to_remove.holder,/mob))
var/mob/M = spell_to_remove.holder
spells += spell_to_remove
M.remove_spell(spell_to_remove)
M.remove_spell(spell_to_remove, FALSE)

for(var/datum/spell/spell_to_add in spells)
H.add_spell(spell_to_add)
Expand All @@ -52,15 +55,16 @@
ability_master.add_spell(spell_to_add, spell_base)
return 1

/mob/proc/remove_spell(datum/spell/spell_to_remove)
/mob/proc/remove_spell(datum/spell/spell_to_remove, should_delete = TRUE)
if(!spell_to_remove || !istype(spell_to_remove))
return

if(mind)
mind.learned_spells -= spell_to_remove
if (ability_master)
if(ability_master)
ability_master.remove_ability(ability_master.get_ability_by_spell(spell_to_remove))
QDEL_NULL(spell_to_remove)
if(should_delete)
QDEL_NULL(spell_to_remove)
return 1

/mob/proc/silence_spells(amount = 0)
Expand Down
84 changes: 84 additions & 0 deletions code/modules/spells/aimed/restore_limbs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/datum/spell/aimed/restore_limbs
name = "Restore Limbs"
desc = "Restores internal damage within the limbs, including broken bones, internal bleeding and missing limbs."
deactive_msg = "You discharge the limb restoration spell..."
active_msg = "You charge the limb restoration spell!"

charge_max = 60 SECONDS
cooldown_reduc = 20 SECONDS

invocation = "Membrum Di'Nath!"
invocation_type = INVOKE_SHOUT
level_max = list(UPGRADE_TOTAL = 2, UPGRADE_SPEED = 1, UPGRADE_POWER = 2)

hud_state = "wiz_restore_limbs"
cast_sound = 'sound/magic/staff_healing.ogg'

range = 1

categories = list(SPELL_CATEGORY_HEALING)
spell_cost = 5
mana_cost = 25

var/restore_missing_limbs = FALSE
/// How many missing limbs can be restored per single cast
var/restore_missing_limbs_count = 1

/datum/spell/aimed/restore_limbs/TargetCastCheck(mob/living/user, mob/living/target)
if(!ishuman(target))
to_chat(user, SPAN_WARNING("The target must be a humanoid creature!"))
return FALSE
if(get_dist(user, target) > range)
to_chat(user, SPAN_WARNING("The target is too far away!"))
return FALSE
return ..()

/datum/spell/aimed/restore_limbs/fire_projectile(mob/living/user, mob/living/carbon/human/H)
. = ..()
for(var/obj/item/organ/external/E in H.bad_external_organs)
if(E.status & ORGAN_ARTERY_CUT)
E.status &= ~ORGAN_ARTERY_CUT
if(E.status & ORGAN_TENDON_CUT)
E.status &= ~ORGAN_TENDON_CUT
if(E.status & ORGAN_BLEEDING)
E.status &= ~ORGAN_BLEEDING
if(E.status & ORGAN_BROKEN)
E.status &= ~ORGAN_BROKEN

if(restore_missing_limbs)
// Remove all stumps first
for(var/O in H.organs_by_name)
var/obj/item/organ/external/E = H.organs_by_name[O]
if(E.is_stump())
H.visible_message(SPAN_WARNING("\The [E.name] falls apart!"))
qdel(E)
var/list/missing_limbs = H.species.has_limbs - H.organs_by_name
for(var/i = 1 to restore_missing_limbs_count)
if(!LAZYLEN(missing_limbs))
break
var/o_type = pick(missing_limbs)
missing_limbs -= o_type
var/limb_type = H.species.has_limbs[o_type]["path"]
var/obj/new_limb = new limb_type(H)
H.visible_message(SPAN_NOTICE(SPAN_BOLD("A new [new_limb.name] grows on \the [H]!")))

H.regenerate_icons()

var/obj/o = new /obj/effect/temp_visual/temporary(get_turf(H), 15, 'icons/effects/effects.dmi', "green_sparkles")
o.color = COLOR_GREEN

to_chat(H, SPAN_NOTICE(SPAN_BOLD("Your bones and wounds seem to mend themselves!")))

return TRUE

/datum/spell/aimed/restore_limbs/ImproveSpellPower()
if(!..())
return FALSE

if(spell_levels[UPGRADE_POWER] == 1)
restore_missing_limbs = TRUE
return "The [src] spell is now capable of restoring missing limbs."

restore_missing_limbs_count += 1

return "The [src] spell is now capable of restoring [restore_missing_limbs_count] missing limbs."
4 changes: 2 additions & 2 deletions code/modules/spells/aoe_turf/summons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
desc = "This spell dispenses wizard justice."

summon_type = list(/mob/living/bot/secbot/ed209)
summon_amt = 10
summon_amt = 8
range = 3
newVars = list("emagged" = 1,"name" = "Wizard's Justicebot")

hud_state = "wiz_ed"

spell_cost = 5
spell_cost = 10
mana_cost = 100

/datum/spell/aoe_turf/conjure/carp
Expand Down
8 changes: 6 additions & 2 deletions code/modules/spells/general/acid_spray.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
name = "Acid Spray"
desc = "A common spell used to destroy basically anything in front of the wizard."
spell_flags = 0
charge_max = 600
charge_max = 30 SECONDS

level_max = list(UPGRADE_TOTAL = 0)

invocation = "Tagopar lethodar!"
invocation_type = INVOKE_SHOUT
var/reagent_type = /datum/reagent/acid/hydrochloric

hud_state = "wiz_acid"
cast_sound = 'sound/magic/disintegrate.ogg'

spell_cost = 3
mana_cost = 10

var/reagent_type = /datum/reagent/acid/hydrochloric

/datum/spell/acid_spray/choose_targets(mob/user = usr)
perform(user, list(holder))

Expand Down
4 changes: 3 additions & 1 deletion code/modules/spells/general/create_air.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
number_of_channels = 0
time_between_channels = 200
hud_state = "wiz_air"
var/list/air_change = list(GAS_OXYGEN = ONE_ATMOSPHERE)

number_of_channels = 0

spell_cost = 1
mana_cost = 5

var/list/air_change = list(GAS_OXYGEN = ONE_ATMOSPHERE)

/datum/spell/create_air/choose_targets(mob/user = usr)
var/air = holder.return_air()
if(air)
Expand Down
51 changes: 0 additions & 51 deletions code/modules/spells/targeted/projectile/stuncuff.dm

This file was deleted.

Binary file modified icons/mob/screen_spells.dmi
Binary file not shown.

0 comments on commit b86d9ef

Please sign in to comment.