Distant battle alg

Issue #310 resolved
dalerank repo owner created an issue

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)

  1. Log in to comment