mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-21 20:13:45 +01:00
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:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user