Changeset 203 for trunk/UClientAI.pas
- Timestamp:
- May 18, 2018, 12:54:37 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UClientAI.pas
r202 r203 17 17 //Targets: TFPGObjectList<TPlayer>; 18 18 CellProcessDirection: Boolean; 19 Player: TPlayer;20 19 procedure AttackNeutral; 21 20 procedure AttackPlayers; … … 34 33 procedure TComputer.DoTurnStart(Sender: TObject); 35 34 begin 36 inherited DoTurnStart(Sender); 35 Process; 36 Protocol.TurnEnd; 37 37 end; 38 38 … … 89 89 if NeighborCell.GetAvialPower < AttackPower then 90 90 AttackPower := NeighborCell.GetAvialPower; 91 Self.Player.SetMove(NeighborCell, Cell, AttackPower, False);91 ControlPlayer.SetMove(NeighborCell, Cell, AttackPower, False); 92 92 TotalAttackPower := TotalAttackPower + AttackPower; 93 93 end; … … 109 109 NeighborCell: TCell; 110 110 begin 111 if Player.Defensive then Exit;111 if ControlPlayer.Defensive then Exit; 112 112 113 113 AllCells := Game.Map.Cells; … … 117 117 // Get list of all attack target cells 118 118 for TargetCell in AllCells do begin 119 if (TargetCell.Terrain <> ttVoid) and (TargetCell.Player <> Player) and119 if (TargetCell.Terrain <> ttVoid) and (TargetCell.Player <> ControlPlayer) and 120 120 (TargetCell.Player <> nil) then begin 121 121 CanAttack := 0; 122 122 for NeighborCell in TargetCell.Neighbors do 123 if NeighborCell.Player = Player then begin123 if NeighborCell.Player = ControlPlayer then begin 124 124 Inc(CanAttack); 125 125 end; … … 137 137 TotalPower := 0; 138 138 for NeighborCell in TargetCell.Neighbors do 139 if NeighborCell.Player = Player then begin139 if NeighborCell.Player = ControlPlayer then begin 140 140 TotalPower := TotalPower + NeighborCell.GetAvialPower; 141 141 end; 142 142 // Attack if target is weaker 143 143 if Game.AttackProbability(TotalPower, TargetCell.Power) >= 144 ComputerAggroProbability[ Player.Agressivity] then begin144 ComputerAggroProbability[ControlPlayer.Agressivity] then begin 145 145 // Try to limit total attacking power to necessary minimum 146 146 while Game.AttackProbability(TotalPower - 1, TargetCell.Power) >= 147 ComputerAggroProbability[ Player.Agressivity] do147 ComputerAggroProbability[ControlPlayer.Agressivity] do 148 148 Dec(TotalPower); 149 149 … … 151 151 TotalAttackPower := 0; 152 152 for NeighborCell in TargetCell.Neighbors do 153 if NeighborCell.Player = Player then begin153 if NeighborCell.Player = ControlPlayer then begin 154 154 // Use only necessary power 155 155 AttackPower := TotalPower - TotalAttackPower; 156 156 if NeighborCell.GetAvialPower < AttackPower then 157 157 AttackPower := NeighborCell.GetAvialPower; 158 Self. Player.SetMove(NeighborCell, TargetCell, AttackPower, False);158 Self.ControlPlayer.SetMove(NeighborCell, TargetCell, AttackPower, False); 159 159 TotalAttackPower := TotalAttackPower + AttackPower; 160 160 if TotalAttackPower >= TotalPower then Break; … … 258 258 begin 259 259 // If available power remains then use all for existed unit moves 260 for Move in Player.Moves do260 for Move in ControlPlayer.Moves do 261 261 with Move do begin 262 262 if CellFrom.GetAvialPower > 0 then begin
Note:
See TracChangeset
for help on using the changeset viewer.