use of spacesettlers.objects.resources.ResourcePile 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;
}
use of spacesettlers.objects.resources.ResourcePile in project spacesettlers by amymcgovern.
the class PurchaseCosts method reset.
/**
* Put the costs back to their initial values
*/
public void reset() {
costs.put(PurchaseTypes.BASE, new ResourcePile(250, 300, 450));
costs.put(PurchaseTypes.SHIP, new ResourcePile(500, 1000, 500));
costs.put(PurchaseTypes.NOTHING, new ResourcePile(0, 0, 0));
costs.put(PurchaseTypes.POWERUP_DOUBLE_BASE_HEALING_SPEED, new ResourcePile(1000, 1000, 500));
costs.put(PurchaseTypes.POWERUP_DOUBLE_MAX_ENERGY, new ResourcePile(750, 1000, 500));
costs.put(PurchaseTypes.POWERUP_DOUBLE_WEAPON_CAPACITY, new ResourcePile(250, 1000, 1000));
costs.put(PurchaseTypes.POWERUP_EMP_LAUNCHER, new ResourcePile(0, 750, 250));
costs.put(PurchaseTypes.POWERUP_SHIELD, new ResourcePile(0, 1500, 500));
}
use of spacesettlers.objects.resources.ResourcePile in project spacesettlers by amymcgovern.
the class Team method deepCopy.
/**
* Make a deep copy for security
*
* @return
*/
public Team deepCopy() {
Team newTeam = new Team(teamClient, ladderName, maxNumberShips);
for (Ship ship : teamShips) {
newTeam.addShip(ship.deepClone());
}
newTeam.teamBaseIDs.addAll(this.teamBaseIDs);
newTeam.costToPurchase = costToPurchase.deepCopy();
newTeam.totalResources = new ResourcePile(totalResources);
newTeam.availableResources = new ResourcePile(availableResources);
newTeam.totalHitsInflicted = this.totalHitsInflicted;
newTeam.totalKillsInflicted = this.totalKillsInflicted;
newTeam.totalKillsReceived = this.totalKillsReceived;
newTeam.totalDamageInflicted = this.totalDamageInflicted;
newTeam.totalDamageReceived = this.totalDamageReceived;
newTeam.totalFlagsCollected = this.totalFlagsCollected;
newTeam.totalCoresCollected = this.totalCoresCollected;
return newTeam;
}
use of spacesettlers.objects.resources.ResourcePile in project spacesettlers by amymcgovern.
the class ResourcesPanel method updateData.
public void updateData(SpaceSettlersSimulator simulator, String teamName) {
Team team = null;
for (Team curTeam : simulator.getTeams()) {
if (curTeam.getLadderName().equalsIgnoreCase(teamName)) {
team = curTeam;
break;
}
}
ResourcePile avail = team.getAvailableResources();
ResourcePile total = team.getTotalResources();
waterAvail.setText("" + avail.getResourceQuantity(ResourceTypes.WATER));
fuelAvail.setText("" + avail.getResourceQuantity(ResourceTypes.FUEL));
metalsAvail.setText("" + avail.getResourceQuantity(ResourceTypes.METALS));
waterTotal.setText("" + total.getResourceQuantity(ResourceTypes.WATER));
fuelTotal.setText("" + total.getResourceQuantity(ResourceTypes.FUEL));
metalsTotal.setText("" + total.getResourceQuantity(ResourceTypes.METALS));
}
Aggregations