Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 06-25-2006, 05:56 PM
unicorn97211
Sarnak
 
Join Date: May 2006
Posts: 37
Default Diffs (Cont)

Code:
--- C:\Code\EQEmu800\zone\npc.cpp	Wed May 31 21:13:32 2006
+++ C:\EQEmuSP\Source\0.7.0\zone\npc.cpp	Sun Jun 25 01:29:00 2006
@@ -233,8 +233,6 @@
 	pet_spell_id = 0;
 	
 	delaytimer = false;
-    feign_memory = "0";
-	forgetchance = 0;
 	attack_event = false;
 	attack_speed = d->attack_speed;
 
@@ -481,30 +479,19 @@
     if (IsStunned()||IsMezzed())
 	    return true;
 
-	//Feign Death Memory
-	if (forget_timer.Check() && strstr(GetFeignMemory(),"0") == NULL) {
-		Client* remember_client = entity_list.GetClientByName(GetFeignMemory());
-		if (remember_client != 0)
+	// EverHood - 6/14/06
+	// Improved Feign Death Memory
+	if (forget_timer.Check() && !feign_memory_list.empty()) {
+		std::list<int32>::iterator RememberedCharID;
+		for (RememberedCharID=feign_memory_list.begin(); RememberedCharID != feign_memory_list.end(); RememberedCharID++)
+		{
+			Client* remember_client = entity_list.GetClientByCharID(*RememberedCharID);
+			if (!remember_client->GetFeigned())
 		{
-			if (!remember_client->CastToClient()->GetFeigned())
-			{
-				AddToHateList(remember_client,1);
-				SetFeignMemory("0");
-				forgetchance = 0;
-			}
-			else if (rand()%100 <= forgetchance)
-			{
-				SetFeignMemory("0");
-				forgetchance = 0;
-			}
-			else
-			{
-				forgetchance += 1;
-			}
+				AddToHateList(remember_client->CastToMob(),1);
+				feign_memory_list.remove(*RememberedCharID);
+				break;
 		}
-		else
-		{
-			SetFeignMemory("0");
 		}
 	}
 	
@@ -519,6 +506,22 @@
     return true;
 }
 
+	// EverHood 6/14/06 - FD memory 
+	void   NPC::AddFeignMemory(Client* attacker) {
+		feign_memory_list.push_back(attacker->CharacterID());
+	}
+	void   NPC::RemoveFromFeignMemory(Client* attacker){
+		if(!feign_memory_list.empty()){
+			int32 attacker_charid = attacker->CharacterID();
+			feign_memory_list.remove(attacker_charid);
+		}
+	}
+	void   NPC::ClearFeignMemory(){
+		if(!feign_memory_list.empty()){
+			feign_memory_list.clear();
+		}
+	}
+
 int32 NPC::CountLoot() {
 	return(itemlist.size());
 }
--- C:\Code\EQEmu800\zone\npc.h	Sun Mar 19 20:04:48 2006
+++ C:\EQEmuSP\Source\0.7.0\zone\npc.h	Sun Jun 25 01:29:00 2006
@@ -161,9 +161,11 @@
     bool    IsOnHatelist(Mob*p) { return hate_list.IsOnHateList(p);}
 
 	void	SetNPCFactionID(sint32 in) { npc_faction_id = in; database.GetFactionIdsForNPC(npc_faction_id, &faction_list, &primary_faction); }
-	void	SetFeignMemory(const char* num) {feign_memory = num;}
-
-	inline const char*    GetFeignMemory()	{ return feign_memory; }
+	// EverHood 6/14/06
+	// Mobs need to be able to remember more than one feigned attacker
+	void	AddFeignMemory(Client* attacker);
+	void	RemoveFromFeignMemory(Client* attacker);
+	void	ClearFeignMemory();
 
 	float   org_x, org_y, org_z, org_heading;
 	
@@ -251,8 +253,8 @@
 	
 	int16	max_dmg;
 	int16	min_dmg;
-	const char*	feign_memory;
-	int8    forgetchance;
+	// EverHood 6/14/06
+	std::list<int32> feign_memory_list;
 	
 	//pet crap:
 	int16	pet_spell_id;
Reply With Quote
  #2  
Old 06-28-2006, 01:31 PM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

ok,

Looks good. I got this in, untested, so grab the next build with it mentioned in the changelog and test it for me.

I made a few changes.
- I fixed an iterator delete bug, you cannot remove an element from any STL container and expect the iterator which pointed to that element to stay valid. Each container has its own erase-while-iterating rules and trick.
- I also changed it from a list to a set, just to ensure uniqueness.
- I moved everything up into Mob so in theory charmed players would exhibit the same behavior. (plus it made the next comment easier)
- Its bad form to name two timers the same thing when they have different purposes, it confused me for a while. Your NPC forget check timer was also somewhat unnescesary (as well as being in a bad spot, that code gets called very rapidly, and your slower timer should be burried inside other shorter timers so it dosent get checked so often.) Because of this, I just eliminated it, and moved the "look for people who got up" code into the AI scan area timer (where we look for people to aggro, which had the same duration).
Reply With Quote
  #3  
Old 06-28-2006, 04:28 PM
unicorn97211
Sarnak
 
Join Date: May 2006
Posts: 37
Default

Great! I look forward to seeing how you implemented the above mentioned changes. The more I learn about the structure and where things should go and what the best objects to use in which situations, the more effective I can fix and or add features. For the immediate future I plan to focus on fixes to the necro class since it's a class I know thoroughly. I hope that more people with class specific knowledge can do the same to free the core devs up for the important things like getting AA's working in 7.0
Reply With Quote
  #4  
Old 06-30-2006, 08:40 AM
unicorn97211
Sarnak
 
Join Date: May 2006
Posts: 37
Default

I grabbed v.812 and did some testing. I found that I am not being remembered. I popped in a debug to tell me when I was being added to the feign memory list and that seems to be working fine. However when I stand up the mob does not remember me and add me to his hate list. It looks as though the memory check isn't being executed. It also looks to me as if the memory check won't occur if the mob is engaged. I'm thinking the mob should remember you even if it's fighting with someone else and you get up.

i.e. If I pull a mob to my group and feign. While the group is fighting the mob , I stand up. My groupies wipe. I should have been remembered when I stood up while the mob was engaged so that when my groupies wipe I am on the hate list even though I may be out of aggro range.

I'm not sure about this as I haven't had time to think through all the possible situations.

FNW: do you want me to try and debug whats going wrong with the memory check the way you implemented it or do you have time to debug it?

Last edited by unicorn97211; 06-30-2006 at 04:43 PM..
Reply With Quote
  #5  
Old 06-30-2006, 04:51 PM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

what you describe is ultimately what should happen, as soon as the mob is no longer engaged (500ms later prolly), it will look for people to remember, but not until it is no longer engaged (no point in checking while engaged since we come back with only 1 hate).

feel free to debug it.
Reply With Quote
  #6  
Old 07-01-2006, 02:31 PM
unicorn97211
Sarnak
 
Join Date: May 2006
Posts: 37
Default

Just got back into town, that makes sense. I'll toss in some debug messages and such and see if I can track down why they aren't remembering me when I get up even though I've been added to feign memory.
Reply With Quote
  #7  
Old 07-01-2006, 08:53 PM
unicorn97211
Sarnak
 
Join Date: May 2006
Posts: 37
Default Found the culprit...

This is causing fd memory to never be checked.

Code:
#ifdef REVERSE_AGGRO
	if(IsNPC() && !CastToNPC()->WillAggroNPCs())
		AIscanarea_timer->Disable();
#endif
FNW: Where do you recommend moving the feign memory check to?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:23 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3