s=nil; -- s will eventually hold the name of the spell we're going to cast
m=0; -- m will hold the maximum amount of damage taken by any raid/party member
w=f; -- w will hold the unitid of the person who took the max dmg
-- loop through all the people in the raid/partyv
for i=nps,npe do
-- set tt to the unitid to check
-- normally just t..i is correct...but there is no partyN unitid for you,
-- so we use this if statement to change "party0" into "player"
if i==0 then tt="player" else tt=t..i end;
-- if that unit exists, is in range, and isn't dead
if UnitExists(tt) and UnitInRange(tt)==1 and UnitIsDeadOrGhost(tt)~=1 then
-- a holds how much damage they've taken
a=UnitHealthMax(tt)-UnitHealth(tt);
-- if a is more than m, this person is our new "max damage" person
if a>m then
-- save the damage they took (m) and their unit (w)
m=a w=tt
end
end
end;