hedgewars/uGearsUtils.pas
changeset 10526 b43d175d1577
parent 10512 25021aac078e
child 10558 b574f04c9685
equal deleted inserted replaced
10525:019b4fbb21d4 10526:b43d175d1577
   203     i:= _1_5;
   203     i:= _1_5;
   204 if (Gear^.Kind = gtHedgehog) and (Gear^.Hedgehog <> nil) and
   204 if (Gear^.Kind = gtHedgehog) and (Gear^.Hedgehog <> nil) and
   205    (Gear^.Hedgehog^.King or (Gear^.Hedgehog^.Effects[heFrozen] > 0)) then
   205    (Gear^.Hedgehog^.King or (Gear^.Hedgehog^.Effects[heFrozen] > 0)) then
   206     ModifyDamage:= hwRound(cDamageModifier * dmg * i * cDamagePercent * _0_5 * _0_01)
   206     ModifyDamage:= hwRound(cDamageModifier * dmg * i * cDamagePercent * _0_5 * _0_01)
   207 else
   207 else
   208     ModifyDamage:= hwRound(cDamageModifier * dmg * i * cDamagePercent * _0_01)
   208     ModifyDamage:= hwRound(cDamageModifier * dmg * i * cDamagePercent * _0_01);
   209 end;
   209 end;
   210 
   210 
   211 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
   211 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
   212 var s: shortstring;
   212 var s: shortstring;
   213     vampDmg, tmpDmg, i: Longword;
   213     vampDmg, tmpDmg, i: Longword;
   260             CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
   260             CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
   261             spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
   261             spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
   262             end;
   262             end;
   263         uStats.HedgehogDamaged(Gear, AttackerHog, Damage, false);
   263         uStats.HedgehogDamaged(Gear, AttackerHog, Damage, false);
   264         end;
   264         end;
       
   265 
       
   266 	if AprilOne and (Gear^.Hedgehog^.Hat = 'fr_tomato') and (Damage > 2) then
       
   267 	    for i := 0 to random(min(Damage,20))+5 do
       
   268 		begin
       
   269 		vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
       
   270 		if vg <> nil then
       
   271 		    with vg^ do
       
   272 			begin
       
   273 			dx:= 0.001 * (random(100)+10);
       
   274 			dy:= 0.001 * (random(100)+10);
       
   275 			tdy:= -cGravityf;
       
   276 			if random(2) = 0 then
       
   277 			    dx := -dx;
       
   278 			//if random(2) = 0 then
       
   279 			//    dy := -dy;
       
   280 			FrameTicks:= random(500) + 1000;
       
   281 			State:= ord(sprBubbles);
       
   282 			//Tint:= $bd2f03ff
       
   283 			Tint:= $ff0000ff
       
   284 			end
       
   285 	end
   265     end else
   286     end else
   266     //else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
   287     //else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
   267         Gear^.Hedgehog:= AttackerHog;
   288         Gear^.Hedgehog:= AttackerHog;
   268     inc(Gear^.Damage, Damage);
   289     inc(Gear^.Damage, Damage);
   269 
   290 
   281 end;
   302 end;
   282 
   303 
   283 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
   304 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
   284 begin
   305 begin
   285 if Hedgehog^.Effects[heFrozen] <> 0 then exit;
   306 if Hedgehog^.Effects[heFrozen] <> 0 then exit;
       
   307 
   286 if (Source = dsFall) or (Source = dsExplosion) then
   308 if (Source = dsFall) or (Source = dsExplosion) then
   287     case random(3) of
   309     case random(3) of
   288         0: PlaySoundV(sndOoff1, Hedgehog^.Team^.voicepack);
   310         0: PlaySoundV(sndOoff1, Hedgehog^.Team^.voicepack);
   289         1: PlaySoundV(sndOoff2, Hedgehog^.Team^.voicepack);
   311         1: PlaySoundV(sndOoff2, Hedgehog^.Team^.voicepack);
   290         2: PlaySoundV(sndOoff3, Hedgehog^.Team^.voicepack);
   312         2: PlaySoundV(sndOoff3, Hedgehog^.Team^.voicepack);