- edited description
Distant battle alg
Issue #310
resolved
Distant battles where you send your soldiers off to fight some other army.
Strength of both enemy and player army is calculated: Enemy army strength = number of soldiers set in the invasion Player army strength = - 1 point per untrained javelin or cavalry soldier - 2 points per trained javelin or cavalry soldier - 2 points per untrained legionary - 3 points per trained legionary
Calculation:
if (playerStrength < enemyStrength) {
won = 0;
pctLoss = 100;
} else {
won = 1;
int pctAdvantage = Calc_getPercentage(playerStrength - enemyStrength, playerStrength);
if (pctAdvantage < 10) {
pctLoss = 70;
} else if (pctAdvantage < 25) {
pctLoss = 50;
} else if (pctAdvantage < 50) {
pctLoss = 25;
} else if (pctAdvantage < 75) {
pctLoss = 15;
} else if (pctAdvantage < 100) {
pctLoss = 10;
} else if (pctAdvantage < 150) {
pctLoss = 5;
} else {
pctLoss = 0;
}
}
killSoldiers(pctLoss);
Comments (4)
-
reporter -
reporter Issue
#36was marked as a duplicate of this issue. -
reporter - changed status to resolved
fix
#310. add Battle alg between two armies. Win calculate in once step.→ <<cset e9f4cb9d991a>>
-
reporter fix
#310. fix clang compilation error→ <<cset f7f2ecb36cca>>
- Log in to comment