mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 21:48:39 +01:00
Curse of the Barnyard is now a pointed spell (#50257)
* Initial commit * Barnyard Curse is not a pointed spell, pointed spell code improvements * Selection type consistency * Grammar cleanup * Cleanup and better mousepointer icon * Line endings
This commit is contained in:
@@ -283,7 +283,15 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
|
||||
/obj/effect/proc_holder/spell/proc/choose_targets(mob/user = usr) //depends on subtype - /targeted or /aoe_turf
|
||||
return
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/can_target(mob/living/target)
|
||||
/**
|
||||
* can_target: Checks if we are allowed to cast the spell on a target.
|
||||
*
|
||||
* Arguments:
|
||||
* * target The atom that is being targeted by the spell.
|
||||
* * user The mob using the spell.
|
||||
* * silent If the checks should not give any feedback messages.
|
||||
*/
|
||||
/obj/effect/proc_holder/spell/proc/can_target(atom/target, mob/user, silent = FALSE)
|
||||
return TRUE
|
||||
|
||||
/obj/effect/proc_holder/spell/proc/start_recharge()
|
||||
@@ -415,7 +423,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
|
||||
switch(max_targets)
|
||||
if(0) //unlimited
|
||||
for(var/mob/living/target in view_or_range(range, user, selection_type))
|
||||
if(!can_target(target))
|
||||
if(!can_target(target, user, TRUE))
|
||||
continue
|
||||
targets += target
|
||||
if(1) //single target can be picked
|
||||
@@ -427,7 +435,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
|
||||
for(var/mob/living/M in view_or_range(range, user, selection_type))
|
||||
if(!include_user && user == M)
|
||||
continue
|
||||
if(!can_target(M))
|
||||
if(!can_target(M, user, TRUE))
|
||||
continue
|
||||
possible_targets += M
|
||||
|
||||
@@ -455,7 +463,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
|
||||
else
|
||||
var/list/possible_targets = list()
|
||||
for(var/mob/living/target in view_or_range(range, user, selection_type))
|
||||
if(!can_target(target))
|
||||
if(!can_target(target, user, TRUE))
|
||||
continue
|
||||
possible_targets += target
|
||||
for(var/i=1,i<=max_targets,i++)
|
||||
@@ -476,11 +484,12 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
|
||||
return
|
||||
|
||||
perform(targets,user=user)
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/choose_targets(mob/user = usr)
|
||||
var/list/targets = list()
|
||||
|
||||
for(var/turf/target in view_or_range(range,user,selection_type))
|
||||
if(!can_target(target))
|
||||
if(!can_target(target, user, TRUE))
|
||||
continue
|
||||
if(!(target in view_or_range(inner_radius,user,selection_type)))
|
||||
targets += target
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/obj/effect/proc_holder/spell/targeted/barnyardcurse
|
||||
name = "Curse of the Barnyard"
|
||||
desc = "This spell dooms an unlucky soul to possess the speech and facial attributes of a barnyard animal."
|
||||
school = "transmutation"
|
||||
charge_type = "recharge"
|
||||
charge_max = 150
|
||||
charge_counter = 0
|
||||
clothes_req = FALSE
|
||||
stat_allowed = FALSE
|
||||
invocation = "KN'A FTAGHU, PUCK 'BTHNK!"
|
||||
invocation_type = "shout"
|
||||
range = 7
|
||||
cooldown_min = 30
|
||||
selection_type = "range"
|
||||
var/static/list/compatible_mobs_typecache = typecacheof(list(/mob/living/carbon/human, /mob/living/carbon/monkey))
|
||||
|
||||
action_icon_state = "barn"
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/barnyardcurse/cast(list/targets, mob/user = usr)
|
||||
if(!targets.len)
|
||||
to_chat(user, "<span class='warning'>No target found in range!</span>")
|
||||
return
|
||||
|
||||
var/mob/living/carbon/target = targets[1]
|
||||
|
||||
|
||||
if(!is_type_in_typecache(target, compatible_mobs_typecache))
|
||||
to_chat(user, "<span class='warning'>You are unable to curse [target]'s head!</span>")
|
||||
return
|
||||
|
||||
if(!(target in oview(range)))
|
||||
to_chat(user, "<span class='warning'>[target.p_theyre(TRUE)] too far away!</span>")
|
||||
return
|
||||
|
||||
if(target.anti_magic_check())
|
||||
to_chat(user, "<span class='warning'>The spell had no effect!</span>")
|
||||
target.visible_message("<span class='danger'>[target]'s face bursts into flames, which instantly burst outward, leaving [target] unharmed!</span>", \
|
||||
"<span class='danger'>Your face starts burning up, but the flames are repulsed by your anti-magic protection!</span>")
|
||||
return
|
||||
|
||||
var/list/masks = list(/obj/item/clothing/mask/pig/cursed, /obj/item/clothing/mask/cowmask/cursed, /obj/item/clothing/mask/horsehead/cursed)
|
||||
|
||||
var/choice = pick(masks)
|
||||
var/obj/item/clothing/mask/magichead = new choice(get_turf(target))
|
||||
target.visible_message("<span class='danger'>[target]'s face bursts into flames, and a barnyard animal's head takes its place!</span>", \
|
||||
"<span class='danger'>Your face burns up, and shortly after the fire you realise you have the face of a barnyard animal!</span>")
|
||||
if(!target.dropItemToGround(target.wear_mask))
|
||||
qdel(target.wear_mask)
|
||||
target.equip_to_slot_if_possible(magichead, ITEM_SLOT_MASK, 1, 1)
|
||||
|
||||
target.flash_act()
|
||||
@@ -275,10 +275,23 @@
|
||||
playsound(get_turf(S), 'sound/effects/ghost.ogg', 100, TRUE)
|
||||
new /obj/effect/temp_visual/cult/sac(get_turf(S))
|
||||
|
||||
/obj/effect/proc_holder/spell/targeted/dominate/can_target(mob/living/target)
|
||||
if(!isanimal(target) || target.stat)
|
||||
/obj/effect/proc_holder/spell/targeted/dominate/can_target(atom/target, mob/user, silent)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return FALSE
|
||||
if("cult" in target.faction)
|
||||
if(!isanimal(target))
|
||||
if(!silent)
|
||||
to_chat(user, "<span class='warning'>Target is not a lesser creature!</span>")
|
||||
return FALSE
|
||||
|
||||
var/mob/living/simple_animal/animal = target
|
||||
if(animal.stat)
|
||||
if(!silent)
|
||||
to_chat(user, "<span class='warning'>Target is dead!</span>")
|
||||
return FALSE
|
||||
if("cult" in animal.faction)
|
||||
if(!silent)
|
||||
to_chat(user, "<span class='warning'>Target is already serving Nar'Sie!</span>")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
var/deactive_msg = "You dispel the magic..."
|
||||
/// Message showing to the spell owner upon activating pointed spell.
|
||||
var/active_msg = "You prepare to use the spell on a target..."
|
||||
/// Variable dictating if the user is allowed to cast a spell on himself.
|
||||
var/self_castable = FALSE
|
||||
|
||||
/obj/effect/proc_holder/spell/pointed/Click()
|
||||
var/mob/living/user = usr
|
||||
@@ -23,6 +25,9 @@
|
||||
msg = "<span class='notice'>[active_msg] <B>Left-click to activate spell on a target!</B></span>"
|
||||
add_ranged_ability(user, msg, TRUE)
|
||||
|
||||
/obj/effect/proc_holder/spell/pointed/on_lose(mob/living/user)
|
||||
remove_ranged_ability()
|
||||
|
||||
/obj/effect/proc_holder/spell/pointed/remove_ranged_ability(msg)
|
||||
. = ..()
|
||||
on_deactivation(ranged_ability_user)
|
||||
@@ -61,14 +66,9 @@
|
||||
/obj/effect/proc_holder/spell/pointed/InterceptClickOn(mob/living/caller, params, atom/target)
|
||||
if(..())
|
||||
return TRUE
|
||||
if(!(target in view_or_range(range, ranged_ability_user, selection_type)))
|
||||
to_chat(ranged_ability_user, "<span class='warning'>[target.p_theyre(TRUE)] too far away!</span>")
|
||||
if(!intercept_check(caller, target))
|
||||
return TRUE
|
||||
if(!intercept_check(ranged_ability_user, target))
|
||||
return TRUE
|
||||
if(!cast_check(user = ranged_ability_user))
|
||||
return TRUE
|
||||
perform(list(target), user = ranged_ability_user)
|
||||
perform(list(target), user = caller)
|
||||
remove_ranged_ability()
|
||||
return TRUE // Do not do any underlying actions after the spell cast
|
||||
|
||||
@@ -80,7 +80,14 @@
|
||||
* * target The atom that is being targeted by the spell via intercept.
|
||||
*/
|
||||
/obj/effect/proc_holder/spell/pointed/proc/intercept_check(mob/user, atom/target)
|
||||
if(!can_target(target))
|
||||
to_chat(user, "<span class='warning'>Invalid target!</span>")
|
||||
if(!self_castable && target == user)
|
||||
to_chat(user, "<span class='warning'>You cannot cast the spell on yourself!</span>")
|
||||
return FALSE
|
||||
if(!(target in view_or_range(range, user, selection_type)))
|
||||
to_chat(user, "<span class='warning'>[target.p_theyre(TRUE)] too far away!</span>")
|
||||
return FALSE
|
||||
if(!can_target(target, user))
|
||||
return FALSE
|
||||
if(!cast_check(FALSE, user))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/obj/effect/proc_holder/spell/pointed/barnyardcurse
|
||||
name = "Curse of the Barnyard"
|
||||
desc = "This spell dooms an unlucky soul to possess the speech and facial attributes of a barnyard animal."
|
||||
school = "transmutation"
|
||||
charge_type = "recharge"
|
||||
charge_max = 150
|
||||
charge_counter = 0
|
||||
clothes_req = FALSE
|
||||
stat_allowed = FALSE
|
||||
invocation = "KN'A FTAGHU, PUCK 'BTHNK!"
|
||||
invocation_type = "shout"
|
||||
range = 7
|
||||
cooldown_min = 30
|
||||
ranged_mousepointer = 'icons/effects/mouse_pointers/barn_target.dmi'
|
||||
action_icon_state = "barn"
|
||||
active_msg = "You prepare to curse a target..."
|
||||
deactive_msg = "You dispel the curse..."
|
||||
/// List of mobs which are allowed to be a target of the spell
|
||||
var/static/list/compatible_mobs_typecache = typecacheof(list(/mob/living/carbon/human, /mob/living/carbon/monkey))
|
||||
|
||||
/obj/effect/proc_holder/spell/pointed/barnyardcurse/cast(list/targets, mob/user)
|
||||
if(!targets.len)
|
||||
to_chat(user, "<span class='warning'>No target found in range!</span>")
|
||||
return FALSE
|
||||
if(!curse_check(user, targets[1]))
|
||||
return FALSE
|
||||
|
||||
var/mob/living/carbon/target = targets[1]
|
||||
|
||||
var/list/masks = list(/obj/item/clothing/mask/pig/cursed, /obj/item/clothing/mask/cowmask/cursed, /obj/item/clothing/mask/horsehead/cursed)
|
||||
var/choice = pick(masks)
|
||||
var/obj/item/clothing/mask/magichead = new choice(get_turf(target))
|
||||
|
||||
target.visible_message("<span class='danger'>[target]'s face bursts into flames, and a barnyard animal's head takes its place!</span>", \
|
||||
"<span class='danger'>Your face burns up, and shortly after the fire you realise you have the face of a barnyard animal!</span>")
|
||||
if(!target.dropItemToGround(target.wear_mask))
|
||||
qdel(target.wear_mask)
|
||||
target.equip_to_slot_if_possible(magichead, ITEM_SLOT_MASK, 1, 1)
|
||||
target.flash_act()
|
||||
|
||||
/**
|
||||
* curse_check: Checks if we are allowed and able to curse the target
|
||||
*
|
||||
* Arguments:
|
||||
* * user - caster of the spell
|
||||
* * target - target of the spell
|
||||
* * silent - if set to TRUE, the spell will not produce any feedback messages
|
||||
*/
|
||||
/obj/effect/proc_holder/spell/pointed/barnyardcurse/proc/curse_check(mob/user, atom/target, silent = FALSE)
|
||||
if(!is_type_in_typecache(target, compatible_mobs_typecache))
|
||||
if(!silent)
|
||||
to_chat(user, "<span class='warning'>You are unable to curse [target]!</span>")
|
||||
return FALSE
|
||||
|
||||
var/mob/living/carbon/victim = target
|
||||
if(victim.anti_magic_check())
|
||||
if(!silent)
|
||||
to_chat(user, "<span class='warning'>The spell had no effect!</span>")
|
||||
victim.visible_message("<span class='danger'>[victim]'s face bursts into flames, which instantly burst outward, leaving [victim] unharmed!</span>", \
|
||||
"<span class='danger'>Your face starts burning up, but the flames are repulsed by your anti-magic protection!</span>")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/effect/proc_holder/spell/pointed/barnyardcurse/can_target(atom/target, mob/user, silent)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return FALSE
|
||||
if(!curse_check(user, target, silent))
|
||||
return FALSE
|
||||
return TRUE
|
||||
+3
-2
@@ -24,11 +24,12 @@
|
||||
charge_max = 400 // needs to be higher than the duration or it'll be permanent
|
||||
sound = 'sound/magic/blind.ogg'
|
||||
|
||||
/obj/effect/proc_holder/spell/pointed/trigger/blind/intercept_check(mob/user, atom/target)
|
||||
/obj/effect/proc_holder/spell/pointed/trigger/blind/can_target(atom/target, mob/user, silent)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return FALSE
|
||||
if(!isliving(target))
|
||||
to_chat(user, "<span class='warning'>You can only blind living beings!</span>")
|
||||
if(!silent)
|
||||
to_chat(user, "<span class='warning'>You can only blind living beings!</span>")
|
||||
return FALSE
|
||||
return TRUE
|
||||
+2
-2
@@ -109,10 +109,10 @@
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/effect/proc_holder/spell/pointed/mind_transfer/intercept_check(mob/user, atom/target)
|
||||
/obj/effect/proc_holder/spell/pointed/mind_transfer/can_target(atom/target, mob/user, silent)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return FALSE
|
||||
if(!swap_check(user, target))
|
||||
if(!swap_check(user, target, silent))
|
||||
return FALSE
|
||||
return TRUE
|
||||
Reference in New Issue
Block a user