PDA

View Full Version : Harmony/Lull temporary fix


inkubus
08-14-2007, 09:43 AM
Hi all

Not sure if i've implemented this in the best way but I am sure someone can point out any issues.


spdat.h changes:
Line 476 add:
bool IsHarmonySpell(int16 spell_id);

spdat.cpp changes:
Line 202
add:
bool IsHarmonySpell(int16 spell_id)
{
int i;
const SPDat_Spell_Struct &sp = spells[spell_id];

for(i = 0; i < EFFECT_COUNT; i++)
{
if(sp.effectid[i] == SE_Lull || sp.effectid[i] == SE_Harmony)
return true;
}
return false;
}

spells.cpp line 2250
(above if(!(IsClient() && CastToClient()->GetGM())) // GMs can cast on anything)
add:
if (!IsHarmonySpell(spell_id))
{

and closing brace below

attack.cpp line 1573 add:
// If the hate's 0 then why bother?
if (hate == 0)
return;


Not sure why hate == 0 wasn't being checked. Is there a reason for this? Please someone proof read!

Thanks

Bolly

inkubus
08-14-2007, 09:52 AM
Eek some changes as i had the line numebrs wrong



spdat.h changes:
Line 476 add:
bool IsHarmonySpell(int16 spell_id);

spdat.cpp changes:
Line 202
add:
bool IsHarmonySpell(int16 spell_id)
{
int i;
const SPDat_Spell_Struct &sp = spells[spell_id];

for(i = 0; i < EFFECT_COUNT; i++)
{
if(sp.effectid[i] == SE_Lull || sp.effectid[i] == SE_Harmony)
return true;
}
return false;
}

spells.cpp line 2250
(above if(!(IsClient() && CastToClient()->GetGM())) // GMs can cast on anything)
add:
if (!IsHarmonySpell(spell_id))
{

and closing brace below

attack.cpp line 1577
(In Mob::AddToHateList() below assert(other != NULL);)
add:
// If the hate's 0 then why bother?
if (hate == 0)
return;

inkubus
08-14-2007, 10:38 AM
Ok for some reason, this sometimes still generates 1 hate on lull line spells. Still looking into this. Fix works fine for harmony though.

Thanks

Bolly

inkubus
08-14-2007, 10:51 AM
Found it,

in aggro.cpp
(below: int16 spell_id = spellid;)
line 989 replace:

int16 AggroAmount = 1;

with:

int16 AggroAmount = 1;
if (IsHarmonySpell(spellid))
{
AggroAmount = 0;
}

gernblan
08-14-2007, 10:54 AM
This is based off of 1030 build?

Thanks for your efforts! This will help many classes, especially chanters, if it gets checked in.

inkubus
08-14-2007, 05:22 PM
Tested on 1026 and 1030 build.

Thanks

Bolly

inkubus
08-14-2007, 05:41 PM
Looks like this has a side effect on npc->npc aggro. Looking into this.

inkubus
08-14-2007, 06:00 PM
Ok found the problem, looks like hate of 0 is needed so drop the change to aggro.cpp and instead add this to spells.cpp ~ 2292:

Replace:

if(spelltar->IsAIControlled())
{
spelltar->AddToHateList(this, 1);
}

With:
if(spelltar->IsAIControlled())
{
if (!IsHarmonySpell(spell_id))
{
spelltar->AddToHateList(this, 1);
}
}

KLS
08-14-2007, 06:04 PM
AddToHateList should be able to accept 0 hate as an argument without us ignoring it. Sometimes we want to be added to something's hate list without actually generating any hate. This is how proximity aggro works.

Probably want to look for where we're calling AddToHateList for lull spells and catch it before it gets there.

Bah apparently you followed up while I was writing this... ingenious!

inkubus
08-14-2007, 06:14 PM
And then of course further down in spells.cpp at the AddToHateList() ~ 2365

Replace:

if (spelltar->IsAIControlled() && IsDetrimentalSpell(spell_id)
) {
int16 aggro_amount = CheckAggroAmount(spell_id);//*spelltar->CastToNPC()->AggroModifier();
mlog(SPELLS__CASTING, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount);
spelltar->AddToHateList(this, aggro_amount);
}


with:

if (spelltar->IsAIControlled() && IsDetrimentalSpell(spell_id)
) {
int16 aggro_amount = CheckAggroAmount(spell_id);//*spelltar->CastToNPC()->AggroModifier();
mlog(SPELLS__CASTING, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount);
if (!IsHarmonySpell(spell_id))
{
spelltar->AddToHateList(this, aggro_amount);
}
}

inkubus
08-14-2007, 06:16 PM
Thanks KLS, just done that now. Appears to be working but will continue further testing!

inkubus
08-14-2007, 06:23 PM
Ok this now works appart from one issue where if it is resisted it won't generate aggro. I will work on this and then post a final diff file.

drakelord
08-14-2007, 07:39 PM
Awesome, thanks much. I'd like to see this as part of the main code.

inkubus
08-15-2007, 03:11 AM
Ok i've fixed that bug (caused by me! 3am coding for you :-))

How do i go about making a diff file? Would I need cvs/svn access?

inkubus
08-15-2007, 04:20 AM
I think i did this right!

Patch:


--- aggro-orig.cpp 2007-08-15 16:58:09.114683370 +0100
+++ aggro.cpp 2007-08-15 17:01:02.979532414 +0100
@@ -987,6 +987,9 @@
int16 Mob::CheckAggroAmount(int16 spellid) {
int16 spell_id = spellid;
int16 AggroAmount = 1;
+ if (IsHarmonySpell(spellid)) {
+ AggroAmount = 0;
+ }
int16 slevel = GetLevel();

for (int o = 0; o < EFFECT_COUNT; o++) {
--- spdat-orig.cpp 2007-08-15 15:34:23.203261821 +0100
+++ spdat.cpp 2007-08-14 22:49:32.057599869 +0100
@@ -199,6 +199,19 @@
return false;
}

+bool IsHarmonySpell(int16 spell_id)
+{
+int i;
+const SPDat_Spell_Struct &sp = spells[spell_id];
+
+for(i = 0; i < EFFECT_COUNT; i++)
+{
+if(sp.effectid[i] == SE_Lull || sp.effectid[i] == SE_Harmony)
+return true;
+}
+return false;
+}
+
bool IsPercentalHealSpell(int16 spell_id)
{
return IsEffectInSpell(spell_id, SE_PercentalHeal);
-- spdat-orig.h 2007-08-15 15:34:34.736113852 +0100
+++ spdat.h 2007-08-15 16:30:38.800733373 +0100
@@ -473,6 +473,7 @@
bool IsStunSpell(int16 spell_id);
bool IsSlowSpell(int16 spell_id);
bool IsHasteSpell(int16 spell_id);
+bool IsHarmonySpell(int16 spell_id);
bool IsPercentalHealSpell(int16 spell_id);
bool IsGroupOnlySpell(int16 spell_id);
bool IsBeneficialSpell(int16 spell_id);
--- spells-orig.cpp 2007-08-15 15:34:49.029169807 +0100
+++ spells.cpp 2007-08-15 16:55:43.259905133 +0100
@@ -2217,6 +2217,8 @@
return(false);
}

+if (!IsHarmonySpell(spell_id))
+{
if(!(IsClient() && CastToClient()->GetGM())) // GMs can cast on anything
{
// Beneficial spells check
@@ -2254,6 +2256,8 @@
}
}

+}
+
// solar: ok at this point the spell is permitted to affect the target,
// but we need to check special cases and resists

@@ -2351,8 +2355,11 @@
) {
int16 aggro_amount = CheckAggroAmount(spell_id);//*spelltar->CastToNPC()->AggroModifier();
mlog(SPELLS__CASTING, "Spell %d cast on %s generated %d hate", spell_id, spelltar->GetName(), aggro_amount);
+ if (!IsHarmonySpell(spell_id))
+ {
spelltar->AddToHateList(this, aggro_amount);
}
+ }
else if (IsBeneficialSpell(spell_id))
entity_list.AddHealAggro(spelltar, this, CheckHealAggroAmount(spell_id));

gernblan
08-15-2007, 08:34 AM
I hope this is solid and gets checked in!

Thanks for all the hard work!

cavedude
08-15-2007, 11:32 AM
I have it up on PEQ and no major problems so far. The only issue it seems is the AE part of the spell isn't working. It's single target only, even though the spell effect is supposed to be AE. This is using the level 5 harmony spell Druids get.

Everything else is perfect so far, thanks :)

inkubus
08-16-2007, 05:11 PM
Oh jeez yeah i forgot to check that. I'll have a look now.

Cheers

Bolly

Angelox
08-21-2007, 10:50 PM
Nice fix, thanks!
This is real important for players you like to play alone, or actually pull mobs like they do on live.

sfisque
08-22-2007, 07:21 AM
the bard and druid in our merry band i'm sure will put this code modifcation thorugh the ringer. i'll post any wierdnesses or issues as i find them. much thanks to all who put this fix together.

== sfisque

ps: you might want to include the cvs version info when you diff, so that people who are patching from older versions (like myself) are forewarned that they might have to do the modifications by hand or at least massage them a bit.

Angelox
08-27-2007, 10:32 PM
So what happened with this fix going into the official source? This is a good fix, and needs to be introduced.

TheLieka
10-10-2007, 06:05 AM
Did anyone ever figure out a good way to make this work with AE lulls?

Dax

Sadoke
11-11-2007, 01:15 PM
I think that the same problem behind the lull and harmony line is also behind the problems I have seen with the Enchanter Alliance spell.

When cast, it produces instant aggro from the target.

Something to add to the check list.

realityincarnate
01-21-2008, 11:46 AM
The same basic fix also works for the Alliance line of spells (and bard song).
I'm new at this and haven't tested it extensively, but it seems to have things working the way they should.

In IsHarmonySpell(), spdat.cpp line ~202 replace:

if(sp.effectid[i] == SE_Lull || sp.effectid[i] == SE_Harmony)


with:

if(sp.effectid[i] == SE_Lull || sp.effectid[i] == SE_Harmony || sp.effectid[i] == SE_AddFaction)

mixxit
07-06-2009, 12:11 PM
Still having this issue - is this in the current one?

gaeorn
07-06-2009, 11:12 PM
Still having this issue - is this in the current one?

Could you be more specific? What problem are you having?

mixxit
07-08-2009, 04:49 AM
A successful harmony causes aggro

gaeorn
07-08-2009, 11:40 AM
A successful harmony causes aggro

Just to make 100% certain, are you using the spell "Harmony" (id 250) or another spell with this effect?

mixxit
07-08-2009, 03:58 PM
yep, try it without gm mode on

mixxit
07-08-2009, 04:32 PM
hmm its working, i think it might have been related to body type - i'll check sorry about this!