Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void setTarget() {
- RSCharacter[] opponent = Combat.getAttackingEntities();
- for (String m : Main.getTask().getFightNames()) {
- RSNPC[] targets = NPCs.findNearest(e);
- //**
- /* Determines if attacking target is valid
- * and sets it to its fighting target
- */
- if (Combat.isUnderAttack() && opponent.length > 0
- && opponent[0] != null && opponent[0].getName().equals(e)) {
- if (targetIsValid((RSNPC)opponent[0])) {
- ourTarget = (RSNPC)opponent[0];
- break;
- }
- }
- //*
- /* Searches through all of the available targets
- * if one is valid, sets target
- */
- else if (targets.length > 0) {
- for (RSNPC t : targets) {
- if (targetIsValid(call)) {
- ourTarget = t;
- break;
- }
- }
- }
- else {
- ourTarget = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment