diff --git a/burgerstation.dme b/burgerstation.dme index ef2745eb9d..8253e142a4 100644 --- a/burgerstation.dme +++ b/burgerstation.dme @@ -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" @@ -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" diff --git a/code/__defines/status.dm b/code/__defines/status.dm index e39e2fcff8..3da1957bde 100644 --- a/code/__defines/status.dm +++ b/code/__defines/status.dm @@ -110,3 +110,4 @@ #define BLINDED "blinded" +#define MANA_ARMOR "mana_armor" \ No newline at end of file diff --git a/code/_core/datum/ability/magic/mana_armor.dm b/code/_core/datum/ability/magic/mana_armor.dm new file mode 100644 index 0000000000..04c4a3e9f8 --- /dev/null +++ b/code/_core/datum/ability/magic/mana_armor.dm @@ -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) \ No newline at end of file diff --git a/code/_core/datum/health/mob/living/_living.dm b/code/_core/datum/health/mob/living/_living.dm index d5ab5a32f8..fef0f434e8 100644 --- a/code/_core/datum/health/mob/living/_living.dm +++ b/code/_core/datum/health/mob/living/_living.dm @@ -76,6 +76,7 @@ else .[damage_type] = bonus[damage_type] + /health/mob/living/update_health() var/mob/living/L = owner diff --git a/code/_core/datum/health/mob/living/advanced/_advanced.dm b/code/_core/datum/health/mob/living/advanced/_advanced.dm index a092041303..670915e46e 100644 --- a/code/_core/datum/health/mob/living/advanced/_advanced.dm +++ b/code/_core/datum/health/mob/living/advanced/_advanced.dm @@ -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 + + + + + + + + diff --git a/code/_core/datum/status_effect/mana_armor.dm b/code/_core/datum/status_effect/mana_armor.dm new file mode 100644 index 0000000000..9246f62b36 --- /dev/null +++ b/code/_core/datum/status_effect/mana_armor.dm @@ -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 diff --git a/code/_core/mob/living/advanced/health.dm b/code/_core/mob/living/advanced/health.dm index be6a877ae4..056b164287 100644 --- a/code/_core/mob/living/advanced/health.dm +++ b/code/_core/mob/living/advanced/health.dm @@ -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. \ No newline at end of file diff --git a/code/_core/obj/hud/buttons/ability.dm b/code/_core/obj/hud/buttons/ability.dm index 9ae18771b5..0e12d87de8 100644 --- a/code/_core/obj/hud/buttons/ability.dm +++ b/code/_core/obj/hud/buttons/ability.dm @@ -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 = "
[ability.cost]
" 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) diff --git a/code/_core/obj/item/ability_learner/_ability_learner.dm b/code/_core/obj/item/ability_learner/_ability_learner.dm index ddb8e57e5a..051982a0b6 100644 --- a/code/_core/obj/item/ability_learner/_ability_learner.dm +++ b/code/_core/obj/item/ability_learner/_ability_learner.dm @@ -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) diff --git a/code/_core/obj/item/ability_learner/ability_learner_magic.dm b/code/_core/obj/item/ability_learner/ability_learner_magic.dm index 243794f036..57bf68877f 100644 --- a/code/_core/obj/item/ability_learner/ability_learner_magic.dm +++ b/code/_core/obj/item/ability_learner/ability_learner_magic.dm @@ -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 \ No newline at end of file diff --git a/code/_core/obj/item/weapon/ranged/spellgem/magic_missile.dm b/code/_core/obj/item/weapon/ranged/spellgem/magic_missile.dm index 1919869e4f..d508afcfd5 100644 --- a/code/_core/obj/item/weapon/ranged/spellgem/magic_missile.dm +++ b/code/_core/obj/item/weapon/ranged/spellgem/magic_missile.dm @@ -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 diff --git a/code/_core/obj/structure/interactive/light_switch.dm b/code/_core/obj/structure/interactive/light_switch.dm index 3929b9217d..e619d3afde 100644 --- a/code/_core/obj/structure/interactive/light_switch.dm +++ b/code/_core/obj/structure/interactive/light_switch.dm @@ -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) diff --git a/code/_core/obj/structure/interactive/local_machine/vendor/_vendor.dm b/code/_core/obj/structure/interactive/local_machine/vendor/_vendor.dm index 3b785a68da..a23dda1c60 100644 --- a/code/_core/obj/structure/interactive/local_machine/vendor/_vendor.dm +++ b/code/_core/obj/structure/interactive/local_machine/vendor/_vendor.dm @@ -237,8 +237,10 @@ 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) @@ -246,9 +248,13 @@ 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 diff --git a/code/_core/obj/structure/interactive/power/apc.dm b/code/_core/obj/structure/interactive/power/apc.dm index 9ab8fce5fb..0c5ec28193 100644 --- a/code/_core/obj/structure/interactive/power/apc.dm +++ b/code/_core/obj/structure/interactive/power/apc.dm @@ -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() diff --git a/icons/hud/ability.dmi b/icons/hud/ability.dmi index 16f052d310..80126f46c4 100644 Binary files a/icons/hud/ability.dmi and b/icons/hud/ability.dmi differ