Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void sendBringHimDown() {
- getTemporaryAttributtes().put("BringHimDownClick", Boolean.TRUE);
- setCantDoDefenceEmote(true);
- setNextAnimation(new Animation(20382));
- damageTime = Utils.currentTimeMillis() + 180000;// 3mins
- for (Player player : instance.getPlayersOnBattle()) {
- if (player == null || player.isDead())
- continue;
- player.stopAll();
- player.faceEntity(this);
- player.getTemporaryAttributtes().put("BRINGHIM", Boolean.TRUE);
- player.setNextAnimation(getBringHimDownAnimation());
- }
- }
- public void processBringHimDown() {
- if (getBringHimPoints() >= 200 && getTemporaryAttributtes().get("BringHimDownClick") == Boolean.TRUE) {
- getTemporaryAttributtes().put("BringHimDownClick", Boolean.FALSE);
- setNextAnimation(new Animation(20383));
- WorldTasksManager.schedule(new WorldTask() {
- @Override
- public void run() {
- getTemporaryAttributtes().put("VoragoType", 2);
- transform();
- finishBringHimDown();
- }
- }, (AnimationDefinitions.getAnimationDefinitions(20383).getEmoteClientCycles() / 30));
- for (Player player : getVoragoInstance().getPlayersOnBattle()) {
- if (player == null)
- continue;
- Vorago thisNPC = this;
- player.getTemporaryAttributtes().remove("BRINGHIM");
- player.lock();
- player.setNextAnimation(new Animation(20400));
- WorldTasksManager.schedule(new WorldTask() {
- @Override
- public void run() {
- if (damageTime >= Utils.currentTimeMillis())
- player.applyHit(new Hit(thisNPC, 200, HitLook.REGULAR_DAMAGE));
- player.unlock();
- }
- }, (AnimationDefinitions.getAnimationDefinitions(20400).getEmoteClientCycles() / 30) + 1);
- }
- }
- }
- public void finishBringHimDown() {
- for (Player player : instance.getPlayersOnBattle()) {
- if (player == null || player.isDead())
- continue;
- VoragoInstance.sendMessage(player, 1,
- "<col=00ff00>Vorago stumbles! Deal as much damage as possible to loosen the next weapon piece!");
- }
- int damageRequired = 2000 * getPlayerOnBattleCount();
- WorldTasksManager.schedule(new WorldTask() {
- @Override
- public void run() {
- setBringHimPoints(0);
- setNextAnimation(new Animation(20362));
- WorldTasksManager.schedule(new WorldTask() {
- @Override
- public void run() {
- getTemporaryAttributtes().remove("BringHimDownClick");
- getTemporaryAttributtes().put("VoragoType", 1);
- transform();
- setCantSetTargetAutoRelatio(false);
- setCantDoDefenceEmote(false);
- }
- }, (AnimationDefinitions.getAnimationDefinitions(20362).getEmoteClientCycles() / 30));
- int finishType = (losenWeaponPieceStage >= 2 || damageWhileDown >= damageRequired) ? 2
- : (damageWhileDown < (damageRequired / 2)) ? 1 : 0;
- for (Player player : instance.getPlayersOnBattle()) {
- if (player == null || player.isDead())
- continue;
- VoragoInstance.sendMessage(player, 1, finishType == 2
- ? "<col=00ff00>The weapon piece falls from Vorago's body!"
- : finishType == 1
- ? "<col=ff0000>You didn't do enough damage in time. The weapon piece still looks secure."
- : "<col=FF6600>Your strong attacks helps loosen the weapon piece a little more.");
- }
- phaseProgress = finishType == 2 ? 5 : 1;
- if (finishType == 2) {
- WorldTile tile = instance.randomSpawnTile(null, instance.getVoragoSpawnLocation(phase), 5);
- weaponPieces[1] = World.addWeaponPiece(new Item(28602), tile);
- } else if (finishType == 0) {
- losenWeaponPieceStage++;
- }
- damageWhileDown = 0;
- stop();
- }
- }, 30);
- }
- public Animation getBringHimDownAnimation() {
- int points = getBringHimPoints();
- int index = 0;
- if (points >= 167 && points < 200)
- index = 5;
- else if (points >= 134 && points < 167)
- index = 4;
- else if (points >= 101 && points < 134)
- index = 3;
- else if (points >= 68 && points < 101)
- index = 2;
- else if (points >= 35 && points < 68)
- index = 1;
- return new Animation(20394 + index);
- }
Advertisement
Add Comment
Please, Sign In to add comment