View Single Post
  #5  
Old 07-09-2006, 07:21 PM
unicorn97211
Sarnak
 
Join Date: May 2006
Posts: 37
Default

Made the changes you recommended, I think

Here's the diff

Code:
--- E:\EQEmu815\zone\mob.h	Mon Jul 10 00:55:03 2006
+++ C:\EQEmuSP\Source\0.7.0\zone\mob.h	Mon Jul 10 00:54:58 2006
@@ -945,8 +945,10 @@
 	AISpells_Struct	AIspells[MAX_AISPELLS]; // expected to be pre-sorted, best at low index
 	HateList hate_list;
 	std::set<int32> feign_memory_list;
-	
-	
+	// EverHood - This is to keep track of mobs we cast faction mod spells on
+	std::map<uint32,sint32> faction_bonuses; // Primary FactionID, Bonus
+	void	AddFactionBonus(uint32 pFactionID,sint32 bonus);
+	sint32	GetFactionBonus(uint32 pFactionID);
 #ifdef ENABLE_FEAR_PATHING
 	void CalculateFearPosition();
 	bool FearTryStraight(Mob *caster, int32 duration, bool flee, VERTEX &hit, VERTEX &fv);
--- E:\EQEmu815\zone\spdat.h	Tue Jul 04 09:33:18 2006
+++ C:\EQEmuSP\Source\0.7.0\zone\spdat.h	Sun Jul 09 23:24:17 2006
@@ -41,6 +41,12 @@
 
 #define EFFECT_COUNT 12
 
+enum SpellAffectIndex {
+	SAI_Calm			= 12, // Lull and Alliance Spells
+	SAI_Dispell			= 14,
+	SAI_Memory_Blur		= 27,
+	SAI_Calm_Song		= 43  // Lull and Alliance Songs
+};
 enum RESISTTYPE
 {
 	RESIST_NONE = 0,
--- E:\EQEmu815\zone\spell_effects.cpp	Tue Jul 04 09:33:18 2006
+++ C:\EQEmuSP\Source\0.7.0\zone\spell_effects.cpp	Sun Jul 09 23:57:17 2006
@@ -375,9 +375,10 @@
 #ifdef SPELL_EFFECT_SPAM
 				snprintf(effect_desc, _EDLEN, "Faction Mod: %+i", effect_value);
 #endif
-				// solar: TODO implement this
-				const char *msg = "Faction Mod is not implemented.";
-				if(caster) caster->Message(13, msg);
+				// EverHood 
+				if(caster && GetPrimaryFaction()>0) {
+					caster->AddFactionBonus(GetPrimaryFaction(),spell.base[0]);
+				}
 				break;
 			}
 
--- E:\EQEmu815\zone\faction.cpp	Fri May 12 19:35:58 2006
+++ C:\EQEmuSP\Source\0.7.0\zone\faction.cpp	Mon Jul 10 00:38:49 2006
@@ -264,6 +264,32 @@
 	return(CheckNPCFactionAlly(other_faction) == FACTION_ALLY);
 }
 
+// EverHood - Faction Mods for Alliance type spells
+void Mob::AddFactionBonus(uint32 pFactionID,sint32 bonus) {
+    map <uint32, sint32> :: const_iterator faction_bonus;
+	typedef std::pair <uint32, sint32> NewFactionBonus;
+
+	faction_bonus = faction_bonuses.find(pFactionID);
+	if(faction_bonus == faction_bonuses.end()){
+		faction_bonuses.insert(NewFactionBonus(pFactionID,bonus));
+	}else{
+		if(faction_bonus->second<bonus){
+			faction_bonuses.erase(pFactionID);
+			faction_bonuses.insert(NewFactionBonus(pFactionID,bonus));
+		}
+	}
+}
+
+sint32 Mob::GetFactionBonus(uint32 pFactionID) {
+    map <uint32, sint32> :: const_iterator faction_bonus;
+	faction_bonus = faction_bonuses.find(pFactionID);
+	if(faction_bonus != faction_bonuses.end()){
+			return (*faction_bonus).second;
+	}
+	return 0;
+}
+
+
 FACTION_VALUE Mob::GetSpecialFactionCon(Mob* iOther) {
 #if FACTIONS_DEBUG >= 5
 	LogFile->write(EQEMuLog::Debug, "called $s::GetSpecialFactionCon(%s)", GetName(), iOther->GetName());
@@ -431,6 +457,8 @@
 		{
 			//Get the players current faction with pFaction
 			tmpFactionValue = GetCharacterFactionLevel(pFaction);
+			// Everhood - tack on any bonuses from Alliance type spell effects
+			tmpFactionValue += GetFactionBonus(pFaction);
 			//Return the faction to the client
 			fac = CalculateFaction(&fmods, tmpFactionValue);
 			//Message(0,"Faction: %i %i %i %i",fmods.base,fmods.class_mod,fmods.race_mod,fmods.deity_mod);
--- E:\EQEmu815\zone\spdat.cpp	Sat Feb 26 14:39:14 2005
+++ C:\EQEmuSP\Source\0.7.0\zone\spdat.cpp	Sun Jul 09 23:24:18 2006
@@ -208,6 +208,16 @@
 
 bool IsBeneficialSpell(int16 spell_id)
 {
+	// EverHood - These spells are actually detrimental
+	if(spells[spell_id].goodEffect == 1){
+		SpellTargetType tt = spells[spell_id].targettype;
+		if(tt == ST_Target || tt == ST_AETarget || tt == ST_Animal || tt == ST_Undead)
+			if(spells[spell_id].resisttype == RESIST_MAGIC){
+				int16 sai = spells[spell_id].SpellAffectIndex;
+				if(sai == SAI_Calm || sai == SAI_Dispell || sai == SAI_Memory_Blur || sai == SAI_Calm_Song)
+					return false;
+			}
+	}
 	return spells[spell_id].goodEffect != 0 || IsGroupSpell(spell_id);
 }
Reply With Quote