mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-31 12:41:46 +00:00
* 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>
53 lines
2.0 KiB
Plaintext
53 lines
2.0 KiB
Plaintext
/**
|
|
* A spell targeting system which is able to select 1 to many targets in range/view of the caster. Has a random mode, distance from user based mode or a user input mode.
|
|
*/
|
|
/datum/spell_targeting/targeted
|
|
/// Only important if max_targets > 1, affects if the spell can be cast multiple times at one person from one cast
|
|
var/can_hit_target_more_than_once = FALSE
|
|
/// Chooses random viable target instead of asking the caster
|
|
var/random_target = FALSE
|
|
/// Who to target when too many targets are found. Only matters when max_targets = 1
|
|
var/target_priority = SPELL_TARGET_CLOSEST
|
|
|
|
/datum/spell_targeting/targeted/choose_targets(mob/user, datum/spell/spell, params, atom/clicked_atom)
|
|
var/list/targets = list()
|
|
var/list/possible_targets = list()
|
|
var/atom/spell_location = use_turf_of_user ? get_turf(user) : user
|
|
for(var/atom/target in view_or_range(range, spell_location, selection_type))
|
|
if(valid_target(target, user, spell, FALSE))
|
|
possible_targets += target
|
|
|
|
if(!length(possible_targets))
|
|
return null
|
|
|
|
if(max_targets == INFINITY) // Unlimited
|
|
targets = possible_targets
|
|
else if(max_targets == 1) // Only one target
|
|
var/atom/target
|
|
if(!random_target)
|
|
target = tgui_input_list(user, "Choose the target for the spell", "Targeting", possible_targets)
|
|
//Adds a safety check post-input to make sure those targets are actually in range.
|
|
if(target in view_or_range(range, spell_location, selection_type))
|
|
targets += target
|
|
else
|
|
switch(target_priority)
|
|
if(SPELL_TARGET_RANDOM)
|
|
target = pick(possible_targets)
|
|
if(SPELL_TARGET_CLOSEST)
|
|
for(var/atom/A as anything in possible_targets)
|
|
if(target)
|
|
if(get_dist(spell_location, A) < get_dist(spell_location, target))
|
|
target = A
|
|
else
|
|
target = A
|
|
targets += target
|
|
else if(max_targets > 1)
|
|
do
|
|
if(can_hit_target_more_than_once)
|
|
targets += pick(possible_targets)
|
|
else
|
|
targets += pick_n_take(possible_targets)
|
|
while(length(possible_targets) && length(targets) < max_targets)
|
|
|
|
return targets
|