joedezzy1

Untitled

Jul 23rd, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. private static void setTarget() {
  2.  
  3.   RSCharacter[] opponent = Combat.getAttackingEntities();
  4.  
  5.   for (String m : Main.getTask().getFightNames()) {
  6.    
  7.    RSNPC[] targets = NPCs.findNearest(e);
  8.    //**
  9.    /* Determines if attacking target is valid
  10.     * and sets it to its fighting target
  11.     */
  12.    if (Combat.isUnderAttack() && opponent.length > 0
  13.      && opponent[0] != null && opponent[0].getName().equals(e)) {
  14.     if (targetIsValid((RSNPC)opponent[0])) {
  15.      ourTarget = (RSNPC)opponent[0];
  16.      break;
  17.     }    
  18.    }
  19.    //*
  20.    /* Searches through all of the available targets
  21.     * if one is valid, sets target
  22.     */
  23.    else if (targets.length > 0) {
  24.     for (RSNPC t : targets) {
  25.      if (targetIsValid(call)) {
  26.       ourTarget = t;
  27.       break;
  28.      }
  29.     }
  30.    }
  31.    else {
  32.     ourTarget = null;
  33.    }
  34.   }
  35.  }
Advertisement
Add Comment
Please, Sign In to add comment