Files
Paradise/code/datums/spell_targeting/spiral_targeting.dm
Qwertytoforty a88828ff47 Ports spacetime distortion spell from TG (#19658)
* NanoMap Auto-Update (Wed Sep 23 20:02:25 UTC 2020)

* Deconflicts

* Revert "Deconflicts"

This reverts commit a52c425136.

* Update filingcabinet.dm (#14616)

* updates haloperidol and nanocalcium to take less effort to modify. (#14612)

* Rename all instances of "virgin" being used as a variable name to more appropriate and self-explanatory variable name

* Oops

* Update filter.dm

* lore fix (#14627)

* breaks spacetime and or smoothing

* spelling, range upgrade for more points

* actually fixes it

* sprite via ramon

* 20 -> 15

* Apply suggestions from code review

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>

* removes element

* sigh

* god I love icon conflicts

* Apply suggestions from code review

Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

* henks requests

* Update code/datums/spells/spacetime_dist.dm

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

* Henks changes

* Update code/datums/spell.dm

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

Co-authored-by: NanoMap Generation <action@github.com>
Co-authored-by: Qwertytoforty <qwertytoforty@gmail.com>
Co-authored-by: SabreML <57483089+SabreML@users.noreply.github.com>
Co-authored-by: Aquilar <20759278+Aquilar@users.noreply.github.com>
Co-authored-by: variableundefined <40092670+variableundefined@users.noreply.github.com>
Co-authored-by: SteelSlayer <alexgcopeland123@yahoo.com>
Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
Co-authored-by: Farie82 <farie82@users.noreply.github.com>
2022-12-24 18:11:23 +01:00

32 lines
960 B
Plaintext

/**
* Gets a list of turfs around the center atom to scramble.
*
* Returns an assoc list of [turf] to [turf]. These pairs are what turfs are
* swapped between one another when the cast is done.
*/
/datum/spell_targeting/spiral
max_targets = INFINITY
/datum/spell_targeting/spiral/choose_targets(atom/center)
// Get turfs around the center
var/list/turfs = spiral_range_turfs(range, center)
if(!length(turfs))
return
var/list/targets = list()
// Go through the turfs we got and pair them up
// This is where we determine what to swap where
var/num_to_scramble = round(length(turfs) * 0.5)
for(var/i in 1 to num_to_scramble)
targets[pick_n_take(turfs)] = pick_n_take(turfs)
// If there's any turfs unlinked with a friend,
// just randomly swap it with any turf in the area
if(length(turfs))
var/turf/loner = pick(turfs)
var/area/caster_area = get_area(center)
targets[loner] = get_turf(pick(caster_area.contents))
return targets