2021-05-01 20:30:52 +00:00
|
|
|
package uulm.teamname.marvelous.gamelibrary.events;
|
|
|
|
|
|
|
|
import uulm.teamname.marvelous.gamelibrary.entities.Entity;
|
|
|
|
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
|
|
|
|
|
2021-05-01 22:03:09 +00:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Objects;
|
|
|
|
|
2021-05-01 20:30:52 +00:00
|
|
|
/** Represents the game state event ({@link EventType#GameStateEvent}). */
|
|
|
|
public class GameStateEvent extends Event {
|
2021-05-01 21:19:36 +00:00
|
|
|
public Entity[] entities;
|
2021-05-01 20:30:52 +00:00
|
|
|
public EntityID[] turnOrder;
|
|
|
|
public EntityID activeCharacter;
|
|
|
|
public boolean winCondition;
|
2021-05-01 22:03:09 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object o) {
|
|
|
|
if (this == o) return true;
|
|
|
|
if (o == null || getClass() != o.getClass()) return false;
|
|
|
|
if (!super.equals(o)) return false;
|
|
|
|
GameStateEvent that = (GameStateEvent) o;
|
|
|
|
return winCondition == that.winCondition && Arrays.equals(entities, that.entities) && Arrays.equals(turnOrder, that.turnOrder) && Objects.equals(activeCharacter, that.activeCharacter);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
|
|
|
int result = Objects.hash(super.hashCode(), activeCharacter, winCondition);
|
|
|
|
result = 31 * result + Arrays.hashCode(entities);
|
|
|
|
result = 31 * result + Arrays.hashCode(turnOrder);
|
|
|
|
return result;
|
|
|
|
}
|
2021-05-01 20:30:52 +00:00
|
|
|
}
|