it was made long ago,
There are two things that were discussed back then:
1.
Is it possible that the percentage is maent for the stored resources in a unit and as they are shared the resources of the faction ? I think I remember it was like this.
SO for example the blacksmith can store wood. So if this has the percentage tag its meant for the wood of the faction.
2.
percentage of unit cost/price
I don't know which one was implemented, can you try to find out ?
After finally getting the percentage variables to work, and by looking at the code:
attacked->getFaction()->incResourceAmount(resource.getResourceType(), -(factionTotalResource * resource.getLossPercentage() / 100));
it appears that your first answer is (almost) correct! The player who owns this unit has the given percentage of their resources taken away from them when this unit is killed.
However, if we have an example, such as a roman general with the variable
<resource name="gold" loss-percentage="5"/>. When the general is killed, the player who owns this unit loses 5% of the gold they currently have stored in total, even though the general does not store any gold on his person.
As mentioned earlier, I got the percentage variables to work. But, I found out that
amount-percentage and
loss-percentage are not meaningful variables. From once again looking at the code:
resource.setAmountFactionPercent(resourceNode->getAttribute("amount-faction-percent")->getIntValue());
and
resource.setLossFactionPercent(resourceNode->getAttribute("loss-faction-percent")->getIntValue());
,
it turned out that the correct variable names are
amount-faction-percent and
loss-faction-percent.
So afaik, everything is working exactly how it should (barring the 2 incorrect variable names)
I'll try to document this on the wiki soon