close Warning: Can't synchronize with repository "(default)" (No changeset 184 in the repository). Look in the Trac log for more information.

Changeset 131


Ignore:
Timestamp:
Jun 18, 2017, 1:37:51 PM (7 years ago)
Author:
chronos
Message:
  • Modified: Allow cells to have more then 99 units. Additional units over 99 will die according twice of root square of units over 99. This allows to quick resolution even in case of narrow connections where two players send maximum units against each other.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r129 r131  
    13941394  I: Integer;
    13951395  Addition: Integer;
    1396 begin
    1397 for I := 0 to Cells.Count - 1 do
     1396  Dies: Integer;
     1397begin
     1398  for I := 0 to Cells.Count - 1 do
    13981399  with TCell(Cells[I]) do begin
    13991400    if (Player = APlayer) and ((Game.GrowCells = gcPlayerAll) or
    14001401    ((Game.GrowCells = gcPlayerCities) and (Terrain = ttCity))) then begin
    1401       if Game.GrowAmount = gaByOne then Addition := 1
    1402         else if Game.GrowAmount = gaBySquareRoot then begin
    1403           Addition := Trunc(Sqrt(Power));
    1404           if Addition = 0 then Addition := 1;
    1405         end;
    1406       Power := Power + Addition;
    1407       if Power > MaxPower then Power := MaxPower;
     1402      if Power < MaxPower then begin
     1403        // Increase units count
     1404        if Game.GrowAmount = gaByOne then Addition := 1
     1405          else if Game.GrowAmount = gaBySquareRoot then begin
     1406            Addition := Trunc(Sqrt(Power));
     1407            if Addition = 0 then Addition := 1;
     1408          end;
     1409        Power := Min(Power + Addition, MaxPower);
     1410      end else
     1411      if Power > MaxPower then begin
     1412        // Reduce units count
     1413        // If cell has more then MaxPower units then additional units dies
     1414        // in twice of squeare root of unites over MaxPower
     1415        Dies := 2 * Trunc(Sqrt(Power - MaxPower));
     1416        Power := Max(Power - Dies, 0);
     1417      end;
    14081418    end;
    14091419  end;
     
    15011511  MaxPower := 99;
    15021512  DefaultCellSize := Point(220, 220);
    1503   Cells := TCells.create;
     1513  Cells := TCells.Create;
    15041514  Cells.Map := Self;
    15051515  Size := Point(0, 0);
     
    23922402    S := 'Att:';
    23932403    for I := 0 to AttackerDiceCount - 1 do
    2394       S := S + InTToStr(Integer(AttackRolls[I])) + ', ';
     2404      S := S + IntToStr(Integer(AttackRolls[I])) + ', ';
    23952405    DefendRolls.Count := DefenderDiceCount;
    23962406    for I := 0 to DefenderDiceCount - 1 do begin
Note: See TracChangeset for help on using the changeset viewer.