Changeset 265 for trunk/UCore.pas


Ignore:
Timestamp:
Jan 15, 2019, 1:03:40 AM (6 years ago)
Author:
chronos
Message:
  • Modified: Cell power is now internally represented as unit power (TUnit class).
  • Modified: Allow to have only one player in the game.
  • Added: New win objective None to just play freely without any win objective.
  • Added: New win objective to capture entire map.
  • Added: TGameSystem class to represent various game play systems of other existing games.
  • Fixed: Clear correctly defender player from unit moves if his cell is captured.
  • Fixed: Do not allow to remove too many players to have at least minimum players.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r254 r265  
    99  UGame, UApplicationInfo, UPersistentForm, UScaleDPI, UCoolTranslator,
    1010  URegistry, ULastOpenedList, UTheme, Registry, Menus, UFormClient, UPlayer,
    11   UGameServer, UGameClient, fgl, UServerList;
     11  UGameServer, UGameClient, fgl, UServerList, UGameSystem, UUnit;
    1212
    1313type
     
    8787    procedure UpdateOtherForms;
    8888    procedure FormClientActions;
     89    procedure InitGameSystems;
    8990  public
    9091    Game: TGame;
     
    99100    LocalClients: TClients;
    100101    ServerList: TServerList;
     102    GameSystems: TGameSystems;
    101103    procedure ReopenGameOnInit;
    102104    procedure LoadConfig;
     
    445447procedure TCore.DataModuleCreate(Sender: TObject);
    446448begin
     449  GameSystems := TGameSystems.Create;
     450  InitGameSystems;
    447451  Server := TServer.Create;
    448452  LocalClients := TClients.Create;
    449453  GameSettings := TGame.Create;
     454  GameSettings.GameSystem := GameSystems.First;
    450455  Game := TGame.Create;
    451456  Game.OnMoveUpdated := DoMoveUpdated;
     
    453458  Game.OnNewTurn := GameNewTurnExecute;
    454459  Game.OnPlayerChange := DoPlayerChange;
     460  Game.GameSystem := GameSystems.First;
    455461  Server.Game := Game;
    456462  LocalClients.Game := Game;
     
    481487  FreeAndNil(Game);
    482488  FreeAndNil(GameSettings);
     489  FreeAndNil(GameSystems);
    483490end;
    484491
     
    486493begin
    487494  LastOpenedList1.LoadToMenuItem(FormMain.MenuItemLoadRecent, LoadRecentExecute);
     495end;
     496
     497procedure TCore.InitGameSystems;
     498begin
     499  with GameSystems.AddNew('HexWars') do begin
     500    MaxPlayerCount := 3;
     501    with UnitKinds.AddNew('Unit') do begin
     502      Moves := 1;
     503      Stack := 99;
     504    end;
     505  end;
     506
     507  with GameSystems.AddNew('Civilization') do begin
     508    MaxPlayerCount := 3;
     509    with UnitKinds.AddNew('Scout') do begin
     510      Moves := 1;
     511      Stack := 1;
     512    end;
     513    with UnitKinds.AddNew('Settler') do begin
     514      Moves := 1;
     515      Stack := 1;
     516    end;
     517  end;
     518
     519  with GameSystems.AddNew('Dune 2') do begin
     520    MaxPlayerCount := 3;
     521    with UnitKinds.AddNew('Light Infantry') do begin
     522      Moves := 1;
     523    end;
     524    with UnitKinds.AddNew('Heavy Troopers') do begin
     525      Moves := 1;
     526    end;
     527    with UnitKinds.AddNew('Trike') do begin
     528      Moves := 1;
     529    end;
     530    with UnitKinds.AddNew('Quad') do begin
     531      Moves := 1;
     532    end;
     533  end;
     534
     535  with GameSystems.AddNew('Battle Isle 2') do begin
     536    MaxPlayerCount := 8;
     537    with UnitKinds.AddNew('Demon 132') do begin
     538      Moves := 4;
     539      Stack := 10;
     540    end;
     541    with UnitKinds.AddNew('Troll 142') do begin
     542      Moves := 3;
     543      Stack := 10;
     544    end;
     545    with UnitKinds.AddNew('Ranger 132') do begin
     546      Moves := 10;
     547      Stack := 10;
     548    end;
     549    with UnitKinds.AddNew('Buggy') do begin
     550      Moves := 10;
     551      Stack := 10;
     552    end;
     553  end;
    488554end;
    489555
Note: See TracChangeset for help on using the changeset viewer.