hedgewars/uAIMisc.pas
changeset 8963 1a8335f0d968
parent 8962 9780e79619ed
child 8964 962ede906da1
equal deleted inserted replaced
8962:9780e79619ed 8963:1a8335f0d968
   143             begin
   143             begin
   144             skip:= false;
   144             skip:= false;
   145             dead:= false;
   145             dead:= false;
   146             Kind:= Gear^.Kind;
   146             Kind:= Gear^.Kind;
   147             Radius:= Gear^.Radius;
   147             Radius:= Gear^.Radius;
       
   148             Density:= hwFloat2Float(Gear^.Density)/3;
   148             Flags:= Gear^.State;
   149             Flags:= Gear^.State;
   149             matters:= (Gear^.AIHints and aihDoesntMatter) = 0;
   150             matters:= (Gear^.AIHints and aihDoesntMatter) = 0;
   150 
   151 
   151             Point.X:= hwRound(Gear^.X);
   152             Point.X:= hwRound(Gear^.X);
   152             Point.Y:= hwRound(Gear^.Y);
   153             Point.Y:= hwRound(Gear^.Y);
   160                 else 
   161                 else 
   161                     begin
   162                     begin
   162                     Score:= Gear^.Health - Gear^.Damage;
   163                     Score:= Gear^.Health - Gear^.Damage;
   163                     inc(e)
   164                     inc(e)
   164                     end;
   165                     end;
   165                 Density:= 1;
       
   166                 end
   166                 end
   167             else if Gear^.Kind = gtExplosives then
   167             else if Gear^.Kind = gtExplosives then
   168                 begin
   168                 Score:= Gear^.Health - Gear^.Damage
   169                 Score:= Gear^.Health - Gear^.Damage;
       
   170                 Density:= 2
       
   171                 end
       
   172             else if Gear^.Kind = gtMine then 
   169             else if Gear^.Kind = gtMine then 
   173                 begin
       
   174                 Score:= max(0,35-Gear^.Damage);
   170                 Score:= max(0,35-Gear^.Damage);
   175                 Density:= 1/3
       
   176                 end
       
   177             end;
   171             end;
   178         inc(Targets.Count)
   172         inc(Targets.Count)
   179         end;
   173         end;
   180     Gear:= Gear^.NextGear
   174     Gear:= Gear^.NextGear
   181     end;
   175     end;
   500     Point.y:= hwRound(Me^.Y);
   494     Point.y:= hwRound(Me^.Y);
   501     skip:= false;
   495     skip:= false;
   502     matters:= true;
   496     matters:= true;
   503     Kind:= gtHedgehog;
   497     Kind:= gtHedgehog;
   504     Density:= 1;
   498     Density:= 1;
       
   499     Radius:= cHHRadius;
   505     Score:= - ThinkingHH^.Health
   500     Score:= - ThinkingHH^.Health
   506     end;
   501     end;
   507 // rate explosion
   502 // rate explosion
   508 dmgBase:= r + cHHRadius div 2;
       
   509 
   503 
   510 if (Flags and afErasesLand <> 0) and (GameFlags and gfSolidLand = 0) then erasure:= r
   504 if (Flags and afErasesLand <> 0) and (GameFlags and gfSolidLand = 0) then erasure:= r
   511 else erasure:= 0;
   505 else erasure:= 0;
   512 
   506 
   513 hadSkips:= false;
   507 hadSkips:= false;
   517         with Targets.ar[i] do
   511         with Targets.ar[i] do
   518           if not matters then hadSkips:= true
   512           if not matters then hadSkips:= true
   519             else
   513             else
   520             begin
   514             begin
   521             dmg:= 0;
   515             dmg:= 0;
       
   516             dmgBase:= r + Radius div 2;
   522             if abs(Point.x - x) + abs(Point.y - y) < dmgBase then
   517             if abs(Point.x - x) + abs(Point.y - y) < dmgBase then
   523                 dmg:= trunc(dmgMod * min((dmgBase - trunc(sqrt(sqr(Point.x - x)+sqr(Point.y - y)))) div 2, r));
   518                 dmg:= trunc(dmgMod * min((dmgBase - trunc(sqrt(sqr(Point.x - x)+sqr(Point.y - y)))) div 2, r));
   524 
   519 
   525             if dmg > 0 then
   520             if dmg > 0 then
   526                 begin
   521                 begin
   673     Point.y:= hwRound(Me^.Y);
   668     Point.y:= hwRound(Me^.Y);
   674     skip:= false;
   669     skip:= false;
   675     matters:= true;
   670     matters:= true;
   676     Kind:= gtHedgehog;
   671     Kind:= gtHedgehog;
   677     Density:= 1;
   672     Density:= 1;
       
   673     Radius:= cHHRadius;
   678     Score:= - ThinkingHH^.Health
   674     Score:= - ThinkingHH^.Health
   679     end;
   675     end;
   680 // rate shot
   676 // rate shot
   681 baseDmg:= cHHRadius + cShotgunRadius + 4;
   677 baseDmg:= cHHRadius + cShotgunRadius + 4;
   682 
   678