1package com.osroyale.content.activity.impl.magearena;
3import com.osroyale.content.ActivityLog;
4import com.osroyale.content.activity.Activity;
5import com.osroyale.content.activity.ActivityDeathType;
6import com.osroyale.content.activity.ActivityType;
7import com.osroyale.content.activity.panel.ActivityPanel;
8import com.osroyale.content.skill.impl.magic.teleport.Teleportation;
9import com.osroyale.content.skill.impl.magic.teleport.TeleportationData;
10import com.osroyale.game.Animation;
11import com.osroyale.game.Graphic;
12import com.osroyale.game.world.World;
13import com.osroyale.game.world.entity.combat.hit.Hit;
14import com.osroyale.game.world.entity.mob.Direction;
15import com.osroyale.game.world.entity.mob.Mob;
16import com.osroyale.game.world.entity.mob.npc.Npc;
17import com.osroyale.game.world.entity.mob.npc.NpcDeath;
18import com.osroyale.game.world.entity.mob.player.Player;
19import com.osroyale.game.world.items.Item;
20import com.osroyale.game.world.pathfinding.TraversalMap;
21import com.osroyale.game.world.position.Area;
22import com.osroyale.game.world.position.Position;
23import com.osroyale.net.packet.out.SendMessage;
24import com.osroyale.util.Utility;
26import java.util.HashMap;
27import java.util.HashSet;
63 INITIALIZE, FIGHTING, FINISH
67 private final Player player;
79 private Map<Integer, Npc> monsters =
new HashMap<>();
82 private MageArena(
Player player,
int instance) {
89 MageArena activity =
new MageArena(player, player.playerAssistant.instance());
90 player.move(
new Position(3105, 3934, 0));
91 player.gameRecord.start();
93 activity.resetCooldown();
98 private Position getAvailablePosition() {
107 private void meteors() {
108 if (
Utility.random(1, 3) == 2) {
111 Set<Position> meteors =
new HashSet<>();
113 if (
Utility.random(100) > 55) {
121 player.damage(
new Hit(Utility.random(5, 12)));
131 for (
int index = 0; index < 3; index++) {
132 int id = index == 0 ? 1157 : (index == 1 ? 1160 : 1158);
133 Npc monster =
new Npc(
id, getAvailablePosition());
134 monster.owner = player;
135 monsters.put(
id, monster);
138 stage =
Stage.FIGHTING;
142 for (
Npc monster : monsters.values()) {
143 if (!monster.getCombat().isAttacking(player)) {
144 monster.getCombat().attack(player);
147 if (monster.getCombat().isUnderAttackBy(player) &&
Utility.random(5, 15) == 5) {
148 monster.speak(
"ARGHHH!");
165 long time = player.gameRecord.end(
ActivityType.KOLODION_ARENA);
169 player.move(
new Position(2540, 4715, 0));
172 player.graphic(
Graphic.RESET,
true);
174 if (stage ==
Stage.FINISH) {
176 player.send(
new SendMessage(
"You have completed Kolodion's arena. Final time: @red@" +
Utility.
getTime(time) +
"</col>. Earned Points: @red@" + points +
"</col>."));
177 player.activityLogger.add(
ActivityLog.KOLODIONS_MINIGAME);
178 player.completedMageArena =
true;
181 player.mageArenaPoints += points;
186 for (
Npc monster : monsters.values()) {
187 monsters.remove(monster);
199 if (!
Area.inkolodionArena(player))
205 player.send(
new SendMessage(
"You can not teleport out of this activity."));
212 String clock =
"Time: <col=FF5500>" +
Utility.
getTime(System.currentTimeMillis() - player.gameRecord.time) +
"</col>";
213 String remain =
"Monsters Left: <col=FF5500>" + (3 - killed) +
"</col>";
214 String gained =
"Points Gained: <col=FF5500>" + points +
"</col>";
215 Item[] items = {
new Item(2412),
new Item(2413),
new Item(2414)};
223 mob.graphic(
Graphic.RESET,
true);
227 if (monsters.containsKey(mob.id)) {
229 points +=
Utility.random(15, 20);
230 monsters.remove(mob.id);
233 if (monsters.isEmpty()) {
234 stage =
Stage.FINISH;
final void resetCooldown()
Activity(int cooldown, int instance)
boolean canTeleport(Player player)
static MageArena create(Player player)
void onLogout(Player player)
void onRegionChange(Player player)
static void clear(Player player)
static void update(Player player, int amount, String title, String footer, String... strings)
static void sendGraphic(Graphic graphic, Position position, int instance)
static void schedule(Task task)
static boolean isTraversable(Position from, Direction direction, int size)
static< T > T randomElement(Collection< T > collection)
static double getPercentageAmount(int progress, int total)