/*
* Copyright (c) 2015 Shervin Asgari
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package no.asgari.civilization.server.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonTypeName;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import no.asgari.civilization.server.SheetName;
@Getter
@Setter
@JsonTypeName("aircraft")
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@EqualsAndHashCode(of = {"attack", "health", "sheetName"}, callSuper = false)
public class Aircraft extends Unit implements Image {
private String ownerId; // id of the player which owns this item
private boolean hidden = true;
private boolean used;
private boolean killed;
private int attack;
private int health;
private boolean isInBattle;
private String image;
private SheetName sheetName;
private int itemNumber;
public Aircraft(int attack, int health) {
this.attack = attack;
this.health = health;
}
/**
* Aircrafts have no level
*
* @return 0
*/
@JsonIgnore
@Override
public int getLevel() {
return 0;
}
@Override
public SheetName getSheetName() {
return sheetName = SheetName.AIRCRAFT;
}
@Override
public String revealPublic() {
return getType();
}
@Override
public String revealAll() {
return toString();
}
@Override
public String toString() {
return getType() + " " + attack + "." + health;
}
@Override
public int compareTo(Spreadsheet o) {
return getSheetName().compareTo(o.getSheetName());
}
@Override
public String getImage() {
image = toString() + PNG;
return image.replaceAll(" ", "");
}
}