Changeset 69 for trunk/UGame.pas
- Timestamp:
- Sep 28, 2014, 5:42:51 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGame.pas
r68 r69 1148 1148 S: string; 1149 1149 const 1150 AttackDiff = 2;1150 AttackDiff = 1; 1151 1151 begin 1152 1152 AllCells := Game.Map.Cells; … … 1283 1283 NewTargetCells.OwnsObjects := False; 1284 1284 1285 // Get list of all our cells which can attack1285 // Get list of all enemy border cells 1286 1286 for C := 0 to AllCells.Count - 1 do 1287 1287 with TCell(AllCells[C]) do begin 1288 if (Player = Game.CurrentPlayer) then begin1288 if (Player <> Game.CurrentPlayer) and (Player <> nil) and (Terrain <> ttVoid) then begin 1289 1289 Cells := Game.Map.GetCellNeighbors(TCell(AllCells[C])); 1290 1290 CanAttack := 0; 1291 1291 for I := 0 to Length(Cells) - 1 do 1292 if ( Cells[I].Player <> Game.CurrentPlayer) and (Cells[I].Terrain <> ttVoid) then begin1292 if ((Cells[I].Player = Game.CurrentPlayer) or (Cells[I].Player = nil)) and (Cells[I].Terrain <> ttVoid) then begin 1293 1293 Inc(CanAttack); 1294 1294 end; … … 1310 1310 for C := 0 to TargetCells.Count - 1 do 1311 1311 with TCell(TargetCells[C]) do begin 1312 //1313 1312 Cells := Game.Map.GetCellNeighbors(TCell(TargetCells[C])); 1314 for I := 0 to Length(Cells) - 1 do 1315 if (Cells[I].Player = Game.CurrentPlayer) and (Cells[I].Terrain <> ttVoid) 1316 and (not Cells[I].Mark) then begin 1317 Game.SetMove(Cells[I], TCell(TargetCells[C]), Cells[I].GetAvialPower); 1318 TCell(TargetCells[C]).Mark := True; 1319 NewTargetCells.Add(Cells[I]); 1313 for I := 0 to Length(Cells) - 1 do begin 1314 if (Cells[I].Terrain <> ttVoid) and (not Cells[I].Mark) then begin 1315 if (TCell(TargetCells[C]).Player = Game.CurrentPlayer) and 1316 (Cells[I].Player = Game.CurrentPlayer) then begin 1317 // Do not take units from front line 1318 Cells2 := Game.Map.GetCellNeighbors(TCell(Cells[I])); 1319 CanAttack := 0; 1320 for J := 0 to Length(Cells2) - 1 do 1321 if ((Cells2[J].Player <> Game.CurrentPlayer) or (Cells2[J].Player = nil)) 1322 and (Cells2[J].Terrain <> ttVoid) then begin 1323 Inc(CanAttack); 1324 end; 1325 if CanAttack = 0 then 1326 Game.SetMove(Cells[I], TCell(TargetCells[C]), Cells[I].GetAvialPower); 1327 end; 1328 TCell(TargetCells[C]).Mark := True; 1329 NewTargetCells.Add(Cells[I]); 1330 end; 1320 1331 end; 1321 1332 end; … … 1695 1706 VoidEnabled := GetValue(Path + '/VoidEnabled', True); 1696 1707 VoidPercentage := GetValue(Path + '/VoidPercentage', 20); 1697 Map.Size := Point(GetValue(Path + '/MapSizeX', 1 5),1698 GetValue(Path + '/MapSizeY', 1 5));1699 CityEnabled := GetValue(Path + '/CityEnabled', True);1708 Map.Size := Point(GetValue(Path + '/MapSizeX', 10), 1709 GetValue(Path + '/MapSizeY', 10)); 1710 CityEnabled := GetValue(Path + '/CityEnabled', False); 1700 1711 CityPercentage := GetValue(Path + '/CityPercentage', 10); 1701 1712 GrowAmount := TGrowAmount(GetValue(Path + '/GrowAmount', Integer(gaBySquareRoot))); … … 1839 1850 MoveAll(CurrentPlayer); 1840 1851 Map.Grow(CurrentPlayer); 1852 UpdateRepeatMoves(CurrentPlayer); 1841 1853 ComputePlayerStats; 1842 1854 PrevPlayer := CurrentPlayer; … … 1847 1859 if Players.IndexOf(CurrentPlayer) < Players.IndexOf(PrevPlayer) then Inc(TurnCounter); 1848 1860 CheckWinObjective; 1849 UpdateRepeatMoves(CurrentPlayer);1850 1861 // For computers take view from previous human 1851 1862 if CurrentPlayer.Mode = pmComputer then CurrentPlayer.View.Assign(PrevPlayer.View);
Note:
See TracChangeset
for help on using the changeset viewer.