-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathrepulse.dm
88 lines (71 loc) · 2.89 KB
/
repulse.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/datum/action/cooldown/spell/aoe/repulse
/// The max throw range of the repulsioon.
var/max_throw = 5
/// A visual effect to be spawned on people who are thrown away.
var/obj/effect/sparkle_path = /obj/effect/temp_visual/gravpush
/// The moveforce of the throw done by the repulsion.
var/repulse_force = MOVE_FORCE_EXTREMELY_STRONG
/datum/action/cooldown/spell/aoe/repulse/get_things_to_cast_on(atom/center)
var/list/things = list()
for(var/atom/movable/nearby_movable in view(aoe_radius, center))
if(nearby_movable == owner || nearby_movable == center)
continue
if(nearby_movable.anchored)
continue
things += nearby_movable
return things
/datum/action/cooldown/spell/aoe/repulse/cast_on_thing_in_aoe(atom/movable/victim, atom/caster)
if(ismob(victim))
var/mob/victim_mob = victim
if(victim_mob.can_block_magic(antimagic_flags))
return
var/turf/throwtarget = get_edge_target_turf(caster, get_dir(caster, get_step_away(victim, caster)))
var/dist_from_caster = get_dist(victim, caster)
if(dist_from_caster == 0)
if(isliving(victim))
var/mob/living/victim_living = victim
victim_living.Paralyze(10 SECONDS)
victim_living.adjustBruteLoss(5)
to_chat(victim, span_userdanger("You're slammed into the floor by [caster]!"))
else
if(sparkle_path)
// Created sparkles will disappear on their own
new sparkle_path(get_turf(victim), get_dir(caster, victim))
if(isliving(victim))
var/mob/living/victim_living = victim
victim_living.Paralyze(4 SECONDS)
to_chat(victim, span_userdanger("You're thrown back by [caster]!"))
// So stuff gets tossed around at the same time.
victim.safe_throw_at(throwtarget, ((clamp((max_throw - (clamp(dist_from_caster - 2, 0, dist_from_caster))), 3, max_throw))), 1, caster, force = repulse_force)
/datum/action/cooldown/spell/aoe/repulse/wizard
name = "Repulse"
desc = "This spell throws everything around the user away."
button_icon_state = "repulse"
sound = 'sound/magic/repulse.ogg'
school = SCHOOL_EVOCATION
invocation = "GITTAH WEIGH"
invocation_type = INVOCATION_SHOUT
aoe_radius = 5
cooldown_time = 40 SECONDS
cooldown_reduction_per_rank = 6.25 SECONDS
/datum/action/cooldown/spell/aoe/repulse/xeno
name = "Tail Sweep"
desc = "Throw back attackers with a sweep of your tail."
background_icon_state = "bg_alien"
overlay_icon_state = "bg_alien_border"
button_icon = 'icons/mob/actions/actions_xeno.dmi'
button_icon_state = "tailsweep"
panel = "Alien"
sound = 'sound/magic/tail_swing.ogg'
cooldown_time = 15 SECONDS
spell_requirements = NONE
invocation_type = INVOCATION_NONE
antimagic_flags = NONE
aoe_radius = 2
sparkle_path = /obj/effect/temp_visual/dir_setting/tailsweep
/datum/action/cooldown/spell/aoe/repulse/xeno/cast(atom/cast_on)
if(iscarbon(cast_on))
var/mob/living/carbon/carbon_caster = cast_on
playsound(get_turf(carbon_caster), 'sound/voice/hiss5.ogg', 80, TRUE, TRUE)
carbon_caster.spin(6, 1)
return ..()