Jump to content

Search the Community

Showing results for tags 'stages'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RuneLocus
    • News & Announcements
    • Information Booth
    • Website Support
    • Introductions
    • Chat
    • Forum Games
  • RuneScape Development
    • RSPS General
    • RuneScape Private Server (RS2)
    • RuneScape Private Server (503+)
    • RuneScape Private Server (EoC 742+)
  • Other
    • Digital Art
    • Gaming
    • Webdevelopment
    • Computers
  • Marketplace
    • RuneScape Market
    • RSPS Market
    • Others Market
    • Freelance Middleman Services
  • Super Secret Club's Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 3 results

  1. omniex

    npc skips stages :1

    I'm Still learning stuff i've been reading tutorials and figuring things out as I go. But [B]the problems I am having[/B] is the npc is [B]skipping case 0 and is going straight to case 1[/B]... Another thing is [B]even if I select a option[/B] at npc start talking [B]it goes straight to case 1 on all 3 starting options[/B] after case -1: Also sometimes when I add in certain cases it will tell me i have duplicate cases when I compile why is that? It's telling me I have Zero errors when I compile but it skips the dialogue i don't get it :/ If anyone is willing to help me that'd be great. [code] package com.rs.game.player.dialogues; import com.rs.utils.ShopsHandler; import com.rs.Settings; import com.rs.cache.loaders.NPCDefinitions; import com.rs.game.WorldTile; import com.rs.game.tasks.WorldTask; import com.rs.game.tasks.WorldTasksManager; import com.rs.game.World; import com.rs.game.Graphics; import com.rs.game.item.Item; public class Researcher extends Dialogue { private int npcId; [MENTION=15855]Over[/MENTION]ride public void start() { npcId = (Integer) parameters[0]; sendNPCDialogue(npcId, 9827, "Hello!, "+player.getDisplayName()+" Do you have any Ancient or Rare items for me to look at?" ); } [MENTION=15855]Over[/MENTION]ride public void run(int interfaceId, int componentId) { switch(stage) { case -1: stage = 0 sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE, "Who are you?", "Rare or Ancient items?", "I think found one of these ancient or rare items."); break; case 0: switch(componentId) { case OPTION_1: stage = 1; sendPlayerDialogue(9827, "Who are you?"); break; case OPTION_2: stage = 4; sendPlayerDialogue(9827, "Rare or Ancient items?"); break; case OPTION_3: stage = 8; sendPlayerDialogue(9827, "I think found one of these ancient or rare items, you were looking for."); break; } case 1: stage = 2; sendNPCDialogue(npcId, 9827, "Oh, Sorry for not introducing myself!. I am the head researcher in lumbridge castle I oversee all items, documents, and maps that come in or out."); break; case 2: stage = 3; sendNPCDialogue(npcId, 9827, "If you find anything you are un-sure about bring it to me and I'll take a look at it and see if I have any information on it. Some items I may even to restore power in it."); break; case 3: stage = 4; sendPlayerDialogue(9827, "What do these rare or ancient items include?"); break; case 4: stage = 5; sendNPCDialogue(npcId, 9827, "Well rumor has it there is a item that exist that can ###### increase magical damage. But nothing has been found to prove it is true. Unless someone could bring us the proof to show us other wise."); break; case 5: stage = 6; sendNPCDialogue(npcId, 9827, "But I doubt it, logic just doesn't support it. And well if we don't have it then it may just be a myth. unless shown other-wise."); case 6: stage = 7; sendNPCDialogue(npcId, 9827, "We've also found documentation about a design on the ###### bring one to me and I'll see what it does."); break; case 7: stage = -2; sendNPCDialogue(npcId, 9827, "I forgot to mention for me to do anything with any item I'll need #### and a #####."); break; case 8: stage = 9; sendNPCDialogue(npcId, 9827, "Really let me have a look!"); break; case 9: sendOptionsDialogue(SEND_DEFAULT_OPTIONS_TITLE, "######", "######"); stage = 10; break; case 10: switch(componentId) { case OPTION_1: stage = 11; if (player.getInventory().containsItem(#####, 1)); if (player.getInventory().containsItem(#####, 1)); if (player.getInventory().containsItem(#####, 1)); player.getInventory().deleteItem(#####, 1); player.getInventory().deleteItem(#####, 1); player.getInventory().deleteItem(#####, 1); player.getInventory().deleteItem(#, 1); player.getInventory().deleteItem(#####, 125); player.getInventory().addItem(#####, 1); sendNPCDialogue(npcId, 9827, "Oh my this is the #####. I can't believe my eyes that a item like this truly exist!"); break; case OPTION_2: stage = 13; if (player.getInventory().containsItem(#####, 1)); if (player.getInventory().containsItem(#, 1)); if (player.getInventory().containsItem(#####, 125)); player.getInventory().deleteItem(####, 1); player.getInventory().deleteItem(#, 1); player.getInventory().deleteItem(#####, 125); player.getInventory().addItem(#####, 1); sendNPCDialogue(npcId, 9827, "Alright thank you!, let me see what this design does for this particular item!"); break; } case 11: stage = 13; sendNPCDialogue(npcId, 9827, "I've binded the items together and this is what happend to the ##### it is truly remarkable"); break; case 12: stage = -2; sendNPCDialogue(npcId, 9827, "Please if you find any more please bring them to me!"); break; case 13: stage = 13; sendNPCDialogue(npcId, 9827, "I've binded the items together and this is what happend to the ##### it is truly remarkable"); break; default: end(); break; } } [MENTION=15855]Over[/MENTION]ride public void finish() { // TODO Auto-generated method stub } } [/code] another thing why the heck is this a thing on the forums? when trying to make a thread title... Tags cannot be overly common words (why)., Tags cannot be overly common words (but) [B]i've tried naming this as dialogue no errors but npc skips stages and the forum said i can't use but that's stupid.[/B] its not like i'm useing repeated words.
  2. Note this system is from Virtue, I take no credit. In NPCHandler.java declare: [CODE] public static int nexCountDown = 0; public boolean[] nexRoom = new boolean[4];[/CODE] and then find public static int getAttackEmote(int i) { under switch (NPCHandler.npcs[i].npcType) { add: [CODE]case 5633: if(npcs[i].nexStage == 1 || npcs[i].nexStage == 2) { switch(npcs[i].glod) { case 1: return 6987; case 2: return 6986; } } else if(npcs[i].nexStage == 3 || npcs[i].nexStage == 4) { switch(npcs[i].glod) { case 1: return 6987; case 2: return 6355; case 3: return 6984; } } else if(npcs[i].nexStage == 5 || npcs[i].nexStage == 6) { switch(npcs[i].glod) { case 1: case 2: return 6987; case 3: return 6948; } } else if(npcs[i].nexStage == 7 || npcs[i].nexStage == 8) { switch(npcs[i].glod) { case 1: case 2: case 3: return 6987; } } else if(npcs[i].nexStage == 9) { switch(npcs[i].glod) { case 1: return 6987; } } return 6354;[/CODE] Now under: public void hitTargetPlayer(Client c, int i, int hit) { add this under npcEffect(c, i, hit); [CODE]if(npcs[i].npcType == 5633) { switch(npcs[i].nexStage) { case 1: case 2: if(npcs[i].glod == 2) { if(c.virusDamage == 0) { c.virusTimer = 10; c.virusDamage = 5; c.forcedChat("*Cough*"); } } if(npcs[i].HP < 2400 && npcs[i].nexStage == 1) { npcs[i].forceChat("Fumus, don't fail me!"); npcs[i].nexStage = 2; nexRoom[0] = true; } break; case 3: case 4: if(npcs[i].glod == 3) { for(int fs = 0; fs < npcs[i].fearShadow.length; fs++) { if(npcs[i].fearShadow[fs][0] == 0) { npcs[i].fearShadow[fs][0] = c.absX; npcs[i].fearShadow[fs][1] = c.absY; break; } } final int DMG = Misc.random(60); final Client c1 = c; final int I = i; EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer e) { for(int ii = 0; ii < npcs[I].fearShadow.length; ii++) { if(npcs[I].fearShadow[ii][0] > 0) { if(c1.absX == npcs[I].fearShadow[ii][0] && c1.absY == npcs[I].fearShadow[ii][1]) { c1.setHitDiff(DMG); c1.playerLevel[3] -= DMG; c1.getPA().refreshSkill(3); c1.updateRequired = true; c1.setHitUpdateRequired(true); c1.logoutDelay = 20; npcs[I].fearShadow[ii][0] = npcs[I].fearShadow[ii][1] = 0; return; } else { npcs[I].fearShadow[ii][0] = npcs[I].fearShadow[ii][1] = 0; return; } } } e.stop(); } }, 1800); return; } if(npcs[i].HP < 1800 && npcs[i].nexStage == 3) { npcs[i].forceChat("Umbra, don't fail me!"); npcs[i].nexStage = 4; nexRoom[1] = true; } break; case 5: case 6: if(npcs[i].glod == 2) { npcs[i].HP += hit; if(npcs[i].HP > npcs[i].MaxHP) { npcs[i].HP = npcs[i].MaxHP; } c.playerLevel[5] /= 2; } if(npcs[i].glod == 3) { for(int t = 0; t < 1+Misc.random(2); t++) { newNPC3(7643, (npcs[i].absX+1)+Misc.random(2), (npcs[i].absY+1)+Misc.random(2), 0, 0, 101, 15, 140, 10, 2); } npcs[i].cooldown = 30; return; } if(npcs[i].HP < 1200 && npcs[i].nexStage == 5) { npcs[i].forceChat("Cruor, don't fail me!"); npcs[i].nexStage = 6; nexRoom[2] = true; } break; case 7: case 8: if(npcs[i].glod == 1) { if(c.freezeTimer < 0) { c.stopMovement(); c.sendMessage("You have been frozen!"); c.freezeTimer = 30; } } else if(npcs[i].glod == 2) { if(npcs[i].CONTAIN_THIS[0][0] > 0) { if(c.absX > npcs[i].CONTAIN_THIS[0][0] && c.absX < npcs[i].CONTAIN_THIS[1][0] && c.absY > npcs[i].CONTAIN_THIS[0][1] && c.absY < npcs[i].CONTAIN_THIS[1][1]) { int iced = Misc.random(65); c.setHitDiff(iced); c.playerLevel[3] -= iced; c.getPA().refreshSkill(3); c.updateRequired = true; c.setHitUpdateRequired(true); c.logoutDelay = 20; return; } else { return; } } } else if(npcs[i].glod == 3) { c.stopMovement(); int iced = Misc.random(60); c.setHitDiff(iced); c.playerLevel[3] -= iced; c.getPA().refreshSkill(3); c.updateRequired = true; c.setHitUpdateRequired(true); c.logoutDelay = 20; return; } else { return; } if(npcs[i].HP < 600 && npcs[i].nexStage == 7) { npcs[i].forceChat("Glacies, don't fail me!"); npcs[i].nexStage = 8; nexRoom[3] = true; } break; case 9: if(npcs[i].prayerUsed == 1) { npcs[i].HP += hit/5; } break; } }[/CODE] Now in public void attackPlayer(Client c, int i) { add: [CODE]} else if(npcs[i].npcType == 5633) { if(npcs[i].nexStage == 7 || npcs[i].nexStage == 8) { if(npcs[i].glod == 2) { npcs[i].CONTAIN_THIS[0][0] = npcs[i].absX-2; npcs[i].CONTAIN_THIS[0][1] = npcs[i].absY-2; npcs[i].CONTAIN_THIS[1][0] = npcs[i].absX+2; npcs[i].CONTAIN_THIS[1][1] = npcs[i].absY+2; int obx = 0, oby = 0; for(int s = 0; s < 4; s++) { c.getPA().globalObject(534, npcs[i].CONTAIN_THIS[0][0]+obx, npcs[i].CONTAIN_THIS[0][1], 0, 10, 0); c.getPA().globalObject(534, npcs[i].CONTAIN_THIS[1][0]-obx, npcs[i].CONTAIN_THIS[1][1], 0, 10, 0); c.getPA().globalObject(534, npcs[i].CONTAIN_THIS[1][0], npcs[i].CONTAIN_THIS[0][1]+oby, 0, 10, 0); c.getPA().globalObject(534, npcs[i].CONTAIN_THIS[0][0], npcs[i].CONTAIN_THIS[1][1]-oby, 0, 10, 0); obx++; oby++; } final Client c1 = c; final int I = i; EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer e) { int obX = 0, obY = 0; for(int s = 0; s < 4; s++) { c1.getPA().globalObject(-1, npcs[I].CONTAIN_THIS[0][0]+obX, npcs[I].CONTAIN_THIS[0][1], 0, 10, 0); c1.getPA().globalObject(-1, npcs[I].CONTAIN_THIS[1][0]-obX, npcs[I].CONTAIN_THIS[1][1], 0, 10, 0); c1.getPA().globalObject(-1, npcs[I].CONTAIN_THIS[1][0], npcs[I].CONTAIN_THIS[0][1]+obY, 0, 10, 0); c1.getPA().globalObject(-1, npcs[I].CONTAIN_THIS[0][0], npcs[I].CONTAIN_THIS[1][1]-obY, 0, 10, 0); obX++; obY++; } npcs[I].CONTAIN_THIS[0][0] = 0; e.stop(); } }, 4000); } else if(npcs[i].glod == 3) { c.getPA().globalObject(534, c.absX-1, c.absY-1, 0, 10, 0); c.getPA().globalObject(534, c.absX, c.absY-1, 0, 10, 0); c.getPA().globalObject(534, c.absX+1, c.absY-1, 0, 10, 0); c.getPA().globalObject(534, c.absX+1, c.absY, 0, 10, 0); c.getPA().globalObject(534, c.absX+1, c.absY+1, 0, 10, 0); c.getPA().globalObject(534, c.absX, c.absY+1, 0, 10, 0); c.getPA().globalObject(534, c.absX-1, c.absY+1, 0, 10, 0); c.getPA().globalObject(534, c.absX-1, c.absY, 0, 10, 0); final Client c1 = c; final int I = i; EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer e) { c1.getPA().globalObject(-1, c1.absX-1, c1.absY-1, 0, 10, 0); c1.getPA().globalObject(-1, c1.absX, c1.absY-1, 0, 10, 0); c1.getPA().globalObject(-1, c1.absX+1, c1.absY-1, 0, 10, 0); c1.getPA().globalObject(-1, c1.absX+1, c1.absY, 0, 10, 0); c1.getPA().globalObject(-1, c1.absX+1, c1.absY+1, 0, 10, 0); c1.getPA().globalObject(-1, c1.absX, c1.absY+1, 0, 10, 0); c1.getPA().globalObject(-1, c1.absX-1, c1.absY+1, 0, 10, 0); c1.getPA().globalObject(-1, c1.absX-1, c1.absY, 0, 10, 0); e.stop(); } }, 4000); } } }[/CODE] Under public static int distanceRequired(int i) { add: [CODE]case 5633: Client c11 = (Client)PlayerHandler.players[npcs[i].killerId]; if(goodDistance(npcs[i].absX, npcs[i].absY, c11.absX, c11.absY, 1 + npcs[i].getTotalNPCSize())) { if(npcs[i].nexStage == 1 || npcs[i].nexStage == 2) { npcs[i].glod = Misc.random2(2); } else if((npcs[i].nexStage == 3 || npcs[i].nexStage == 4) || (npcs[i].nexStage == 5 || npcs[i].nexStage == 6) || (npcs[i].nexStage == 7 || npcs[i].nexStage == 8)) { npcs[i].glod = Misc.random2(3); } else if(npcs[i].nexStage == 9) { npcs[i].glod = Misc.random(1); } } else { if(npcs[i].nexStage == 1 || npcs[i].nexStage == 2) { npcs[i].glod = 1+Misc.random2(1); } else if((npcs[i].nexStage == 3 || npcs[i].nexStage == 4) || (npcs[i].nexStage == 5 || npcs[i].nexStage == 6) || (npcs[i].nexStage == 7 || npcs[i].nexStage == 8)) { npcs[i].glod = 1+Misc.random2(2); } else if(npcs[i].nexStage == 9) { npcs[i].glod = 1; } } if(npcs[i].cooldown > 0) { if(((npcs[i].nexStage == 1 || npcs[i].nexStage == 2) && npcs[i].glod == 2) || ((npcs[i].nexStage == 3 || npcs[i].nexStage == 4) && npcs[i].glod == 2) || ((npcs[i].nexStage == 5 || npcs[i].nexStage == 6) && npcs[i].glod == 2 || npcs[i].glod == 3) || ((npcs[i].nexStage == 7 || npcs[i].nexStage == 8) && (npcs[i].glod == 2 || npcs[i].glod == 3))) { npcs[i].glod = 1; } } return 6 + npcs[i].getNPCSize();[/CODE] under getDeadEmote: [CODE] case 5633: return 6951;[/CODE] under public int getHitDelay(int i) { add: [CODE]case 5633: if(npcs[i].nexStage == 1 || npcs[i].nexStage == 2) { switch(npcs[i].glod){ case 1: case 2: return 4; } } else if(npcs[i].nexStage == 3 || npcs[i].nexStage == 4) { switch(npcs[i].glod){ case 1: case 2: return 4; } } else if(npcs[i].nexStage == 5 || npcs[i].nexStage == 6) { switch(npcs[i].glod){ case 1: case 2: return 4; } } else if(npcs[i].nexStage == 7 || npcs[i].nexStage == 8) { switch(npcs[i].glod){ case 1: return 4; case 2: case 3: return 6; } } else if(npcs[i].nexStage == 9) { switch(npcs[i].glod){ case 1: return 4; } } return 2;[/CODE] Under public int getNpcDelay(final int i) { add: [CODE]case 5633: if((npcs[i].nexStage == 3 || npcs[i].nexStage == 4) && npcs[i].glod == 3) { return 8; } if((npcs[i].nexStage == 5 || npcs[i].nexStage == 6) && npcs[i].glod == 3) { return 18; } if((npcs[i].nexStage == 7 || npcs[i].nexStage == 8) && (npcs[i].glod == 2 || npcs[i].glod == 3)) { return 8; } return 6;[/CODE] Now find public int getProjectileSpeed(int i) { under it find and switch(npcs[i].npcType) { and this under it: [CODE] case 5633: return 100;[/CODE] In getRespawnTime add: [CODE] case 5633: return 300[/CODE] Now find public void loadSpell(Client c, int i) { and add: [CODE]case 5633: if(npcs[i].nexStage == 1 || npcs[i].nexStage == 2) { if(npcs[i].glod == 1) { npcs[i].multiAttack = true; npcs[i].attackType = 2; npcs[i].projectileId = 386; npcs[i].endGfx = 390; } else if(npcs[i].glod == 2) { npcs[i].forceChat("Let the virus flow through you!"); npcs[i].multiAttack = true; npcs[i].attackType = 4; npcs[i].projectileId = -1; npcs[i].endGfx = -1; npcs[i].cooldown = 30; } else { npcs[i].attackType = 0; npcs[i].projectileId = -1; npcs[i].endGfx = -1; } } else if(npcs[i].nexStage == 3 || npcs[i].nexStage == 4) { if(npcs[i].glod == 1) { npcs[i].multiAttack = true; npcs[i].attackType = 1; npcs[i].projectileId = 378; npcs[i].endGfx = -1; } else if(npcs[i].glod == 2) { npcs[i].forceChat("Embrace darkness!"); npcs[i].multiAttack = true; npcs[i].attackType = 4; npcs[i].projectileId = -1; npcs[i].endGfx = -1; npcs[i].cooldown = 30; } else if(npcs[i].glod == 3) { npcs[i].forceChat("Fear the shadow!"); npcs[i].multiAttack = true; npcs[i].attackType = 4; npcs[i].projectileId = -1; npcs[i].endGfx = 382; } else { npcs[i].attackType = 0; npcs[i].projectileId = -1; npcs[i].endGfx = -1; } } else if(npcs[i].nexStage == 5 || npcs[i].nexStage == 6) { if(npcs[i].glod == 1) { npcs[i].multiAttack = true; npcs[i].attackType = 2; npcs[i].projectileId = 374; npcs[i].endGfx = 376; } else if(npcs[i].glod == 2) { npcs[i].forceChat("I demand a blood sacrifice!"); npcs[i].multiAttack = true; npcs[i].attackType = 2; npcs[i].projectileId = -1; npcs[i].endGfx = 377; npcs[i].cooldown = 20; } else if(npcs[i].glod == 3) { npcs[i].forceChat("A siphon will solve this!"); npcs[i].attackType = 2; npcs[i].projectileId = -1; npcs[i].endGfx = -1; } else { npcs[i].attackType = 0; npcs[i].projectileId = -1; npcs[i].endGfx = -1; } } else if(npcs[i].nexStage == 7 || npcs[i].nexStage == 8) { if(npcs[i].glod == 1) { npcs[i].multiAttack = true; npcs[i].attackType = 2; npcs[i].projectileId = 362; npcs[i].endGfx = 369; } else if(npcs[i].glod == 2) { npcs[i].forceChat("Contain this!"); npcs[i].multiAttack = true; npcs[i].attackType = 2; npcs[i].projectileId = -1; npcs[i].endGfx = -1; npcs[i].cooldown = 16; } else if(npcs[i].glod == 3) { npcs[i].forceChat("Die now, in a prison of ice!"); npcs[i].attackType = 2; npcs[i].projectileId = -1; npcs[i].endGfx = -1; npcs[i].cooldown = 16; } else { npcs[i].attackType = 0; npcs[i].projectileId = -1; npcs[i].endGfx = -1; } } else if(npcs[i].nexStage == 9) { if(npcs[i].glod == 1) { npcs[i].multiAttack = true; npcs[i].attackType = 2; npcs[i].projectileId = 386; npcs[i].endGfx = 390; } else { npcs[i].attackType = 0; npcs[i].projectileId = (npcs[i].prayerUsed == 1 ? 2263:-1); npcs[i].endGfx = (npcs[i].prayerUsed == 1 ? 2264:-1); } } break; [/CODE] now find public void multiAttackDamage(final int i) { replace the whole void with this: [CODE] public void multiAttackDamage(final int i) { int dmg2 = npcs[i].maxHit; final int max = getMaxHit(i); for (final Player player : PlayerHandler.players) { if (player != null) { final Client c = (Client) player; if (c.isDead || c.heightLevel != NPCHandler.npcs[i].heightLevel) { continue; } if (player.goodDistance(c.absX, c.absY, NPCHandler.npcs[i].absX, NPCHandler.npcs[i].absY, 15)) { if (NPCHandler.npcs[i].attackType == 2) { if ((15 + Misc.random(c.getCombat().calculateMagicDefence()) < Misc.random(Server.npcHandler.npcs[i].attack)) && !c.prayerActive[16]) { int damage = Misc.random(dmg2); switch(npcs[i].npcType) { case 6222: damage = Misc.random(21); break; case 6203: damage = Misc.random(30); break; case 3072: damage = Misc.random(20); break; case 5633: damage = Misc.random((55)); break; } npcs[i].multiAttack = false; hitTargetPlayer(c, i, damage); } else { int damage = Misc.random(dmg2); npcs[i].multiAttack = false; if(npcs[i].npcType == 3072 && npcs[i].dragon == 5) { hitTargetPlayer(c, i, damage/2); } if(npcs[i].npcType == 5633) { hitTargetPlayer(c, i, damage/2); } else { npcs[i].multiAttack = false; c.gfx100(85); return; } } } else if (NPCHandler.npcs[i].attackType == 1) { if ((15 + Misc.random(c.getCombat().calculateRangeDefence()) < Misc.random(Server.npcHandler.npcs[i].attack)) && !c.prayerActive[17]) { int damage = Misc.random(dmg2); if(npcs[i].npcType == 6260) { damage = Misc.random(35); } else if(npcs[i].npcType == 3072) { damage = Misc.random(25); } else if(npcs[i].npcType == 5633) { damage = Misc.random(40); } npcs[i].multiAttack = false; hitTargetPlayer(c, i, damage); } else { npcs[i].multiAttack = false; hitTargetPlayer(c, i, (npcs[i].npcType == 5633 ? Misc.random(40/2):0)); } } if (NPCHandler.npcs[i].endGfx > 0) { c.gfx0(NPCHandler.npcs[i].endGfx); } } c.getPA().refreshSkill(3); } } }[/CODE] find public boolean multiAttackingNPC(int i) { & add case 5633: (or the ID for Nex). Now, find: public void process() { and add this somewhere: [CODE]if(npcs[i].npcType == 5633) { if(nexCountDown > 0) { nexCountDown--; if(npcs[i].nexStage == 0) { if(nexCountDown == 24) { npcs[i].forceChat("AT LAST!"); } else if(nexCountDown == 18) { npcs[i].forceChat("Fumus!"); npcs[i].startAnimation(6987); npcs[i].turnNpc(2552, 4967); } else if(nexCountDown == 14) { npcs[i].forceChat("Umbra!"); npcs[i].startAnimation(6987); npcs[i].turnNpc(2567, 4967); } else if(nexCountDown == 10) { npcs[i].forceChat("Cruor!"); npcs[i].startAnimation(6987); npcs[i].turnNpc(2567, 4952); } else if(nexCountDown == 6) { npcs[i].forceChat("Glacies!"); npcs[i].startAnimation(6987); npcs[i].turnNpc(2552, 4952); } else if(nexCountDown == 2) { npcs[i].forceChat("Fill my soul with smoke!"); npcs[i].nexStage = 1; } } else if(npcs[i].nexStage == 2) { if(nexCountDown == 1) { npcs[i].forceChat("Darken my shadow!"); npcs[i].nexStage = 3; } } else if(npcs[i].nexStage == 4) { if(nexCountDown == 1) { npcs[i].forceChat("Flood my lungs with blood!"); npcs[i].nexStage = 5; } } else if(npcs[i].nexStage == 6) { if(nexCountDown == 1) { npcs[i].forceChat("Infuse me with the power of ice!"); npcs[i].nexStage = 7; } } else if(npcs[i].nexStage == 8) { if(nexCountDown == 1) { npcs[i].forceChat("NOW, THE POWER OF ZAROS!"); npcs[i].nexStage = 9; nexCountDown = 10; npcs[i].HP += 600; npcs[i].startAnimation(6326); NPCHandler.npcs[i].updateRequired = true; } } } }[/CODE] now find handleJadDeath under the } under it add: [CODE] if(npcs[i].npcType == 5633) { npcs[i].requestTransform(5636); npcs[i].forceChat("Taste my wrath!"); npcs[i].gfx0(2259); }[/CODE] now find npcs[i].isDead) { and add this somewherE: [CODE] } else if(npcs[i].npcType == 5633) { newNPC3(5630, 2552, 4967, 0, 0, 600, 32, 120, 100, 4); newNPC3(5632, 2567, 4967, 0, 0, 600, 32, 120, 100, 4); newNPC3(5631, 2567, 4952, 0, 0, 600, 32, 120, 100, 4); newNPC3(5629, 2552, 4952, 0, 0, 600, 32, 120, 100, 4); for(int nr = 0; nr < nexRoom.length; nr++) { nexRoom[nr] = false; } }[/CODE] Now open NPC.java add declare [CODE] int npcSize; public int prayerUsed = 0; public int extraHitDelay = 0, glod, deadCyle = 1; public final int[][] fearShadow = new int[100][100]; public int diliHits = 30, nexStage = 0, cooldown = 0, mustDie = 0; /** * Face */ public int FocusPointX = -1, FocusPointY = -1; public int face = 0;[/CODE] now add this somewhere: [CODE] public String Glod() { int talk = Misc.random(2); switch(talk) { case 1: return "Glod Angry!"; case 2: return "Glod Bash!"; } return "Glod Smash!"; }[/CODE] add the following anywhere: [CODE] public void turnNpc(final int i, final int j) { FocusPointX = 2 * i + 1; FocusPointY = 2 * j + 1; updateRequired = true; }[/CODE] Now open up Player.Java and add this somewhere: [CODE] public void poisonProcess() { Client p = (Client) Server.playerHandler.players[playerId]; if(virusTimer > -1) { virusTimer--; if (virusTimer == 0 && virusDamage > 0) { forcedChat("*Cough*"); playerLevel[3] -= (playerLevel[3] - virusDamage < 0 ? playerLevel[3]:virusDamage); setHitDiff(virusDamage); setHitUpdateRequired(true); updateRequired = true; p.getPA().refreshSkill(3); virusTimer = 10; virusDamage--; if(virusDamage == 0) { virusTimer = -1; p.sendMessage("The smoke clouds around you dissipate."); } } } }[/CODE] Now find public final int[] PRAYER_DRAIN_RATE = above that add: [CODE]public int virusTimer = -1, virusDamage = 0; public byte poisonMask = 0,[/CODE] Finally add a new class in server.model.npc, call the class NPCSize: [CODE]package server.model.npc; /** * NPC Sizes. * * @author Primadude. */ public class NPCSize { /** * Gets the size of the specified NPC. * * @param npcType * The type of the NPC. * @return The NPC size. */ public static int getNPCSize(int npcType) { int NPC_TYPE = 0; int NPC_SIZE = 1; for (int i = 0; i < NPC_SIZES.length; i++) { if (npcType == NPC_SIZES[i][NPC_TYPE]) { return NPC_SIZES[i][NPC_SIZE]; } } if(npcType >= 9948 && npcType <= 9957) { return 5; } else if(npcType >= 9912 && npcType <= 9928) { return 2; } else if(npcType == 9727) { return 4; } return 1; } /** * NPC Sizes. {NPC TYPE, SIZE}. */ private static final int[][] NPC_SIZES = { { 49, 2 }, { 50, 5 }, { 51, 2 }, { 52, 2 }, { 53, 4 }, { 54, 4 }, { 55, 4 }, { 69, 2 }, { 78, 2 }, { 79, 2 }, { 80, 2 }, { 81, 2 }, { 82, 2 }, { 83, 3 }, { 84, 3 }, { 85, 2 }, { 86, 2 }, { 87, 2 }, { 88, 2 }, { 89, 2 }, { 95, 2 }, { 96, 2 }, { 97, 2 }, { 105, 2 }, { 106, 2 }, { 107, 2 }, { 108, 2 }, { 110, 2 }, { 111, 2 }, { 112, 2 }, { 113, 2 }, { 114, 2 }, { 115, 2 }, { 116, 2 }, { 117, 2 }, { 130, 3 }, { 133, 2 }, { 135, 3 }, { 136, 2 }, { 137, 2 }, { 138, 2 }, { 141, 2 }, { 142, 2 }, { 143, 2 }, { 144, 2 }, { 146, 2 }, { 147, 2 }, { 148, 2 }, { 149, 2 }, { 150, 2 }, { 269, 2 }, { 270, 2 }, { 271, 2 }, { 374, 2 }, { 397, 2 }, { 446, 2 }, { 667, 3 }, { 677, 3 }, { 742, 4 }, { 752, 2 }, { 839, 2 }, { 840, 2 }, { 852, 2 }, { 853, 2 }, { 854, 2 }, { 855, 2 }, { 856, 2 }, { 857, 2 }, { 858, 2 }, { 859, 2 }, { 860, 2 }, { 861, 2 }, { 862, 2 }, { 863, 2 }, { 864, 2 }, { 865, 2 }, { 866, 2 }, { 867, 2 }, { 868, 2 }, { 869, 2 }, { 870, 2 }, { 871, 2 }, { 873, 2 }, { 874, 2 }, { 875, 2 }, { 876, 2 }, { 879, 2 }, { 880, 2 }, { 899, 2 }, { 909, 3 }, { 911, 3 }, { 934, 3 }, { 939, 2 }, { 941, 4 }, { 950, 2 }, { 955, 2 }, { 978, 2 }, { 986, 2 }, { 987, 2 }, { 991, 2 }, { 997, 3 }, { 998, 3 }, { 999, 3 }, { 1000, 3 }, { 1003, 2 }, { 1005, 2 }, { 1010, 2 }, { 1047, 2 }, { 1052, 2 }, { 1053, 2 }, { 1069, 2 }, { 1095, 2 }, { 1096, 2 }, { 1097, 2 }, { 1098, 2 }, { 1099, 2 }, { 1100, 2 }, { 1115, 2 }, { 1116, 2 }, { 1117, 2 }, { 1125, 3 }, { 1126, 2 }, { 1127, 2 }, { 1128, 2 }, { 1129, 2 }, { 1135, 2 }, { 1136, 2 }, { 1137, 2 }, { 1139, 2 }, { 1151, 2 }, { 1153, 2 }, { 1154, 3 }, { 1155, 4 }, { 1156, 2 }, { 1157, 4 }, { 1158, 5 }, { 1159, 5 }, { 1160, 5 }, { 1172, 3 }, { 1173, 3 }, { 1179, 2 }, { 1180, 2 }, { 1181, 2 }, { 1195, 2 }, { 1196, 2 }, { 1197, 2 }, { 1198, 2 }, { 1213, 2 }, { 1222, 2 }, { 1224, 2 }, { 1326, 2 }, { 1328, 2 }, { 1329, 2 }, { 1330, 2 }, { 1335, 2 }, { 1341, 2 }, { 1342, 2 }, { 1343, 2 }, { 1344, 2 }, { 1345, 2 }, { 1346, 2 }, { 1347, 2 }, { 1348, 3 }, { 1349, 3 }, { 1350, 3 }, { 1351, 3 }, { 1352, 3 }, { 1353, 3 }, { 1354, 3 }, { 1355, 3 }, { 1356, 3 }, { 1373, 2 }, { 1431, 2 }, { 1432, 2 }, { 1438, 2 }, { 1459, 2 }, { 1460, 2 }, { 1461, 2 }, { 1462, 2 }, { 1472, 3 }, { 1505, 2 }, { 1506, 2 }, { 1507, 2 }, { 1508, 2 }, { 1509, 2 }, { 1516, 3 }, { 1521, 2 }, { 1522, 2 }, { 1542, 3 }, { 1555, 2 }, { 1556, 2 }, { 1558, 2 }, { 1559, 2 }, { 1575, 2 }, { 1578, 3 }, { 1580, 2 }, { 1581, 2 }, { 1582, 2 }, { 1583, 2 }, { 1584, 2 }, { 1585, 2 }, { 1586, 2 }, { 1587, 2 }, { 1588, 2 }, { 1589, 2 }, { 1590, 4 }, { 1591, 4 }, { 1592, 4 }, { 1600, 2 }, { 1601, 2 }, { 1602, 2 }, { 1603, 2 }, { 1604, 2 }, { 1605, 2 }, { 1606, 2 }, { 1607, 2 }, { 1608, 3 }, { 1609, 3 }, { 1610, 3 }, { 1611, 3 }, { 1612, 2 }, { 1616, 2 }, { 1617, 2 }, { 1618, 2 }, { 1619, 2 }, { 1620, 2 }, { 1621, 3 }, { 1627, 2 }, { 1628, 2 }, { 1631, 2 }, { 1632, 2 }, { 1653, 2 }, { 1654, 2 }, { 1655, 2 }, { 1656, 2 }, { 1657, 2 }, { 1676, 2 }, { 1677, 2 }, { 1681, 2 }, { 1689, 3 }, { 1691, 2 }, { 1693, 2 }, { 1719, 2 }, { 1720, 2 }, { 1721, 2 }, { 1722, 2 }, { 1723, 2 }, { 1728, 2 }, { 1730, 2 }, { 1731, 2 }, { 1732, 2 }, { 1733, 2 }, { 1734, 2 }, { 1735, 2 }, { 1736, 2 }, { 1737, 2 }, { 1738, 2 }, { 1739, 3 }, { 1740, 3 }, { 1741, 2 }, { 1742, 3 }, { 1743, 3 }, { 1744, 3 }, { 1745, 2 }, { 1746, 2 }, { 1747, 3 }, { 1748, 3 }, { 1750, 2 }, { 1766, 2 }, { 1767, 2 }, { 1768, 2 }, { 1778, 2 }, { 1779, 2 }, { 1780, 2 }, { 1781, 2 }, { 1782, 2 }, { 1783, 2 }, { 1784, 2 }, { 1785, 2 }, { 1786, 2 }, { 1787, 2 }, { 1792, 2 }, { 1802, 2 }, { 1803, 2 }, { 1804, 2 }, { 1811, 2 }, { 1812, 2 }, { 1813, 2 }, { 1821, 2 }, { 1828, 2 }, { 1873, 2 }, { 1943, 2 }, { 1944, 2 }, { 1945, 2 }, { 1946, 2 }, { 1951, 2 }, { 1952, 2 }, { 1953, 2 }, { 1954, 2 }, { 1955, 2 }, { 1956, 2 }, { 1970, 2 }, { 1971, 2 }, { 1990, 2 }, { 1993, 2 }, { 1996, 2 }, { 1998, 2 }, { 1999, 2 }, { 2000, 2 }, { 2022, 3 }, { 2033, 2 }, { 2038, 2 }, { 2039, 2 }, { 2040, 2 }, { 2041, 2 }, { 2042, 2 }, { 2043, 2 }, { 2044, 2 }, { 2045, 2 }, { 2046, 2 }, { 2047, 2 }, { 2048, 2 }, { 2049, 2 }, { 2050, 2 }, { 2051, 2 }, { 2052, 2 }, { 2053, 2 }, { 2054, 2 }, { 2055, 2 }, { 2056, 2 }, { 2057, 2 }, { 2060, 3 }, { 2063, 2 }, { 2064, 2 }, { 2065, 2 }, { 2240, 2 }, { 2252, 2 }, { 2254, 2 }, { 2255, 2 }, { 2289, 2 }, { 2317, 2 }, { 2417, 2 }, { 2418, 2 }, { 2419, 2 }, { 2434, 2 }, { 2452, 2 }, { 2453, 2 }, { 2482, 2 }, { 2534, 3 }, { 2554, 3 }, { 2555, 3 }, { 2556, 3 }, { 2557, 3 }, { 2558, 3 }, { 2559, 3 }, { 2560, 3 }, { 2561, 3 }, { 2562, 3 }, { 2563, 3 }, { 2629, 2 }, { 2630, 2 }, { 2631, 3 }, { 2632, 3 }, { 2637, 2 }, { 2640, 2 }, { 2641, 3 }, { 2642, 5 }, { 2644, 2 }, { 2651, 2 }, { 2722, 2 }, { 2723, 2 }, { 2736, 2 }, { 2737, 2 }, { 2739, 3 }, { 2740, 3 }, { 2741, 4 }, { 2742, 4 }, { 2743, 5 }, { 2744, 5 }, { 2745, 5 }, { 2783, 3 }, { 2801, 2 }, { 2803, 3 }, { 2804, 2 }, { 2805, 2 }, { 2806, 2 }, { 2809, 2 }, { 2810, 2 }, { 2811, 2 }, { 2812, 2 }, { 2813, 2 }, { 2814, 2 }, { 2815, 2 }, { 2849, 2 }, { 2850, 2 }, { 2880, 2 }, { 2881, 3 }, { 2882, 3 }, { 2883, 3 }, { 2885, 2 }, { 2886, 2 }, { 2889, 2 }, { 2890, 2 }, { 2919, 3 }, { 2920, 3 }, { 2921, 3 }, { 3051, 2 }, { 3052, 2 }, { 3053, 2 }, { 3054, 2 }, { 3055, 2 }, { 3056, 2 }, { 3058, 2 }, { 3063, 2 }, { 3064, 2 }, { 3066, 2 }, { 3068, 3 }, { 3069, 3 }, { 3070, 3 }, { 3071, 3 }, { 3072, 2 }, { 3076, 2 }, { 3077, 2 }, { 3100, 2 }, { 3101, 2 }, { 3103, 2 }, { 3124, 2 }, { 3125, 2 }, { 3129, 2 }, { 3130, 2 }, { 3132, 2 }, { 3133, 2 }, { 3134, 2 }, { 3135, 2 }, { 3140, 3 }, { 3154, 2 }, { 3200, 3 }, { 3203, 3 }, { 3301, 3 }, { 3309, 2 }, { 3332, 5 }, { 3333, 5 }, { 3334, 5 }, { 3337, 3 }, { 3338, 3 }, { 3339, 4 }, { 3340, 3 }, { 3347, 2 }, { 3376, 2 }, { 3398, 2 }, { 3419, 2 }, { 3420, 2 }, { 3421, 2 }, { 3423, 2 }, { 3443, 2 }, { 3444, 2 }, { 3445, 3 }, { 3446, 2 }, { 3447, 2 }, { 3448, 3 }, { 3463, 2 }, { 3464, 2 }, { 3466, 2 }, { 3467, 2 }, { 3468, 2 }, { 3469, 5 }, { 3470, 5 }, { 3471, 5 }, { 3472, 5 }, { 3476, 3 }, { 3477, 3 }, { 3484, 2 }, { 3493, 3 }, { 3494, 5 }, { 3497, 3 }, { 3498, 3 }, { 3499, 3 }, { 3500, 3 }, { 3501, 3 }, { 3502, 3 }, { 3519, 2 }, { 3530, 3 }, { 3556, 2 }, { 3558, 2 }, { 3585, 2 }, { 3586, 2 }, { 3587, 2 }, { 3588, 2 }, { 3589, 3 }, { 3590, 3 }, { 3591, 3 }, { 3592, 3 }, { 3593, 3 }, { 3594, 2 }, { 3599, 3 }, { 3600, 4 }, { 3601, 5 }, { 3602, 3 }, { 3603, 3 }, { 3604, 4 }, { 3605, 5 }, { 3606, 2 }, { 3607, 2 }, { 3608, 2 }, { 3609, 2 }, { 3610, 2 }, { 3611, 2 }, { 3612, 3 }, { 3613, 3 }, { 3614, 3 }, { 3636, 2 }, { 3637, 4 }, { 3645, 2 }, { 3646, 2 }, { 3647, 2 }, { 3649, 2 }, { 3650, 2 }, { 3651, 2 }, { 3652, 2 }, { 3653, 2 }, { 3654, 2 }, { 3655, 2 }, { 3656, 2 }, { 3657, 2 }, { 3658, 3 }, { 3659, 3 }, { 3660, 3 }, { 3661, 2 }, { 3662, 2 }, { 3664, 2 }, { 3665, 2 }, { 3666, 2 }, { 3667, 2 }, { 3668, 2 }, { 3669, 2 }, { 3670, 2 }, { 3675, 2 }, { 3676, 2 }, { 3681, 3 }, { 3772, 2 }, { 3773, 2 }, { 3774, 2 }, { 3775, 2 }, { 3776, 2 }, { 6142, 3 }, { 6143, 3 }, { 6144, 3 }, { 6145, 3 }, { 3808, 3 }, { 3819, 3 }, { 3835, 5 }, { 3836, 5 }, { 5529, 2 }, { 6829, 2 }, { 6831, 2 }, { 6847, 2 }, { 6994, 2 }, { 6871, 2 }, { 6847, 2 }, { 6853, 2 }, { 6875, 2 }, { 6877, 2 }, { 6879, 2 }, { 6881, 2 }, { 6883, 2 }, { 6885, 2 }, { 6887, 2 }, { 6855, 2 }, { 6794, 2 }, { 6857, 2 }, { 7363, 2 }, { 7365, 2 }, { 7337, 2 }, { 6802, 2 }, { 6859, 2 }, { 6815, 2 }, { 6813, 2 }, { 6839, 2 }, { 8575, 2 }, { 7345, 2 }, { 6861, 2 }, { 7347, 2 }, { 6800, 2 }, { 7355, 2 }, { 7357, 2 }, { 7359, 2 }, { 6811, 2 }, { 6804, 2 }, { 7341, 2 }, { 7329, 2 }, { 6863, 2 }, { 6822, 2 }, { 7339, 2 }, { 7349, 2 }, { 7375, 2 }, { 6873, 2 }, { 7343, 2 }, { 5807, 5 }, { 8349, 3 }, { 8350, 3 }, { 8351, 3 } }; }[/CODE] and just incase anyone needs this: [CODE]package server.model.npcs; public class NPCDefinitions { public static int NPCS = 15000; private static NPCDefinitions[] definitions = new NPCDefinitions[NPCS]; /** * @return the definitions */ public static NPCDefinitions[] getDefinitions() { return definitions; } private int npcId; private String npcName; private int npcCombat; private int npcHealth; public NPCDefinitions(int _npcId) { npcId = _npcId; } public NPCDefinitions(NPCDefinitions def) { definitions[def.getNpcId()] = def; } /** * @return the npcId */ public int getNpcId() { return npcId; } /** * @param npcId * the npcId to set */ public void setNpcId(int npcId) { this.npcId = npcId; } /** * @return the npcName */ public String getNpcName() { return npcName; } /** * @param npcName * the npcName to set */ public void setNpcName(String npcName) { this.npcName = npcName; } /** * @return the npcCombat */ public int getNpcCombat() { return npcCombat; } /** * @param npcCombat * the npcCombat to set */ public void setNpcCombat(int npcCombat) { this.npcCombat = npcCombat; } /** * @return the npcHealth */ public int getNpcHealth() { return npcHealth; } /** * @param npcHealth * the npcHealth to set */ public void setNpcHealth(int npcHealth) { this.npcHealth = npcHealth; } }[/CODE] [CODE]public void newNPC3(int npcType, int x, int y, int heightLevel, int WalkingType, int HP, int maxHit, int attack, int defence, int size) { // first, search for a free slot int slot = -1; for (int i = 1; i < maxNPCs; i++) { if (npcs[i] == null) { slot = i; break; } } if (slot == -1) return; // no free slot found NPC newNPC = new NPC(slot, npcType); newNPC.absX = x; newNPC.absY = y; newNPC.makeX = x; newNPC.makeY = y; newNPC.heightLevel = heightLevel; newNPC.walkingType = WalkingType; newNPC.HP = HP; newNPC.MaxHP = HP; newNPC.maxHit = maxHit; newNPC.attack = attack; newNPC.defence = defence; newNPC.npcSize = size; npcs[slot] = newNPC; /*if (npcType == 1160) { npcs[slot].actionTimer = 4; npcs[slot].startAnimation(6237);*/ } }[/CODE] Not sure if I missed anything, if I have just say so.
  3. bl00dz

    562 Nex Stages

    Hi i am using a PDF base and I am using beuners nex minigame and I saw that mystic flow released this code for nex. Where would i put this code? I really really really want this! Maybe someone could do it on teamviewer for me? package org.dementhium.model.npc.impl.godwars; import java.util.ArrayList; import java.util.List; import java.util.Random; import org.dementhium.content.misc.Following; import org.dementhium.content.skills.Prayer; import org.dementhium.model.Location; import org.dementhium.model.Mob; import org.dementhium.model.World; import org.dementhium.model.combat.CombatAction; import org.dementhium.model.combat.CombatHit; import org.dementhium.model.combat.Combat.FightType; import org.dementhium.model.map.ObjectManager; import org.dementhium.model.map.Region; import org.dementhium.model.mask.Animation; import org.dementhium.model.mask.Graphic; import org.dementhium.model.misc.ProjectileManager; import org.dementhium.model.misc.DamageManager.DamageType; import org.dementhium.model.npc.NPC; import org.dementhium.model.player.Player; import org.dementhium.net.ActionSender; import org.dementhium.tickable.Tick; import org.dementhium.tickable.impl.CountdownTick; import org.dementhium.tickable.impl.NexVirusTick; import org.dementhium.util.Misc; import org.dementhium.util.misc.Sounds; /** * * [url]http://runescape.wikia.com/wiki/NEX[/url] * Solo basic gameplay -> [url]http://www.youtube.com/watch?v=BLqcYbuNLqg[/url] * Advanced team gameplay -> [url]http://www.youtube.com/watch?v=K4wxNdm3NK8[/url] * Further solo gameplay -> [url]http://www.youtube.com/watch?v=3-vxug6HOXU[/url] * * @author 'Mystic Flow (Wrote the whole class) * @author MangiS (Id's) * @author cart (Information on attacks) * @author Steve (Camera movement) * * @note THIS IS A FUCKING MESS */ public class Nex extends NPC { /* 1215 1216 1217 1218 1219 1271 - clouds ??? 1190 1189 2932 2931 471 14 - grapple mithril 354+ interesting stopped at 700 */ //2777+ dungeon emotes //wrath gfx 2261 //2244 = gfx id for projectiles //1214 might be attack //2767 - when nex grabs you //2870 /************************************************ * The room beyond this point is a prison! * There is no way out other than death or teleport * Only those who can endure dangerous encounters should proceed. * * There is currently one person (no one) fighting. * Do you wish to join them? * * Climb Down. * Stay here. * * -> If you try attack a minion (The avatar is not weak enough to damage this minion.) * ***********************************************/ //In red - Nex has marked you as a sacrifice, RUN! //You didn't make it far enough in time - Nex fires a punishing attack! public static enum NexPhase { SPAWNED(null, null, -1, -1), // we can't attack at this stage SMOKE("Fill my soul with smoke!", "fumus", Sounds.NexFumus, Sounds.NexFillSmoke), // When we gain powers from Fumus SHADOW("Darken my shadow!", "umbra", Sounds.NexUmbra, Sounds.NexEmbraceDarkness), //When we gain powers from Umbra BLOOD("Flood my lungs with blood!", "cruor", Sounds.NexCrour, Sounds.NexFloodBlood), //When we gain powers from Cruor ICE("Infuse me with the power of ice!", "glacies", Sounds.NexGlacies, Sounds.NexInfuseMeIce), //When we gain powers from Glacies FINAL("NOW, THE POWER OF ZAROS!", null, -1, Sounds.NexPowerOfZaros); //The last phase Nex has private String initialMessage, minionName; private int initialSoundId, soundId; private NexPhase(String initialMessage, String minionName, int initialSoundId, int soundId) { this.initialMessage = initialMessage; this.minionName = minionName; this.initialSoundId = initialSoundId; this.soundId = soundId; } } public static final int DEFAULT_NEX_ID = 13447, SOUL_SPLIT_NEX = 13448, MELEE_DEFLECT_NEX = 13449, WRATH_NEX = 13450; private static final int REAVER_ID = 13458; private static final Animation SPAWN_ANIMATION = Animation.create(6355); private static final Animation THROW_ANIMATION = Animation.create(6986); private static final Animation CAST_ANIMATION = Animation.create(6987); private static final Animation ATTACK_ANIMATION = Animation.create(6354); private static final Animation FLY_ANIMATION = Animation.create(6321); private static final Animation SIPHON_ANIMATION = Animation.create(6948); private static final Animation SMASH_ANIMATION = Animation.create(6984); private static final Animation TURMOIL_ANIMATION = Animation.create(6326); private static final Animation FALL_BACK_ANIMATION = Animation.create(10070); private static final Animation DRAG_ANIMATION = Animation.create(14388); private static final Graphic PURPLE_SMOKE_GRAPHIC = Graphic.create(1217); private static final Graphic FLYING_PURPLE_SMOKE = Graphic.create(1216); private static final Graphic CAST_GRAPHICS = Graphic.create(1214); private static final Graphic SMASH_SMOKE = Graphic.create(1215); private static final Graphic TURMOIL_GRAPHICS = Graphic.create(1204); private static final Graphic[] AFTERMATH_GRAPHICS = { null, Graphic.create(471), null, Graphic.create(376), Graphic.create(362), null }; private static final Location[] NO_ESCAPE_TELEPORTS = { Location.locate(2924, 5213, 0), //north, left side from area Location.locate(2934, 5202, 0), //east, upwards from area Location.locate(2924, 5192, 0), //south, right side from area Location.locate(2913, 5202, 0), //west }; public static final int FUMUS = 13451, UMBRA = 13452, CRUOR = 13453, GLACIES = 13454; private NexPhase phase = NexPhase.SPAWNED; private NexCombatAction combatAction; private boolean changingPhase; private boolean noEscapeAttack; private long lastEscapeAttack; private long lastDragAttack; private long lastShadowAttack; private long lastPrayerSwitch; private boolean protectingMinion; private boolean protectingCruor; private boolean castedVirus; private boolean castedShadow; private boolean siphonMode; public Nex(int id) { super(id); combatAction = new NexCombatAction(); } @Override public boolean isNex() { return true; } @Override public CombatAction getCustomCombatAction() { return combatAction; } public boolean noEscapeAttack() { return noEscapeAttack; } public boolean isAttackable() { return phase != NexPhase.SPAWNED && !noEscapeAttack; } public boolean isProtectingMinion() { return protectingMinion; } public boolean isProtectingCruor() { return protectingCruor; } public boolean isSiphonMode() { return siphonMode; } public NexPhase getPhase() { return phase; } public void playSound(int sound) { for(Player player : World.getWorld().getPlayers()) { if(player.getLocation().distance(getLocation()) < 18) { ActionSender.sendSound(player, sound, 100, 255, true); } } } /** * @author 'Mystic Flow */ public static class NexAreaEvent extends Tick { private static final NexAreaEvent INSTANCE = new NexAreaEvent(); private static final Location AREA_CENTER = Location.locate(2924, 5203, 0); public static NexAreaEvent getNexAreaEvent() { return INSTANCE; } private Nex nex; private int spawnDelay, minionSpawnDelay, minionSpawnStage; private boolean spawned; private NPC[] minions = new NPC[4]; private Random random = new Random(); private int delay; public NexAreaEvent() { super(2); } @Override public void execute() { if(nex == null) { if(delay > 0) { delay--; return; } boolean startSpawn = false; for(Player player : Region.getLocalPlayers(AREA_CENTER, 12)) { if(player.isOnline()) { if(World.getWorld().getAreaManager().getAreaByName("Nex").contains(player.getLocation())) { startSpawn = true; break; } } } if(startSpawn) { nex = new Nex(DEFAULT_NEX_ID); nex.setLocation(AREA_CENTER); nex.setOriginalLocation(AREA_CENTER); nex.setDoesWalk(false); // custom movements nex.loadEntityVariables(); nex.setUnrespawnable(true); spawnDelay = 10; //20 ticks } } else { if(nex.isDead()) { nex = null; spawned = false; minionSpawnStage = 0; delay = 75; for(NPC minion : minions) { if(minion != null) { minion.sendDead(); } } return; } if(spawned) { if(minionSpawnDelay > 0) { if(minionSpawnDelay % 4 == 0 && minionSpawnDelay != 20) { spawnMinion(NexPhase.values()[++minionSpawnStage]); } minionSpawnDelay--; } else { for(NPC minion : minions) { if(minion != null) { minion.turnTo(nex); } } if(nex.phase == NexPhase.SPAWNED) { changePhase(NexPhase.SMOKE); } checkLife(); switch(nex.phase) { case SMOKE: smokeAttack(); break; case SHADOW: shadowAttack(); break; case BLOOD: bloodAttack(); break; case ICE: iceAttack(); break; case FINAL: zarosAttack(); break; } if(!nex.changingPhase && !nex.noEscapeAttack && nex.phase != NexPhase.SPAWNED) { int closestDistance = -1; Mob closeMob = null; for(Player player : World.getWorld().getPlayers()) { if(nex.getLocation().distance(player.getLocation()) > 16) { continue; } int distance = Misc.getDistance(nex.getLocation().getX(), nex.getLocation().getY(), player.getLocation().getX(), player.getLocation().getY()); if(closestDistance == -1 || closestDistance > distance) { closestDistance = distance; closeMob = player; } } if (closeMob != null) { nex.getCombatState().setVictim(closeMob); } } if(nex.phase == NexPhase.SMOKE || nex.phase == NexPhase.FINAL) { if(!nex.changingPhase && !nex.noEscapeAttack) { if(random.nextInt(100) < (nex.phase == NexPhase.FINAL ? 5 : 30) && dragAttack()) { return; } noEscapeAttack(); } } } return; } if(spawnDelay > 0) { spawnDelay--; } else { nex.animate(SPAWN_ANIMATION); nex.graphics(PURPLE_SMOKE_GRAPHIC); nex.forceText("AT LAST!"); nex.playSound(Sounds.NexAtLast); World.getWorld().getNpcs().add(nex); spawned = true; minionSpawnDelay = 20; setTime(1); } } } private void zarosAttack() { if(System.currentTimeMillis() - nex.lastPrayerSwitch > 10000 + Misc.random(10000)) { int switchId = DEFAULT_NEX_ID + Misc.random(2); while(switchId == nex.getId()) { // so we don't see the same phase switchId = DEFAULT_NEX_ID + Misc.random(2); } if(nex.lastPrayerSwitch == 0L) { switchId = SOUL_SPLIT_NEX; } nex.lastPrayerSwitch = System.currentTimeMillis(); nex.getMask().setSwitchId(switchId); } } private void iceAttack() { boolean attacking = nex.hasTick("ice_attack"); if(!attacking) { nex.getCombatState().setSpellDelay(4); nex.getCombatState().setAttackDelay(4); if(random.nextInt(100) <= 45) { nex.forceText("Contain this!"); nex.playSound(Sounds.NexContainThis); nex.animate(SMASH_ANIMATION); nex.graphics(SMASH_SMOKE); final Location currentLocation = nex.getLocation().transform(1, 1, 0); nex.submitTick("ice_attack", new Tick(3) { private boolean done; public void execute() { if(!done) { done = true; setTime(25); for(int x = -1; x <= 1; x++) { for(int y = -1; y <= 1; y++) { if(x == y) { continue; } final Location loc = currentLocation.transform(x, y, 0); if(loc != currentLocation && !loc.hasObjects()) { if(loc.containsPlayers()) { for(Player attack : loc.getPlayers()) { attack.getDamageManager().damage(nex, random.nextInt(350), 350, DamageType.RED_DAMAGE); attack.sendMessage("The icicle spike you to the spot!"); if(attack.getPrayer().isAncientCurses()) { attack.getPrayer().closeOnPrayers(1, new int[] {Prayer.DEFLECT_MAGIC, Prayer.DEFLECT_MELEE, Prayer.DEFLECT_MISSILES, Prayer.DEFLECT_SUMMONING}); } else { attack.getPrayer().closeOnPrayers(0, new int[] {Prayer.PROTECT_FROM_MAGIC, Prayer.PROTECT_FROM_MISSILES, Prayer.PROTECT_FROM_MELEE, Prayer.PROTECT_FROM_SUMMONING}); } attack.getPrayer().recalculatePrayer(); attack.getMask().setApperanceUpdate(true); attack.stun(5, "You've been injured and can't use " + (attack.getPrayer().isAncientCurses() ? "deflect curses" : "protection prayers ") + "!", false); attack.submitTick("nex_drag", new CountdownTick(attack, 15, null)); // only way to prevent prayers :s } } ObjectManager.addCustomObject(57262, loc.getX(), loc.getY(), 0, 10, 0); World.getWorld().submit(new Tick(5) { public void execute() { stop(); ObjectManager.clearArea(nex.getLocation(), 25); } }); } } } return; } stop(); } }); } else { //You managed to destroy the icicle! nex.forceText("Die now, in a prison of ice!"); nex.playSound(Sounds.NexDieNowInPrison); nex.submitTick("ice_attack", new Tick(2) { private boolean done; public void execute() { if(!done) { done = true; setTime(25); List<Player> locPlayers = Region.getLocalPlayers(nex.getLocation(), 14); if(locPlayers.size() > 0) { final Player player = locPlayers.get(random.nextInt(locPlayers.size())); if(player != null && !player.isDead()) { final Location currentLocation = player.getLocation(); for(int x = -1; x <= 1; x++) { for(int y = -1; y <= 1; y++) { final Location loc = currentLocation.transform(x, y, 0); if(!loc.hasObjects()) { ObjectManager.addCustomObject(57263, loc.getX(), loc.getY(), 0, 10, 0); player.submitTick("ice_prison", new Tick(4) { private boolean remove = false; public void execute() { if(remove) { ObjectManager.removeCustomObject(loc.getX(), loc.getY(), 0, 10, true); stop(); } setTime(1); remove = true; if(player.getLocation() == currentLocation) { player.sendMessage("The centre of the ice prison freezes you to the bone!"); player.getDamageManager().damage(nex, random.nextInt(600), 600, DamageType.RED_DAMAGE); } } }); } } } } } } stop(); } }); } } } private void bloodAttack() { if(!nex.hasTick("siphon")) { nex.forceText("A siphon will solve this!"); nex.playSound(Sounds.NexSiphon); nex.siphonMode = true; nex.animate(SIPHON_ANIMATION); nex.setCanAnimate(false); final NPC bloodReaver = World.getWorld().register(Nex.REAVER_ID, nex.getLocation()); bloodReaver.setUnrespawnable(true); nex.submitTick("siphon", new Tick(8) { private boolean done = false; public void execute() { if(done) { if(bloodReaver != null && !bloodReaver.isDead()) { //nex.heal(bloodReaver.getHitPoints()); bloodReaver.setHidden(true); bloodReaver.sendDead(); } stop(); } else { done = true; nex.siphonMode = false; nex.setCanAnimate(true); setTime(35); } } }); return; } if(!nex.siphonMode && !nex.hasTick("blood_sacrifice")) { nex.forceText("I demand a blood sacrifice!"); nex.playSound(Sounds.NexBloodSacrifice); nex.submitTick("blood_sacrifice", new Tick(2) { private boolean done; public void execute() { if(!done) { done = true; for(final Player player : Region.getLocalPlayers(nex.getLocation(), 2)) { if(!player.isDead()) { player.sendMessage("Nex has marked you as a sacrifice, RUN!"); final Location currentLocation = player.getLocation(); World.getWorld().submit(new Tick(2) { @Override public void execute() { stop(); if(player.getLocation() == currentLocation) { player.sendMessage("You didn't make it far enough in time - Nex fires a punishing attack!"); for(final Player pl : World.getWorld().getPlayers()) { if(pl.getLocation().distance(player.getLocation()) < 18) { nex.animate(CAST_ANIMATION); ProjectileManager.sendDelayedProjectile(nex, pl, 374, false); World.getWorld().submit(new Tick(3) { @Override public void execute() { stop(); int damage = random.nextInt(300); pl.getDamageManager().damage(nex, damage, 300, DamageType.MAGE); pl.getSkills().drainPray(pl.getSkills().getLevel(5) / 2); nex.graphics(377); nex.heal(Math.round(damage * 0.15F)); } }); } } } } }); break; } } setTime(10); return; } stop(); } }); } } private void smokeAttack() { if(nex.castedVirus) { boolean noVirus = true; for(Player player : World.getWorld().getPlayers()) { // prefer this over region if(player.getLocation().distance(AREA_CENTER) < 25) { if(player.hasTick("nex_virus")) { noVirus = false; break; } } } if(noVirus) { nex.castedVirus = false; } } } private void shadowAttack() { if(System.currentTimeMillis() - nex.lastShadowAttack >= 5400 && !nex.castedShadow) { final List<Player> localPlayers = new ArrayList<Player>(); for(Player player : World.getWorld().getPlayers()) { if(player.getLocation().distance(nex.getLocation()) <= 10) { localPlayers.add(player); } } if(localPlayers.size() == 0) { return; } nex.castedShadow = true; nex.lastShadowAttack = System.currentTimeMillis(); final Location[] locationArray = new Location[localPlayers.size()]; final boolean distanceAttack = random.nextInt(100) < 75; if(distanceAttack) { nex.forceText("Embrace darkness!"); nex.playSound(Sounds.NexEmbraceDarkness); } else { nex.forceText("Fear the shadow!"); nex.playSound(Sounds.NexFearTheShadow); } int index = 0; for(Player player : localPlayers) { locationArray[index++] = player.getLocation(); for(Player local : localPlayers) { ActionSender.sendObject(local, 57261, player.getLocation().getX(), player.getLocation().getY(), 0, 10, 0); } } localPlayers.clear(); World.getWorld().submit(new Tick(3) { @Override public void execute() { nex.castedShadow = false; stop(); for(Player player : World.getWorld().getPlayers()) { if(player.getLocation().distance(nex.getLocation()) <= 10) { localPlayers.add(player); } } for(Player player : localPlayers) { for(Location loc : locationArray) { ActionSender.deleteObject(player, 57261, loc.getX(), loc.getY(), 0, 10, 0); ActionSender.sendPositionedGraphic(player, loc, 383); if(player.getLocation() == loc) { int damageInflicted = 400 + Misc.random(distanceAttack ? player.getLocation().distance(nex.getLocation()) * 50 : 400); player.getDamageManager().damage(nex, damageInflicted, 1000, DamageType.MAGE); } } } } }); } } public void spawnMinion(NexPhase phase) { NPC minion; switch(phase) { case SMOKE: minion = new NPC(FUMUS, Location.locate(2912, 5216, 0)); break; case SHADOW: minion = new NPC(UMBRA, Location.locate(2937, 5216, 0)); break; case BLOOD: minion = new NPC(CRUOR, Location.locate(2937, 5190, 0)); break; default: minion = new NPC(GLACIES, Location.locate(2912, 5190, 0)); } nex.forceText(Misc.upperFirst(phase.minionName) + "!"); nex.playSound(phase.initialSoundId); nex.animate(THROW_ANIMATION); nex.getMask().setFacePosition(minion.getLocation(), 1, 1); minion.turnTo(nex); minion.setAttribute("cantMove", Boolean.TRUE); World.getWorld().getNpcs().add(minion); ProjectileManager.sendGlobalProjectile(2244, minion, nex, 37, 60, 50); minions[phase.ordinal() - 1] = minion; } private void checkLife() { if(nex.protectingMinion) { int index = nex.phase.ordinal() - 1; if(minions[index] != null) { if(minions[index].isDead() || minions[index].destroyed()) { changePhase(NexPhase.values()[index + 2]); minions[index] = null; } } return; } int hitpoints = nex.getHitPoints(); int maxHitpoints = nex.getMaximumHitPoints(); if(hitpoints <= maxHitpoints * 0.8 && nex.phase == NexPhase.SMOKE) { nex.protectingMinion = true; nex.forceText("Fumus, don't fail me!"); nex.playSound(Sounds.NexFumusDontFail); } if(hitpoints <= maxHitpoints * 0.6 && nex.phase == NexPhase.SHADOW) { nex.protectingMinion = true; nex.forceText("Umbra, don't fail me!"); nex.playSound(Sounds.NexUmbraDontFail); } if(hitpoints <= maxHitpoints * 0.4 && nex.phase == NexPhase.BLOOD) { nex.protectingCruor = true; nex.protectingMinion = true; nex.forceText("Cruor, don't fail me!"); nex.playSound(Sounds.NexCrourDontFail); } if(hitpoints <= maxHitpoints * 0.2 && nex.phase == NexPhase.ICE) { nex.protectingMinion = true; nex.forceText("Glacies, don't fail me!"); nex.playSound(Sounds.NexGlaciesDontFail); } } public boolean isSpawned() { return nex != null; } public boolean ableToAttack() { return nex.phase != NexPhase.SPAWNED; } public void changePhase(final NexPhase phase) { int ticks = 5; if(nex.phase == NexPhase.SPAWNED) { ticks = 2; } World.getWorld().submit(new Tick(ticks) { @Override public void execute() { stop(); if(nex.phase != phase && !nex.changingPhase) { nex.changingPhase = true; nex.forceText(phase.initialMessage); nex.playSound(phase.soundId); if(phase != NexPhase.FINAL) { ProjectileManager.sendGlobalProjectile(2244, minions[phase.ordinal() - 1], nex, 46, 60, 50); } else { nex.heal(6000); nex.animate(TURMOIL_ANIMATION); nex.graphics(TURMOIL_GRAPHICS); } ObjectManager.clearArea(nex.getLocation(), 25); World.getWorld().submit(new Tick(3) { @Override public void execute() { stop(); nex.changingPhase = false; nex.phase = phase; nex.protectingMinion = false; } }); } } }); } private boolean dragAttack() { if(System.currentTimeMillis() - nex.lastDragAttack > 5000 && !nex.isAnimating() && nex.getCombatState().getAttackDelay() < 2 && nex.getCombatState().getSpellDelay() < 2) { nex.lastDragAttack = System.currentTimeMillis(); List<Player> locPlayers = Region.getLocalPlayers(nex.getLocation(), 14); if(locPlayers.size() > 0) { int attempts = locPlayers.size(); while(--attempts != -1) { if(drag(locPlayers.get(random.nextInt(locPlayers.size())))) { return true; } } } } return false; } private void noEscapeAttack() { long currentTime = System.currentTimeMillis(); if(currentTime - nex.lastEscapeAttack >= 8000 && random.nextInt(15) == 0) { nex.lastEscapeAttack = currentTime + 3600; nex.noEscapeAttack = true; nex.getCombatState().setVictim(null); nex.getWalkingQueue().reset(); nex.forceText("There is..."); nex.playSound(Sounds.NexThereIs); nex.setLocation(AREA_CENTER); World.getWorld().submit(new Tick(2) { @Override public void execute() { stop(); nex.animate(FLY_ANIMATION); nex.graphics(FLYING_PURPLE_SMOKE); World.getWorld().submit(new Tick(2) { @Override public void execute() { stop(); final int index = random.nextInt(NO_ESCAPE_TELEPORTS.length); final Location noEscapePosition = NO_ESCAPE_TELEPORTS[index]; nex.teleport(noEscapePosition); //nex.forceMovement(null, noEscapePosition.getX(), noEscapePosition.getY(), 1, 2, -1, 2, true, false); nex.forceText("NO ESCAPE!"); nex.playSound(Sounds.NexNoEscape); nex.getMask().setFacePosition(AREA_CENTER, 1, 1); World.getWorld().submit(new Tick(2) { private List<Player> playersToHit; private int countdown = 3; @Override public void execute() { countdown--; if(countdown == 2) { nex.forceMovement(null, 2924, 5203, 0, 60, -1, 2, true, true); for(Player attack : playersToHit = attackablePlayers(index)) { attack.getMask().setFacePosition(noEscapePosition, 1, 1); attack.setAttribute("cantMove", Boolean.TRUE); doCamera(attack, index); } } else if(countdown == 1) { for(Player attack : playersToHit) { int movementX = attack.getLocation().getX(); int movementY = attack.getLocation().getY(); switch(index) { case 0: movementY -= 2; break; case 1: movementX -= 2; break; case 2: movementY += 2; break; case 3: movementX += 2; break; } int dir = 0; if (attack.getLocation().getX() > noEscapePosition.getX()) dir = 3; if (attack.getLocation().getX() < noEscapePosition.getX()) dir = 1; if (attack.getLocation().getY() > noEscapePosition.getY()) dir = 2; if (attack.getLocation().getY() < noEscapePosition.getY()) dir = 0; attack.forceMovement(FALL_BACK_ANIMATION, movementX, movementY, 30, 60, dir, 1, true); int maxDamage = nex.phase == NexPhase.FINAL ? 550 : 400; int damage = r.nextInt(maxDamage); attack.removeAttribute("cantMove"); attack.getDamageManager().damage(nex, damage, maxDamage, DamageType.RED_DAMAGE); } } else if(countdown == 0) { nex.noEscapeAttack = false; stop(); } } private void doCamera(final Player attack, int dir) { int movementX = AREA_CENTER.getX(); int movementY = AREA_CENTER.getY(); int rotateX = AREA_CENTER.getX(); int rotateY = AREA_CENTER.getY(); switch (dir) { case 3: rotateY -= 8; movementY += 9; break; case 2: rotateY -= 8; movementY += 9; break; case 1: rotateX += 8; movementX -= 9; break; case 0: rotateY += 8; movementY -= 9; break; } //World.getWorld().getGroundItemManager().sendGlobalGroundItem(World.getWorld().getGroundItemManager().create(attack, new Item(391, 1), Location.locate(rotateX, rotateY, 0)), false); movementX = (movementX - (attack.getLocation().getRegionX() - 6) * 8); movementY = (movementY - (attack.getLocation().getRegionY() - 6) * 8); rotateX = (rotateX - (attack.getLocation().getRegionX() - 6) * 8); rotateY = (rotateY - (attack.getLocation().getRegionY() - 6) * 8); ActionSender.moveCamera(attack, 100, movementX, movementY, 3, 2); ActionSender.rotateCamera(attack, rotateX, rotateY, 100, 50); World.getWorld().submit(new Tick(3) { int counter = 0; @Override public void execute() { if (counter == 0) { Location loc = Location.locate(attack.getLocation().getX(), attack.getLocation().getY() - 4, 0); ActionSender.moveCamera(attack, 5, loc.getLocalY(), loc.getLocalX(), 3, 5); ActionSender.rotateCamera(attack, attack.getLocation().getLocalX(), attack.getLocation().getLocalY(), 7, 50); counter++; } else if (counter == 1) { ActionSender.resetCamera(attack); stop(); } } }); } }); } }); } }); } } private List<Player> attackablePlayers(int direction) { if(direction < 0 || direction > 3) { return null; } List<Player> players = new ArrayList<Player>(); int startX = -1, endX = -1; int startY = -1, endY = -1; switch(direction) { case 0: startX = 2924; endX = 2926; startY = 5202; endY = 5211; break; case 1: startX = 2924; endX = 2933; startY = 5202; endY = 5204; break; case 2: startX = 2924; endX = 2926; startY = 5195; endY = 5204; break; case 3: startX = 2916; endX = 2923; startY = 5202; endY = 5204; break; } for(int x = startX; x <= endX; x++) { for(int y = startY; y <= endY; y++) { Location loc = Location.locate(x, y, 0); if(loc.containsPlayers()) { players.addAll(loc.getPlayers()); } } } return players; } public boolean drag(final Player victim) { if(victim.hasTick("nex_drag") || victim.getHitPoints() < 100) { return false; } nex.getCombatState().setVictim(victim); victim.sendMessage("Nex draws you in..."); victim.forceMovement(DRAG_ANIMATION, nex.getLocation().getX(), nex.getLocation().getY(), 0, 80, -1, 2, true); victim.submitTick("nex_drag", new Tick(3) { private int cycles = 0; @Override public void execute() { if(cycles == 15) { stop(); } if(cycles == 0) { if(victim.getPrayer().isAncientCurses()) { victim.getPrayer().closeOnPrayers(1, new int[] {Prayer.DEFLECT_MAGIC, Prayer.DEFLECT_MELEE, Prayer.DEFLECT_MISSILES, Prayer.DEFLECT_SUMMONING}); } else { victim.getPrayer().closeOnPrayers(0, new int[] {Prayer.PROTECT_FROM_MAGIC, Prayer.PROTECT_FROM_MISSILES, Prayer.PROTECT_FROM_MELEE, Prayer.PROTECT_FROM_SUMMONING}); } victim.getPrayer().recalculatePrayer(); victim.getMask().setApperanceUpdate(true); victim.stun(5, "You've been injured and can't use " + (victim.getPrayer().isAncientCurses() ? "deflect curses" : "protection prayers ") + "!", false); } cycles++; } }); return true; } public Nex getNex() { return nex; } } private final class NexCombatAction extends CombatAction { @Override public CombatHit hit(Mob mob, final Mob victim) { if(noEscapeAttack || changingPhase || siphonMode) { return null; } if(phase == NexPhase.SMOKE) { if(!castedVirus || (r.nextInt(100) < 10 && r.nextBoolean())) { castedVirus = true; castVirus(victim); return null; } } boolean close = mob.getLocation().withinDistance(victim.getLocation(), size()); boolean usingMagic = !close; int cycles = 1; int damage = 0; int maxDamage = 0; if(!usingMagic && (RANDOM.nextInt(phase == NexPhase.FINAL ? 10 : 3) == 0 || phase == NexPhase.SHADOW)) { usingMagic = true; } if(getCombatState().getSpellDelay() != 0) { usingMagic = false; } if(usingMagic) { cycles = 3; getCombatState().setAttackDelay(2); animate(CAST_ANIMATION); turnTo(victim); getCombatState().setSpellDelay(5); int projectileId = -1; switch(phase) { case FINAL: case SMOKE: projectileId = 306; graphics(CAST_GRAPHICS); damage = getHit(Nex.this, victim, maxDamage = (phase == NexPhase.FINAL ? 350 : 251)); break; case SHADOW: projectileId = 380; damage = getHit(Nex.this, victim, maxDamage = 301); // wild guess break; case BLOOD: projectileId = 374; damage = getHit(Nex.this, victim, maxDamage = 301); break; case ICE: projectileId = 362; damage = getHit(Nex.this, victim, maxDamage = 301); break; } if(projectileId != -1) { ProjectileManager.sendDelayedProjectile(Nex.this, victim, projectileId, false); } final int fMaxDamage = maxDamage, fProjectileId = projectileId; World.getWorld().submit(new Tick(3) { private int attacked; @Override public void execute() { stop(); for(Player other : Region.getLocalPlayers(getLocation(), 13)) { if(attacked > 20) { break; } if(other == victim) { continue; } int castedDamage = getHit(Nex.this, other, fMaxDamage); ProjectileManager.sendDelayedProjectile(Nex.this, other, fProjectileId, false); other.getDamageManager().damage(Nex.this, castedDamage, fMaxDamage, phase == NexPhase.SHADOW ? DamageType.RANGE : DamageType.MAGE); attacked++; switch(phase) { case SMOKE: boolean poison = r.nextInt(100) <= 25; if(poison) { other.getPoisonManager().poison(Nex.this, 60 + r.nextInt(50)); other.graphics(AFTERMATH_GRAPHICS[phase.ordinal()]); } break; case BLOOD: heal(Math.round(castedDamage * 0.10F)); other.graphics(AFTERMATH_GRAPHICS[phase.ordinal()]); break; case ICE: if(!other.getCombatState().isFrozen() && castedDamage > 0) { other.getCombatState().setFrozenTime(5000); other.getWalkingQueue().reset(); other.submitTick("freeze_immunity", new CountdownTick(other, 10, null)); other.graphics(AFTERMATH_GRAPHICS[phase.ordinal()]); } break; } } } }); } else { if(close) { if(getCombatState().getSpellDelay() > 2) { return null; } animate(ATTACK_ANIMATION); getCombatState().setAttackDelay(4); damage = getHit(Nex.this, victim, maxDamage = (phase == NexPhase.FINAL ? 550 : 370)); } else { return null; } } switch(phase) { case SMOKE: boolean poison = r.nextInt(100) <= 25; if(poison) { victim.getPoisonManager().poison(Nex.this, 60 + r.nextInt(50)); } break; case BLOOD: heal(Math.round(damage * 0.15F)); break; case ICE: if(!victim.hasTick("freeze_immunity") && !victim.getCombatState().isFrozen() && damage > 0) { victim.getCombatState().setFrozenTime(5000); victim.getWalkingQueue().reset(); victim.submitTick("freeze_immunity", new CountdownTick(victim.getPlayer(), 20, null)); } break; } FightType type = usingMagic ? phase == NexPhase.SHADOW ? FightType.RANGE : FightType.MAGIC : FightType.MELEE; return new CombatHit(Nex.this, victim, damage, maxDamage, cycles).setFightType(type); } public void castVirus(Mob victim) { animate(CAST_ANIMATION); getCombatState().setAttackDelay(3); getCombatState().setSpellDelay(3); forceText("Let the virus flow through you!"); playSound(Sounds.NexVirus); if(victim.hasTick("nex_virus")) { victim.removeTick("nex_virus"); } victim.submitTick("nex_virus", new NexVirusTick(victim.getPlayer())); } @Override public boolean canAttack(Mob mob, Mob victim) { if(noEscapeAttack || changingPhase || siphonMode) { return false; } if(mob.getLocation().distance(victim.getLocation()) > victim.size() && r.nextBoolean() && r.nextBoolean()) { Following.combatFollow(mob, victim); return false; } return true; } } }
×