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

33 lines
1.2 KiB
Java
Raw Normal View History

package uulm.teamname.marvelous.gamelibrary.events;
import uulm.teamname.marvelous.gamelibrary.entities.Entity;
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
import java.util.Arrays;
import java.util.Objects;
/** Represents the game state event ({@link EventType#GameStateEvent}). */
public class GameStateEvent extends Event {
public Entity[] entities;
public EntityID[] turnOrder;
public EntityID activeCharacter;
public boolean winCondition;
@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;
}
}