# Plunder

From Stardrift Empires Wiki

Plunder is what happens at the end of a combat in which the attacker wins. The attacker receives up to half of each of the defender's planet's three resources, or however much he has cargo space for, whichever is less.

### Calculation

- Take each of the defending planet's resources and divide by 2. This is the plunderable amount. The rest remains on the planet and we'll ignore it for the rest of the steps.
- If the available cargo space is higher than the amount of plunderable resources on the planet, simply load them all and finish. If not, move on to step 3.
- Attempt to load all 3 resources equally. Of the plunderable amount, find the resource with the smallest amount. If that amount is greater than or equal to 1/3 of total cargo capacity, then fill the cargo equally with each resource and finish. If not, move on to step 4.
- If the smallest resource is less than 1/3 of total cargo capacity, then load that amount of
*each*resource into cargo. Move on to step 5. - Attempt to fill cargo space equally with the 2 remaining resources. If the smaller resource would take up less than half of the remaining cargo space then fill the cargo space with all of that resource. Then fill any remaining space with the third resource (the one there was the most of.)

- Example 1
- You plunder a planet that has 100,000 ore, 100,000 crystal, and 100,000 hydrogen. That leaves 50,000 plunderable of each resource. You have only 30,000 cargo space, so you plunder an equal 10,000 of each resource.

- Example 2
- You have 20,000 cargo space and plunder a planet that has 40,000 ore, 14,000 crystal, and 10,000 hydrogen. The planet therefore has plunderable resources of 20,000 ore, 7,000 crystal, and 5,000 hydrogen. This is more than you have cargo space for, but not enough to divide equally.

- So first we find that hydrogen is the smallest resource, with only 5,000. You then receive 5,000 ore, 5,000 crystal, and 5,000 hydrogen. You now have 5,000 cargo remaining. The planet now has 15,000 Ore and 2,000 crystal remaining.

- That is still not enough to fill your capacity equally, so you get all 2,000 Crystal, plus 3,000 more ore, for a total plunder of 8,000 ore, 7,000 crystal, and 5,000 hydrogen.