View Single Post
  #1  
Old 07-07-2011, 08:01 AM
Criimson
Hill Giant
 
Join Date: Sep 2006
Posts: 172
Default Enchanter mez code

SO looking through some of the code I found an agro check and thought I'd start there.

But my C++ knowledge hasn't quite gotten to pointers. Ive only taken early classes at this point and am hoping somone can help.

Code:
//Criimson:  Testing AI mez code
					//Say("BotOwner = %s.", GetBotOwner());
					//Say("Target = %s.", GetTarget());
					//int testMez = (entity_list.GetHatedCount(GetBotOwner(), GetTarget()));
					//Say("The number of mobs I could mez is %s.", testMez);
This is the code I was working with. A simple check during the enchanter spell ai to see if the chanter can even see how many mobs the MT has agroing him.

Here is the actual code I am calling:

Code:
int EntityList::GetHatedCount(Mob *attacker, Mob *exclude) {

	// Return a list of how many non-feared, non-mezzed, non-green mobs, within aggro range, hate *attacker

	if(!attacker) return 0;

	int Count = 0;

	LinkedListIterator<NPC*> iterator(npc_list);

	for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) {

		NPC* mob = iterator.GetData();

		if(!mob || (mob == exclude)) continue;
		
		if(!mob->IsEngaged()) continue;

		if(mob->IsFeared() || mob->IsMezzed()) continue;

		if(attacker->GetLevelCon(mob->GetLevel()) == CON_GREEN) continue;

		if(!mob->CheckAggro(attacker)) continue;

		float AggroRange = mob->GetAggroRange();

		// Square it because we will be using DistNoRoot
			
		AggroRange = AggroRange * AggroRange;

		if(mob->DistNoRoot(*attacker) > AggroRange) continue;

		Count++;

	}

	return Count;

}
I was hoping this code could be modified a bit to allow the enchanter bot to mez the adds.

I'm guessing I'm missing something simple

Criimson
Reply With Quote