Advertisement
tazerman2

Untitled

May 6th, 2024
1,708
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         if (actor.getTemplate().getAiType() == NpcAiType.MAGE && !actor.getCast().isCastingNow())
  2.         {
  3.             // This list is used in order to avoid multiple calls on skills lists. Tests are made one after the other, and content is replaced when needed.
  4.             List<L2Skill> defaultList;
  5.            
  6.             // -------------------------------------------------------------------------------
  7.             // Heal
  8.             defaultList = actor.getTemplate().getSkills(NpcSkillType.HEAL);
  9.             if (!defaultList.isEmpty())
  10.             {
  11.                 Player leader = actor.getLeader();
  12.                
  13.                 // Go through all characters around the actor that belongs to its faction.
  14.                 for (Creature cha : actor.getKnownTypeInRadius(Creature.class, 1000))
  15.                 {
  16.                     if (leader.getStatus().getHpRatio() < 0.75)
  17.                         cha = leader;
  18.                     else if (actor.getStatus().getHpRatio() < 0.75)
  19.                         cha = actor;
  20.                     else if (cha instanceof BodyGuard && ((BodyGuard) cha).getclans().getname() == leader.getName())
  21.                        
  22.                         // Will affect only defenders or NPCs from same faction.
  23.                         if (!actor.isAttackingDisabled())
  24.                         {
  25.                             for (L2Skill sk : defaultList)
  26.                             {
  27.                                 System.out.println("name:" + cha.getName() + " sk: " + sk.getName());
  28.                                 actor.getCast().doCast(sk, cha, actor.getActiveWeapon());
  29.                                 return;
  30.                             }
  31.                         }
  32.                    
  33.                     leader.getClan().getName();
  34.                    
  35.                 }
  36.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement