• Visit Rebornbuddy
  • [Release] Healing (Manual Targeting)

    Discussion in 'Buddy Wing Forum' started by SirSik, Apr 18, 2017.

    1. SirSik

      SirSik Member

      Joined:
      Jul 9, 2013
      Messages:
      173
      Likes Received:
      6
      Trophy Points:
      18
      Ok Guys,

      So before we get going into this I just want to remind you all that I am not a coder, this method was found from logical trial and error, and i also had to edit my class routine (Sorcerer) and that's the only class i tested this on.
      I am putting as much info into this thread as i can as to help the devs get a better understanding of what i did so maybe they can come up with a permanent fix.

      This method does not "Fix" healing. All it does is makes the bot heal your target (will kind of include AOE) regardless of health. So it will just cast your healing rotation, at whatever priority is set first for your class routine.
      Please also note that i have not got every part of the healing routine included yet but I am finding little things to fix daily which improve's the combat routine support. (for example i don't have cleanse working yet as i've not had chance to look into it but it's on my todo list)

      So firstly, i started off gathering a "basic" understanding of how default combat works. As i know nothing about c# i just went with what looked logical and then fixing any grammatical coding mistakes after.
      I was looking around in the CORE Default Combat files and noticed that in Spell.cs the routine casts a heal differently as to casting a normal spell on an enemy target. When a spell is cast on an enemy target it basically uses this line of code for the casting:

      Code:
              public static Composite Cast(string spell, Selection<bool> reqs = null)
              {
                  return Cast(spell, ret => Me.CurrentTarget, reqs);
              }
      
              public static Composite Cast(string spell, UnitSelectionDelegate onUnit, Selection<bool> reqs = null)
              {
                  return
                      new Decorator(
                          ret =>
                              onUnit != null && onUnit(ret) != null && (reqs == null || reqs(ret)) &&
                              AbilityManager.CanCast(spell, onUnit(ret)),
                          new PrioritySelector(
                              new Action(delegate
                              {
                                  //added current target health percent check
                                  Logger.Write(">> Casting <<   " + spell);
                                  return RunStatus.Failure;
                              }),
                              new Action(ret => AbilityManager.Cast(spell, onUnit(ret))))
                          );
              }
      But when a heal is cast it uses THIS code:

      Code:
              public static Composite Heal(string spell, int hp = 100, Selection<bool> reqs = null)
              {
                  return Heal(spell, onUnit => Targeting.HealTarget, hp, reqs);
              }
      
              public static Composite Heal(string spell, UnitSelectionDelegate onUnit, int hp = 100, Selection<bool> reqs = null)
              {
                  return new Decorator(
                      ret =>
                          onUnit != null && onUnit(ret) != null && (reqs == null || reqs(ret)) && onUnit(ret).HealthPercent <= hp &&
                          Target(onUnit(ret)),
                      Cast(spell, onUnit, reqs));
              }
      As you can see, the top one (spell cast) uses 'ret => Me.CurrentTarget' whereas the bottom one (heal cast) uses 'onUnit => Targeting.HealTarget' for the targeting.

      I then edited the healing one to look more like the spell cast one and got this:

      Code:
              public static Composite Heal(string spell, int hp = 100, Selection<bool> reqs = null)
              {
                  return Cast(spell, ret => Me.CurrentTarget, reqs);
              }
      
              public static Composite Heal(string spell, UnitSelectionDelegate onUnit, int hp = 100, Selection<bool> reqs = null)
              {
                  return new Decorator(
                      ret =>
                          onUnit != null && onUnit(ret) != null && (reqs == null || reqs(ret)) && onUnit(ret).HealthPercent <= hp &&
                          Target(onUnit(ret)),
                      Cast(spell, onUnit, reqs));
              }
      I then went through all the other parts of the 'Heal region' and edited them similar to the cast ones.
      After this (and a about 30 mins of fixing a couple of other mistakes i had made) i was able to get "some" of my routine casting non stop on whatever target i selected.

      I then went into my advance class routine (Corruption.cs for Sorcerer in my case) and made some adjustments to get things working in the right order etc, but this was mainly for my benefit.

      I also notices that AOE casting wasn't working right in Madness spec for me (no AOE ever) and i fixed this by changing:

      Code:
              public static Composite CastOnGround(string spell, Selection<bool> reqs = null)
              {
                  return
                      new Decorator(
                          ret =>
                              (reqs == null || reqs(ret)) && Me.CurrentTarget != null,
                          CastOnGround(spell, ctx => Me.CurrentTarget.Position, ctx => true));
              }
      to this:

      Code:
              public static Composite CastOnGround(string spell, Selection<bool> reqs = null)
              {
                  return
                      new Decorator(
                          ret =>
                              (reqs == null || reqs(ret)) && Me.CurrentTarget != null,
                          CastOnGround(spell, ret => Me.CurrentTarget.Position, ret => true));
              }
      you'll notice all i did here was replace 'ctx' with 'ret' and that seemed to work, although i must admit i don't know the difference between those commands.

      I have included MY "up to date" spell.cs which you are free to download and edit to suit you.
      I will happily answer any questions and help anyone who needs help setting their CR up but please remember that this isn't my area of expertise and all i have done is logically move things and change a few things to match what is already there :)

      DOWNLOAD:

      File: Spell.Txt

      Replace all text in "%Buddywing%\Routines\DefaultCombat\Core\Spell.cs" with this file.

      UPDATE 4 *** 20/04/17 ***

      -1. Fixed - Seer.cs - Wasn't casting "Force Armor" due to wrong debuff set as variable. Fixed

      UPDATE 3 *** 19/04/17 ***

      -1. Added - Seer.cs - This is as close as i could get it to my Corruption routine at the minute as i don't have a Seer. Levelling one to test at the minute.

      UPDATE 2 *** 19/04/17 ***

      -1. Fixed a few little things in Spell.cs that were causing issues.
      -2. Included my Sorcerer.cs - This heals your target, keeps a bubble on self while in combat, uses "Consuming Darkness" whenever "Force Surge" buff is up to keep mana uptime to max. Deals single target and AOE rotation to enemy targets.

      feel free to request any changes and i will reply as soon as i can.

      UPDATE 1 *** 18/04/17 ***

      -1. Fixed - Bot should now not cast heals when targeting enemies (only heals when targeting friendly targets). This allows for "combat/non heal" spells to be cast on enemies and it removes healing attack rotation (for damage dealing / solo missions)
       

      Attached Files:

      Last edited: Apr 20, 2017
      Praline likes this.
    2. SirSik

      SirSik Member

      Joined:
      Jul 9, 2013
      Messages:
      173
      Likes Received:
      6
      Trophy Points:
      18
      Please leave plenty of Knowledge/Feedback/Criticism/Requests etc etc.

      *Reserved*
       
    3. Praline

      Praline Member

      Joined:
      Aug 17, 2015
      Messages:
      149
      Likes Received:
      2
      Trophy Points:
      18
      Can't wait to try it out when the update comes out. Thank you so much for sharing your ideas.
       
    4. SirSik

      SirSik Member

      Joined:
      Jul 9, 2013
      Messages:
      173
      Likes Received:
      6
      Trophy Points:
      18
      No Problem.. As i only get access to the bot at the same time as everyone else, I won't be able to update this until we have a release after the patch.
      If the healing isn't fixed with the next update then i will continue with my files, test it and continue to improve from there.

      For the past few hours i have been finding "improvements" and better ways to handle the commands and keep improving my knowledge of how it all works etc etc so i'm finding more things that i can actually get working so bear with me for lots and lots of changes :)
       
      Praline likes this.
    5. Logandros

      Logandros Moderator Moderator

      Joined:
      Nov 20, 2012
      Messages:
      370
      Likes Received:
      21
      Trophy Points:
      18
      Great to see others jumping in and helping!
       
    6. Praline

      Praline Member

      Joined:
      Aug 17, 2015
      Messages:
      149
      Likes Received:
      2
      Trophy Points:
      18
      I am very excited ! Hope the new update will be quick as usual. Would love to try my Sage again, but will even go to the dark side fo this /gasp.
       
    7. SirSik

      SirSik Member

      Joined:
      Jul 9, 2013
      Messages:
      173
      Likes Received:
      6
      Trophy Points:
      18
      It is! The more the merrier :)
      You wouldn't need to go to the dark side, after comparing my Corruption.CS to the original one, I haven't made that many changes to my routine. Unfortunately the only healing class I currently have is Sith Sorcerer and I don't have the spare cash atm to buy character boosts, so you will have to wait til i level a seer or make the changes yourself :D
       
    8. tchallaaoc

      tchallaaoc New Member

      Joined:
      Mar 1, 2016
      Messages:
      7
      Likes Received:
      0
      Trophy Points:
      1
      SirSilk - Thanks for starting this. Please share your current version of Corruption.cs as I also run this spec. Am interested in testing and assisting with improving. Bravo!
       
    9. SirSik

      SirSik Member

      Joined:
      Jul 9, 2013
      Messages:
      173
      Likes Received:
      6
      Trophy Points:
      18
      I will upload it when the bot is back up as i cant remember if it was working atm as i was testing and fixing a few other changes when the server went down.. like i say most of the changes is made was just swapping the order of things and adding a few extra variables onto the end of the spells to check for buffs / debuffs etc etc

       
    10. SirSik

      SirSik Member

      Joined:
      Jul 9, 2013
      Messages:
      173
      Likes Received:
      6
      Trophy Points:
      18
      Updated a little bit :)
       
    11. Praline

      Praline Member

      Joined:
      Aug 17, 2015
      Messages:
      149
      Likes Received:
      2
      Trophy Points:
      18
      I tried your fix on my Sorc and it was awesome! Clever clever you are! :)
      On my Sage it was pretty bad hahaha. Please fix Sage too :)
      On a serious note, do you think if I just use the mirror skills on my Sage, it will work, or do we have to re-write a lot of things to make it work as well as the Sorcerer does?
       
    12. SirSik

      SirSik Member

      Joined:
      Jul 9, 2013
      Messages:
      173
      Likes Received:
      6
      Trophy Points:
      18
      Update.... ;)
       
      Praline likes this.
    13. tchallaaoc

      tchallaaoc New Member

      Joined:
      Mar 1, 2016
      Messages:
      7
      Likes Received:
      0
      Trophy Points:
      1
      Are you guys able to use BW since new patch? Mine is getting an Object Reference error...
       
    14. SirSik

      SirSik Member

      Joined:
      Jul 9, 2013
      Messages:
      173
      Likes Received:
      6
      Trophy Points:
      18
      try a fresh install
       
    15. Praline

      Praline Member

      Joined:
      Aug 17, 2015
      Messages:
      149
      Likes Received:
      2
      Trophy Points:
      18
      You are great! Thank you. Had to change one name from "Force Surge" to the seer's "resplendence" (hope that was the correct mirror ability?) . It works well, but still not as great as the Sorc. :)
       
    16. SirSik

      SirSik Member

      Joined:
      Jul 9, 2013
      Messages:
      173
      Likes Received:
      6
      Trophy Points:
      18
      Ahhh yes, i have fixed that now and re updated it on the thread :). When you say it doesn't work as good as Sorc, what PARTS of the routine aren't working as well? I edited the seer one without testing as i have nothing currently to test it on!
       
      Praline likes this.
    17. Praline

      Praline Member

      Joined:
      Aug 17, 2015
      Messages:
      149
      Likes Received:
      2
      Trophy Points:
      18
      My statement about Seer not working as well as sorcerer is similar to American politics. Based on "feelings" and not facts. Haha
      Maybe one big difference is it not using the bubble and never the "Oh shit" bubble. ;-p
      But will keep testing and maybe even attach a log file that might actually be helpful, instead of a vague "not working as well" next time.
       
    18. SirSik

      SirSik Member

      Joined:
      Jul 9, 2013
      Messages:
      173
      Likes Received:
      6
      Trophy Points:
      18
      that's okay, i'm gonna level a Seer a bit later and test it out :)
      Maybe it's just the actual command itself... the Spell.HoT command refers to whatever it is told to do in Spell.cs
      as there is 2 separate versions of HoT i need to double check which one it uses for that command.
      I'm going to go through later and have a look to see if i can add all the variables into the spell.cs and make the routine editing down to a minimum to avoid any other discrepancies with other routines.
      As you may notice in spell.cs i have added some "Me.CurrentTarget.IsFriendly" which is great as i can add it on the "Heal" spells instead of the "Combat" spells then it can differentiate what spell to cast on what unit. Before i did that it was just trying to bubble the enemy over and over again. I have a feeling it is something to do with that :)

      ####

      On another note now this "workaround" is working to a point where it's usable, it gives me more time to look at other things. With a bit of knowledge that i've gained from doing this, i'm going to have a crack at seeing if i can't add some variables into targeting to work out health percentages easier and make healing work properly with auto targeting etc etc. No promises though but i am almost CERTAIN that healing can be fixed routine side and not bot side :)
       
    19. SirSik

      SirSik Member

      Joined:
      Jul 9, 2013
      Messages:
      173
      Likes Received:
      6
      Trophy Points:
      18
      Ok, I had a very quick look and i had set the debuff to look for the sith one rather than the jedi one.
      Can you please test it and tell me if it works, if not i need you to tell me exactly what the debuff is called (case sensitive) when you apply a bubble to yourself.
      I think it's right as "Force-imbalance" but need this confirming :)
       
    20. Praline

      Praline Member

      Joined:
      Aug 17, 2015
      Messages:
      149
      Likes Received:
      2
      Trophy Points:
      18
      it is definitely "Force-imbalance". But when I try to run it, this error:

      2017-04-20 15:00:39,624 [7] ERROR AssemblyLoader`1 - Compiler Error: d:\SWTOR xxx\Routines\DefaultCombat\Helpers\Logger.cs(23,4) : warning CS0618: 'Buddy.Common.Logging.Write(System.Windows.Media.Color, string, params object[])' is obsolete: 'Logging.WriteX is no longer used, declare [private ILog _log = Log.Get();] in your type and use its members instead!'
      2017-04-20 15:00:39,625 [7] ERROR AssemblyLoader`1 - Compiler Error: d:\SWTOR xxx\Routines\DefaultCombat\Routines\Advanced\Sage\seer.cs(89,6) : error CS1501: No overload for method 'HoT' takes 5 arguments

      So, something is not happy :)
       
      Last edited: Apr 20, 2017

    Share This Page