• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Fixing Healing

    Discussion in 'Community Developer Forum' started by alltrueist, Mar 4, 2016.

    1. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      We need to fix healing. Here's some code I butchered from my Discipline Priest routine from WoW, adapted to Buddywing the best I could:

      PHP:
              #region TestStuff
              
      public static IEnumerable<TorPlayerPartyMembers get { return getPartyMembers(); } }
              public static 
      IEnumerable<TorPlayerTanks get { return getTanks(); } }

              public static 
      IEnumerable<TorPlayergetPartyMembers()
              {
                  var 
      ObjectManager.GetObjects<TorPlayer>().Where(=> p.IsFriendly).ToList();
                      return 
      t;
              }
              public static 
      IEnumerable<TorPlayergetTanks()
              {
                  var 
      ObjectManager.GetObjects<TorPlayer>().Where(=> != null && (p.Discipline == CharacterDiscipline.Defense
                                                                                          
      || p.Discipline == CharacterDiscipline.Darkness
                                                                                          
      || p.Discipline == CharacterDiscipline.Immortal
                                                                                          
      || p.Discipline == CharacterDiscipline.KeneticCombat
                                                                                          
      || p.Discipline == CharacterDiscipline.ShieldSpecialist
                                                                                          
      || p.Discipline == CharacterDiscipline.ShieldTech)).ToList();
                      return 
      t;
              }

              public static 
      TorPlayer experimentalhealTarget
              
      {
                  
      get
                  
      {
                      if (!
      Me.InCombat) return null;
                      var 
      PartyMembers.Where(=> != null
                          
      && !p.IsDead
                          
      && p.InLineOfSight
                          
      && p.HealthPercent <= 80
                          
      && p.Distance <= 40).OrderBy(=> p.HealthPercent).FirstOrDefault();
                      return 
      != null null;
                  }
              }

              public static 
      TorPlayer experimentalhealTank
              
      {
                  
      get
                  
      {
                      if (!
      Me.InCombat) return null;
                      var 
      Tanks.Where(=> != null
                          
      && !p.IsDead
                          
      && p.InLineOfSight
                          
      && p.HealthPercent <= 95
                          
      && p.Distance <= 40).OrderBy(=> p.HealthPercent).FirstOrDefault();
                      return 
      != null null;
                  }
              }
              
      #endregion
      Then, in the individual healing file, you'd call it doing something like this (using Seer.cs for example):

      PHP:
      Spell.Cast("Benevolence"onTarget => Targeting.experimentalhealTarget),
      Theoretically, would this work? Could we add companions? I feel like the current way that DefaultCombat calls healing targets is way too complicated, but maybe that's for a reason.

      Also, we super need a way to call GroupMembers and RaidMembers. I thought I was crazy because I couldn't find this, but it just isn't there. At the moment, it'll just heal any friendly player in range.
       
    2. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      Okay so it loads up just fine. I ran solo, and it healed me just fine.

      Immediate to-do:
      1. Try to test in groups
      2. Figure out how to target companion
       
    3. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      I need to know the difference between
      TorPlayer
      TorCharacter
      TorObject
      TorNPC

      Which one is OTHER PLAYERS? Which one is MY COMPANION?
       
    4. wired203

      wired203 Community Developer

      Joined:
      Jan 22, 2015
      Messages:
      391
      Likes Received:
      1
      Trophy Points:
      18
      Default calls companion with me.companion if that helps any. Found it under targeting.cs

      public static List<TorCharacter> HealCandidates = new List<TorCharacter>();

      looks like TorCharacter would be other players.

      and these lines
      private static TorPlayer Me
      and
      if (Me.Companion != null)

      makes it look like comp is TorPlayer.Companion

      Hope this helps
       
      Last edited: Mar 5, 2016
    5. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      Actually I figured it out, and also figured out why healing wasn't working before.

      The companion is a TorNpc! That's why Default would never target him/her
       
    6. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      Here is the updated Healing Fix. Put this in your Targeting.cs file in DefaultCombat. I've tested it solo but not yet in groups, and it works perfectly-- heals your companion 100% all the time.

      PHP:
      #region TestStuff
              
      public static IEnumerable<TorCharacterPartyMembers get { return getPartyMembers(); } }
              public static 
      IEnumerable<TorCharacterTanks get { return getTanks(); } }

              public static 
      IEnumerable<TorCharactergetPartyMembers()
              {
                  var 
      ObjectManager.GetObjects<TorPlayer>().Where(=> != null && p.IsTargetable && p.GroupId == Me.GroupId).ToList();
                      return 
      t;
              }
              public static 
      IEnumerable<TorCharactergetTanks()
              {
                  if (
      Me.GroupId == && Me.InCombat)
                  {
                      return 
      ObjectManager.GetObjects<TorNpc>().Where(=> != null && p.IsTargetable && p.Guid == Me.Companion.Guid);
                  }
                  else
                  {
                      var 
      ObjectManager.GetObjects<TorPlayer>().Where(=> != null && p.GroupId == Me.GroupId && p.IsTargetable && (p.Discipline == CharacterDiscipline.Defense
                                                                                                                            
      || p.Discipline == CharacterDiscipline.Darkness
                                                                                                                            
      || p.Discipline == CharacterDiscipline.Immortal
                                                                                                                            
      || p.Discipline == CharacterDiscipline.KeneticCombat
                                                                                                                            
      || p.Discipline == CharacterDiscipline.ShieldSpecialist
                                                                                                                            
      || p.Discipline == CharacterDiscipline.ShieldTech)).ToList();
                      return 
      t;
                  }
              }

              public static 
      TorCharacter hTarget
              
      {
                  
      get
                  
      {
                      if (!
      Me.InCombat) return null;
                      var 
      PartyMembers.Where(=> != null
                          
      && !p.IsDead
                          
      && p.InLineOfSight
                          
      && p.Distance <= 30).OrderBy(=> p.HealthPercent).FirstOrDefault();
                      return 
      != null null;
                  }
              }

              public static 
      TorCharacter hTank
              
      {
                  
      get
                  
      {
                      if (!
      Me.InCombat) return null;
                      var 
      Tanks.Where(=> != null
                          
      && !p.IsDead
                          
      && p.InLineOfSight
                          
      && p.Distance <= 30).OrderBy(=> p.HealthPercent).FirstOrDefault();
                      return 
      != null null;
                  }
              }
              
      #endregion
      Here is my sample Seer.cs file, with the new fixes for healing implemented. You'll find them in the AoE section:

      PHP:
      // Copyright (C) 2011-2015 Bossland GmbH
      // See the file LICENSE for the source code's detailed license

      using Buddy.BehaviorTree;
      using DefaultCombat.Core;
      using DefaultCombat.Helpers;
      using T DefaultCombat.Core.Targeting;

      namespace 
      DefaultCombat.Routines
      {
          
      internal class Seer RotationBase
          
      {
              public 
      override string Name
              
      {
                  
      get { return "Sage Seer"; }
              }

              public 
      override Composite Buffs
              
      {
                  
      get
                  
      {
                      return new 
      PrioritySelector(
                          
      Spell.Buff("Force Valor")
                          );
                  }
              }

              public 
      override Composite Cooldowns
              
      {
                  
      get
                  
      {
                      return new 
      PrioritySelector(
                          
      Spell.Buff("Force Potency"ret => Targeting.ShouldAoeHeal),
                          
      Spell.Buff("Mental Alacrity"ret => Targeting.ShouldAoeHeal),
                          
      Spell.Buff("Vindicate"ret => NeedForce()),
                          
      Spell.Buff("Force Mend"ret => Me.HealthPercent <= 75)
                          );
                  }
              }

              public 
      override Composite SingleTarget
              
      {
                  
      get
                  
      {
                      return new 
      PrioritySelector(
                          
      //Movement
                          
      CombatMovement.CloseDistance(Distance.Ranged),
                          
      Spell.Cast("Mind Snap"ret => Me.CurrentTarget.IsCasting && !DefaultCombat.MovementDisabled),
                          
      Spell.Cast("Force Stun"ret => Me.CurrentTarget.IsCasting && !DefaultCombat.MovementDisabled),
                          
      Spell.Cast("Forcequake"ret => Targeting.ShouldAoe),
                          
      Spell.Cast("Mind Crush"),
                          
      Spell.DoT("Weaken Mind""Weaken Mind"),
                          
      Spell.Cast("Project"),
                          
      Spell.Cast("Telekinetic Throw"),
                          
      Spell.Cast("Disturbance")
                          );
                  }
              }

              public 
      override Composite AreaOfEffect
              
      {
                  
      get
                  
      {
                      return new 
      PrioritySelector(
                          
      //Cleanse if needed
                          
      Spell.Cleanse("Restoration"),

                          
      //Emergency Heal (Insta-cast)
                          
      Spell.Cast("Benevolence"onTarget => T.hTargetret => T.hTarget.HealthPercent <= 80 && Me.HasBuff("Altruism")),

                          
      //Aoe Heal
                          
      Spell.HealGround("Salvation"ret => Targeting.ShouldAoe),

                          
      //Single Target Healing
                          
      Spell.Cast("Healing Trance"onTarget => T.hTargetret => T.hTarget.HealthPercent <= 80),
                          
      Spell.Cast("Force Armor"onTarget => T.hTargetret => T.hTarget.HealthPercent <= 80 && !T.hTarget.HasDebuff("Force-imbalance") && !T.hTarget.HasBuff("Force Armor")),

                          
      //Buff Tank
                          
      Spell.Cast("Force Armor"onTarget => T.hTankret => !T.hTank.HasDebuff("Force-imbalance") && !T.hTank.HasBuff("Force Armor")),
                          
      Spell.Cast("Wandering Mend"onTarget => T.hTankret => T.hTank.InCombat && Me.BuffCount("Wandering Mend Charges") <= 1),

                          
      //Use Force Bending
                          
      new Decorator(ret => Me.HasBuff("Conveyance"),
                              new 
      PrioritySelector(
                                  
      Spell.Cast("Healing Trance"onTarget => T.hTargetret => T.hTarget.HealthPercent <= 90),
                                  
      Spell.Cast("Deliverance"onTarget => T.hTargetret => T.hTarget.HealthPercent <= 50)
                                  )),

                          
      //Build Force Bending
                          
      Spell.Cast("Rejuvenate"onTarget => T.hTankret => T.hTank.InCombat && !T.hTank.HasBuff("Rejuvenate")),
                          
      Spell.Cast("Rejuvenate"onTarget => T.hTargetret => T.hTarget.HealthPercent <= 80 && !T.hTarget.HasBuff("Rejuvenate")),

                          
      //Single Target Healing 
                          
      Spell.Cast("Benevolence"onTarget => T.hTargetret => T.hTarget.HealthPercent <= 35),
                          
      Spell.Cast("Deliverance"onTarget => T.hTargetret => T.hTarget.HealthPercent <= 80)
                          );
                  }
              }

              private 
      bool NeedForce()
              {
                  if (
      Me.ForcePercent <= 20)
                      return 
      true;
                  if (
      Me.HasBuff("Resplendence") && Me.ForcePercent 80 && !Me.HasBuff("Amnesty"))
                      return 
      true;
                  return 
      false;
              }
          }
      }
      I ran through a couple of chapters on my Sage and never once had a targeting/healing issue. It appears to work 100% of the time. I haven't tested in groups yet, so I'm interested to see if that works, but so far the targeting works great for solo play. I'm going to tune up the other Republic classes and post here, then you guys can translate them to Empire.
       
    7. Cryogenesis

      Cryogenesis Moderator Moderator

      Joined:
      Jul 13, 2010
      Messages:
      2,128
      Likes Received:
      13
      Trophy Points:
      38
      Nice man, keep up the good work :)
      Now for Party, FP and OPS.
       
    8. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      Should work in Party & FP currently. I'm not sure how OPs will handle groups, and since we don't have a way to get Operation members it's potentially spotty.

      Go ahead and test it in a group/FP and let me know how it works.
       
    9. russ1979

      russ1979 Member

      Joined:
      Aug 25, 2011
      Messages:
      357
      Likes Received:
      0
      Trophy Points:
      16


      where as we suppose to add it? can you just uload an updated targeting.cs file?
       
    10. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      I'm going to have to upload the entire routine fix-- I rewrote targeting completely and it had tons of consequences for every other file in the routine. Works really well though, still haven't tested in a FP, I didn't have time this weekend.
       
    11. russ1979

      russ1979 Member

      Joined:
      Aug 25, 2011
      Messages:
      357
      Likes Received:
      0
      Trophy Points:
      16
      are you going to relaunch Pure routine or you just updating the default routine?
       
    12. Logandros

      Logandros Moderator Moderator

      Joined:
      Nov 20, 2012
      Messages:
      370
      Likes Received:
      21
      Trophy Points:
      18
      This is awesome alltrueist !

      Can't wait to see healing completely working again .. been so long ... thanks again!
       
    13. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      It's still Default, I just rewrote the entire Targeting.cs file (and every file that had a dependency on something in the old Targeting, which was almost everything).
       
    14. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      Tell me about it! I hated playing my Sage and Scoundrel as the DPS specs, it's nice to be back to solo healing. I can wait to test stuff out in groups, or I can put it here for you guys to test out for me since I don't have a lot of playtime. I'll probably end up just uploading everything and let you guys be the QA ;)
       
    15. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38

    Share This Page