Gamelib/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/InfinityStone.java

53 lines
1.4 KiB
Java

package uulm.teamname.marvelous.gamelibrary.entities;
import uulm.teamname.marvelous.gamelibrary.IntVector2;
import java.util.Objects;
/** Represents an infinity stone {@link Entity}. Can only exist on the map. */
public class InfinityStone extends Entity {
/** The {@link StoneType} of the infinity stone */
public final StoneType type;
/**
* Constructs a new {@link InfinityStone}.
* @param id The {@link EntityID} of the stone
* @param position The position of the stone
* @param type The {@link StoneType} of the stone
*/
public InfinityStone(EntityID id, IntVector2 position, StoneType type) {
super(id, position);
solid = false;
opaque = false;
this.type = type;
}
@Override
public InfinityStone clone() {
return new InfinityStone(id, position, 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;
InfinityStone that = (InfinityStone) o;
return type == that.type;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), type);
}
@Override
public String toString() {
return "InfinityStone{" +
"type=" + type +
", position=" + position +
'}';
}
}