hedgewars/GSHandlers.inc
changeset 4184 bc2b88eea8c4
parent 4182 5240a84df702
child 4187 adb144a907aa
equal deleted inserted replaced
4182:5240a84df702 4184:bc2b88eea8c4
  4197     graves: TPGearArray;
  4197     graves: TPGearArray;
  4198     resgear: PGear;
  4198     resgear: PGear;
  4199     hh: PHedgehog;
  4199     hh: PHedgehog;
  4200     i: LongInt;
  4200     i: LongInt;
  4201 begin
  4201 begin
       
  4202     if (TurnTimeLeft > 0) then
       
  4203         dec(TurnTimeLeft);
       
  4204 
  4202     AllInactive := false;
  4205     AllInactive := false;
  4203     hh := PHedgehog(Gear^.Hedgehog);
  4206     hh := PHedgehog(Gear^.Hedgehog);
  4204     DrawCentered(hwRound(hh^.Gear^.X) + WorldDx, hwRound(hh^.Gear^.Y) + WorldDy -
  4207     DrawCentered(hwRound(hh^.Gear^.X) + WorldDx, hwRound(hh^.Gear^.Y) + WorldDy -
  4205             cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex);
  4208             cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex);
  4206     (*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF,
  4209     (*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF,
  4216         begin
  4219         begin
  4217         inc(Gear^.Power);
  4220         inc(Gear^.Power);
  4218         if not TestCollisionYwithGear(hh^.Gear, -1) then hh^.Gear^.Y := hh^.Gear^.Y - _1;
  4221         if not TestCollisionYwithGear(hh^.Gear, -1) then hh^.Gear^.Y := hh^.Gear^.Y - _1;
  4219         end;
  4222         end;
  4220 
  4223 
  4221     graves := GearsNear(Gear^.X, Gear^.Y + int2hwFloat(Gear^.Power),
  4224     graves := GearsNear(Gear^.X, Gear^.Y, gtGrave, Gear^.Radius);
  4222                     gtGrave, Gear^.Radius);
       
  4223 
  4225 
  4224     if Length(graves) = 0 then 
  4226     if Length(graves) = 0 then 
  4225         begin
  4227         begin
  4226         StopSound(Gear^.SoundChannel);
  4228         StopSound(Gear^.SoundChannel);
  4227         Gear^.Timer := 250;
  4229         Gear^.Timer := 250;
  4228         Gear^.doStep := @doStepIdle;
  4230         Gear^.doStep := @doStepIdle;
  4229         exit;
  4231         exit;
  4230         end;
  4232         end;
  4231 
  4233 
  4232     if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) then 
  4234     if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) and (TurnTimeLeft > 0) then 
  4233         begin
  4235         begin
  4234         i := getRandom(Length(graves));
  4236         i := getRandom(Length(graves));
  4235         dec(hh^.Gear^.Health);
  4237         dec(hh^.Gear^.Health);
  4236         if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then
  4238         if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then
  4237             hh^.Gear^.Damage:= 1;
  4239             hh^.Gear^.Damage:= 1;