Changeset 265 for trunk/UClientAI.pas
- Timestamp:
- Jan 15, 2019, 1:03:40 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UClientAI.pas
r231 r265 44 44 TotalAttackPower: Integer; 45 45 CanAttack: Integer; 46 TargetPower: Integer; 46 47 TargetCells: TPlayerCells; 47 48 Cell: TPlayerCell; … … 81 82 82 83 // Attack if target is weaker 83 if TotalPower >= (MapCell.Power + AttackDiff) then begin 84 if Assigned(MapCell.OneUnit) then TargetPower := MapCell.OneUnit.Power 85 else TargetPower := 0; 86 if TotalPower >= (TargetPower + AttackDiff) then begin 84 87 TotalAttackPower := 0; 85 88 for NeighborCell in Neighbors do 86 89 if NeighborCell.MapCell.Player = ControlPlayer then begin 87 90 // Use only necessary power 88 AttackPower := MapCell.Power - TotalAttackPower + AttackDiff;91 AttackPower := TargetPower - TotalAttackPower + AttackDiff; 89 92 if NeighborCell.GetAvialPower < AttackPower then 90 93 AttackPower := NeighborCell.GetAvialPower; … … 141 144 end; 142 145 // Attack if target is weaker 143 if Game.AttackProbability(TotalPower, TargetCell.MapCell. Power) >=146 if Game.AttackProbability(TotalPower, TargetCell.MapCell.OneUnit.Power) >= 144 147 ComputerAggroProbability[ControlPlayer.Agressivity] then begin 145 148 // Try to limit total attacking power to necessary minimum 146 while Game.AttackProbability(TotalPower - 1, TargetCell.MapCell. Power) >=149 while Game.AttackProbability(TotalPower - 1, TargetCell.MapCell.OneUnit.Power) >= 147 150 ComputerAggroProbability[ControlPlayer.Agressivity] do 148 151 Dec(TotalPower); … … 306 309 for I := 0 to Neighbors.Count - 1 do 307 310 if (Neighbors[I].MapCell.Player <> ControlPlayer) and (Neighbors[I].MapCell.Player <> nil) then begin 308 Inc(EnemyPower, Neighbors[I].MapCell. Power);311 Inc(EnemyPower, Neighbors[I].MapCell.OneUnit.Power); 309 312 end; 310 313 if EnemyPower > (GetAvialPower + GetAttackPower) then begin
Note:
See TracChangeset
for help on using the changeset viewer.