PDA

View Full Version : bot cleric CH vs Regular heal


louis1016
04-25-2012, 06:53 PM
My bot clerics are always casting CH heals, even when i take a little bit of damage. I want them to only CH when I get down to about 50% health or so. Ive tried a few things but nothing worked, how can I modify the code to have this happen?

louis1016
04-25-2012, 07:56 PM
I think i got it. CH is being classified as both a regularsingletargethealspell and a completehealspell in spdat.cpp. I just added "&& != spell_id != 13" in the check for regularsingletargethealspells and now it works fine. I reccomend anyone do the same if you want your clerics to only CHeal at certain percentages

louis1016
04-26-2012, 10:25 AM
my bad, i meant

"&& spell_id != 13"

bad_captain
04-29-2012, 11:10 PM
bool IsRegularSingleTargetHealSpell(int16 spell_id) {
bool result = false;

if(spells[spell_id].effectid[0] == 0 && spells[spell_id].base[0] > 0 && spells[spell_id].targettype == ST_Target && spells[spell_id].buffduration == 0
&& !IsFastHealSpell(spell_id) && !IsCompleteHealSpell(spell_id) && !IsHealOverTimeSpell(spell_id) && !IsGroupSpell(spell_id)) {
result = true;
}

return result;
}


If this is what you mean, Complete Heal should already be excluded because of the check for !IsCompleteHealSpell(spell_id). Also, it's best to not add spell ids directly, as anyone with a custom spell file may not see the correct results (although the code for IsCompleteHealSpell does include spellid = 13, but it should probably be removed.

I would have to test this out to see why that change would have any effect, as it shouldn't with the complete heal check already in there..

louis1016
05-02-2012, 08:32 PM
It appears I was mistaken, bots still are CHing when they shouldnt. Setting the percentageheal to only cast at < 55 health isnt working. Trying a few different things nothing is working so far.

louis1016
05-02-2012, 08:39 PM
It looks like its working as intended when i target myself and do a #damage. They are healing me with the correct spells. When I am engaged in a fight, however, the cleric bot is CHing me no matter what my HP is.

EDIT- Further testing shows that cleric heals good when he is commanded to guard with #bot group guard before I am in combat and heals intelligently while I am in combat (but only if he is still guarding) or if there is no combat at all. However, once the cleric joins the fight wither with #bot group attack or #bot group follow, he CH's as his default heal no matter how much health I have.

louis1016
05-02-2012, 09:35 PM
I think i figured it out. I found the code for the engaged bots trying to heal and noticed it doesnt have any entries for percentageheal or regular heals so im guessing thats where the problem lies.

EDIT - tried modifying to the following:

