Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum SpellIds
- {
- SPELL_AREA_OF_EFFECT = 30953
- };
- class spell_area_of_effect : public SpellScript
- {
- PrepareSpellScript(spell_area_of_effect);
- void HandleDummy(SpellEffIndex /*effIndex*/)
- {
- float x, y, z, orientation;
- // Get the caster's position and orientation
- GetCaster()->GetPosition(x, y, z);
- orientation = GetCaster()->GetOrientation();
- // Set the starting point for the spell
- Position startPos = {x, y, z};
- // Set the end point for the spell
- float endX = startPos.m_positionX + (40.0f * cos(orientation));
- float endY = startPos.m_positionY + (40.0f * sin(orientation));
- float endZ = startPos.m_positionZ;
- Position endPos = {endX, endY, endZ};
- // Set the current point of the spell
- Position curPos = startPos;
- // Set the step size of the spell
- float step = 10.0f;
- // Loop through until we reach the end point
- while(curPos.m_positionX < endPos.m_positionX && curPos.m_positionY < endPos.m_positionY)
- {
- // Cast the spell at the current position
- GetCaster()->CastSpell(curPos, SPELL_AREA_OF_EFFECT, true);
- // Increment the current position by the step size
- curPos.m_positionX += (step * cos(orientation));
- curPos.m_positionY += (step * sin(orientation));
- GetCaster()->CastSpell(curPos, SPELL_AREA_OF_EFFECT, true);
- }
- }
- void Register() override
- {
- OnEffectHit += SpellEffectFn(spell_area_of_effect::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
- }
- };
- void AddSC_SpellScripts()
- {
- new spell_area_of_effect();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement