@@ -1416,18 +1416,14 @@ class druid_bot : public CreatureScript
1416
1416
{
1417
1417
if (!IsSpellReady (INNERVATE_1, diff) || Rand () > 25 )
1418
1418
return ;
1419
- if (_form != BOT_STANCE_NONE && _form != DRUID_MOONKIN_FORM && _form != DRUID_TREE_FORM &&
1420
- (IsTank () || me->getAttackers ().size () > 3 ))
1419
+ if (_form != BOT_STANCE_NONE && _form != DRUID_MOONKIN_FORM && _form != DRUID_TREE_FORM && (IsTank () || me->getAttackers ().size () > 3 ))
1421
1420
return ;
1422
1421
1423
- static const uint8 minmanaval = 30 ;
1424
1422
Unit* iTarget = nullptr ;
1425
1423
1426
- if (master->IsInCombat () && master->GetPowerType () == POWER_MANA &&
1427
- GetManaPCT (master) < minmanaval && !master->GetAuraEffect (SPELL_AURA_PERIODIC_ENERGIZE, SPELLFAMILY_DRUID, 0x0 , 0x1000 , 0x0 ))
1424
+ if (_isValidInnervateTarget (master))
1428
1425
iTarget = master;
1429
- else if (me->IsInCombat () && me->GetPowerType () == POWER_MANA &&
1430
- GetManaPCT (me) < minmanaval && !me->GetAuraEffect (SPELL_AURA_PERIODIC_ENERGIZE, SPELLFAMILY_DRUID, 0x0 , 0x1000 , 0x0 ))
1426
+ else if (_isValidInnervateTarget (me))
1431
1427
iTarget = me;
1432
1428
1433
1429
if (!IAmFree ())
@@ -1439,13 +1435,7 @@ class druid_bot : public CreatureScript
1439
1435
for (BotMap::const_iterator itr = map->begin (); itr != map->end (); ++itr)
1440
1436
{
1441
1437
Creature* bot = itr->second ;
1442
- if (!bot || !bot->IsInCombat () || !bot->IsAlive () || bot->IsTempBot ()) continue ;
1443
- if (bot->GetPowerType () != POWER_MANA) continue ;
1444
- if (bot->GetBotClass () == BOT_CLASS_HUNTER || bot->GetBotClass () == BOT_CLASS_WARLOCK ||
1445
- bot->GetBotClass () == BOT_CLASS_SPHYNX || bot->GetBotClass () == BOT_CLASS_SPELLBREAKER ||
1446
- bot->GetBotClass () == BOT_CLASS_NECROMANCER) continue ;
1447
- if (me->GetExactDist (bot) > 30 ) continue ;
1448
- if (GetManaPCT (bot) < minmanaval && !bot->GetAuraEffect (SPELL_AURA_PERIODIC_ENERGIZE, SPELLFAMILY_DRUID, 0x0 , 0x1000 , 0x0 ))
1438
+ if (bot && !bot->IsTempBot () && _isValidInnervateTarget (bot))
1449
1439
{
1450
1440
iTarget = bot;
1451
1441
break ;
@@ -1459,19 +1449,10 @@ class druid_bot : public CreatureScript
1459
1449
{
1460
1450
for (Unit* member : members)
1461
1451
{
1462
- if (!(i == 0 ? member->IsPlayer () : member->IsNPCBot ()) || !member-> IsInWorld () || ! member-> IsInCombat () ||
1463
- !member-> IsAlive () || me-> GetExactDist (member) > 30 || GetManaPCT (member) > minmanaval ||
1464
- member->GetAuraEffect (SPELL_AURA_PERIODIC_ENERGIZE, SPELLFAMILY_DRUID, 0x0 , 0x1000 , 0x0 ))
1452
+ if (!(i == 0 ? member->IsPlayer () : member->IsNPCBot ()) || !_isValidInnervateTarget ( member))
1453
+ continue ;
1454
+ if (i == 1 && member->ToCreature ()-> IsTempBot ( ))
1465
1455
continue ;
1466
- if (i == 1 )
1467
- {
1468
- Creature const * bot = member->ToCreature ();
1469
- if (bot->IsTempBot () || bot->GetPowerType () != POWER_MANA ||
1470
- bot->GetBotClass () == BOT_CLASS_HUNTER || bot->GetBotClass () == BOT_CLASS_WARLOCK ||
1471
- bot->GetBotClass () == BOT_CLASS_SPHYNX || bot->GetBotClass () == BOT_CLASS_SPELLBREAKER ||
1472
- bot->GetBotClass () == BOT_CLASS_NECROMANCER)
1473
- continue ;
1474
- }
1475
1456
iTarget = member;
1476
1457
break ;
1477
1458
}
@@ -2932,6 +2913,29 @@ class druid_bot : public CreatureScript
2932
2913
}
2933
2914
2934
2915
private:
2916
+ bool _isValidInnervateTarget (Unit const * unit) const
2917
+ {
2918
+ if (!unit || unit->GetPowerType () != POWER_MANA || !unit->IsInCombat () || !unit->IsInMap (me) || me->GetExactDist (unit) > 30 .f ||
2919
+ unit->GetAuraEffect (SPELL_AURA_PERIODIC_ENERGIZE, SPELLFAMILY_DRUID, 0x0 , 0x1000 , 0x0 ))
2920
+ return false ;
2921
+
2922
+ if (unit->IsNPCBot ())
2923
+ {
2924
+ switch (unit->ToCreature ()->GetBotClass ())
2925
+ {
2926
+ case BOT_CLASS_HUNTER: case BOT_CLASS_WARLOCK: case BOT_CLASS_SPHYNX: case BOT_CLASS_SPELLBREAKER: case BOT_CLASS_NECROMANCER:
2927
+ return false ;
2928
+ default :
2929
+ break ;
2930
+ }
2931
+ }
2932
+
2933
+ uint8 mpct = (unit->GetMaxPower (POWER_MANA) - unit->GetPower (POWER_MANA) > me->GetCreateMana () * 2 ) ? 30 : 3 ;
2934
+ if (GetManaPCT (unit) >= mpct)
2935
+ return false ;
2936
+
2937
+ return true ;
2938
+ }
2935
2939
static uint32 _baseSpellForShapeshift (BotStances form)
2936
2940
{
2937
2941
switch (form)
@@ -2969,7 +2973,7 @@ class druid_bot : public CreatureScript
2969
2973
if (form == BOT_STANCE_NONE && HasRole (BOT_ROLE_DPS))
2970
2974
form = (!HasRole (BOT_ROLE_HEAL) && !!GetSpell (_baseSpellForShapeshift (DRUID_MOONKIN_FORM))) ? DRUID_MOONKIN_FORM : BOT_STANCE_NONE;
2971
2975
if (form == BOT_STANCE_NONE && HasRole (BOT_ROLE_HEAL))
2972
- form = !! GetSpell (_baseSpellForShapeshift (DRUID_TREE_FORM)) ? DRUID_TREE_FORM : BOT_STANCE_NONE;
2976
+ form = (! HasRole (BOT_ROLE_DPS) && !! GetSpell (_baseSpellForShapeshift (DRUID_TREE_FORM) )) ? DRUID_TREE_FORM : BOT_STANCE_NONE;
2973
2977
return form;
2974
2978
}
2975
2979
0 commit comments