Jump to content

Implement Stance Dance


Forev

Recommended Posts

First, I'm new to to coding but i would really like if someone could show me a snippet of how to go about implementing stance dance to the warrior routine.

Some obvious examples where Stance-dance is needed

Overpower pops :  Berserker Stance ---> Battle Stance  -->Use Overpower

Taunt resisted:  Def Stance ---> Battle Stance  -->Use Mocking Blow 

 

Link to comment
Share on other sites

All of these require Lua events:

Check how it reads whether overpower procs here: https://github.com/EinBaum/SP_Overpower (or if you're not in vanilla read up on COMBAT_LOG_EVENT_UNFILTERED in TBC+)

If overpower procs, set a boolean value to true in your rotation scripts
Build a step in your rotation that that switches to Battle Stance if the boolean is true and rage is below 25
Build a step that casts overpower in battlestance if possible AND sets the boolean back to false
Build a step that casts Berserker stance, if you're not in Berserker stance and the boolean is set to false
(info on how to read current stances: http://wowwiki.wikia.com/wiki/API_GetShapeshiftFormInfo)

Link to comment
Share on other sites

On ‎9‎/‎23‎/‎2018 at 8:28 PM, Matenia said:

All of these require Lua events:

Check how it reads whether overpower procs here: https://github.com/EinBaum/SP_Overpower (or if you're not in vanilla read up on COMBAT_LOG_EVENT_UNFILTERED in TBC+)

If overpower procs, set a boolean value to true in your rotation scripts
Build a step in your rotation that that switches to Battle Stance if the boolean is true and rage is below 25
Build a step that casts overpower in battlestance if possible AND sets the boolean back to false
Build a step that casts Berserker stance, if you're not in Berserker stance and the boolean is set to false
(info on how to read current stances: http://wowwiki.wikia.com/wiki/API_GetShapeshiftFormInfo)

Could you please show me how that would be written ? 

Like for ExampleBerserker Stance ---> Battle Stance  -->Use Overpower

Cuz im not sure i fully graps how it should be written out

 

Link to comment
Share on other sites

No, but I assumed you would be using it, because you didn't clarify anything.

If you are writing a fightclass in C# for vanilla:

 

private static DateTime _lastDodge = DateTime.MinValue;
private static DateTime _lastOverpower = DateTime.MinValue;

public void Initialize()
{
	EventsLuaWithArgs.OnEventsLuaWithArgs += OverpowerHandler;
}

private void OverpowerHandler(LuaEventsId id, List<string> args)
    {
        if (id == LuaEventsId.CHAT_MSG_COMBAT_SELF_MISSES)
        {
            string msg = args[0];
            if (new Regex("You attack\\. (.+) dodges\\.").Matches(msg).Count > 0)
            {
                Logging.WriteFight("Setting dodge - time to overpower");
                _lastDodge = DateTime.Now;
            }
        }
        if (id == LuaEventsId.CHAT_MSG_SPELL_SELF_DAMAGE || id == LuaEventsId.CHAT_MSG_SPELL_DAMAGESHIELDS_ON_SELF)
        {
            string msg = args[0];
            if (new Regex("Your (.+) was dodged by (.+)\\.").Matches(msg).Count > 0)
            {
                Logging.WriteFight("Setting dodge - time to overpower");
                _lastDodge = DateTime.Now;
            }

            if (new Regex("Your (Overpower) .*").Matches(msg).Count > 0)
            {
                Logging.WriteFight("Overpower successful");
                _lastOverpower = DateTime.Now;;
            }
        }
    }

Now you can modify your rotation to read those variables, for example

if(_lastDodge.AddSeconds(3.5) > DateTime.Now && _lastDodge > _lastOverpower)
{
  SpellManager.CastSpellByNameLUA("Battle Stance");
  Thread.Sleep(1500 + Usefuls.LatencyReal + 50);
  SpellManager.CastSpellByNameLUA("Overpower");
  Thread.Sleep(1500 + Usefuls.LatencyReal + 50);
  SpellManager.CastSpellByNameLUA("Berserker Stance");
}

Just as an example. You can also just build this into your rotation as different steps, rather than one "action" where you create sleeps between executing skills (because maybe in the mean time you need to cast something else due to many enemies around).

You could also put that code right into the OverpowerHandler function, but then you'd have to do stuff like wait until GCD is over etc to make sure you can actually cast Battle Stance + Overpower when the dodge happens.

Link to comment
Share on other sites

Thank you for the answer!!

I'm analyzing what you wrote as I write this, but I was wondering why you didn't use the API_GetShapeshiftFormInfo() ? Maybe a stupid question but still...

Link to comment
Share on other sites

Because that's for the rotation steps that you (might have to) implement yourself. It's for conditiomal if you wanna make sure to only switch stances if you aren't currently IN a certain stance. I'm only giving pointers, not creating everything for you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...