hedgewars/uGears.pas
changeset 4932 f11d80bac7ed
parent 4900 8ad0e23e6d63
child 4976 088d40d8aba2
equal deleted inserted replaced
4931:da43c36a6e92 4932:f11d80bac7ed
  1260 uAIMisc.AwareOfExplosion(0, 0, 0)
  1260 uAIMisc.AwareOfExplosion(0, 0, 0)
  1261 end;
  1261 end;
  1262 
  1262 
  1263 procedure ShotgunShot(Gear: PGear);
  1263 procedure ShotgunShot(Gear: PGear);
  1264 var t: PGear;
  1264 var t: PGear;
  1265     dmg: LongInt;
  1265     dmg, dist: LongInt;
  1266 begin
  1266 begin
  1267 Gear^.Radius:= cShotgunRadius;
  1267 Gear^.Radius:= cShotgunRadius;
  1268 t:= GearsList;
  1268 t:= GearsList;
  1269 while t <> nil do
  1269 while t <> nil do
  1270     begin
  1270     begin
  1271     dmg:= ModifyDamage(min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25), t);
  1271     dist:= hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y));
       
  1272     dmg:= ModifyDamage(min(Gear^.Radius + t^.Radius - dist, 25), t);
  1272     if dmg > 0 then
  1273     if dmg > 0 then
  1273     case t^.Kind of
  1274     case t^.Kind of
  1274         gtHedgehog,
  1275         gtHedgehog,
  1275             gtMine,
  1276             gtMine,
  1276             gtSMine,
  1277             gtSMine,
  1277             gtCase,
  1278             gtCase,
  1278             gtTarget,
  1279             gtTarget,
  1279             gtExplosives,
  1280             gtExplosives,
  1280             gtStructure: begin
  1281             gtStructure: begin
       
  1282 addFileLog('ShotgunShot radius: ' + inttostr(Gear^.Radius) + ', t^.Radius = ' + inttostr(t^.Radius) + ', distance = ' + inttostr(dist) + ', dmg = ' + inttostr(dmg));
  1281                     if (not t^.Invulnerable) then
  1283                     if (not t^.Invulnerable) then
  1282                         ApplyDamage(t, Gear^.Hedgehog, dmg, dsBullet)
  1284                         ApplyDamage(t, Gear^.Hedgehog, dmg, dsBullet)
  1283                     else
  1285                     else
  1284                         Gear^.State:= Gear^.State or gstWinner;
  1286                         Gear^.State:= Gear^.State or gstWinner;
  1285 
  1287