use of spacesettlers.graphics.ShipGraphics in project spacesettlers by amymcgovern.
the class Ship method deepClone.
/**
* Deep copy of a ship (used for security)
* @return
*/
public Ship deepClone() {
Ship newShip = new Ship(teamName, teamColor, getPosition().deepCopy());
newShip.setAlive(isAlive);
newShip.resources = new ResourcePile();
newShip.addResources(resources);
newShip.lastRespawnCounter = lastRespawnCounter;
newShip.numBeacons = numBeacons;
newShip.energy = energy;
newShip.respawnCounter = respawnCounter;
newShip.graphic = new ShipGraphics(newShip, teamColor);
newShip.currentAction = currentAction;
newShip.numWeaponsInAir = numWeaponsInAir;
newShip.id = id;
newShip.maxEnergy = maxEnergy;
newShip.currentPowerups = new LinkedHashSet<SpaceSettlersPowerupEnum>(currentPowerups);
newShip.weaponCapacity = weaponCapacity;
newShip.hitsInflicted = hitsInflicted;
newShip.killsInflicted = killsInflicted;
newShip.killsReceived = killsReceived;
newShip.damageInflicted = damageInflicted;
newShip.carryingFlag = carryingFlag;
newShip.numFlags = numFlags;
newShip.isShielded = isShielded;
newShip.numCores = numCores;
if (this.flag != null) {
newShip.flag = flag.deepClone();
}
return newShip;
}
Aggregations