feat: added TeleportedEvent

This commit is contained in:
Yannik Bretschneider 2021-06-24 15:25:02 +02:00
parent abdd4dfbb7
commit 81e53edb2a
2 changed files with 59 additions and 0 deletions

View File

@ -25,6 +25,9 @@ public enum EventType {
UseInfinityStoneEvent, UseInfinityStoneEvent,
ExchangeInfinityStoneEvent, ExchangeInfinityStoneEvent,
// TeleportedEvent
TeleportedEvent,
// GameEvents // GameEvents
RoundSetupEvent, RoundSetupEvent,
TurnEvent, TurnEvent,

View File

@ -0,0 +1,56 @@
package uulm.teamname.marvelous.gamelibrary.events;
import uulm.teamname.marvelous.gamelibrary.IntVector2;
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
import java.util.Objects;
public class TeleportedEvent extends Event {
public EntityID teleportedEntity;
public IntVector2 originField, targetField;
public EntityID originPortal, targetPortal;
@Override
public boolean check() {
return teleportedEntity != null &&
originField != null &&
targetField != null &&
originPortal != null &&
targetPortal != null &&
super.check();
}
@Override
public Event type(EventType type) {
return super.type(type);
}
@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;
TeleportedEvent that = (TeleportedEvent) o;
return Objects.equals(teleportedEntity, that.teleportedEntity) && Objects.equals(originField, that.originField) && Objects.equals(targetField, that.targetField) && Objects.equals(originPortal, that.originPortal) && Objects.equals(targetPortal, that.targetPortal);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), teleportedEntity, originField, targetField, originPortal, targetPortal);
}
@Override
public String toString() {
return "TeleportedEvent{" +
"teleportedEntity=" + teleportedEntity +
", originField=" + originField +
", targetField=" + targetField +
", originPortal=" + originPortal +
", targetPortal=" + targetPortal +
'}';
}
}