View Single Post
  #2  
Old 11-18-2008, 12:21 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

After checking into it a bit, it looks like it may be easier than I thought. I am pretty sure that I have the new special attack setting added properly to npc.cpp and mob.h, but I am still not exactly sure on where to put the part for attack.cpp or even if it is correct.

The code in red is the code that would be getting added to the existing code:

attack.cpp - Not sure if this is right yet, or exactly where to put it
Code:
if(skillinuse == ARCHERY || skillinuse == THROWING) {
	if(against->SpecAttacks[IMMUNE_RANGED]) {
		return 0;
	}
}
mob.h
Code:
enum {
	SPECATK_NONE = 0,
	SPECATK_SUMMON,		//S
	SPECATK_ENRAGE,		//E
	SPECATK_RAMPAGE,	//R
	SPECATK_FLURRY,		//F
	SPECATK_TRIPLE,		//T
	SPECATK_QUAD,		//Q
	UNSLOWABLE,			//U
	UNMEZABLE,			//M
	UNCHARMABLE,		//C
	UNSTUNABLE,			//N
	UNSNAREABLE,		//I
	UNFEARABLE,			//D
	IMMUNE_MELEE,		//A
	IMMUNE_MAGIC,		//B
	IMMUNE_FLEEING,		//f
	IMMUNE_MELEE_EXCEPT_BANE,	//O
	IMMUNE_MELEE_NONMAGICAL,	//W
	IMMUNE_AGGRO, //H, wont aggro, ever.
	IMMUNE_RANGED, //P - Projectile
	SPECATK_MAXNUM
				//X,Y,Z are old interactive NPC codes
};

npc.cpp - Slightly modified the format, since it was kinda sloppy and hard to read
Code:
void Mob::NPCSpecialAttacks(const char* parse, int permtag) {
    for(int i = 0; i < SPECATK_MAXNUM; i++)
	{
	    SpecAttacks[i] = false;
        SpecAttackTimers[i] = NULL;
    }
	
	const char* orig_parse = parse;
    while (*parse)
    {
        switch(*parse)
        {
		case 'E':
			SpecAttacks[SPECATK_ENRAGE] = true;
			break;
		case 'F':
			SpecAttacks[SPECATK_FLURRY] = true;
			break;
		case 'R':
			SpecAttacks[SPECATK_RAMPAGE] = true;
			break;
		case 'S':
			SpecAttacks[SPECATK_SUMMON] = true;
			SpecAttackTimers[SPECATK_SUMMON] = new Timer(6000);
			SpecAttackTimers[SPECATK_SUMMON]->Start();
			break;
		case 'T':
			SpecAttacks[SPECATK_TRIPLE] = true;
			break;
		case 'Q':
			//quad requires triple to work properly
			SpecAttacks[SPECATK_TRIPLE] = true;
			SpecAttacks[SPECATK_QUAD] = true;
			break;
		case 'U':
			SpecAttacks[UNSLOWABLE] = true;
			break;
		case 'M':
			SpecAttacks[UNMEZABLE] = true;
			break;
		case 'C':
			SpecAttacks[UNCHARMABLE] = true;
			break;
		case 'N':
			SpecAttacks[UNSTUNABLE] = true;
			break;
		case 'I':
			SpecAttacks[UNSNAREABLE] = true;
			break;
		case 'D':
			SpecAttacks[UNFEARABLE] = true;
			break;
		case 'A':
			SpecAttacks[IMMUNE_MELEE] = true;
			break;
		case 'B':
			SpecAttacks[IMMUNE_MAGIC] = true;
			break;
		case 'f':
			SpecAttacks[IMMUNE_FLEEING] = true;
			break;
		case 'O':
			SpecAttacks[IMMUNE_MELEE_EXCEPT_BANE] = true;
			break;
		case 'W':
			SpecAttacks[IMMUNE_MELEE_NONMAGICAL] = true;
			break;
		case 'H':
			SpecAttacks[IMMUNE_AGGRO] = true;
			break;
		case 'P':
			SpecAttacks[IMMUNE_RANGED] = true;
			break;
		default:
			break;
        }
        parse++;
    }
	
	if(permtag == 1 && this->GetNPCTypeID() > 0){
		if(database.SetSpecialAttkFlag(this->GetNPCTypeID(), orig_parse)) {
			LogFile->write(EQEMuLog::Normal, "NPCTypeID: %i flagged to '%s' for Special Attacks.\n",this->GetNPCTypeID(),orig_parse);
		}
	}
}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote