mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-29 16:58:02 +00:00
Merge branch 'master' into StringFormatting.
Cleaned up the problems. Tested on Linux. Still need to test on windows. Conflicts: common/CMakeLists.txt common/MiscFunctions.cpp common/MiscFunctions.h common/debug.cpp world/Adventure.cpp
This commit is contained in:
+191
-191
@@ -18,7 +18,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(tar->GetAppearance() == eaDead) {
|
||||
if((tar->IsClient() && tar->CastToClient()->GetFeigned()) || tar->IsBot()) {
|
||||
// do nothing
|
||||
@@ -46,10 +46,10 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
|
||||
//TODO
|
||||
//Check if single target or AoE mez is best
|
||||
//if (TARGETS ON MT IS => 3 THEN botSpell = AoEMez)
|
||||
@@ -68,17 +68,17 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(!(!addMob->IsImmuneToSpell(botSpell.SpellId, this) && addMob->CanBuffStack(botSpell.SpellId, botLevel, true) >= 0))
|
||||
break;
|
||||
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, addMob, botSpell.ManaCost);
|
||||
|
||||
if(castedSpell) {
|
||||
char* gmsg = 0;
|
||||
|
||||
|
||||
MakeAnyLenString(&gmsg, "Attempting to mez %s.", addMob->GetCleanName());
|
||||
|
||||
if(gmsg && GetGroupMessagesOn())
|
||||
BotGroupSay(this, gmsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
uint8 hpr = (uint8)tar->GetHPRatio();
|
||||
bool hasAggro = false;
|
||||
bool isPrimaryHealer = false;
|
||||
|
||||
|
||||
if(HasGroup()) {
|
||||
isPrimaryHealer = IsGroupPrimaryHealer();
|
||||
}
|
||||
@@ -193,12 +193,12 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
hpRatioToCast = isPrimaryHealer?100.0f:0.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//If we're at specified mana % or below, don't heal as hybrid
|
||||
if(tar->GetHPRatio() <= hpRatioToCast)
|
||||
botSpell = GetBestBotSpellForRegularSingleTargetHeal(this);
|
||||
}
|
||||
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
botSpell = GetBestBotSpellForRegularSingleTargetHeal(this);
|
||||
|
||||
@@ -231,7 +231,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
// TODO: Replace this code with logic that calculates the delay based on number of clerics in rotation
|
||||
// and ignores heals for anyone except the main tank
|
||||
if(!IsHealOverTimeSpell(botSpell.SpellId)) {
|
||||
if(IsCompleteHealSpell(botSpell.SpellId)) {
|
||||
if(IsCompleteHealSpell(botSpell.SpellId)) {
|
||||
// Complete Heal 4 second rotation
|
||||
tar->SetDontHealMeBefore(Timer::GetCurrentTime() + 4000);
|
||||
}
|
||||
@@ -275,7 +275,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
@@ -290,9 +290,9 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
break;
|
||||
|
||||
uint32 TempDontRootMeBefore = tar->DontRootMeBefore();
|
||||
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost, &TempDontRootMeBefore);
|
||||
|
||||
|
||||
if(TempDontRootMeBefore != tar->DontRootMeBefore())
|
||||
tar->SetDontRootMeBefore(TempDontRootMeBefore);
|
||||
}
|
||||
@@ -322,7 +322,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
// Validate target
|
||||
|
||||
if(!((spells[selectedBotSpell.SpellId].targettype == ST_Target || spells[selectedBotSpell.SpellId].targettype == ST_Pet || tar == this ||
|
||||
if(!((spells[selectedBotSpell.SpellId].targettype == ST_Target || spells[selectedBotSpell.SpellId].targettype == ST_Pet || tar == this ||
|
||||
spells[selectedBotSpell.SpellId].targettype == ST_Group || spells[selectedBotSpell.SpellId].targettype == ST_GroupTeleport ||
|
||||
(botClass == BARD && spells[selectedBotSpell.SpellId].targettype == ST_AEBard))
|
||||
&& !tar->IsImmuneToSpell(selectedBotSpell.SpellId, this)
|
||||
@@ -341,7 +341,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
case ARCHETYPE_CASTER:
|
||||
//TODO: probably more caster specific spell effects in here
|
||||
if(IsEffectInSpell(selectedBotSpell.SpellId, SE_AttackSpeed) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ATK) ||
|
||||
IsEffectInSpell(selectedBotSpell.SpellId, SE_STR) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ReverseDS))
|
||||
IsEffectInSpell(selectedBotSpell.SpellId, SE_STR) || IsEffectInSpell(selectedBotSpell.SpellId, SE_ReverseDS))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -363,7 +363,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(botClass == ENCHANTER && IsEffectInSpell(selectedBotSpell.SpellId, SE_Rune))
|
||||
{
|
||||
float manaRatioToCast = 75.0f;
|
||||
|
||||
|
||||
switch(this->GetBotStance())
|
||||
{
|
||||
case BotStanceEfficient:
|
||||
@@ -382,7 +382,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
manaRatioToCast = 75.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//If we're at specified mana % or below, don't rune as enchanter
|
||||
if(this->GetManaRatio() <= manaRatioToCast)
|
||||
break;
|
||||
@@ -408,13 +408,13 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
case SpellType_Escape: {
|
||||
uint8 hpr = (uint8)GetHPRatio();
|
||||
bool mayGetAggro = false;
|
||||
|
||||
#ifdef IPC
|
||||
|
||||
#ifdef IPC
|
||||
if (hpr <= 5 || (IsNPC() && CastToNPC()->IsInteractive() && tar != this) )
|
||||
#else
|
||||
if(hpr > 15 && ((botClass == WIZARD) || (botClass == ENCHANTER) || (botClass == RANGER)))
|
||||
mayGetAggro = HasOrMayGetAggro(); //classes have hate reducing spells
|
||||
|
||||
mayGetAggro = HasOrMayGetAggro(); //classes have hate reducing spells
|
||||
|
||||
if (hpr <= 15 || mayGetAggro)
|
||||
#endif
|
||||
{
|
||||
@@ -422,10 +422,10 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
break;
|
||||
|
||||
|
||||
if(IsInvulnerabilitySpell(botSpell.SpellId))
|
||||
tar = this; //target self for invul type spells
|
||||
|
||||
tar = this; //target self for invul type spells
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost);
|
||||
}
|
||||
break;
|
||||
@@ -436,14 +436,14 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
if(botClass == CLERIC || botClass == ENCHANTER)
|
||||
{
|
||||
float manaRatioToCast = 75.0f;
|
||||
|
||||
|
||||
switch(this->GetBotStance())
|
||||
{
|
||||
case BotStanceEfficient:
|
||||
@@ -464,7 +464,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
manaRatioToCast = 50.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//If we're at specified mana % or below, don't nuke as cleric or enchanter
|
||||
if(this->GetManaRatio() <= manaRatioToCast)
|
||||
break;
|
||||
@@ -480,7 +480,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(botClass == PALADIN || botClass == DRUID || botClass == CLERIC || botClass == ENCHANTER || botClass == WIZARD) {
|
||||
if(botSpell.SpellId == 0) {
|
||||
uint8 stunChance = (tar->IsCasting() ? 30: 15);
|
||||
|
||||
|
||||
if(botClass == PALADIN)
|
||||
stunChance = 50;
|
||||
|
||||
@@ -502,8 +502,8 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(!(!tar->IsImmuneToSpell(botSpell.SpellId, this) && (tar->CanBuffStack(botSpell.SpellId, botLevel, true) >= 0)))
|
||||
break;
|
||||
|
||||
if(IsFearSpell(botSpell.SpellId)) {
|
||||
|
||||
if(IsFearSpell(botSpell.SpellId)) {
|
||||
// don't let fear cast if the npc isn't snared or rooted
|
||||
if(tar->GetSnaredAmount() == -1) {
|
||||
if(!tar->IsRooted())
|
||||
@@ -520,10 +520,10 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
|
||||
botSpell = GetFirstBotSpellBySpellType(this, iSpellTypes);
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
@@ -547,13 +547,13 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
break;
|
||||
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SpellType_InCombatBuff: {
|
||||
|
||||
|
||||
if(botClass == SHAMAN) {
|
||||
checked_los = true;
|
||||
|
||||
@@ -573,7 +573,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
//short duration buffs or other buffs only to be cast during combat.
|
||||
if (IsSelfConversionSpell(selectedBotSpell.SpellId)) {
|
||||
if(GetManaRatio() > 90.0f || GetHPRatio() < 50.0f || GetHPRatio() < (GetManaRatio() + 10.0f))
|
||||
break; //don't cast if low hp, lots of mana, or if mana is higher than hps
|
||||
break; //don't cast if low hp, lots of mana, or if mana is higher than hps
|
||||
}
|
||||
|
||||
castedSpell = AIDoSpellCast(selectedBotSpell.SpellIndex, tar, selectedBotSpell.ManaCost);
|
||||
@@ -590,7 +590,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
@@ -624,9 +624,9 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
break;
|
||||
|
||||
uint32 TempDontSnareMeBefore = tar->DontSnareMeBefore();
|
||||
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost, &TempDontSnareMeBefore);
|
||||
|
||||
|
||||
if(TempDontSnareMeBefore != tar->DontSnareMeBefore())
|
||||
tar->SetDontSnareMeBefore(TempDontSnareMeBefore);
|
||||
}
|
||||
@@ -680,19 +680,19 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
|
||||
switch (botClass) {
|
||||
case ENCHANTER: {
|
||||
botSpell = GetBestBotSpellForMagicBasedSlow(this);
|
||||
break;
|
||||
}
|
||||
case SHAMAN:
|
||||
case SHAMAN:
|
||||
case BEASTLORD: {
|
||||
botSpell = GetBestBotSpellForDiseaseBasedSlow(this);
|
||||
|
||||
|
||||
if(botSpell.SpellId == 0 || ((tar->GetMR() - 50) < (tar->GetDR() + spells[botSpell.SpellId].ResistDiff)))
|
||||
botSpell = GetBestBotSpellForMagicBasedSlow(this);
|
||||
break;
|
||||
@@ -704,12 +704,12 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(!(!tar->IsImmuneToSpell(botSpell.SpellId, this) && tar->CanBuffStack(botSpell.SpellId, botLevel, true) >= 0))
|
||||
break;
|
||||
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost);
|
||||
|
||||
if(castedSpell) {
|
||||
char* gmsg = 0;
|
||||
|
||||
|
||||
MakeAnyLenString(&gmsg, "Attempting to slow %s.", tar->GetCleanName());
|
||||
|
||||
if(gmsg && GetGroupMessagesOn())
|
||||
@@ -724,10 +724,10 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(!checked_los) {
|
||||
if(!CheckLosFN(tar))
|
||||
break; //cannot see target... we assume that no spell is going to work since we will only be casting detrimental spells in this call
|
||||
|
||||
|
||||
checked_los = true;
|
||||
}
|
||||
|
||||
|
||||
botSpell = GetBestBotSpellForResistDebuff(this, tar);
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
@@ -750,7 +750,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
if(botSpell.SpellId == 0)
|
||||
break;
|
||||
|
||||
|
||||
uint32 TempDontCureMeBeforeTime = tar->DontCureMeBefore();
|
||||
|
||||
castedSpell = AIDoSpellCast(botSpell.SpellIndex, tar, botSpell.ManaCost, &TempDontCureMeBeforeTime);
|
||||
@@ -759,7 +759,7 @@ bool Bot::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
if(botClass != BARD) {
|
||||
if(IsGroupSpell(botSpell.SpellId)){
|
||||
Group *g;
|
||||
|
||||
|
||||
if(this->HasGroup()) {
|
||||
Group *g = this->GetGroup();
|
||||
|
||||
@@ -815,8 +815,8 @@ bool Bot::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain
|
||||
float dist2 = 0;
|
||||
|
||||
if (AIspells[i].type & SpellType_Escape) {
|
||||
dist2 = 0;
|
||||
} else
|
||||
dist2 = 0;
|
||||
} else
|
||||
dist2 = DistNoRoot(*tar);
|
||||
|
||||
if (((((spells[AIspells[i].spellid].targettype==ST_GroupTeleport && AIspells[i].type==2)
|
||||
@@ -837,7 +837,7 @@ bool Bot::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain
|
||||
SetMana(hasMana);
|
||||
extraMana = false;
|
||||
}
|
||||
else { //handle spell recast and recast timers
|
||||
else { //handle spell recast and recast timers
|
||||
if(GetClass() == BARD && IsGroupSpell(AIspells[i].spellid)) {
|
||||
AIspells[i].time_cancast = (spells[AIspells[i].spellid].recast_time > (spells[AIspells[i].spellid].buffduration * 6000)) ? Timer::GetCurrentTime() + spells[AIspells[i].spellid].recast_time : Timer::GetCurrentTime() + spells[AIspells[i].spellid].buffduration * 6000;
|
||||
//spellend_timer.Start(spells[AIspells[i].spellid].cast_time);
|
||||
@@ -854,14 +854,14 @@ bool Bot::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain
|
||||
|
||||
bool Bot::AI_PursueCastCheck() {
|
||||
bool result = false;
|
||||
|
||||
|
||||
if (AIautocastspell_timer->Check(false)) {
|
||||
_ZP(Bot_AI_Process_pursue_cast);
|
||||
|
||||
|
||||
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
|
||||
|
||||
|
||||
mlog(AI__SPELLS, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells.");
|
||||
|
||||
|
||||
if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) {
|
||||
if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) {
|
||||
if(!AICastSpell(GetTarget(), 100, SpellType_Nuke)) {
|
||||
@@ -874,12 +874,12 @@ bool Bot::AI_PursueCastCheck() {
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!AIautocastspell_timer->Enabled())
|
||||
AIautocastspell_timer->Start(RandomTimer(100, 250), false);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -893,10 +893,10 @@ bool Bot::AI_IdleCastCheck() {
|
||||
#endif
|
||||
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
|
||||
|
||||
//Ok, IdleCastCheck depends of class.
|
||||
//Ok, IdleCastCheck depends of class.
|
||||
// Healers WITHOUT pets will check if a heal is needed before buffing.
|
||||
uint8 botClass = GetClass();
|
||||
|
||||
|
||||
if(botClass == CLERIC || botClass == PALADIN || botClass == RANGER) {
|
||||
if(!entity_list.Bot_AICheckCloseBeneficialSpells(this, 100, BotAISpellRange, SpellType_Cure)) {
|
||||
if (!AICastSpell(this, 100, SpellType_Heal)) {
|
||||
@@ -913,7 +913,7 @@ bool Bot::AI_IdleCastCheck() {
|
||||
result = true;
|
||||
}
|
||||
// Pets class will first cast their pet, then buffs
|
||||
else if(botClass == DRUID || botClass == MAGICIAN || botClass == SHADOWKNIGHT || botClass == SHAMAN || botClass == NECROMANCER || botClass == ENCHANTER || botClass == BEASTLORD || botClass == WIZARD) {
|
||||
else if(botClass == DRUID || botClass == MAGICIAN || botClass == SHADOWKNIGHT || botClass == SHAMAN || botClass == NECROMANCER || botClass == ENCHANTER || botClass == BEASTLORD || botClass == WIZARD) {
|
||||
if(!entity_list.Bot_AICheckCloseBeneficialSpells(this, 100, BotAISpellRange, SpellType_Cure)) {
|
||||
if (!AICastSpell(this, 100, SpellType_Pet)) {
|
||||
if (!AICastSpell(this, 100, SpellType_Heal)) {
|
||||
@@ -931,24 +931,24 @@ bool Bot::AI_IdleCastCheck() {
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
else if(botClass == BARD) {
|
||||
// bard bots
|
||||
if(!AICastSpell(this, 100, SpellType_Cure)) {
|
||||
if(!AICastSpell(this, 100, SpellType_Heal)) {
|
||||
if(!AICastSpell(this, 100, SpellType_Buff)) {
|
||||
//
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
if(!AIautocastspell_timer->Enabled())
|
||||
AIautocastspell_timer->Start(RandomTimer(1000, 5000), false);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1149,7 +1149,7 @@ bool Bot::AI_EngagedCastCheck() {
|
||||
failedToCast = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1173,7 +1173,7 @@ bool Bot::AIHealRotation(Mob* tar, bool useFastHeals) {
|
||||
|
||||
if(!AI_HasSpells())
|
||||
return false;
|
||||
|
||||
|
||||
if(tar->GetAppearance() == eaDead) {
|
||||
if((tar->IsClient() && tar->CastToClient()->GetFeigned()) || tar->IsBot()) {
|
||||
// do nothing
|
||||
@@ -1322,7 +1322,7 @@ std::list<BotSpell> Bot::GetBotSpellsBySpellType(Bot* botCaster, uint16 spellTyp
|
||||
|
||||
BotSpell Bot::GetFirstBotSpellBySpellType(Bot* botCaster, uint16 spellType) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1341,7 +1341,7 @@ BotSpell Bot::GetFirstBotSpellBySpellType(Bot* botCaster, uint16 spellType) {
|
||||
result.SpellId = botSpellList[i].spellid;
|
||||
result.SpellIndex = i;
|
||||
result.ManaCost = botSpellList[i].manacost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1352,7 +1352,7 @@ BotSpell Bot::GetFirstBotSpellBySpellType(Bot* botCaster, uint16 spellType) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForFastHeal(Bot *botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1377,7 +1377,7 @@ BotSpell Bot::GetBestBotSpellForFastHeal(Bot *botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForHealOverTime(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1414,7 +1414,7 @@ BotSpell Bot::GetBestBotSpellForHealOverTime(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForPercentageHeal(Bot *botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1433,7 +1433,7 @@ BotSpell Bot::GetBestBotSpellForPercentageHeal(Bot *botCaster) {
|
||||
result.SpellId = botSpellList[i].spellid;
|
||||
result.SpellIndex = i;
|
||||
result.ManaCost = botSpellList[i].manacost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1444,7 +1444,7 @@ BotSpell Bot::GetBestBotSpellForPercentageHeal(Bot *botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForRegularSingleTargetHeal(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1469,7 +1469,7 @@ BotSpell Bot::GetBestBotSpellForRegularSingleTargetHeal(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetFirstBotSpellForSingleTargetHeal(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1493,95 +1493,95 @@ BotSpell Bot::GetFirstBotSpellForSingleTargetHeal(Bot* botCaster) {
|
||||
}
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForGroupHeal(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
BotSpell result;
|
||||
|
||||
if(botCaster) {
|
||||
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CurrentHP);
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
|
||||
for(std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) {
|
||||
// Assuming all the spells have been loaded into this list by level and in descending order
|
||||
if(IsRegularGroupHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(botCaster) {
|
||||
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CurrentHP);
|
||||
|
||||
return result;
|
||||
for(std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) {
|
||||
// Assuming all the spells have been loaded into this list by level and in descending order
|
||||
if(IsRegularGroupHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForGroupHealOverTime(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
BotSpell result;
|
||||
|
||||
if(botCaster) {
|
||||
std::list<BotSpell> botHoTSpellList = GetBotSpellsForSpellEffect(botCaster, SE_HealOverTime);
|
||||
std::vector<AISpells_Struct> botSpellList = botCaster->GetBotSpells();
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
|
||||
for(std::list<BotSpell>::iterator botSpellListItr = botHoTSpellList.begin(); botSpellListItr != botHoTSpellList.end(); botSpellListItr++) {
|
||||
// Assuming all the spells have been loaded into this list by level and in descending order
|
||||
if(IsGroupHealOverTimeSpell(botSpellListItr->SpellId)) {
|
||||
if(botCaster) {
|
||||
std::list<BotSpell> botHoTSpellList = GetBotSpellsForSpellEffect(botCaster, SE_HealOverTime);
|
||||
std::vector<AISpells_Struct> botSpellList = botCaster->GetBotSpells();
|
||||
|
||||
for (int i = botSpellList.size() - 1; i >= 0; i--) {
|
||||
if (botSpellList[i].spellid <= 0 || botSpellList[i].spellid >= SPDAT_RECORDS) {
|
||||
// this is both to quit early to save cpu and to avoid casting bad spells
|
||||
// Bad info from database can trigger this incorrectly, but that should be fixed in DB, not here
|
||||
continue;
|
||||
}
|
||||
for(std::list<BotSpell>::iterator botSpellListItr = botHoTSpellList.begin(); botSpellListItr != botHoTSpellList.end(); botSpellListItr++) {
|
||||
// Assuming all the spells have been loaded into this list by level and in descending order
|
||||
if(IsGroupHealOverTimeSpell(botSpellListItr->SpellId)) {
|
||||
|
||||
if(botSpellList[i].spellid == botSpellListItr->SpellId && (botSpellList[i].type & SpellType_Heal) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
for (int i = botSpellList.size() - 1; i >= 0; i--) {
|
||||
if (botSpellList[i].spellid <= 0 || botSpellList[i].spellid >= SPDAT_RECORDS) {
|
||||
// this is both to quit early to save cpu and to avoid casting bad spells
|
||||
// Bad info from database can trigger this incorrectly, but that should be fixed in DB, not here
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
|
||||
if(botCaster) {
|
||||
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CompleteHeal);
|
||||
|
||||
for(std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) {
|
||||
// Assuming all the spells have been loaded into this list by level and in descending order
|
||||
if(IsGroupCompleteHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
|
||||
if(botSpellList[i].spellid == botSpellListItr->SpellId && (botSpellList[i].type & SpellType_Heal) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForGroupCompleteHeal(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
|
||||
if(botCaster) {
|
||||
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffect(botCaster, SE_CompleteHeal);
|
||||
|
||||
for(std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) {
|
||||
// Assuming all the spells have been loaded into this list by level and in descending order
|
||||
if(IsGroupCompleteHealSpell(botSpellListItr->SpellId) && CheckSpellRecastTimers(botCaster, botSpellListItr->SpellIndex)) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForMez(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1595,7 +1595,7 @@ BotSpell Bot::GetBestBotSpellForMez(Bot* botCaster) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1606,7 +1606,7 @@ BotSpell Bot::GetBestBotSpellForMez(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForMagicBasedSlow(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1620,7 +1620,7 @@ BotSpell Bot::GetBestBotSpellForMagicBasedSlow(Bot* botCaster) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1631,7 +1631,7 @@ BotSpell Bot::GetBestBotSpellForMagicBasedSlow(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForDiseaseBasedSlow(Bot* botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1645,7 +1645,7 @@ BotSpell Bot::GetBestBotSpellForDiseaseBasedSlow(Bot* botCaster) {
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1661,7 +1661,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, BotSpell botSpell) {
|
||||
|
||||
std::list<NPC*> npc_list;
|
||||
entity_list.GetNPCList(npc_list);
|
||||
|
||||
|
||||
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); itr++) {
|
||||
NPC* npc = *itr;
|
||||
|
||||
@@ -1692,7 +1692,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, BotSpell botSpell) {
|
||||
|
||||
BotSpell Bot::GetBestBotMagicianPetSpell(Bot *botCaster) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1754,7 +1754,7 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) {
|
||||
else if(botCaster->GetLevel() < 30) {
|
||||
// Under level 30
|
||||
int counter = MakeRandomInt(0, 3);
|
||||
|
||||
|
||||
switch(counter) {
|
||||
case 0:
|
||||
result = std::string("SumWater");
|
||||
@@ -1776,7 +1776,7 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) {
|
||||
else {
|
||||
// Over level 30
|
||||
int counter = MakeRandomInt(0, 4);
|
||||
|
||||
|
||||
switch(counter) {
|
||||
case 0:
|
||||
result = std::string("SumWater");
|
||||
@@ -1803,7 +1803,7 @@ std::string Bot::GetBotMagicianPetType(Bot* botCaster) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForNukeByTargetType(Bot* botCaster, SpellTargetType targetType) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1817,7 +1817,7 @@ BotSpell Bot::GetBestBotSpellForNukeByTargetType(Bot* botCaster, SpellTargetType
|
||||
result.SpellId = botSpellListItr->SpellId;
|
||||
result.SpellIndex = botSpellListItr->SpellIndex;
|
||||
result.ManaCost = botSpellListItr->ManaCost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1856,7 +1856,7 @@ BotSpell Bot::GetBestBotSpellForStunByTargetType(Bot* botCaster, SpellTargetType
|
||||
|
||||
BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* target) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1868,7 +1868,7 @@ BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* targ
|
||||
|
||||
if((target->GetMR() > maxTargetResistValue) && (target->GetCR() > maxTargetResistValue) && (target->GetFR() > maxTargetResistValue))
|
||||
selectLureNuke = true;
|
||||
|
||||
|
||||
|
||||
std::list<BotSpell> botSpellList = GetBotSpellsForSpellEffectAndTargetType(botCaster, SE_CurrentHP, ST_Target);
|
||||
|
||||
@@ -1886,18 +1886,18 @@ BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* targ
|
||||
spellSelected = true;
|
||||
}
|
||||
else if(IsPureNukeSpell(botSpellListItr->SpellId)) {
|
||||
if(((target->GetMR() < target->GetCR()) || (target->GetMR() < target->GetFR())) && (GetSpellResistType(botSpellListItr->SpellId) == RESIST_MAGIC)
|
||||
if(((target->GetMR() < target->GetCR()) || (target->GetMR() < target->GetFR())) && (GetSpellResistType(botSpellListItr->SpellId) == RESIST_MAGIC)
|
||||
&& (spells[botSpellListItr->SpellId].ResistDiff > lureResisValue))
|
||||
{
|
||||
spellSelected = true;
|
||||
}
|
||||
else if(((target->GetCR() < target->GetMR()) || (target->GetCR() < target->GetFR())) && (GetSpellResistType(botSpellListItr->SpellId) == RESIST_COLD)
|
||||
&& (spells[botSpellListItr->SpellId].ResistDiff > lureResisValue))
|
||||
else if(((target->GetCR() < target->GetMR()) || (target->GetCR() < target->GetFR())) && (GetSpellResistType(botSpellListItr->SpellId) == RESIST_COLD)
|
||||
&& (spells[botSpellListItr->SpellId].ResistDiff > lureResisValue))
|
||||
{
|
||||
spellSelected = true;
|
||||
}
|
||||
else if(((target->GetFR() < target->GetCR()) || (target->GetFR() < target->GetMR())) && (GetSpellResistType(botSpellListItr->SpellId) == RESIST_FIRE)
|
||||
&& (spells[botSpellListItr->SpellId].ResistDiff > lureResisValue))
|
||||
&& (spells[botSpellListItr->SpellId].ResistDiff > lureResisValue))
|
||||
{
|
||||
spellSelected = true;
|
||||
}
|
||||
@@ -1928,7 +1928,7 @@ BotSpell Bot::GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* targ
|
||||
|
||||
BotSpell Bot::GetDebuffBotSpell(Bot* botCaster, Mob *tar) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
@@ -1946,14 +1946,14 @@ BotSpell Bot::GetDebuffBotSpell(Bot* botCaster, Mob *tar) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(((botSpellList[i].type & SpellType_Debuff) || IsDebuffSpell(botSpellList[i].spellid))
|
||||
&& (!tar->IsImmuneToSpell(botSpellList[i].spellid, botCaster)
|
||||
&& tar->CanBuffStack(botSpellList[i].spellid, botCaster->GetLevel(), true) >= 0)
|
||||
if(((botSpellList[i].type & SpellType_Debuff) || IsDebuffSpell(botSpellList[i].spellid))
|
||||
&& (!tar->IsImmuneToSpell(botSpellList[i].spellid, botCaster)
|
||||
&& tar->CanBuffStack(botSpellList[i].spellid, botCaster->GetLevel(), true) >= 0)
|
||||
&& CheckSpellRecastTimers(botCaster, i)) {
|
||||
result.SpellId = botSpellList[i].spellid;
|
||||
result.SpellIndex = i;
|
||||
result.ManaCost = botSpellList[i].manacost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1964,14 +1964,14 @@ BotSpell Bot::GetDebuffBotSpell(Bot* botCaster, Mob *tar) {
|
||||
|
||||
BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* botCaster, Mob *tar) {
|
||||
BotSpell result;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
|
||||
|
||||
if(!tar)
|
||||
return result;
|
||||
|
||||
|
||||
int level_mod = (tar->GetLevel() - botCaster->GetLevel())* (tar->GetLevel() - botCaster->GetLevel()) / 2;
|
||||
if(tar->GetLevel() - botCaster->GetLevel() < 0)
|
||||
{
|
||||
@@ -1982,7 +1982,7 @@ BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* botCaster, Mob *tar) {
|
||||
bool needsFireResistDebuff = (tar->GetFR() + level_mod) > 100 ? true: false;
|
||||
bool needsPoisonResistDebuff = (tar->GetPR() + level_mod) > 100 ? true: false;
|
||||
bool needsDiseaseResistDebuff = (tar->GetDR() + level_mod) > 100 ? true: false;
|
||||
|
||||
|
||||
if(botCaster && botCaster->AI_HasSpells()) {
|
||||
std::vector<AISpells_Struct> botSpellList = botCaster->GetBotSpells();
|
||||
|
||||
@@ -1993,19 +1993,19 @@ BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* botCaster, Mob *tar) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(((botSpellList[i].type & SpellType_Debuff) || IsResistDebuffSpell(botSpellList[i].spellid))
|
||||
&& ((needsMagicResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistMagic)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll))
|
||||
if(((botSpellList[i].type & SpellType_Debuff) || IsResistDebuffSpell(botSpellList[i].spellid))
|
||||
&& ((needsMagicResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistMagic)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll))
|
||||
|| (needsColdResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistCold)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll))
|
||||
|| (needsFireResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistFire)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll))
|
||||
|| (needsPoisonResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistPoison)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll))
|
||||
|| (needsDiseaseResistDebuff && (IsEffectInSpell(botSpellList[i].spellid, SE_ResistDisease)) || IsEffectInSpell(botSpellList[i].spellid, SE_ResistAll)))
|
||||
&& (!tar->IsImmuneToSpell(botSpellList[i].spellid, botCaster)
|
||||
&& tar->CanBuffStack(botSpellList[i].spellid, botCaster->GetLevel(), true) >= 0)
|
||||
&& (!tar->IsImmuneToSpell(botSpellList[i].spellid, botCaster)
|
||||
&& tar->CanBuffStack(botSpellList[i].spellid, botCaster->GetLevel(), true) >= 0)
|
||||
&& CheckSpellRecastTimers(botCaster, i)) {
|
||||
result.SpellId = botSpellList[i].spellid;
|
||||
result.SpellIndex = i;
|
||||
result.ManaCost = botSpellList[i].manacost;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2017,14 +2017,14 @@ BotSpell Bot::GetBestBotSpellForResistDebuff(Bot* botCaster, Mob *tar) {
|
||||
BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
|
||||
BotSpell result;
|
||||
bool spellSelected = false;
|
||||
|
||||
|
||||
result.SpellId = 0;
|
||||
result.SpellIndex = 0;
|
||||
result.ManaCost = 0;
|
||||
|
||||
|
||||
if(!tar)
|
||||
return result;
|
||||
|
||||
|
||||
int countNeedsCured = 0;
|
||||
bool isPoisoned = tar->FindType(SE_PoisonCounter);
|
||||
bool isDiseased = tar->FindType(SE_DiseaseCounter);
|
||||
@@ -2033,7 +2033,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
|
||||
|
||||
if(botCaster && botCaster->AI_HasSpells()) {
|
||||
std::list<BotSpell> cureList = GetBotSpellsBySpellType(botCaster, SpellType_Cure);
|
||||
|
||||
|
||||
if(tar->HasGroup()) {
|
||||
Group *g = tar->GetGroup();
|
||||
|
||||
@@ -2046,12 +2046,12 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Check for group cure first
|
||||
if(countNeedsCured > 2) {
|
||||
for(list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
|
||||
BotSpell selectedBotSpell = *itr;
|
||||
|
||||
|
||||
if(IsGroupSpell(itr->SpellId) && CheckSpellRecastTimers(botCaster, itr->SpellIndex)) {
|
||||
if(selectedBotSpell.SpellId == 0)
|
||||
continue;
|
||||
@@ -2088,7 +2088,7 @@ BotSpell Bot::GetBestBotSpellForCure(Bot* botCaster, Mob *tar) {
|
||||
if(!spellSelected) {
|
||||
for(list<BotSpell>::iterator itr = cureList.begin(); itr != cureList.end(); itr++) {
|
||||
BotSpell selectedBotSpell = *itr;
|
||||
|
||||
|
||||
if(CheckSpellRecastTimers(botCaster, itr->SpellIndex)) {
|
||||
if(selectedBotSpell.SpellId == 0)
|
||||
continue;
|
||||
@@ -2143,9 +2143,9 @@ int32 Bot::GetSpellRecastTimer(Bot *caster, int timer_index) {
|
||||
|
||||
bool Bot::CheckSpellRecastTimers(Bot *caster, int SpellIndex) {
|
||||
if(caster) {
|
||||
if(caster->AIspells[SpellIndex].time_cancast < Timer::GetCurrentTime()) { //checks spell recast
|
||||
if(GetSpellRecastTimer(caster, spells[caster->AIspells[SpellIndex].spellid].EndurTimerIndex) < Timer::GetCurrentTime()) { //checks for spells on the same timer
|
||||
return true; //can cast spell
|
||||
if(caster->AIspells[SpellIndex].time_cancast < Timer::GetCurrentTime()) { //checks spell recast
|
||||
if(GetSpellRecastTimer(caster, spells[caster->AIspells[SpellIndex].spellid].EndurTimerIndex) < Timer::GetCurrentTime()) { //checks for spells on the same timer
|
||||
return true; //can cast spell
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2181,8 +2181,8 @@ uint32 Bot::GetDisciplineRemainingTime(Bot *caster, int timer_index) {
|
||||
|
||||
bool Bot::CheckDisciplineRecastTimers(Bot *caster, int timer_index) {
|
||||
if(caster) {
|
||||
if(GetDisciplineRecastTimer(caster, timer_index) < Timer::GetCurrentTime()) { //checks for spells on the same timer
|
||||
return true; //can cast spell
|
||||
if(GetDisciplineRecastTimer(caster, timer_index) < Timer::GetCurrentTime()) { //checks for spells on the same timer
|
||||
return true; //can cast spell
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -2196,17 +2196,17 @@ void Bot::CalcChanceToCast() {
|
||||
_spellCastingChances[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BotStanceType botStance = GetBotStance();
|
||||
uint8 botClass = GetClass();
|
||||
bool isPrimaryHealer = false;
|
||||
bool isPrimarySlower = false;
|
||||
|
||||
|
||||
if(HasGroup()) {
|
||||
isPrimaryHealer = IsGroupPrimaryHealer();
|
||||
isPrimarySlower = IsGroupPrimarySlower();
|
||||
}
|
||||
|
||||
|
||||
//Nuke
|
||||
switch(botClass)
|
||||
{
|
||||
@@ -3188,7 +3188,7 @@ uint8 Bot::GetChanceToCastBySpellType(uint16 spellType) {
|
||||
|
||||
if(GetBotStance() >= MaxStances)
|
||||
return 0;
|
||||
|
||||
|
||||
switch (spellType) {
|
||||
case SpellType_Nuke: {
|
||||
index = SpellType_NukeIndex;
|
||||
@@ -3218,7 +3218,7 @@ uint8 Bot::GetChanceToCastBySpellType(uint16 spellType) {
|
||||
index = SpellType_LifetapIndex;
|
||||
break;
|
||||
}
|
||||
case SpellType_Snare: {
|
||||
case SpellType_Snare: {
|
||||
index = SpellType_SnareIndex;
|
||||
break;
|
||||
}
|
||||
@@ -3258,7 +3258,7 @@ uint8 Bot::GetChanceToCastBySpellType(uint16 spellType) {
|
||||
|
||||
if(index >= MaxSpellTypes)
|
||||
return 0;
|
||||
|
||||
|
||||
chance = _spellCastingChances[botStance][index];
|
||||
|
||||
return chance;
|
||||
|
||||
Reference in New Issue
Block a user