// Evaluate the situation
if((IsEngaged()) && ((botClass == CLERIC) || (botClass == DRUID) || (botClass == SHAMAN) || (botClass == PALADIN))) {
if(tar->GetTarget() && tar->GetTarget()->GetHateTop() && tar->GetTarget()->GetHateTop() == tar) {
hasAggro = true;
}
if (hpr <= 35 ) {
botSpell = GetBestBotSpellForFastHeal(this);
}
if ((hpr < 55) && (tar->GetArchetype() != ARCHETYPE_CASTER)) {
botSpell = GetBestBotSpellForPercentageHeal(this);
}

if ((hpr > 35 && hpr < 70) && (tar->GetArchetype() == ARCHETYPE_CASTER)) {
botSpell = GetBestBotSpellForRegularSingleTargetHeal(this);
}

else if(hpr >= 35 && hpr < 70){
if(GetNumberNeedingHealedInGroup(60, false) >= 3)
botSpell = GetBestBotSpellForGroupHeal(this);

still NO results, what am i missing?

louis1016
05-02-2012, 10:51 PM
I finally got it

bad_captain
05-03-2012, 10:39 AM
What did you change, and what was the result?

I've been really busy so I haven't been able to test this myself. I hope to have more time this weekend.

louis1016
05-03-2012, 12:33 PM
There were no checks for regular heals in the bot hasaggro heal code, I just had to modify the existing code to what I wanted which was this:

// Evaluate the situation
if((IsEngaged()) && ((botClass == CLERIC) || (botClass == DRUID) || (botClass == SHAMAN) || (botClass == PALADIN))) {
if(tar->GetTarget() && tar->GetTarget()->GetHateTop() && tar->GetTarget()->GetHateTop() == tar) {
hasAggro = true;
}

if(hpr < 35) {
botSpell = GetBestBotSpellForFastHeal(this);
}
else if(hpr >= 40 && hpr < 55 && (tar->GetArchetype() != ARCHETYPE_CASTER)) {
if(GetNumberNeedingHealedInGroup(60, false) >= 3)
botSpell = GetBestBotSpellForGroupHeal(this);

if(botSpell.SpellId == 0)
botSpell = GetBestBotSpellForPercentageHeal(this);
}
else if(hpr >= 35 && hpr < 75 && (tar->GetArchetype() == ARCHETYPE_CASTER)) {
if(GetNumberNeedingHealedInGroup(60, false) >= 3)
botSpell = GetBestBotSpellForGroupHeal(this);

if(botSpell.SpellId == 0)
botSpell = GetBestBotSpellForRegularSingleTargetHeal(this);
}




else if(hpr >= 40 && hpr < 55 && (tar->GetArchetype() != ARCHETYPE_CASTER)) {
if(GetNumberNeedingHealedInGroup(80, false) >= 3)
botSpell = GetBestBotSpellForGroupHealOverTime(this);

if(hasAggro)
botSpell = GetBestBotSpellForPercentageHeal(this);
}
else {
if(!tar->FindType(SE_HealOverTime))
botSpell = GetBestBotSpellForHealOverTime(this);
}
}

Than I realized that no matter what, bots were bealing healed up to a minimum 95% that wasnt reflected in what I modified. This was due to the hp checks at the beginning of the heal code looking to see if anyone was below 95% or if the bot owner has below 95%. This was overwriting all of my values so I changed that to my values that I wanted as well.

Besides the archetypes that i added checks for I also added checks here to reflect the change in clerics behavior as he hits level 39 and gets cheal. (39 on my server I dont remember if thats the stock peq CHeal level). I need to change the target checks for levels to a botlevel check instead to account for different level bots in our group if we ever get there. (just noticed after posting)


if(hpr < 75 && (tar->GetArchetype() == ARCHETYPE_CASTER) || (hpr < 55 && (tar->GetArchetype() != ARCHETYPE_CASTER) && (tar->GetLevel() >= 39)) || (hpr < 75 && (tar->GetArchetype() != ARCHETYPE_CASTER) && (tar->GetLevel() < 39)) || (botClass == BARD)) {
if(tar->GetClass() == NECROMANCER) {
// Give necromancers a chance to go lifetap something or cleric can spend too much mana on a necro
if(hpr >= 40) {
break;
}
}

The result is my cleric CHeals only when melees and hybrids are below 55%, casts regular heals on casters when they are below 75. Working pretty smoothly so far.


I also did modifications to the hpr levels in the check for heals out of combat. Just had to add some archetype checks and modify the existing hpr values.

bad_captain
05-03-2012, 01:18 PM
I'll check your changes out. I know the heal ai can be updated even more to better incorporate the bot stances, but I've been trying to level up my other accounts on live to better test mercs and their spell casting.

May I ask what kind of content you are on? The reason I ask, and a reason this ai is so difficult to get right is that there's a big difference beween early planes and later expansions where trash regularly hit for more that 1k at lvl 65. I'm in EPs in POP, and have been working on progressing through GoD. I'm currently getting ready to start the raids in KodTaz, as I just finished the group trials. In KodTaz, a Ra'tuk rabidfury hits for between 400-1200, 2 attacks per round. If he averages 1000 per hit and hits twice per round, in 2 rounds, he will have done 4000 damage. To survive, the tank would have to have at least 8k HP if you start CHeal at 50%. If you have 50.111% and are hit twice, you could be at only 2k hp (assuming 8k total) before CHeal is even cast. There's no way you survive unless very lucky. Even if CHeal is cast at 50%, you will be dead in 2 rounds, which will probably happen in less time that it takes to cast CHeal. My tank bot is ~10hp, so he could survive a little longer, but if he gets an add, he's done.

I purposefully made complete heals a little early or cast too often, but I'd rather that than have my tank die on trash mobs.

This is a good example of the potential of stances, as reactive would cast fewer complete heals but would be less mana efficient.

louis1016
05-03-2012, 07:15 PM
I play in mostly classic zones. My server is mostly classic up to the bots and their spells. Perhaps some more checks can be added to account for the combat in later expansions. I was also thinking about making CHeal check for the targets max health subtracted from his current health and if its 1200 or higher then cast a CHeal or if not a regular heal.