Core/Scripts: Avoid some possible crashes

Temporary fix since Sartura obviously needs a rewrite.
This commit is contained in:
kaelima
2011-06-13 13:06:02 +02:00
parent de41092cab
commit f45121ebe9
2 changed files with 30 additions and 33 deletions

View File

@@ -105,13 +105,12 @@ public:
if (WhirlWindRandom_Timer <= diff)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true))
{
me->AddThreat(target, 1.0f);
me->TauntApply(target);
AttackStart(target);
}
WhirlWindRandom_Timer = 3000 + rand()%4000;
} else WhirlWindRandom_Timer -= diff;
@@ -134,15 +133,14 @@ public:
if (AggroReset_Timer <= diff)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
AggroReset = true;
AggroReset_Timer = 2000 + rand()%3000;
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true))
{
me->AddThreat(target, 1.0f);
me->TauntApply(target);
AttackStart(target);
}
AggroReset = true;
AggroReset_Timer = 2000 + rand()%3000;
} else AggroReset_Timer -= diff;
if (AggroReset)
@@ -242,12 +240,12 @@ public:
if (WhirlWindRandom_Timer <= diff)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true))
{
me->AddThreat(target, 1.0f);
me->TauntApply(target);
AttackStart(target);
}
WhirlWindRandom_Timer = 3000 + rand()%4000;
} else WhirlWindRandom_Timer -= diff;
@@ -263,12 +261,12 @@ public:
if (AggroReset_Timer <= diff)
{
//Attack random Gamers
Unit *pTarget = NULL;
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (pTarget)
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true))
{
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
}
AggroReset = true;
AggroReset_Timer = 2000 + rand()%3000;

View File

@@ -169,11 +169,10 @@ public:
if (uiCurseFatigueTimer <= diff)
{
//WowWiki say "Curse of Fatigue-Kirk'thir will cast Curse of Fatigue on 2-3 targets periodically."
Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
Unit *pTarget_1 = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
DoCast(pTarget, SPELL_CURSE_OF_FATIGUE);
DoCast(pTarget_1, SPELL_CURSE_OF_FATIGUE);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
DoCast(target, SPELL_CURSE_OF_FATIGUE);
if (Unit* tankTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
DoCast(tankTarget, SPELL_CURSE_OF_FATIGUE);
uiCurseFatigueTimer = 10*IN_MILLISECONDS;
} else uiCurseFatigueTimer -= diff;