Skip to content

Commit

Permalink
Adds mana armor + misc bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BurgerLUA committed Apr 14, 2024
1 parent 075ee51 commit 14f3b8b
Show file tree
Hide file tree
Showing 15 changed files with 105 additions and 8 deletions.
2 changes: 2 additions & 0 deletions burgerstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
#include "code\_core\datum\ability\magic\_magic_projectile.dm"
#include "code\_core\datum\ability\magic\_magic_summon_item.dm"
#include "code\_core\datum\ability\magic\fireball.dm"
#include "code\_core\datum\ability\magic\mana_armor.dm"
#include "code\_core\datum\ability\magic\radial_blind.dm"
#include "code\_core\datum\ability\magic\smite.dm"
#include "code\_core\datum\ability\magic\soul_trap.dm"
Expand Down Expand Up @@ -817,6 +818,7 @@
#include "code\_core\datum\status_effect\grab.dm"
#include "code\_core\datum\status_effect\immortal.dm"
#include "code\_core\datum\status_effect\last_breath.dm"
#include "code\_core\datum\status_effect\mana_armor.dm"
#include "code\_core\datum\status_effect\mana_void.dm"
#include "code\_core\datum\status_effect\paralyzed.dm"
#include "code\_core\datum\status_effect\parried.dm"
Expand Down
1 change: 1 addition & 0 deletions code/__defines/status.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,4 @@

#define BLINDED "blinded"

#define MANA_ARMOR "mana_armor"
25 changes: 25 additions & 0 deletions code/_core/datum/ability/magic/mana_armor.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/ability/magic/mana_armor
name = "toggle mana armor"
desc = "A togglable ability that adds 25% of your total overall arcane armor rating to your overall blunt, blade, and pierce armor rating as long as you have more mana than half of your maximum mana. Taking damage removes mana equal to the amount of blunt, blade and pierce damage dealt."
icon_state = "mana_armor"
cost = 25
cooldown = SECONDS_TO_DECISECONDS(3)

toggle = TRUE

/ability/magic/mana_armor/is_active(var/mob/caller)

if(is_living(caller))
var/mob/living/L = caller
return L.has_status_effect(MANA_ARMOR)

return FALSE

/ability/magic/mana_armor/on_cast(var/mob/caller,var/atom/target,location,params)
. = ..()
if(. && is_living(caller))
var/mob/living/L = caller
if(L.has_status_effect(MANA_ARMOR))
L.remove_status_effect(MANA_ARMOR)
else
L.add_status_effect(MANA_ARMOR,25,-1,L,TRUE,FALSE,TRUE)
1 change: 1 addition & 0 deletions code/_core/datum/health/mob/living/_living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
else
.[damage_type] = bonus[damage_type]


/health/mob/living/update_health()

var/mob/living/L = owner
Expand Down
22 changes: 22 additions & 0 deletions code/_core/datum/health/mob/living/advanced/_advanced.dm
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,25 @@
clothing_defense *= 0.5
.[damage_type] += FLOOR(clothing_defense,1)
.["items"] += C

var/mana_armor_value = STATUS_EFFECT_MAGNITUDE(A,MANA_ARMOR)
if(mana_armor_value > 0 && mana_current >= mana_max*0.5 && length(A.overall_clothing_defense_rating) && A.overall_clothing_defense_rating[ARCANE] > 0)
var/bonus_mana_armor = (mana_armor_value/100) * A.overall_clothing_defense_rating[ARCANE]
bonus_mana_armor = CEILING(bonus_mana_armor,1)
if(bonus_mana_armor > 0)
for(var/damage_type in list(BLADE,BLUNT,PIERCE))
if(!.[damage_type])
.[damage_type] = 0
else if(IS_INFINITY(.[damage_type]))
continue
var/damage_type_difference = min(bonus_mana_armor,bonus_mana_armor - .[damage_type])
if(damage_type_difference > 0)
.[damage_type] += damage_type_difference








11 changes: 11 additions & 0 deletions code/_core/datum/status_effect/mana_armor.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/status_effect/mana_armor
name = "Mana Armor"
desc = "Your mana protects your health, as long as you have more than half your maximum mana. Protection granted is based on arcane armor."
id = MANA_ARMOR
maximum = SECONDS_TO_DECISECONDS(300)
minimum = SECONDS_TO_DECISECONDS(1)

default_duration = SECONDS_TO_DECISECONDS(30)
default_magnitude = 10 //Percent of mana taken before health

affects_dead = FALSE
7 changes: 7 additions & 0 deletions code/_core/mob/living/advanced/health.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,11 @@

. = ..()

if(damage_amount > 0)
var/mana_armor_value = STATUS_EFFECT_MAGNITUDE(src,MANA_ARMOR)
if(mana_armor_value > 0 && src.health && src.health.mana_current > src.health.mana_current*0.5 && length(src.overall_clothing_defense_rating[ARCANE]) > 0 && length(damage_table))
var/total_brute = SAFENUM(damage_table[BLUNT]) + SAFENUM(damage_table[PIERCE]) + SAFENUM(damage_table[BLADE])
if(total_brute > 0)
src.health.adjust_mana(-total_brute)

HOOK_CALL("on_damage_received") //For hulking and whatnot.
6 changes: 3 additions & 3 deletions code/_core/obj/hud/buttons/ability.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@
I.maptext = id
add_overlay(I)
if(ability)
if(ability.toggle && ability.is_active(owner))
var/image/I3 = new/image(initial(icon),"[initial(icon_state)]_selected")
add_overlay(I3)
var/image/I2 = new/image(ability.icon,ability.icon_state)
I2.maptext = "<div align='right' style='color:[ability_colors[ability.resource_type]]'>[ability.cost]</div>"
I2.maptext_x = -5
add_overlay(I2)
name = ability.name
desc_extended = ability.desc
if(ability.toggle && ability.is_active(owner))
var/image/I3 = new/image(initial(icon),"[initial(icon_state)]_selected")
add_overlay(I3)
else
name = initial(name)
desc_extended = initial(desc_extended)
Expand Down
4 changes: 4 additions & 0 deletions code/_core/obj/item/ability_learner/_ability_learner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@
. = ..()
if(name == "ability scroll")
name = "ability scroll: [initial(stored_ability.name)]"
desc_extended = initial(stored_ability.desc)

/obj/item/ability_learner/update_overlays()
. = ..()
if(icon_state == "scroll" && stored_ability)
var/image/I = new/image(initial(stored_ability.icon),initial(stored_ability.icon_state))
var/matrix/M = matrix()
M.Scale(0.75,0.75)
I.transform = M
add_overlay(I)

/obj/item/ability_learner/click_self(var/mob/caller)
Expand Down
10 changes: 10 additions & 0 deletions code/_core/obj/item/ability_learner/ability_learner_magic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,30 @@

/obj/item/ability_learner/fireball
stored_ability = /ability/magic/projectile/fireball
rarity = RARITY_COMMON
value = 1500

/obj/item/ability_learner/tesla
stored_ability = /ability/magic/projectile/tesla
rarity = RARITY_UNCOMMON
value = 2500

/obj/item/ability_learner/wrath
stored_ability = /ability/magic/wrath
rarity = RARITY_UNCOMMON
value = 2000

/obj/item/ability_learner/radial_blind
stored_ability = /ability/magic/radial_blind
rarity = RARITY_UNCOMMON
value = 2000

/obj/item/ability_learner/soul_trap
stored_ability = /ability/magic/summon_item/soultrap
rarity = RARITY_COMMON
value = 1200

/obj/item/ability_learner/mana_armor
stored_ability = /ability/magic/mana_armor
rarity = RARITY_RARE
value = 3000
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
desc_extended = "Shoots one enemy-seeking magic missiles that deals arcane damage."
icon_state = "damage"

rarity = RARITY_CUMMON
rarity = RARITY_COMMON

shoot_delay = 10

Expand Down
2 changes: 2 additions & 0 deletions code/_core/obj/structure/interactive/light_switch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,12 @@
add_underlay(I)

/obj/structure/interactive/light_switch/proc/toggle(var/mob/caller)

var/area/A = get_area(src)
if(!A || !A.linked_apc || !A.linked_apc.cell || !A.linked_apc.cell.charge_current)
caller.to_chat(span("warning","This doesn't seem to be working..."))
return FALSE

play_sound('sound/machines/click.ogg',get_turf(src),range_max=VIEW_RANGE*0.5)

if(A.enable_power_lights & ON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,24 @@
price_max = accepts_item.amount_max

for(var/obj/item/I in stored_objects)

if(stored_cost[I.type])
continue

var/local_markup = markup
if(!ignore_economy)
local_markup = max(markup * (SSeconomy.price_multipliers["[I.type]"] ? SSeconomy.price_multipliers["[I.type]"] : 1),markup)
if(isnum(item_multiplier[I.type]))
stored_cost[I.type] = CEILING((get_bullshit_price(I.get_value()*local_markup)*item_multiplier[I.type]),1)
else
stored_cost[I.type] = CEILING(get_bullshit_price(I.get_value()*local_markup),1)
if(price_max)
stored_cost[I.type] = min(price_max,stored_cost[I.type])
if(stored_cost[I.type] <= 0)

if(price_max && stored_cost[I.type] > price_max)
log_error("Warning: [I.type] is for sale, yet it is too expensive to be purchased in \the [src.get_debug_name()]!")
stored_cost -= I.type
stored_objects -= I
qdel(I)
else if(stored_cost[I.type] <= 0)
log_error("Warning: [I.type] is for sale, yet it has no value!")
stored_cost -= I.type
stored_objects -= I
Expand Down
8 changes: 7 additions & 1 deletion code/_core/obj/structure/interactive/power/apc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@

/obj/structure/interactive/power/apc/get_examine_list(var/mob/examiner)
. = ..()
. += div("notice","Area Power Draw: [src.power_draw]w.")

var/total_power_draw = 0
for(var/k in linked_areas)
var/area/A = k
total_power_draw += A.power_draw

. += div("notice","Area Power Draw: [total_power_draw]w.")
. += div("notice","\The [cell.name] has [cell.charge_current] out of [cell.charge_max] charge remaining.")

/obj/structure/interactive/power/apc/PreDestroy()
Expand Down
Binary file modified icons/hud/ability.dmi
Binary file not shown.

0 comments on commit 14f3b8b

Please sign in to comment.