I've been using DB for a week now and using this great plugin since the start. Works great out of the box, but here are my current tweaks, hope this will help to improve the plugin.
First, my "Mantra Spam" approach
Why have a single rule for casting? You need to save energy to cast Blinding Flash and Sweeping wind, but once SW is up you just need to save enough for Breath of Heaven (25BoH+50 of the mantra = 75, or 50%)
My first version looked like this:
Code:
if (!bOOCBuff && hashPowerHotbarAbilities.Contains(SNOPower.Monk_MantraOfConviction) &&
// Spam a lot more if you already have sweeping winds
// playerStatus.dCurrentEnergyPct >= 0.75 && playerStatus.dCurrentEnergy >= 85 &&
((playerStatus.dCurrentEnergyPct >= 0.75 && playerStatus.dCurrentEnergy >= 85) ||
(playerStatus.dCurrentEnergyPct >= 0.5 && playerStatus.dCurrentEnergy >= 75 && GilesHasBuff(SNOPower.Monk_SweepingWind)) )&&
// end mod
(iElitesWithinRange[RANGE_30] >= 1 || iAnythingWithinRange[RANGE_30] >= 3) &&
GilesUseTimer(SNOPower.Monk_MantraOfConviction))
{
return new GilesPower(SNOPower.Monk_MantraOfConviction, 0f, vNullLocation, iCurrentWorldID, -1, 0, 0, USE_SLOWLY);
}
Some runs later I coded an even more aggressive approach and downed the saved energy a little more if Health is high. So in the end, if SW is down, the bot will save energy for BF+SW+mantra (10+75+50=135) to ensure SW can be cast, then while is up, will spam it saving just 15 energy if health is above 80%, and 25 (the full cost of Breath of Heaven) if the Health is below.
Code:
if (!bOOCBuff && hashPowerHotbarAbilities.Contains(SNOPower.Monk_MantraOfConviction) &&
( playerStatus.dCurrentEnergy >= 135 ||
( GilesHasBuff(SNOPower.Monk_SweepingWind) && (playerStatus.dCurrentEnergy >= 75 || ( playerStatus.dCurrentEnergy >= 65 && playerStatus.dCurrentHealthPct <= 0.8 ) ) ) ) &&
(iElitesWithinRange[RANGE_30] >= 1 || iAnythingWithinRange[RANGE_30] >= 3) &&
GilesUseTimer(SNOPower.Monk_MantraOfConviction))
{
return new GilesPower(SNOPower.Monk_MantraOfConviction, 0f, vNullLocation, iCurrentWorldID, -1, 0, 0, USE_SLOWLY);
}
I think the other mantras could benefit from that too.
Also, note that I removed here the % energy checks, see below for my thoughts on that.
I have seen my monk die more than once while surrounded by mobs while potions, the heal and the invul are in cd, but blinding flash is ready to cast. In the current code there is a part to cast it while life is under 40%, but still requires sweeping winds to be ready, so it won't be cast if you don't have a LOT of energy. Casting BF when below 25%hp if there's anything in range may be not optimal SW-wise, but having to do a corpse run is worse.
For clarity, I added a separate entry for the defensive cast, (so don't replace the BF entry with this one, just add this after the original one).
Code:
// Blinding Flash as a DEFENSE
if (!bOOCBuff && playerStatus.dCurrentEnergy >= 10 && hashPowerHotbarAbilities.Contains(SNOPower.Monk_BlindingFlash) &&
playerStatus.dCurrentHealthPct <= 0.25 && iAnythingWithinRange[RANGE_15] >= 1 &&
GilesUseTimer(SNOPower.Monk_BlindingFlash) && PowerManager.CanCast(SNOPower.Monk_BlindingFlash))
{
return new GilesPower(SNOPower.Monk_BlindingFlash, 11f, vNullLocation, iCurrentWorldID, -1, 1, 0, USE_SLOWLY);
}
I noticed that in the Breath of Heaven code, it requires 30 energy to cast, while the skill itself cost 25. It would make sense to make it 35 (25+10 backup for serenity), but not 30...
Code:
// Breath of heaven when needing healing or the buff
if (!bOOCBuff && (playerStatus.dCurrentHealthPct <= 0.6 || !GilesHasBuff(SNOPower.Monk_BreathOfHeaven)) && hashPowerHotbarAbilities.Contains(SNOPower.Monk_BreathOfHeaven) &&
GilesUseTimer(SNOPower.Monk_BreathOfHeaven) &&
playerStatus.dCurrentEnergy >= [COLOR="#FF0000"]25[/COLOR] && PowerManager.CanCast(SNOPower.Monk_BreathOfHeaven))
...
In many places in the monk code you have things like this (this one is from the mantra of conviction short buff):
Code:
playerStatus.dCurrentEnergyPct >= 0.75 && playerStatus.dCurrentEnergy >= 85
Am I missing something here or this is just redundant? As I understand the code above can be replaced with:
Code:
playerStatus.dCurrentEnergy >= 112.5
and it will do the same, right? (75% of 150 spirit =112.5 spirit). Also here the numbers didn't match in this particular example, may it be that you reduced the second value to improve spam and forgot to modify the %?
I think the code will be a lot cleaner and easy to maintain/read without the % checks, and also I think (didn't have time to actually test it, sorry) the % checks will cause strange behaviors with Exalted Soul saving a lot more spirit than needed.
But again, maybe I'm missing something and that double check needs to be there for some reason.
Sorry for the long post
