Пример #1
0
	    private static void summonJadHealers(Player p,  Npc jad) {
		    for (int i = 0; i < 4; i++) {
			    Npc npc = new Npc(2746);
			    Location minCoords = new Location((20000 + 2363) + (200 * p.getIndex()), 25502, 0);
			    Location maxCoords = new Location((20000 + 2430) + (200 * p.getIndex()), 25123, 0);
			    npc.setMinimumCoords(minCoords);
			    npc.setMaximumCoords(maxCoords);
			    npc.setLocation(new Location((20000 + 2387) + (200 * p.getIndex()) + misc.random(22), 20000 + 5069 + misc.random(33), 0));
			    npc.setEntityFocus(jad.getClientIndex());
			    npc.setOwner(p);
			    npc.getFollow().setFollowing(jad);
			    npc.setTarget(null);
			    Server.getNpcList().Add(npc);

                Event jadHealerEvent = new Event(2000);
                jadHealerEvent.setAction(() => {
					if (npc.isDead() || !npc.isVisible() || npc.isDestroyed()) {
						jadHealerEvent.stop();
						return;
					}
					if (npc.getLocation().withinDistance(jad.getLocation(), 2) && !npc.inCombat()) {
						if (misc.random(7) == 0) {
							jad.setLastGraphics(new Graphics(444));
							npc.setLastAnimation(new Animation(9254));
							int jadMaxHp = jad.getMaxHp();
							jad.heal((int) (jadMaxHp * 0.5));
						}
					}
			    });
                Server.registerEvent(jadHealerEvent);
		    }
	    }