Advertisement
MichaelCrow

Untitled

Dec 8th, 2022
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. enum SpellIds
  2. {
  3. SPELL_AREA_OF_EFFECT = 30953
  4. };
  5.  
  6. class spell_area_of_effect : public SpellScript
  7. {
  8. PrepareSpellScript(spell_area_of_effect);
  9.  
  10. void HandleDummy(SpellEffIndex /*effIndex*/)
  11. {
  12. float x, y, z, orientation;
  13. // Get the caster's position and orientation
  14. GetCaster()->GetPosition(x, y, z);
  15. orientation = GetCaster()->GetOrientation();
  16. // Set the starting point for the spell
  17. Position startPos = {x, y, z};
  18. // Set the end point for the spell
  19. float endX = startPos.m_positionX + (40.0f * cos(orientation));
  20. float endY = startPos.m_positionY + (40.0f * sin(orientation));
  21. float endZ = startPos.m_positionZ;
  22. Position endPos = {endX, endY, endZ};
  23. // Set the current point of the spell
  24. Position curPos = startPos;
  25. // Set the step size of the spell
  26. float step = 10.0f;
  27. // Loop through until we reach the end point
  28. while(curPos.m_positionX < endPos.m_positionX && curPos.m_positionY < endPos.m_positionY)
  29. {
  30. // Cast the spell at the current position
  31. GetCaster()->CastSpell(curPos, SPELL_AREA_OF_EFFECT, true);
  32. // Increment the current position by the step size
  33. curPos.m_positionX += (step * cos(orientation));
  34. curPos.m_positionY += (step * sin(orientation));
  35. GetCaster()->CastSpell(curPos, SPELL_AREA_OF_EFFECT, true);
  36. }
  37. }
  38.  
  39. void Register() override
  40. {
  41. OnEffectHit += SpellEffectFn(spell_area_of_effect::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
  42. }
  43. };
  44.  
  45. void AddSC_SpellScripts()
  46. {
  47. new spell_area_of_effect();
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement