1333 uAIMisc.AwareOfExplosion(0, 0, 0) |
1333 uAIMisc.AwareOfExplosion(0, 0, 0) |
1334 end; |
1334 end; |
1335 |
1335 |
1336 procedure ShotgunShot(Gear: PGear); |
1336 procedure ShotgunShot(Gear: PGear); |
1337 var t: PGear; |
1337 var t: PGear; |
1338 dmg, dist: LongInt; |
1338 dmg, r, dist: LongInt; |
|
1339 dx, dy: hwFloat; |
1339 begin |
1340 begin |
1340 Gear^.Radius:= cShotgunRadius; |
1341 Gear^.Radius:= cShotgunRadius; |
1341 t:= GearsList; |
1342 t:= GearsList; |
1342 while t <> nil do |
1343 while t <> nil do |
1343 begin |
1344 begin |
1344 dist:= hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)); |
|
1345 dmg:= ModifyDamage(min(Gear^.Radius + t^.Radius - dist, 25), t); |
|
1346 if dmg > 0 then |
|
1347 case t^.Kind of |
1345 case t^.Kind of |
1348 gtHedgehog, |
1346 gtHedgehog, |
1349 gtMine, |
1347 gtMine, |
1350 gtSMine, |
1348 gtSMine, |
1351 gtCase, |
1349 gtCase, |
1352 gtTarget, |
1350 gtTarget, |
1353 gtExplosives, |
1351 gtExplosives, |
1354 gtStructure: begin |
1352 gtStructure: begin |
1355 addFileLog('ShotgunShot radius: ' + inttostr(Gear^.Radius) + ', t^.Radius = ' + inttostr(t^.Radius) + ', distance = ' + inttostr(dist) + ', dmg = ' + inttostr(dmg)); |
1353 //addFileLog('ShotgunShot radius: ' + inttostr(Gear^.Radius) + ', t^.Radius = ' + inttostr(t^.Radius) + ', distance = ' + inttostr(dist) + ', dmg = ' + inttostr(dmg)); |
1356 if (not t^.Invulnerable) then |
1354 r:= Gear^.Radius + t^.Radius; |
1357 ApplyDamage(t, Gear^.Hedgehog, dmg, dsBullet) |
1355 dx:= Gear^.X-t^.X; |
1358 else |
1356 dx.isNegative:= false; |
1359 Gear^.State:= Gear^.State or gstWinner; |
1357 dy:= Gear^.Y-t^.Y; |
1360 |
1358 dy.isNegative:= false; |
1361 DeleteCI(t); |
1359 if r - hwRound(dx+dy) < 25 then |
1362 t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX); |
1360 begin |
1363 t^.dY:= t^.dY + Gear^.dY * dmg * _0_01; |
1361 dist:= hwRound(Distance(dx, dy)); |
1364 t^.State:= t^.State or gstMoving; |
1362 dmg:= ModifyDamage(min(r - dist, 25), t); |
1365 t^.Active:= true; |
1363 end; |
1366 FollowGear:= t |
1364 if dmg > 0 then |
|
1365 begin |
|
1366 if (not t^.Invulnerable) then |
|
1367 ApplyDamage(t, Gear^.Hedgehog, dmg, dsBullet) |
|
1368 else |
|
1369 Gear^.State:= Gear^.State or gstWinner; |
|
1370 |
|
1371 DeleteCI(t); |
|
1372 t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX); |
|
1373 t^.dY:= t^.dY + Gear^.dY * dmg * _0_01; |
|
1374 t^.State:= t^.State or gstMoving; |
|
1375 t^.Active:= true; |
|
1376 FollowGear:= t |
|
1377 end |
1367 end; |
1378 end; |
1368 gtGrave: begin |
1379 gtGrave: begin |
1369 t^.dY:= - _0_1; |
1380 r:= Gear^.Radius + t^.Radius; |
1370 t^.Active:= true |
1381 dx:= Gear^.X-t^.X; |
|
1382 dx.isNegative:= false; |
|
1383 dy:= Gear^.Y-t^.Y; |
|
1384 dy.isNegative:= false; |
|
1385 if r - hwRound(dx+dy) < 25 then |
|
1386 begin |
|
1387 dist:= hwRound(Distance(dx, dy)); |
|
1388 dmg:= ModifyDamage(min(r - dist, 25), t); |
|
1389 end; |
|
1390 if dmg > 0 then |
|
1391 begin |
|
1392 t^.dY:= - _0_1; |
|
1393 t^.Active:= true |
|
1394 end |
1371 end; |
1395 end; |
1372 end; |
1396 end; |
1373 t:= t^.NextGear |
1397 t:= t^.NextGear |
1374 end; |
1398 end; |
1375 if (GameFlags and gfSolidLand) = 0 then DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cShotgunRadius) |
1399 if (GameFlags and gfSolidLand) = 0 then DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cShotgunRadius) |