hedgewars/uAIMisc.pas
changeset 6474 42e9773eedfd
parent 6396 71dd6b8494e5
child 6580 6155187bf599
equal deleted inserted replaced
6473:2bed5ba1a7ea 6474:42e9773eedfd
   113 
   113 
   114 if e > f then friendlyfactor:= 300 + (e - f) * 30
   114 if e > f then friendlyfactor:= 300 + (e - f) * 30
   115 else friendlyfactor:= max(30, 300 - f * 80 div max(1,e))
   115 else friendlyfactor:= max(30, 300 - f * 80 div max(1,e))
   116 end;
   116 end;
   117 
   117 
       
   118 procedure AddBonus(x, y: LongInt; r: Longword; s: LongInt);
       
   119 begin
       
   120 bonuses.ar[bonuses.Count].x:= x;
       
   121 bonuses.ar[bonuses.Count].y:= y;
       
   122 bonuses.ar[bonuses.Count].Radius:= r;
       
   123 bonuses.ar[bonuses.Count].Score:= s;
       
   124 inc(bonuses.Count);
       
   125 TryDo(bonuses.Count <= MAXBONUS, 'Bonuses overflow', true)
       
   126 end;
       
   127 
   118 procedure FillBonuses(isAfterAttack: boolean; filter: TGearsType);
   128 procedure FillBonuses(isAfterAttack: boolean; filter: TGearsType);
   119 var Gear: PGear;
   129 var Gear: PGear;
   120     MyClan: PClan;
   130     MyClan: PClan;
   121 
       
   122     procedure AddBonus(x, y: LongInt; r: Longword; s: LongInt);
       
   123     begin
       
   124     bonuses.ar[bonuses.Count].x:= x;
       
   125     bonuses.ar[bonuses.Count].y:= y;
       
   126     bonuses.ar[bonuses.Count].Radius:= r;
       
   127     bonuses.ar[bonuses.Count].Score:= s;
       
   128     inc(bonuses.Count);
       
   129     TryDo(bonuses.Count <= MAXBONUS, 'Bonuses overflow', true)
       
   130     end;
       
   131 
       
   132 begin
   131 begin
   133 bonuses.Count:= 0;
   132 bonuses.Count:= 0;
   134 MyClan:= ThinkingHH^.Hedgehog^.Team^.Clan;
   133 MyClan:= ThinkingHH^.Hedgehog^.Team^.Clan;
   135 Gear:= GearsList;
   134 Gear:= GearsList;
   136 while Gear <> nil do
   135 while Gear <> nil do