mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Rework of some existing spell AI code
This commit is contained in:
+27
-28
@@ -38,8 +38,10 @@ extern EntityList entity_list;
|
||||
|
||||
extern Zone *zone;
|
||||
|
||||
#ifdef _EQDEBUG
|
||||
#define MobAI_DEBUG_Spells -1
|
||||
#if EQDEBUG >= 12
|
||||
#define MobAI_DEBUG_Spells 25
|
||||
#elif EQDEBUG >= 9
|
||||
#define MobAI_DEBUG_Spells 10
|
||||
#else
|
||||
#define MobAI_DEBUG_Spells -1
|
||||
#endif
|
||||
@@ -97,12 +99,8 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
) {
|
||||
|
||||
#if MobAI_DEBUG_Spells >= 21
|
||||
std::cout << "Mob::AICastSpell: Casting: spellid=" << AIspells[i].spellid
|
||||
<< ", tar=" << tar->GetName()
|
||||
<< ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range *spells[AIspells[i].spellid].range
|
||||
<< ", mana_cost[" << mana_cost << "]<=" << GetMana()
|
||||
<< ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime()
|
||||
<< ", type=" << AIspells[i].type << std::endl;
|
||||
Log.Out(Logs::Detail, Logs::AI, "Mob::AICastSpell: Casting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u",
|
||||
AIspells[i].spellid, tar->GetName(), dist2, (spells[AIspells[i].spellid].range * spells[AIspells[i].spellid].range), mana_cost, GetMana(), AIspells[i].time_cancast, Timer::GetCurrentTime(), AIspells[i].type);
|
||||
#endif
|
||||
|
||||
switch (AIspells[i].type) {
|
||||
@@ -323,7 +321,8 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
}
|
||||
#if MobAI_DEBUG_Spells >= 21
|
||||
else {
|
||||
std::cout << "Mob::AICastSpell: NotCasting: spellid=" << AIspells[i].spellid << ", tar=" << tar->GetName() << ", dist2[" << dist2 << "]<=" << spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range << ", mana_cost[" << mana_cost << "]<=" << GetMana() << ", cancast[" << AIspells[i].time_cancast << "]<=" << Timer::GetCurrentTime() << std::endl;
|
||||
Log.Out(Logs::Detail, Logs::AI, "Mob::AICastSpell: NotCasting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u",
|
||||
AIspells[i].spellid, tar->GetName(), dist2, (spells[AIspells[i].spellid].range * spells[AIspells[i].spellid].range), mana_cost, GetMana(), AIspells[i].time_cancast, Timer::GetCurrentTime(), AIspells[i].type);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -333,7 +332,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) {
|
||||
|
||||
bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore) {
|
||||
#if MobAI_DEBUG_Spells >= 1
|
||||
std::cout << "Mob::AIDoSpellCast: spellid=" << AIspells[i].spellid << ", tar=" << tar->GetName() << ", mana=" << mana_cost << ", Name: " << spells[AIspells[i].spellid].name << std::endl;
|
||||
Log.Out(Logs::Detail, Logs::AI, "Mob::AIDoSpellCast: spellid = %u, tar = %s, mana = %i, Name: '%s'", AIspells[i].spellid, tar->GetName(), mana_cost, spells[AIspells[i].spellid].name);
|
||||
#endif
|
||||
casting_spell_AIindex = i;
|
||||
|
||||
@@ -2252,20 +2251,20 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
|
||||
DBnpcspells_Struct* parentlist = database.GetNPCSpells(spell_list->parent_list);
|
||||
uint32 i;
|
||||
#if MobAI_DEBUG_Spells >= 10
|
||||
std::cout << "Loading NPCSpells onto " << this->GetName() << ": dbspellsid=" << iDBSpellsID;
|
||||
std::string debug_msg = StringFormat("Loading NPCSpells onto %s: dbspellsid=%u", this->GetName(), iDBSpellsID);
|
||||
if (spell_list) {
|
||||
std::cout << " (found, " << spell_list->numentries << "), parentlist=" << spell_list->parent_list;
|
||||
debug_msg.append(StringFormat(" (found, %u), parentlist=%u", spell_list->numentries, spell_list->parent_list));
|
||||
if (spell_list->parent_list) {
|
||||
if (parentlist) {
|
||||
std::cout << " (found, " << parentlist->numentries << ")";
|
||||
}
|
||||
if (parentlist)
|
||||
debug_msg.append(StringFormat(" (found, %u)", parentlist->numentries));
|
||||
else
|
||||
std::cout << " (not found)";
|
||||
debug_msg.append(" (not found)");
|
||||
}
|
||||
}
|
||||
else
|
||||
std::cout << " (not found)";
|
||||
std::cout << std::endl;
|
||||
else {
|
||||
debug_msg.append(" (not found)");
|
||||
}
|
||||
Log.Out(Logs::Detail, Logs::AI, "%s", debug_msg.c_str());
|
||||
#endif
|
||||
uint16 attack_proc_spell = -1;
|
||||
int8 proc_chance = 3;
|
||||
@@ -2412,20 +2411,20 @@ bool NPC::AI_AddNPCSpellsEffects(uint32 iDBSpellsEffectsID) {
|
||||
|
||||
uint32 i;
|
||||
#if MobAI_DEBUG_Spells >= 10
|
||||
std::cout << "Loading NPCSpellsEffects onto " << this->GetName() << ": dbspellseffectsid=" << iDBSpellsEffectsID;
|
||||
std::string debug_msg = StringFormat("Loading NPCSpellsEffects onto %s: dbspellseffectid=%u", this->GetName(), iDBSpellsEffectsID);
|
||||
if (spell_effects_list) {
|
||||
std::cout << " (found, " << spell_effects_list->numentries << "), parentlist=" << spell_effects)list->parent_list;
|
||||
debug_msg.append(StringFormat(" (found, %u), parentlist=%u", spell_effects_list->numentries, spell_effects_list->parent_list));
|
||||
if (spell_effects_list->parent_list) {
|
||||
if (parentlist) {
|
||||
std::cout << " (found, " << parentlist->numentries << ")";
|
||||
}
|
||||
if (parentlist)
|
||||
debug_msg.append(StringFormat(" (found, %u)", parentlist->numentries));
|
||||
else
|
||||
std::cout << " (not found)";
|
||||
debug_msg.append(" (not found)");
|
||||
}
|
||||
}
|
||||
else
|
||||
std::cout << " (not found)";
|
||||
std::cout << std::endl;
|
||||
else {
|
||||
debug_msg.append(" (not found)");
|
||||
}
|
||||
Log.Out(Logs::Detail, Logs::AI, "%s", debug_msg.c_str());
|
||||
#endif
|
||||
|
||||
if (parentlist) {
|
||||
|
||||
Reference in New Issue
Block a user