- Timestamp:
- Nov 16, 2014, 5:12:25 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r87 r90 11 11 const 12 12 ZoomFactor = 1.5; 13 MouseMinDiff = 6;13 MouseMinDiff = 0.1; 14 14 15 15 type … … 359 359 if Assigned(Core.Game.CurrentPlayer) then begin 360 360 if MoveActive then 361 if (Abs(StartMousePoint.X - X) > MouseMinDiff) or (Abs(StartMousePoint.Y - Y) > MouseMinDiff) then 361 if (Abs(StartMousePoint.X - X) > Trunc(Screen.PixelsPerInch * MouseMinDiff)) or 362 (Abs(StartMousePoint.Y - Y) > Trunc(Screen.PixelsPerInch * MouseMinDiff)) then 362 363 with Core.Game.CurrentPlayer do begin 363 364 if Mode = pmHuman then begin … … 390 391 Shift: TShiftState; X, Y: Integer); 391 392 begin 392 if (Abs(StartMousePoint.X - X) < MouseMinDiff) and (Abs(StartMousePoint.Y - Y) < MouseMinDiff) then begin 393 if (Abs(StartMousePoint.X - X) < Trunc(Screen.PixelsPerInch * MouseMinDiff)) and 394 (Abs(StartMousePoint.Y - Y) < Trunc(Screen.PixelsPerInch * MouseMinDiff)) then begin 393 395 if Core.Game.Running and (Core.Game.CurrentPlayer.Mode = pmHuman) then begin 394 396 Core.Game.CurrentPlayer.View.SelectCell(Point(X, Y), Core.Game.CurrentPlayer, Shift); -
trunk/Forms/UFormNew.pas
r82 r90 311 311 NewPlayer.Color := PlayerColors[Players.Count]; 312 312 NewPlayer.Mode := pmComputer; 313 NewPlayer.Agressivity := caMedium; 313 314 Players.Add(NewPlayer); 314 315 ReloadView; -
trunk/Forms/UFormPlayer.lfm
r29 r90 1 1 object FormPlayer: TFormPlayer 2 2 Left = 470 3 Height = 3 033 Height = 347 4 4 Top = 219 5 5 Width = 551 6 6 Caption = 'Player' 7 ClientHeight = 3 037 ClientHeight = 347 8 8 ClientWidth = 551 9 9 LCLVersion = '1.3' … … 26 26 Left = 307 27 27 Height = 25 28 Top = 2 5228 Top = 296 29 29 Width = 75 30 30 Anchors = [akRight, akBottom] … … 36 36 Left = 428 37 37 Height = 25 38 Top = 2 5238 Top = 296 39 39 Width = 75 40 40 Anchors = [akRight, akBottom] … … 83 83 TabOrder = 4 84 84 end 85 object Label4: TLabel 86 Left = 24 87 Height = 22 88 Top = 168 89 Width = 92 90 Caption = 'Agressivity:' 91 ParentColor = False 92 end 93 object ComboBoxAgressivity: TComboBox 94 Left = 139 95 Height = 30 96 Top = 168 97 Width = 368 98 ItemHeight = 0 99 Items.Strings = ( 100 'Low' 101 'Medium' 102 'High' 103 '' 104 ) 105 Style = csDropDownList 106 TabOrder = 5 107 end 108 object CheckBoxDefensive: TCheckBox 109 Left = 24 110 Height = 24 111 Top = 208 112 Width = 103 113 Caption = 'Defensive' 114 TabOrder = 6 115 end 85 116 end -
trunk/Forms/UFormPlayer.lrt
r29 r90 6 6 TFORMPLAYER.LABEL2.CAPTION=Mode: 7 7 TFORMPLAYER.LABEL3.CAPTION=Color: 8 TFORMPLAYER.LABEL4.CAPTION=Agressivity: 9 TFORMPLAYER.CHECKBOXDEFENSIVE.CAPTION=Defensive -
trunk/Forms/UFormPlayer.pas
r55 r90 16 16 ButtonCancel: TButton; 17 17 ButtonOk: TButton; 18 CheckBoxDefensive: TCheckBox; 18 19 ColorBox1: TColorBox; 19 20 ComboBox1: TComboBox; 21 ComboBoxAgressivity: TComboBox; 20 22 EditName: TEdit; 21 23 Label1: TLabel; 22 24 Label2: TLabel; 23 25 Label3: TLabel; 26 Label4: TLabel; 24 27 private 25 28 { private declarations } … … 40 43 SHuman = 'Human'; 41 44 SComputer = 'Computer'; 45 SAgroNotAttacking = 'Not attacking'; 46 SAgroLow = 'Low'; 47 SAgroMedium = 'Medium'; 48 SAgroHigh = 'High'; 42 49 43 50 { TFormPlayer } … … 54 61 ItemIndex := LastIndex; 55 62 end; 63 with ComboBoxAgressivity do begin 64 LastIndex := ItemIndex; 65 Clear; 66 Items.Add(SAgroLow); 67 Items.Add(SAgroMedium); 68 Items.Add(SAgroHigh); 69 ItemIndex := LastIndex; 70 end; 56 71 end; 57 72 … … 61 76 ComboBox1.ItemIndex := Integer(Player.Mode); 62 77 ColorBox1.Selected := Player.Color; 78 Label4.Visible := Player.Mode = pmComputer; 79 ComboBoxAgressivity.Visible := Player.Mode = pmComputer; 80 ComboBoxAgressivity.ItemIndex := Integer(Player.Agressivity); 81 CheckBoxDefensive.Visible := Player.Mode = pmComputer; 82 CheckBoxDefensive.Checked := Player.Defensive; 63 83 end; 64 84 … … 68 88 Player.Mode := TPlayerMode(ComboBox1.ItemIndex); 69 89 Player.Color := ColorBox1.Selected; 90 Player.Agressivity := TComputerAgressivity(ComboBoxAgressivity.ItemIndex); 91 Player.Defensive := CheckBoxDefensive.Checked; 70 92 end; 71 93 -
trunk/Languages/xtactics.cs.po
r82 r90 238 238 #: tformnew.checkboxfogofwar.caption 239 239 msgid "Fog of war" 240 msgstr " "240 msgstr "Skrytá mapa" 241 241 242 242 #: tformnew.checkboxsymetricmap.caption … … 339 339 msgstr "Hráč" 340 340 341 #: tformplayer.checkboxdefensive.caption 342 msgid "Defensive" 343 msgstr "Obranný" 344 341 345 #: tformplayer.combobox1.text 342 346 msgctxt "tformplayer.combobox1.text" … … 356 360 msgstr "Barva:" 357 361 362 #: tformplayer.label4.caption 363 msgid "Agressivity:" 364 msgstr "Agresivita:" 365 358 366 #: tformsettings.buttoncancel.caption 359 367 msgctxt "tformsettings.buttoncancel.caption" … … 373 381 #: tformsettings.checkbox1.caption 374 382 msgid "Autosave game on each turn" 375 msgstr " "383 msgstr "Automaticky uložit hru po každém tahu" 376 384 377 385 #: tformsettings.checkboxdevelmode.caption … … 501 509 msgstr "Zůstat naživu určený počet tahů" 502 510 511 #: uformplayer.sagrohigh 512 msgid "High" 513 msgstr "Vysoká" 514 515 #: uformplayer.sagrolow 516 msgid "Low" 517 msgstr "Nízká" 518 519 #: uformplayer.sagromedium 520 msgid "Medium" 521 msgstr "Střední" 522 523 #: uformplayer.sagronotattacking 524 msgid "Not attacking" 525 msgstr "" 526 503 527 #: uformplayer.scomputer 504 528 msgctxt "uformplayer.scomputer" … … 545 569 msgid "Wrong file format" 546 570 msgstr "Chybný formát souboru" 547 -
trunk/Languages/xtactics.po
r82 r90 325 325 msgstr "" 326 326 327 #: tformplayer.checkboxdefensive.caption 328 msgid "Defensive" 329 msgstr "" 330 327 331 #: tformplayer.combobox1.text 328 332 msgctxt "tformplayer.combobox1.text" … … 342 346 msgstr "" 343 347 348 #: tformplayer.label4.caption 349 msgid "Agressivity:" 350 msgstr "" 351 344 352 #: tformsettings.buttoncancel.caption 345 353 msgctxt "TFORMSETTINGS.BUTTONCANCEL.CAPTION" … … 487 495 msgstr "" 488 496 497 #: uformplayer.sagrohigh 498 msgid "High" 499 msgstr "" 500 501 #: uformplayer.sagrolow 502 msgid "Low" 503 msgstr "" 504 505 #: uformplayer.sagromedium 506 msgid "Medium" 507 msgstr "" 508 509 #: uformplayer.sagronotattacking 510 msgid "Not attacking" 511 msgstr "" 512 489 513 #: uformplayer.scomputer 490 514 msgctxt "uformplayer.scomputer" -
trunk/UGame.pas
r89 r90 239 239 240 240 TPlayerMode = (pmHuman, pmComputer); 241 TComputerAgressivity = (caLow, caMedium, caHigh); 241 242 242 243 { TPlayer } … … 258 259 StartCell: TCell; 259 260 PlayerMap: TPlayerMap; 261 Defensive: Boolean; 262 Agressivity: TComputerAgressivity; 260 263 procedure LoadFromNode(Node: TDOMNode); 261 264 procedure SaveToNode(Node: TDOMNode); … … 404 407 PlayerColors: array[0..7] of TColor = (clBlue, clRed, clGreen, clOrange, 405 408 clPurple, clMaroon, clAqua, clFuchsia); 409 ComputerAggroProbability: array[TComputerAgressivity] of Single = (0.9, 0.7, 0.5); 406 410 407 411 procedure InitStrings; … … 787 791 NewPlayer.Mode := Mode; 788 792 NewPlayer.Id := GetNewPlayerId; 793 if Mode = pmComputer then 794 NewPlayer.Agressivity := caMedium; 789 795 Add(NewPlayer); 790 796 end; … … 1671 1677 StartCell := FGame.Map.Cells.FindById(ReadInteger(Node, 'StartCell', 0)); 1672 1678 StartUnits := ReadInteger(Node, 'StartUnits', 0); 1679 Agressivity := TComputerAgressivity(ReadInteger(Node, 'Agressivity', Integer(caMedium))); 1680 Defensive := ReadBoolean(Node, 'Defensive', False); 1673 1681 1674 1682 with Node do begin … … 1689 1697 WriteInteger(Node, 'StartCell', StartCell.Id); 1690 1698 WriteInteger(Node, 'StartUnits', StartUnits); 1699 WriteInteger(Node, 'Agressivity', Integer(Agressivity)); 1700 WriteBoolean(Node, 'Defensive', Defensive); 1691 1701 1692 1702 with Node do begin … … 1787 1797 AttackDiff = 2; 1788 1798 begin 1799 if Game.CurrentPlayer.Defensive then Exit; 1800 1789 1801 AllCells := Game.Map.Cells; 1790 1802 TargetCells := TCells.Create; … … 1818 1830 end; 1819 1831 // Attack if target is weaker 1820 if TotalPower >= (Power + AttackDiff) then begin 1832 if Game.AttackProbability(TotalPower, Power) >= ComputerAggroProbability[Game.CurrentPlayer.Agressivity] then begin 1833 // Try to limit total attacking power to necessary minimum 1834 while Game.AttackProbability(TotalPower - 1, Power) >= ComputerAggroProbability[Game.CurrentPlayer.Agressivity] do 1835 Dec(TotalPower); 1836 1837 // Collect required attack units from our cells 1821 1838 TotalAttackPower := 0; 1822 1839 for I := 0 to Neighbors.Count - 1 do 1823 1840 if (TCell(Neighbors[I]).Player = Game.CurrentPlayer) then begin 1824 1841 // Use only necessary power 1825 AttackPower := Power - TotalAttackPower + AttackDiff;1842 AttackPower := TotalPower - TotalAttackPower; 1826 1843 if TCell(Neighbors[I]).GetAvialPower < AttackPower then 1827 1844 AttackPower := TCell(Neighbors[I]).GetAvialPower; 1828 1845 Game.SetMove(TCell(Neighbors[I]), TCell(TargetCells[C]), AttackPower, False); 1829 1846 TotalAttackPower := TotalAttackPower + AttackPower; 1847 if TotalAttackPower >= TotalPower then Break; 1830 1848 end; 1831 1849 end; … … 2084 2102 StartUnits := Source.StartUnits; 2085 2103 StartCell := Source.StartCell; 2104 Agressivity := Source.Agressivity; 2105 Defensive := Source.Defensive; 2086 2106 View.Assign(Source.View); 2087 2107 end; -
trunk/xtactics.lpi
r87 r90 111 111 <HasResources Value="True"/> 112 112 <ResourceBaseClass Value="Form"/> 113 <UnitName Value="UFormPlayer"/> 113 114 </Unit3> 114 115 <Unit4>
Note:
See TracChangeset
for help on using the changeset viewer.