Ports Anti-magic from TG. (#27560)

* the rest of the fucking owl

* OK hands need work but otherwise good

* fuck time out fix vampire after

* temporary codersprite do not merge this lmao

* codersprite up

* pause, time out

* deploy the antimagic

* Update code/__HELPERS/trait_helpers.dm

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>

* Update code/datums/status_effects/buffs.dm

Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/game/gamemodes/wizard/magic_tarot.dm

Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

---------

Signed-off-by: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
Qwertytoforty
2025-01-02 03:36:07 -05:00
committed by GitHub
parent 6057ff5c31
commit 7bbebbb23f
62 changed files with 580 additions and 28 deletions
@@ -3,6 +3,7 @@
desc = "This spell needs a description!"
human_req = TRUE
clothes_req = FALSE
antimagic_flags = NONE
/// A reference to the owner mindflayer's antag datum.
var/datum/antagonist/mindflayer/flayer
+15 -1
View File
@@ -93,6 +93,7 @@ RESTRICT_TYPE(/datum/antagonist/vampire)
mob_override.dna?.species.hunger_icon = initial(mob_override.dna.species.hunger_icon)
owner.current.alpha = 255
REMOVE_TRAITS_IN(owner.current, "vampire")
UnregisterSignal(owner, COMSIG_ATOM_HOLY_ATTACK)
#define BLOOD_GAINED_MODIFIER 0.5
@@ -362,8 +363,21 @@ RESTRICT_TYPE(/datum/antagonist/vampire)
mob_override.dna?.species.hunger_icon = 'icons/mob/screen_hunger_vampire.dmi'
check_vampire_upgrade(FALSE)
RegisterSignal(mob_override, COMSIG_ATOM_HOLY_ATTACK, PROC_REF(holy_attack_reaction))
/datum/antagonist/vampire/proc/holy_attack_reaction(mob/target, obj/item/source, mob/user, antimagic_flags)
SIGNAL_HANDLER // COMSIG_ATOM_HOLY_ATTACK
if(!HAS_MIND_TRAIT(user, TRAIT_HOLY)) // Sec officer with a nullrod, or miner with a talisman, does not get to do this
return
if(!source.force) // Needs force to work.
return
var/bonus_force = 0
if(istype(source, /obj/item/nullrod))
var/obj/item/nullrod/N = source
bonus_force = N.sanctify_force
if(!get_ability(/datum/vampire_passive/full))
to_chat(owner.current, "<span class='warning'>[source]'s power interferes with your own!</span>")
adjust_nullification(30 + bonus_force, 15 + bonus_force)
/datum/antagonist/vampire/custom_blurb()
return "On the date [GLOB.current_date_string], at [station_time_timestamp()],\n in the [station_name()], [get_area_name(owner.current, TRUE)]...\nThe hunt begins again..."
@@ -161,6 +161,10 @@
/datum/spell/vampire/switch_places/cast(list/targets, mob/user)
var/mob/living/target = targets[1]
if(target.can_block_magic(antimagic_flags))
to_chat(user, "<span class='warning'>The spell had no effect!</span>")
to_chat(target, "<span class='warning'>You feel space bending, but it rapidly dissipates.</span>")
return FALSE
var/turf/user_turf = get_turf(user)
var/turf/target_turf = get_turf(target)
if(!(SEND_SIGNAL(target, COMSIG_MOVABLE_TELEPORTING, user_turf) & COMPONENT_BLOCK_TELEPORT))
@@ -157,6 +157,8 @@
/obj/item/projectile/magic/demonic_grasp/on_hit(atom/target, blocked, hit_zone)
. = ..()
if(!.)
return
if(!isliving(target))
return
var/mob/living/L = target
@@ -3,6 +3,9 @@
//Other vampires and thralls aren't affected
if(mind?.has_antag_datum(/datum/antagonist/vampire) || mind?.has_antag_datum(/datum/antagonist/mindslave/thrall))
return FALSE
/// Chaplains with their nullrod can block a full power vampire, but a chaplain by themselfs or a crew with a null rod can not.
if(can_block_magic(MAGIC_RESISTANCE_HOLY) && HAS_MIND_TRAIT(src, TRAIT_HOLY))
return FALSE
//Vampires who have reached their full potential can affect nearly everything
var/datum/antagonist/vampire/V = user?.mind.has_antag_datum(/datum/antagonist/vampire)
if(V?.get_ability(/datum/vampire_passive/full))
@@ -10,12 +13,15 @@
//Holy characters are resistant to vampire powers
if(HAS_MIND_TRAIT(src, TRAIT_HOLY))
return FALSE
if(can_block_magic(MAGIC_RESISTANCE_HOLY))
return FALSE
return TRUE
/datum/spell/vampire
action_background_icon_state = "bg_vampire"
human_req = TRUE
clothes_req = FALSE
antimagic_flags = MAGIC_RESISTANCE_HOLY
/// How much blood this ability costs to use
var/required_blood
var/deduct_blood_on_cast = TRUE
@@ -52,6 +58,7 @@
action_icon_state = "vampire_rejuvinate"
base_cooldown = 20 SECONDS
stat_allowed = UNCONSCIOUS
antimagic_flags = NONE // So. If you have a null rod on your person, you can't cast vampire spells. I would rather not have officers abuse this by putting a nullrod in their pocket or something to block rejuvinate.
/datum/spell/vampire/self/rejuvenate/cast(list/targets, mob/user = usr)
var/mob/living/U = user
@@ -5,6 +5,7 @@
action_background_icon_state = "bg_vampire"
human_req = TRUE
clothes_req = FALSE
antimagic_flags = NONE
base_cooldown = 0 SECONDS
var/list/our_claws = list()
var/infection_stage = 1 // mostly for adminbus and testing
+11
View File
@@ -200,6 +200,17 @@
/obj/item/clothing/suit/space/hardsuit/wizard/setup_shielding()
AddComponent(/datum/component/shielded, max_charges = 15, recharge_start_delay = 0 SECONDS)
/obj/item/clothing/suit/space/hardsuit/wizard/equipped(mob/user, slot)
. = ..()
ADD_TRAIT(user, TRAIT_ANTIMAGIC, "[UID(src)]")
ADD_TRAIT(user, TRAIT_ANTIMAGIC_NO_SELFBLOCK, "[UID(src)]")
/obj/item/clothing/suit/space/hardsuit/wizard/dropped(mob/user)
. = ..()
REMOVE_TRAIT(user, TRAIT_ANTIMAGIC, "[UID(src)]")
REMOVE_TRAIT(user, TRAIT_ANTIMAGIC_NO_SELFBLOCK, "[UID(src)]")
/obj/item/clothing/suit/space/hardsuit/wizard/arch
desc = "For the arch wizard in need of additional protection."
min_cold_protection_temperature = SPACE_SUIT_MIN_TEMP_PROTECT
@@ -338,6 +338,7 @@
max_charges = 1
flags = NOBLUDGEON
force = 18
antimagic_flags = NONE
/obj/item/ammo_casing/magic/hook
name = "hook"
@@ -384,7 +385,7 @@
//Immortality Talisman
/obj/item/immortality_talisman
name = "Immortality Talisman"
name = "\improper Immortality Talisman"
desc = "A dread talisman that can render you completely invulnerable."
icon = 'icons/obj/lavaland/artefacts.dmi'
icon_state = "talisman"
@@ -393,6 +394,21 @@
actions_types = list(/datum/action/item_action/immortality)
var/cooldown = 0
/obj/item/immortality_talisman/Initialize(mapload)
. = ..()
AddComponent(/datum/component/anti_magic, ALL)
/obj/item/immortality_talisman/equipped(mob/user, slot)
..()
if(slot != ITEM_SLOT_IN_BACKPACK)
var/user_UID = user.UID()
ADD_TRAIT(user, TRAIT_ANTIMAGIC_NO_SELFBLOCK, user_UID)
/obj/item/immortality_talisman/dropped(mob/user, silent)
. = ..()
var/user_UID = user.UID()
REMOVE_TRAIT(user, TRAIT_ANTIMAGIC_NO_SELFBLOCK, user_UID)
/datum/action/item_action/immortality
name = "Immortality"
@@ -184,6 +184,10 @@
)
hide_tail_by_species = list("Unathi", "Tajaran", "Vox", "Vulpkanin")
/obj/item/clothing/suit/hooded/berserker/Initialize(mapload)
. = ..()
AddComponent(/datum/component/anti_magic, ALL, inventory_flags = ITEM_SLOT_OUTER_SUIT)
/obj/item/clothing/head/hooded/berserker
name = "berserker helmet"
desc = "Peering into the eyes of the helmet is enough to seal damnation."
@@ -143,6 +143,7 @@
desc = "Allows you to recruit a conscious, non-braindead, non-catatonic human to be part of the Greyshirts, your personal henchmen. This works on Assistants only and you can recruit a maximum of 3!."
base_cooldown = 450
clothes_req = FALSE
antimagic_flags = NONE
action_icon_state = "spell_greytide"
var/recruiting = 0
@@ -242,6 +242,7 @@
name = "Unfold/Fold Chassis"
desc = "Allows you to fold in/out of your mobile form."
clothes_req = FALSE
antimagic_flags = NONE
base_cooldown = 20 SECONDS
action_icon_state = "repairbot"
action_background_icon_state = "bg_tech_blue"
@@ -63,6 +63,7 @@
gain_desc = "You can now charge at a target on screen, dealing massive damage and destroying structures."
base_cooldown = 30 SECONDS
clothes_req = FALSE
antimagic_flags = NONE
action_icon_state = "terror_prince"
/datum/spell/princely_charge/create_new_targeting()
+87
View File
@@ -1428,3 +1428,90 @@ GLOBAL_LIST_INIT(holy_areas, typecacheof(list(
if(user.incapacitated())
return
return relaydrive(user, direction)
/**
* Checks to see if the mob can cast normal magic spells.
*
* args:
* * magic_flags (optional) A bitfield with the type of magic being cast (see flags at: /datum/component/anti_magic)
**/
/mob/proc/can_cast_magic(magic_flags = MAGIC_RESISTANCE)
if(magic_flags == NONE) // magic with the NONE flag can always be cast
return TRUE
var/restrict_magic_flags = SEND_SIGNAL(src, COMSIG_MOB_RESTRICT_MAGIC, magic_flags)
return restrict_magic_flags == NONE
/**
* Checks to see if the mob can block magic
*
* args:
* * casted_magic_flags (optional) A bitfield with the types of magic resistance being checked (see flags at: /datum/component/anti_magic)
* * charge_cost (optional) The cost of charge to block a spell that will be subtracted from the protection used
**/
/mob/proc/can_block_magic(casted_magic_flags = MAGIC_RESISTANCE, charge_cost = 1)
if(casted_magic_flags == NONE) // magic with the NONE flag is immune to blocking
return FALSE
// A list of all things which are providing anti-magic to us
var/list/antimagic_sources = list()
var/is_magic_blocked = FALSE
if(SEND_SIGNAL(src, COMSIG_MOB_RECEIVE_MAGIC, casted_magic_flags, charge_cost, antimagic_sources) & COMPONENT_MAGIC_BLOCKED)
is_magic_blocked = TRUE
if(HAS_TRAIT(src, TRAIT_ANTIMAGIC))
is_magic_blocked = TRUE
if((casted_magic_flags & MAGIC_RESISTANCE_HOLY) && HAS_TRAIT(src, TRAIT_HOLY))
is_magic_blocked = TRUE
if(is_magic_blocked && charge_cost > 0 && !HAS_TRAIT(src, TRAIT_RECENTLY_BLOCKED_MAGIC))
on_block_magic_effects(casted_magic_flags, antimagic_sources)
return is_magic_blocked
/// Called whenever a magic effect with a charge cost is blocked and we haven't recently blocked magic.
/mob/proc/on_block_magic_effects(magic_flags, list/antimagic_sources)
return
/mob/living/on_block_magic_effects(magic_flags, list/antimagic_sources)
ADD_TRAIT(src, TRAIT_RECENTLY_BLOCKED_MAGIC, MAGIC_TRAIT)
addtimer(CALLBACK(src, PROC_REF(remove_recent_magic_block)), 6 SECONDS)
var/mutable_appearance/antimagic_effect
var/antimagic_color
var/atom/antimagic_source = length(antimagic_sources) ? pick(antimagic_sources) : src
if(magic_flags & MAGIC_RESISTANCE)
visible_message(
"<span class='warning'>[src] pulses red as [ismob(antimagic_source) ? p_they() : antimagic_source] absorbs magic energy!</span>",
"<span class='userdanger'>An intense magical aura pulses around [ismob(antimagic_source) ? "you" : antimagic_source] as it dissipates into the air!</span>",
)
antimagic_effect = mutable_appearance('icons/effects/effects.dmi', "shield-red", ABOVE_MOB_LAYER)
antimagic_color = LIGHT_COLOR_BLOOD_MAGIC
playsound(src, 'sound/magic/magic_block.ogg', 50, TRUE)
else if(magic_flags & MAGIC_RESISTANCE_HOLY)
visible_message(
"<span class='warning'>[src] starts to glow as [ismob(antimagic_source) ? p_they() : antimagic_source] emits a halo of light!</span>",
"<span class='userdanger'>A feeling of warmth washes over [ismob(antimagic_source) ? "you" : antimagic_source] as rays of light surround your body and protect you!</span>",
)
antimagic_effect = mutable_appearance('icons/mob/genetics.dmi', "servitude", ABOVE_MOB_LAYER)
antimagic_color = LIGHT_COLOR_HOLY_MAGIC
playsound(src, 'sound/magic/magic_block_holy.ogg', 50, TRUE)
else if(magic_flags & MAGIC_RESISTANCE_MIND)
visible_message(
"<span class='warning'>[src] forehead shines as [ismob(antimagic_source) ? p_they() : antimagic_source] repulses magic from their mind!</span>",
"<span class='userdanger'>A feeling of cold splashes on [ismob(antimagic_source) ? "you" : antimagic_source] as your forehead reflects magic usering your mind!</span>",
)
antimagic_effect = mutable_appearance('icons/mob/genetics.dmi', "telekinesishead", ABOVE_MOB_LAYER)
antimagic_color = LIGHT_COLOR_DARK_BLUE
playsound(src, 'sound/magic/magic_block_mind.ogg', 50, TRUE)
mob_light(_color = antimagic_color, _range = 2, _power = 2, _duration = 5 SECONDS)
add_overlay(antimagic_effect)
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, cut_overlay), antimagic_effect), 5 SECONDS)
/mob/living/proc/remove_recent_magic_block()
REMOVE_TRAIT(src, TRAIT_RECENTLY_BLOCKED_MAGIC, MAGIC_TRAIT)
+7 -1
View File
@@ -366,12 +366,17 @@
var/insignia_type = /obj/item/mod/module/insignia
/// Additional module we add, as a treat.
var/additional_module
/// Inquisitorial module, as we have reached that point.
var/inquisitorial_module
/obj/item/mod/control/pre_equipped/responsory/Initialize(mapload, new_theme, new_skin, new_core)
applied_modules.Insert(1, insignia_type)
if(additional_module)
applied_modules += additional_module
default_pins += additional_module
if(inquisitorial_module)
applied_modules += inquisitorial_module
return ..()
/obj/item/mod/control/pre_equipped/responsory/commander
@@ -410,9 +415,10 @@
insignia_type = /obj/item/mod/module/insignia/chaplain
additional_module = /obj/item/mod/module/injector
/// Diffrent look, as well as magic proof on TG. We don't have the magic proof stuff here, but it's perfect for inqusitors. Or if you want to give your ERT a fancy look.
/// Diffrent look, as well as magic proof. It's perfect for inqusitors. Or if you want to give your ERT a fancy look. At this time, the other ones are unused, and frankly I don't like the idea of antimagic gamma.
/obj/item/mod/control/pre_equipped/responsory/inquisitory
applied_skin = "inquisitory"
inquisitorial_module = /obj/item/mod/module/anti_magic
/obj/item/mod/control/pre_equipped/responsory/inquisitory/commander
insignia_type = /obj/item/mod/module/insignia/commander
+18
View File
@@ -527,6 +527,24 @@
/obj/item/mod/module/energy_shield/gamma
shield_icon = "shield-old"
///Magic Nullifier - Protects you from magic.
/obj/item/mod/module/anti_magic
name = "MOD magic nullifier module"
desc = "A series of obsidian rods installed into critical points around the suit, \
vibrated at a certain low frequency to enable them to resonate. \
This creates a low-range, yet strong, magic nullification field around the user, \
aided by a full replacement of the suit's normal coolant with holy water. \
Spells will spall right off this field, though it'll do nothing to help others believe you about all this."
icon_state = "magic_nullifier"
removable = FALSE
incompatible_modules = list(/obj/item/mod/module/anti_magic)
/obj/item/mod/module/anti_magic/on_suit_activation()
ADD_TRAIT(mod.wearer, TRAIT_ANTIMAGIC, "[UID(src)]")
/obj/item/mod/module/anti_magic/on_suit_deactivation(deleting = FALSE)
REMOVE_TRAIT(mod.wearer, TRAIT_ANTIMAGIC, "[UID(src)]")
/obj/item/mod/module/anomaly_locked/teslawall
name = "MOD arc-shield module" // temp
desc = "A module that uses a flux core to project an unstable protective shield." //change
+2 -1
View File
@@ -18,7 +18,8 @@
/obj/item/projectile/magic/chaos/on_hit(atom/target, blocked = 0)
. = ..()
if(!.)
return
if(iswallturf(target) || isobj(target))
target.color = pick(GLOB.random_color_list)
return
+4
View File
@@ -15,6 +15,7 @@
var/can_charge = TRUE
var/ammo_type
var/no_den_usage
var/antimagic_flags = MAGIC_RESISTANCE
origin_tech = null
clumsy_check = FALSE
trigger_guard = TRIGGER_GUARD_ALLOW_ALL // Has no trigger at all, uses magic instead
@@ -31,6 +32,9 @@
return
else
no_den_usage = 0
if(!user.can_cast_magic(antimagic_flags))
to_chat(user, "<span class='warning'>[src] whizzles quietly.</span>")
return FALSE
..()
/obj/item/gun/magic/can_shoot()
@@ -6,6 +6,28 @@
nodamage = 1
armour_penetration_percentage = 100
flag = MAGIC
/// determines what type of antimagic can block the spell projectile
var/antimagic_flags = MAGIC_RESISTANCE
/// determines the drain cost on the antimagic item
var/antimagic_charge_cost = 1
/obj/item/projectile/magic/prehit(atom/target)
if(isliving(target))
var/mob/living/victim = target
if(victim.can_block_magic(antimagic_flags, antimagic_charge_cost))
visible_message("<span class='warning'>[src] fizzles on contact with [victim]!</span>")
damage = 0
nodamage = 1
return FALSE
return ..()
/obj/item/projectile/magic/on_hit(atom/target, blocked, hit_zone)
if(isliving(target))
var/mob/living/victim = target
if(victim.can_block_magic(antimagic_flags, antimagic_charge_cost)) // Yes we have to check this twice welcome to bullet hell code
return FALSE
return ..()
/obj/item/projectile/magic/death
name = "bolt of death"
@@ -21,7 +43,7 @@
muzzle_flash_range = 2
muzzle_flash_color_override = LIGHT_COLOR_PURPLE
impact_light_intensity = 7
impact_light_range = 2.5
impact_light_range = 2.5
impact_light_color_override = LIGHT_COLOR_PURPLE
/obj/item/projectile/magic/fireball
@@ -41,6 +63,8 @@
/obj/item/projectile/magic/death/on_hit(mob/living/carbon/target)
. = ..()
if(!.)
return .
if(isliving(target))
if(target.mob_biotypes & MOB_UNDEAD) //negative energy heals the undead
if(target.revive())
@@ -75,6 +99,8 @@
/obj/item/projectile/magic/fireball/on_hit(target)
. = ..()
if(!.)
return .
var/turf/T = get_turf(target)
explosion(T, exp_devastate, exp_heavy, exp_light, exp_flash, 0, flame_range = exp_fire)
if(ismob(target)) //multiple flavors of pain
@@ -95,6 +121,8 @@
/obj/item/projectile/magic/resurrection/on_hit(mob/living/carbon/target)
. = ..()
if(!.)
return .
if(ismob(target))
if(target.mob_biotypes & MOB_UNDEAD) //positive energy harms the undead
target.death(FALSE)
@@ -121,6 +149,8 @@
/obj/item/projectile/magic/teleport/on_hit(mob/target)
. = ..()
if(!.)
return .
var/teleammount = 0
var/teleloc = target
if(!isturf(target))
@@ -142,6 +172,8 @@
/obj/item/projectile/magic/door/on_hit(atom/target)
. = ..()
if(!.)
return .
var/atom/T = target.loc
if(isturf(target) && target.density)
if(!(istype(target, /turf/simulated/wall/indestructible)))
@@ -179,6 +211,8 @@
/obj/item/projectile/magic/change/on_hit(atom/change)
. = ..()
if(!.)
return .
wabbajack(change)
GLOBAL_LIST_INIT(wabbajack_hostile_animals, list(
@@ -380,6 +414,9 @@ GLOBAL_LIST_INIT(wabbajack_docile_animals, list(
SpinAnimation()
/obj/item/projectile/magic/slipping/on_hit(atom/target, blocked = 0)
. = ..()
if(!.)
return .
if(ishuman(target))
var/mob/living/carbon/human/H = target
H.slip(src, slip_weaken, 0, FALSE, TRUE) //Slips even with noslips/magboots on. NO ESCAPE!
@@ -394,7 +431,6 @@ GLOBAL_LIST_INIT(wabbajack_docile_animals, list(
to_chat(target, "<span class='notice'>You get splatted by [src].</span>")
L.Weaken(slip_weaken)
L.Stun(slip_stun)
. = ..()
/obj/item/projectile/magic/arcane_barrage
name = "arcane bolt"
@@ -506,6 +506,7 @@
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
antimagic_flags = NONE
selection_activated_message = "You warm up your Binyat deck, there's an idle buzzing at the back of your mind as it awaits a target."
selection_deactivated_message = "Your hacking deck makes an almost disappointed sounding buzz at the back of your mind as it powers down."
action_icon_state = "hackerman"