Thread: boss system rs2-server

Results 1 to 2 of 2
  1. #1 boss system rs2-server 
    Registered Member Andrew's Avatar
    Join Date
    Nov 2008
    Posts
    2,887
    Thanks given
    602
    Thanks received
    196
    Rep Power
    490
    Alright so I'm making jad, and howcome it is not working? it isn't doing the magic emote, it's just sticking to the normal one that is declared in the npcCombat def, i think its because jad is labeled as tztok-jad and the - is what hte problem is and i can't label it that


    Code:
    package org.rs2server.rs2.model.combat.npcs;
    
    import java.util.Random;
    
    import org.rs2server.rs2.model.Animation;
    import org.rs2server.rs2.model.Graphic;
    import org.rs2server.rs2.model.Hit;
    import org.rs2server.rs2.model.Mob;
    import org.rs2server.rs2.model.NPC;
    import org.rs2server.rs2.model.Prayers;
    import org.rs2server.rs2.model.Skills;
    import org.rs2server.rs2.model.World;
    import org.rs2server.rs2.model.combat.CombatAction;
    import org.rs2server.rs2.model.combat.CombatFormulae;
    import org.rs2server.rs2.model.combat.CombatState.AttackType;
    import org.rs2server.rs2.model.combat.impl.AbstractCombatAction;
    import org.rs2server.rs2.tickable.Tickable;
    
    public class TzTokJad extends AbstractCombatAction {
    	
    	/**
    	 * Jad
    	 * @author Andrew
    	 *
    	 *
    		
    		/**
    		 * The singleton instance.
    		 */
    		private static final TzTokJad INSTANCE = new TzTokJad();
    		
    		/**
    		 * Gets the singleton instance.
    		 * @return The singleton instance.
    		 */
    		public static CombatAction getAction() {
    			return INSTANCE;
    		}
    		
    		/**
    		 * The random number generator.
    		 */
    		private final Random random = new Random();
    		
    		/**
    		 * Default private constructor.
    		 */
    		public TzTokJad() {
    			
    		}
    		
    		private enum CombatStyle {
    			MELEE,
    			
    			MAGIC
    		}
    		
    		@Override
    		public void hit(final Mob attacker, final Mob victim) {
    			super.hit(attacker, victim);
    			
    			if(!attacker.isNPC()) {
    				return; //this should be an NPC!
    			}
    			
    			NPC npc = (NPC) attacker;
    			
    			CombatStyle style = CombatStyle.MAGIC;
    			
    			
    			int maxHit;
    			int damage;
    			int randomHit;
    			int hitDelay;
    			boolean blockAnimation;
    			final int hit;
    
    			if(attacker.getLocation().isWithinDistance(attacker, victim, 1)) {
    				switch(random.nextInt(2)) {
    				case 0:
    					style = CombatStyle.MELEE;	
    					break;
    				case 1:
    					style = CombatStyle.MAGIC;
    					break;
    				}
    			}
    			
    			switch(style) {
    			case MELEE:
    				Animation anim = attacker.getAttackAnimation();
    				if(random.nextInt(2) == 1) {
    					anim = Animation.create(2655);
    				}
    				attacker.playAnimation(anim);
    				
    				hitDelay = 2;
    				blockAnimation = true;
    				maxHit = npc.getCombatDefinition().getMaxHit();
    				damage = damage(maxHit, attacker, victim, attacker.getCombatState().getAttackType(), Skills.ATTACK , Prayers.PROTECT_FROM_MELEE, false, false);
    				randomHit = random.nextInt(damage < 1 ? 1 : damage + 1);
    				if(randomHit > victim.getSkills().getLevel(Skills.HITPOINTS)) {
    					randomHit = victim.getSkills().getLevel(Skills.HITPOINTS);
    				}
    				hit = randomHit;
    				break;
    			default:
    			case MAGIC:
    				attacker.playAnimation(Animation.create(2656));
    				//attacker.playGraphics(Graphic.create(1, 0, 100));
    
    				hitDelay = 2;
    				blockAnimation = false;
    				maxHit = 50;
    				damage = damage(maxHit, attacker, victim, AttackType.MAGIC, Skills.MAGIC , Prayers.PROTECT_FROM_MAGIC, false, true);
    				randomHit = random.nextInt(damage < 1 ? 1 : damage + 1);
    				if(randomHit > victim.getSkills().getLevel(Skills.HITPOINTS)) {
    					randomHit = victim.getSkills().getLevel(Skills.HITPOINTS);
    				}
    				/**double jadReduction = CombatFormulae.jadReduction(victim);
    				if(jadReduction > 0) {
    					randomHit -= (randomHit * jadReduction);
    					if(randomHit < 0) {
    						randomHit = 0;
    					}
    				}**/
    				hit = randomHit;
    				break;
    			}		
    			
    			attacker.getCombatState().setAttackDelay(5);
    			attacker.getCombatState().setSpellDelay(5);
    			
    			World.getWorld().submit(new Tickable(hitDelay) {
    				@Override
    				public void execute() {
    					victim.inflictDamage(new Hit(hit), attacker);
    					smite(attacker, victim, hit);
    					recoil(attacker, victim, hit);
    					this.stop();
    				}			
    			});
    			vengeance(attacker, victim, hit, 1);
    			
    			victim.getActiveCombatAction().defend(attacker, victim, blockAnimation);
    		}
    		
    		@Override
    		public int distance(Mob attacker) {
    			return 5;
    		}
    }
    Code:
    <entry>
        <int>2745</int>
        <CombatDefinition>
          <maxHit>70</maxHit>
          <combatCooldownDelay>5</combatCooldownDelay>
          <respawnTicks>-1</respawnTicks>
          <aggressive>true</aggressive>
          <attack>
            <id>2655</id>
            <delay>0</delay>
          </attack>
          <defend>
            <id>2653</id>
            <delay>0</delay>
          </defend>
          <death>
            <id>2654</id>
            <delay>0</delay>
          </death>
          <attackType>CRUSH</attackType>
          <combatStyle>ACCURATE</combatStyle>
          <combatActionType>CUSTOM</combatActionType>
          <skills>
            <entry>
              <skill>ATTACK</skill>
              <int>160</int>
            </entry>
            <entry>
              <skill>DEFENCE</skill>
              <int>150</int>
            </entry>
            <entry>
              <skill>MAGIC</skill>
              <int>150</int>
            </entry>
            <entry>
              <skill>HITPOINTS</skill>
              <int>300</int>
            </entry>
          </skills>
          <bonuses>
            <int>180</int>
            <int>180</int>
            <int>180</int>
            <int>180</int>
            <int>180</int>
            <int>150</int>
            <int>150</int>
            <int>150</int>
            <int>150</int>
            <int>150</int>
            <int>150</int>
            <int>0</int>
            <int>0</int>
    		</bonuses>
          <constantDrops>
          </constantDrops>
          <randomDrops/>
        </CombatDefinition>
      </entry>
    Reply With Quote  
     

  2. #2  
    Registered Member Andrew's Avatar
    Join Date
    Nov 2008
    Posts
    2,887
    Thanks given
    602
    Thanks received
    196
    Rep Power
    490
    uppp
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Rs2-Server Thieving System
    By Jesse in forum Snippets
    Replies: 10
    Last Post: 04-25-2012, 04:08 PM
  2. Repost Rs2-server Web system
    By Jesse in forum Snippets
    Replies: 3
    Last Post: 02-04-2012, 12:06 AM
  3. Replies: 6
    Last Post: 04-22-2008, 02:43 PM
  4. The reason why RS2 Servers are Slow.
    By Inside Sin in forum RS2 Server
    Replies: 3
    Last Post: 03-02-2008, 09:32 PM
  5. Making a boss to your server, Ice queen!
    By Aconitic in forum Tutorials
    Replies: 10
    Last Post: 08-16-2007, 07:21 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •