Files
Paradise/code/datums/spells/charge_up_bounce.dm
T
eee8878024 Datumizes spells (#24242)
* datumized spells

* finished

* last changes

* conflict

* Update code/datums/spells/alien_spells/transfer_plasma.dm

* conflicts

* shitty runtime fix until i get to this tomorrow

* Update code/datums/spell.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spell_handler/alien_spell_handler.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/alien_spells/regurgitate.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/alien_spells/regurgitate.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/bloodcrawl.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/bloodcrawl.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/modules/antagonists/vampire/vampire_powers/hemomancer_powers.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/modules/antagonists/vampire/vampire_powers/vampire_powers.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/modules/awaymissions/mission_code/ruins/wizardcrash.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/modules/research/xenobiology/xenobiology.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/modules/mob/living/carbon/superheroes.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/conjure.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/ethereal_jaunt.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/emplosion.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/turf_teleport.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/wizard_spells.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/wizard_spells.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/game/dna/mutations/mutation_powers.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/wizard_spells.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/datums/spells/wizard_spells.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/game/dna/mutations/mutation_powers.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/game/gamemodes/miniantags/revenant/revenant_abilities.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* guess who just rework the entire malf ai actionsf ai

* gc better

---------

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
2024-04-01 07:42:21 +00:00

72 lines
2.1 KiB
Plaintext

/**
* A spell template that adds bounces to the charge_up spell template. The spell will bounce between targets once released.
* Don't override cast and instead override apply_bounce_effect and the other procs
*/
/datum/spell/charge_up/bounce
var/bounce_hit_sound
/datum/spell/charge_up/bounce/create_new_targeting()
var/datum/spell_targeting/click/T = new
T.allowed_type = /mob/living
T.try_auto_target = FALSE
T.use_obstacle_check = TRUE
return T
/datum/spell/charge_up/bounce/cast(list/targets, mob/user = usr)
var/mob/living/target = targets[1]
bounce(user, target, get_bounce_energy(), get_bounce_amount(), user)
/**
* How much energy should each bounce have?
*/
/datum/spell/charge_up/bounce/proc/get_bounce_energy()
return
/**
* How much bounces should there be in total?
*/
/datum/spell/charge_up/bounce/proc/get_bounce_amount()
return
/**
* Called when a bounce travels from one mob to another
*
* Arguments:
* * origin - Where the bounce came from
* * target - The mob that got hit
*/
/datum/spell/charge_up/bounce/proc/create_beam(mob/origin, mob/target)
return
/**
* The proc called when a bounce hits a target. Override this to add an effect
* The user itself is never hit
*
* Arguments:
* * origin - Where the bounce came from
* * target - The mob that got hit
* * energy - How much energy the bounce has
* * user - The caster of the spell
*/
/datum/spell/charge_up/bounce/proc/apply_bounce_effect(mob/origin, mob/target, energy, mob/user)
return
/datum/spell/charge_up/bounce/proc/bounce(mob/origin, mob/target, energy, bounces, mob/user)
SHOULD_CALL_PARENT(TRUE)
create_beam(origin, target)
apply_bounce_effect(origin, target, energy, user)
add_attack_logs(user, target, "Bounce spell '[src]' bounced on")
playsound(get_turf(target), bounce_hit_sound, 50, 1, -1)
if(bounces >= 1)
var/list/possible_targets = list()
for(var/mob/living/M in view(targeting.range, target))
if(user == M || target == M && targeting.obstacle_check(target, M))
continue
possible_targets += M
if(!length(possible_targets))
return
var/mob/living/next = pick(possible_targets)
bounce(target, next, energy, bounces - 1, user)