Changeset 297 for trunk/UBuilding.pas


Ignore:
Timestamp:
Mar 29, 2019, 2:11:34 PM (6 years ago)
Author:
chronos
Message:
  • Added: Unit bonuses configurable for buildings.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UBuilding.pas

    r296 r297  
    1616    Cost: Integer;
    1717    SpecialType: TBuildingSpecialType;
     18    BonusAttack: Integer;
     19    BonusDefense: Integer;
     20    BonusViewRange: Integer;
     21    BonusGrow: Integer;
    1822    class function GetFields: TItemFields; override;
    1923    procedure GetValue(Index: Integer; out Value); override;
     
    5458  SNone = 'None';
    5559  SCity = 'City';
     60  SBonusAttack = 'Unit attack bonus';
     61  SBonusDefense = 'Unit defense bonus';
     62  SBonusViewRange = 'Unit view range bonus';
     63  SBonusGrow = 'Unit grow bonus';
    5664
    5765
     
    93101  Field.EnumStates.Add(SNone);
    94102  Field.EnumStates.Add(SCity);
     103  Result.AddField(4, 'BonusAttack', SBonusAttack, dtInteger);
     104  Result.AddField(5, 'BonusDefense', SBonusDefense, dtInteger);
     105  Result.AddField(6, 'BonusViewRange', SBonusViewRange, dtInteger);
     106  Result.AddField(7, 'BonusGrow', SBonusGrow, dtInteger);
    95107end;
    96108
     
    100112  else if Index = 2 then Integer(Value) := Cost
    101113  else if Index = 3 then TBuildingSpecialType(Value) := SpecialType
     114  else if Index = 4 then Integer(Value) := BonusAttack
     115  else if Index = 5 then Integer(Value) := BonusDefense
     116  else if Index = 6 then Integer(Value) := BonusViewRange
     117  else if Index = 7 then Integer(Value) := BonusGrow
    102118  else inherited;
    103119end;
     
    108124  else if Index = 2 then Cost := Integer(Value)
    109125  else if Index = 3 then SpecialType := TBuildingSpecialType(Value)
     126  else if Index = 4 then BonusAttack := Integer(Value)
     127  else if Index = 5 then BonusDefense := Integer(Value)
     128  else if Index = 6 then BonusViewRange := Integer(Value)
     129  else if Index = 7 then BonusGrow := Integer(Value)
    110130  else inherited;
    111131end;
Note: See TracChangeset for help on using the changeset viewer.