raids plugin: fix rotation solver
This commit is contained in:
@@ -98,6 +98,25 @@ public class Raid
|
||||
return combatRooms.toArray(new RaidRoom[0]);
|
||||
}
|
||||
|
||||
void setCombatRooms(RaidRoom[] combatRooms)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for (Room room : layout.getRooms())
|
||||
{
|
||||
if (room == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rooms[room.getPosition()].getType() == RoomType.COMBAT)
|
||||
{
|
||||
rooms[room.getPosition()] = combatRooms[index];
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String toCode()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
@@ -320,7 +320,9 @@ public class RaidsPlugin extends Plugin
|
||||
}
|
||||
|
||||
raid.updateLayout(layout);
|
||||
RotationSolver.solve(raid.getCombatRooms());
|
||||
RaidRoom[] rooms = raid.getCombatRooms();
|
||||
RotationSolver.solve(rooms);
|
||||
raid.setCombatRooms(rooms);
|
||||
overlay.setScoutOverlayShown(true);
|
||||
|
||||
if (config.layoutMessage())
|
||||
|
||||
@@ -69,4 +69,12 @@ public class RotationSolverTest
|
||||
RotationSolver.solve(rooms);
|
||||
assertArrayEquals(new RaidRoom[]{VASA, SHAMANS, VESPULA, GUARDIANS}, rooms);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSolve5()
|
||||
{
|
||||
RaidRoom[] rooms = new RaidRoom[]{GUARDIANS, UNKNOWN_COMBAT, SHAMANS, VASA};
|
||||
RotationSolver.solve(rooms);
|
||||
assertArrayEquals(new RaidRoom[]{GUARDIANS, VESPULA, SHAMANS, VASA}, rooms);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user