mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-04 06:28:51 +00:00
Raid ending rework
This commit is contained in:
1 parent
ab1ce3d70f
commit
c1f5b5cbe5
1 file changed
+58
-15
@@ -222,12 +222,10 @@ public class Raid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End of raid
|
* End of raid
|
||||||
*/
|
*/
|
||||||
public void stop() {
|
public void stop() {
|
||||||
this.phase = RaidPhase.END;
|
|
||||||
Bukkit.getScheduler().cancelTask(this.bukkitId[0]);
|
Bukkit.getScheduler().cancelTask(this.bukkitId[0]);
|
||||||
RaidData.removeRaid(this);
|
RaidData.removeRaid(this);
|
||||||
}
|
}
|
||||||
@@ -745,19 +743,12 @@ public class Raid {
|
|||||||
Raid.this.raiderPlayers = Raid.this.war.getSide2Players();
|
Raid.this.raiderPlayers = Raid.this.war.getSide2Players();
|
||||||
Raid.this.defenderPlayers = Raid.this.war.getSide1Players();
|
Raid.this.defenderPlayers = Raid.this.war.getSide1Players();
|
||||||
}
|
}
|
||||||
if (Raid.this.raidTicks >= RaidPhase.END.startTick) {
|
|
||||||
Bukkit.getServer().getScheduler().cancelTask(Raid.this.bukkitId[0]);
|
|
||||||
Raid.this.phase = RaidPhase.END;
|
|
||||||
//TODO: fix raid scoring
|
|
||||||
//for raiders to win, they need a significant up from the defenders
|
|
||||||
if (Raid.this.raidScore > 800) {
|
|
||||||
Raid.this.raidersWin(Raid.this.owner, Raid.this.raidScore);
|
|
||||||
} else {
|
|
||||||
Raid.this.defendersWin(Raid.this.raidScore);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
raidTicks += incremental;
|
raidTicks += incremental;
|
||||||
|
|
||||||
|
if (Raid.this.raidTicks >= RaidPhase.END.startTick && Raid.this.phase == RaidPhase.COMBAT) {
|
||||||
|
Raid.this.phase = RaidPhase.END;
|
||||||
|
}
|
||||||
|
|
||||||
//check and start travel phase
|
//check and start travel phase
|
||||||
if (Raid.this.raidTicks >= RaidPhase.TRAVEL.startTick && Raid.this.phase == RaidPhase.GATHER) {
|
if (Raid.this.raidTicks >= RaidPhase.TRAVEL.startTick && Raid.this.phase == RaidPhase.GATHER) {
|
||||||
startTravel();
|
startTravel();
|
||||||
@@ -768,6 +759,16 @@ public class Raid {
|
|||||||
startCombat();
|
startCombat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Raid.this.phase == RaidPhase.END) {
|
||||||
|
//TODO: fix raid scoring
|
||||||
|
//for raiders to win, they need a significant up from the defenders
|
||||||
|
if (Raid.this.raidScore > 800) {
|
||||||
|
Raid.this.raidersWin(Raid.this.owner, Raid.this.raidScore);
|
||||||
|
} else {
|
||||||
|
Raid.this.defendersWin(Raid.this.raidScore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Raid gather phase behavior
|
//Raid gather phase behavior
|
||||||
if (Raid.this.phase == RaidPhase.GATHER) {
|
if (Raid.this.phase == RaidPhase.GATHER) {
|
||||||
//Broadcast
|
//Broadcast
|
||||||
@@ -779,16 +780,22 @@ public class Raid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Prevent players from leaving gather town prematurely
|
//Prevent players from leaving gather town prematurely, if player is raid owner, dont do that
|
||||||
for (String playerName : getActiveRaiders()) {
|
for (String playerName : getActiveRaiders()) {
|
||||||
try {
|
try {
|
||||||
Player p = Bukkit.getPlayer(playerName);
|
Player p = Bukkit.getPlayer(playerName);
|
||||||
ArrayList<WorldCoord> cluster = Helper.getCluster(Raid.this.getGatherTown().getHomeBlock().getWorldCoord());
|
ArrayList<WorldCoord> cluster = Helper.getCluster(Raid.this.getGatherTown().getHomeBlock().getWorldCoord());
|
||||||
if (!cluster.contains(WorldCoord.parseWorldCoord(p))) {
|
if (!cluster.contains(WorldCoord.parseWorldCoord(p))) {
|
||||||
|
if (p.equals(owner)) {
|
||||||
|
p.teleport(gatherTown.getSpawn());
|
||||||
|
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You cannot leave the gather town. As raid party leader, you have remained in the party. To stop the raid type /raid abandon");
|
||||||
|
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You have been teleported to the gather town's spawn.");
|
||||||
|
} else {
|
||||||
Raid.this.removeActiveRaider(p.getName());
|
Raid.this.removeActiveRaider(p.getName());
|
||||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "By leaving the gathering town you have left the raid on " + Raid.this.getRaidedTown().getName() + "!");
|
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "By leaving the gathering town you have left the raid on " + Raid.this.getRaidedTown().getName() + "!");
|
||||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "To rejoin, do /raid join [war] [town]");
|
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "To rejoin, do /raid join [war] [town]");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (NotRegisteredException e) {
|
} catch (NotRegisteredException e) {
|
||||||
@@ -874,11 +881,47 @@ public class Raid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TownBlock getHomeBlockRaided() {
|
||||||
|
return homeBlockRaided;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHomeBlockRaided(TownBlock homeBlockRaided) {
|
||||||
|
this.homeBlockRaided = homeBlockRaided;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TownBlock getHomeBlockGather() {
|
||||||
|
return homeBlockGather;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHomeBlockGather(TownBlock homeBlockGather) {
|
||||||
|
this.homeBlockGather = homeBlockGather;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhase(RaidPhase phase) {
|
||||||
|
this.phase = phase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getTownSpawnRaided() {
|
||||||
|
return townSpawnRaided;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTownSpawnRaided(Location townSpawnRaided) {
|
||||||
|
this.townSpawnRaided = townSpawnRaided;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getTownSpawnGather() {
|
||||||
|
return townSpawnGather;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTownSpawnGather(Location townSpawnGather) {
|
||||||
|
this.townSpawnGather = townSpawnGather;
|
||||||
|
}
|
||||||
|
|
||||||
public static class LootBlock {
|
public static class LootBlock {
|
||||||
|
|
||||||
public WorldCoord worldCoord;
|
public WorldCoord worldCoord;
|
||||||
|
|||||||
Reference in new issue
Block a user