Gamelib/src/main/java/uulm/teamname/marvelous/gamelibrary/requests/CharacterRequest.java

34 lines
1.7 KiB
Java

package uulm.teamname.marvelous.gamelibrary.requests;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import uulm.teamname.marvelous.gamelibrary.IntVector2;
import uulm.teamname.marvelous.gamelibrary.entities.EntityID;
import uulm.teamname.marvelous.gamelibrary.entities.StoneType;
import java.util.Objects;
/** Represents a character event for: {@link RequestType#MeleeAttackRequest}, {@link RequestType#RangedAttackRequest}, {@link RequestType#MoveRequest}, {@link RequestType#ExchangeInfinityStoneRequest}, {@link RequestType#UseInfinityStoneRequest}. */
@JsonPropertyOrder({"requestType", "originEntity", "targetEntity", "originField", "targetField", "stoneType", "value"})
public class CharacterRequest extends Request {
public EntityID originEntity = null;
public EntityID targetEntity = null;
public IntVector2 originField = null;
public IntVector2 targetField = null;
public Integer value = null; //why is it called amount in events and value in requests?
public StoneType stoneType = null;
@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;
CharacterRequest that = (CharacterRequest) o;
return Objects.equals(originEntity, that.originEntity) && Objects.equals(targetEntity, that.targetEntity) && Objects.equals(originField, that.originField) && Objects.equals(targetField, that.targetField) && Objects.equals(value, that.value) && stoneType == that.stoneType;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), originEntity, targetEntity, originField, targetField, value, stoneType);
}
}