public void computeAggregate(Player owner) { aggregate = new ShipDesignAggregate(); aggregate.setMass(hull.getMass()); aggregate.setArmor(hull.getArmor()); aggregate.setShield(0); aggregate.setCargoCapacity(0); aggregate.setFuelCapacity(hull.getFuelCapacity() == 0 ? 0 : hull.getFuelCapacity()); aggregate.setColoniser(false); aggregate.setCost(hull.getCost()); aggregate.setSpaceDock(-1); foreach (ShipDesignSlot slot in slots) { if (slot.getHullComponent() != null) { if (slot.getHullComponent() is TechEngine) { aggregate.setEngine((TechEngine)slot.getHullComponent()); aggregate.setEngineName(slot.getHullComponent().getName()); } Cost cost = slot.getHullComponent().getCost().multiply(slot.getQuantity()); cost = cost.add(aggregate.getCost()); aggregate.setCost(cost); aggregate.setMass(aggregate.getMass() + slot.getHullComponent().getMass() * slot.getQuantity()); if (slot.getHullComponent().getArmor() != 0) { aggregate.setArmor(aggregate.getArmor() + slot.getHullComponent().getArmor() * slot.getQuantity()); } if (slot.getHullComponent().getShield() != 0) { aggregate.setShield(aggregate.getShield() + slot.getHullComponent().getShield() * slot.getQuantity()); } if (slot.getHullComponent().getCargoBonus() != 0) { aggregate.setCargoCapacity(aggregate.getCargoCapacity() + slot.getHullComponent().getCargoBonus() * slot.getQuantity()); } if (slot.getHullComponent().getFuelBonus() != 0) { aggregate.setFuelCapacity(aggregate.getFuelCapacity() + slot.getHullComponent().getFuelBonus() * slot.getQuantity()); } if (slot.getHullComponent().isColonisationModule()) { aggregate.setColoniser(true); } } if (slot.getHullSlot().getTypes().Contains(HullSlotType.SpaceDock)) { aggregate.setSpaceDock(slot.getHullSlot().getCapacity()); } if (slot.getHullSlot().getTypes().Contains(HullSlotType.Cargo)) { aggregate.setCargoCapacity(aggregate.getCargoCapacity() + slot.getHullSlot().getCapacity()); } if (slot.getHullSlot().getTypes().Contains(HullSlotType.Bomb)) { aggregate.setKillPop(aggregate.getKillPop() + slot.getHullSlot().getCapacity()); } } computeScanRanges(owner); }
public void setAggregate(ShipDesignAggregate aggregate) { this.aggregate = aggregate; }