Gamelib/src/main/java/uulm/teamname/marvelous/gamelibrary/events/GameEvent.java

36 lines
1.6 KiB
Java

package uulm.teamname.marvelous.gamelibrary.events;
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
import java.util.Arrays;
import java.util.Objects;
/** Represents a game event for: {@link EventType#RoundSetupEvent}, {@link EventType#TurnEvent}, {@link EventType#WinEvent}, {@link EventType#TurnTimeoutEvent}, {@link EventType#TimeoutWarningEvent}, {@link EventType#TimeoutEvent}, {@link EventType#PauseStartEvent}, {@link EventType#PauseStopEvent}, {@link EventType#DisconnectEvent}. */
public class GameEvent extends Event {
public Integer roundCount;
public Integer turnCount;
public EntityID[] characterOrder;
public EntityID nextCharacter;
public Integer playerWon;
public String message;
public Integer timeLeft;
@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;
GameEvent gameEvent = (GameEvent) o;
return Objects.equals(roundCount, gameEvent.roundCount) && Objects.equals(turnCount, gameEvent.turnCount) && Objects.equals(playerWon, gameEvent.playerWon) && Objects.equals(timeLeft, gameEvent.timeLeft) && Arrays.equals(characterOrder, gameEvent.characterOrder) && Objects.equals(nextCharacter, gameEvent.nextCharacter) && Objects.equals(message, gameEvent.message);
}
@Override
public int hashCode() {
int result = Objects.hash(super.hashCode(), roundCount, turnCount, nextCharacter, playerWon, message, timeLeft);
result = 31 * result + Arrays.hashCode(characterOrder);
return result;
}
}