It has come to my attention that while my research into the gains formula has been publicly available for some time now, many people are still not aware of it. This thread is just simply designed to fill in those people. Some of this is straight forward, some is more complicated, if you don't understand something feel free to ask questions and I'll try to answer them.
I put most of this stuff together back around March-April, and have had a few (top) kingdoms testing/using it since and so far (when used properly) has been 100% accurate every single time. The danger is though it is VERY easy to mis-calculate something or fail to account for a factor, so until you are used to it don't expect perfect results.
Province Networth Factor (PNF):
Relative Province Networth (rpnw) = TargetsNW / SelfNW
IF rpnw < 0.567, then PNF = 0
IF 0.567 < rpnw < 0.9, then PNF = 3 * rpnw - 1.7
IF 0.9 < rpnw < 1.1, then PNF = 1
IF 1.1 < rpnw < 1.6, then PNF = -2 * rpnw + 3.2
IF rpnw > 1.6, then PNF = 0
Kingdom Networth Factor (KNF):
Relative Kingdom Networth (rknw) = TargetKingdomNW / SelfKingdomNW
IF rknw < 0.4, then KNF = 0.6666
IF 0.4 < rknw < 0.9, then KNF = rknw * 2/3 + 0.4
IF rpnw > 0.9, then KNF = 1
In english:
relnw = targetnw/yournw
if relnw <0.9 then:
prov factor = 3 x relnw -1.7
If 0.9 < relnw < 1.1 then full gains
If above 1.1
prov factor = -2 x relnw +3.2
KDNW is above 0.9 (again target/self), then full gains
If below 0.4 then 2/3 gains
If between those two then:
kdnw factor = relkdnw *2/3 +0.4
Attack types
These are base gains, so apply all modifiers to these numbers:
TM = 12% land, Conquest = max 6.8% land, Plunder = 50% gold, 60% runes/food, Learn = 9.375% books, Massacre = 9.5% peasants, 8.5% thieves and 5% wizzards.
OOW - Max gains are 135% of base gains, or 20% of your land (Whichever is smaller), base losses are 7.5%, non-land hits impart 6% gains protection, land hits impart (%land x 2.75) % gains protection.
WAR - Max gains are 20% of either yours or targets land (whichever is smaller, this doesn't include explore pool which makes it 22% effectively). Minimum gains are around 3.6% land for Trad March.
Building credits = Land x 0.55 x percent nw
percent nw = targetsnw/yournw
Spec credits = Targets Def x 0.0055 x relative nw (max 1)
relative nw = min(targetsnw/yournw,yournw/targetsnw)
I have scripts on IRC which use many of these things such as !nw (!nw help) - which uses the gains formula, !gbp and !gains - gives information on these, and ChainDef - which calculates a targets def based on a posted attack message (useful mostly in chains). Feel free to try them out or PM me for more information or if you want me to provide these services to your kingdom.
Finally, obviously this isn't all that I know about this stuff, but I feel that it is appropriate to let everyone have equal access to things like this at least. I hope you enjoy it and find it useful. If you want to learn, be patient, it took longer than 5 min to figure it out, and it'll take you longer than 5 min to learn it all properly.
Useful links:
http://www.wiki.utopia-game.com/inde..._%26_Defending
http://www.youtube.com/watch?v=dP8gR8HPrLI
http://thedragonportal.net/
http://clampy.webdrisign.com/ClampbotReadme.txt
P.S. Bijo has included the gains formula into Ultima available at the dragon portal, and the latest DPbot includes some of these functions.