int HatFun(list<HatVal> &hat1,list<HatVal> &hat2,char *perHerId,char *goodsOwner,\
		   char *monId,bool isCopy)
{
    int flag,flgGogs;   
    Hero* hero;
    flag = -1;         //返回值	
    flgGogs = -1;     //物品归属标记值
    bool delPet;
    list<HatVal>::iterator hat1_it;   //hat1迭代器,新
    list<HatVal>::iterator hat2_it;   //hat2迭代器,旧
    hero = NULL;
    delPet = false;

    /*如果目标为空*/
    if(perHerId == NULL)
    {
        flag = 0;
    }

    /*如果物品有归属*/
    if(strlen(goodsOwner) == 0)
    {
        flgGogs = 0;
    }	

    /*遍历取交集*/
    for(hat2_it = hat2.begin();hat2_it != hat2.end();hat2_it++)
    {
        for(hat1_it = hat1.begin();hat1_it != hat1.end();hat1_it++)
        {
            // cout<<"newEnmistyId:"<<(*hat1_it).id<<endl;
            /*如果目标不为空,且目标还在新的仇恨范围内*/
            if(flag != 0 && strcmp((*hat1_it).id,perHerId) == 0)
            {
                flag = 1;               
            }
            /*如果此玩家原来在仇恨列表里,且现在又产生新的仇恨值了*/
            if(strcmp((*hat1_it).id,(*hat2_it).id) == 0)
            {
                delPet = true;
                /*取大者(注意:是经过叠加后的)*/
                if((*hat2_it).value > (*hat1_it).value)
                {
                    (*hat1_it).value = (*hat2_it).value;                    
                }
            }
            /*如果物品有归属*/
            if(flgGogs == -1)
            {
                /*如果此物品原来的归属还在仇恨范围内*/
                if(strcmp(goodsOwner,(*hat1_it).id) == 0)
                {
                    flgGogs = 1;
                }
            }
        }
		if(!delPet && isCopy)
        {
			hat1.insert(hat1.begin(),*hat2_it);
        }
        else if(!delPet)
        {
            hero = heroid_to_hero((*hat2_it).id);
            if(hero != NULL)
            {
                hero->deleteAttList(monId);
            }
        }

        delPet = false;         
    }
    /*对仇恨列表对仇恨值进行从大到小的排序*/
    hat1.sort(ComFun);

    /*如果此物品原来的归属不在仇恨范围内*/
    if(flgGogs != 1)
    {
		memset(goodsOwner,'\0',IDL + 1);
    }

    return flag;
}
/* 过滤仇恨列表中的角色*/
void MonsterAttRed::PasSchRge(void) 
{
    list<HatVal>::iterator hatVal_it;
	map<string,Hero*>::iterator hero_it;
	Point heroPt;
	Hero *hero;
	bool flgGods;
	flgGods = true;

	
	for(hatVal_it = enmityValues.begin(); hatVal_it != enmityValues.end();)
	{
		hero_it = heroId_to_pHero.find((*hatVal_it).id);
		
		/*下线死亡就从仇恨列表清除*/
		if(hero_it == heroId_to_pHero.end())
        {
			if(flgGods)
			{
				if(strlen(goodsOwner) > 0 && strcmp(goodsOwner,(*hatVal_it).id) == 0)
				{
					flgGods = false;
				}
			}
			if(perHerId != NULL && strlen(perHerId) != 0 && strcmp(perHerId,(*hatVal_it).id) == 0)
			{
				memset(perHerId,'\0',SHOR_MID_VALUE_LENGTH + 1);
			}
			
			hatVal_it = enmityValues.erase(hatVal_it);
            continue;
        }
		/*死亡就从仇恨列表清除*/
		if(hero_it->second->getLifeStation() == DEAD || !hero_it->second->getWalkingFlg())
		{
			if(flgGods)
			{
				if(strlen(goodsOwner) > 0 && strcmp(goodsOwner,(*hatVal_it).id) == 0)
				{
					flgGods = false;
				}
			}
			if(perHerId != NULL && strlen(perHerId) != 0 && strcmp(perHerId,(*hatVal_it).id) == 0)
			{
				memset(perHerId,'\0',SHOR_MID_VALUE_LENGTH + 1);
			}
			hatVal_it = enmityValues.erase(hatVal_it);
			continue;
		}
		/*为了减少误差,用像素判断*/
        heroPt = hero_it->second->getLocation();   

        /*判断是否在仇恨范围内*/		
		/*现在是以出生点为圆心,仇恨范围不动的格式做的*/
		
     
        if(sqrt(pow(fabs(heroPt._x - pt._x),2)+pow(fabs(heroPt._y - pt._y),2)) > hatRge) //by benliao,not follow hero in all the copy map.
        {
			hero = getHero(((*hatVal_it).id));
			if(hero != NULL)
			{				
				hero->deleteAttList(identity);
			}
			if(flgGods)
			{
				if(strlen(goodsOwner) > 0 && strcmp(goodsOwner,(*hatVal_it).id) == 0)
				{
					flgGods = false;
				}
			}
			
			if(perHerId != NULL && strcmp(perHerId,(*hatVal_it).id) == 0)
			{
				memset(perHerId,'\0',SHOR_MID_VALUE_LENGTH + 1);
			}
			
            hatVal_it = enmityValues.erase(hatVal_it);
            continue;                       
        }
		hatVal_it++;
	}
}