hedgewars/uGearsUtils.pas
changeset 12169 869cf5f34700
parent 12150 bbefbd1a3b0a
child 12176 29f1ea94488b
equal deleted inserted replaced
12168:666e18b1ca32 12169:869cf5f34700
    82     fX, fY, tdX, tdY: hwFloat;
    82     fX, fY, tdX, tdY: hwFloat;
    83     vg: PVisualGear;
    83     vg: PVisualGear;
    84     i, cnt: LongInt;
    84     i, cnt: LongInt;
    85     wrap: boolean;
    85     wrap: boolean;
    86     bubble: PVisualGear;
    86     bubble: PVisualGear;
       
    87     s: ansistring;
    87 begin
    88 begin
    88 if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');
    89 if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');
    89 if Radius > 25 then KickFlakes(Radius, X, Y);
    90 if Radius > 25 then KickFlakes(Radius, X, Y);
    90 
    91 
    91 if ((Mask and EXPLNoGfx) = 0) then
    92 if ((Mask and EXPLNoGfx) = 0) then
   176                                 if Gear^.Kind <> gtFlame then FollowGear:= Gear
   177                                 if Gear^.Kind <> gtFlame then FollowGear:= Gear
   177                                 end;
   178                                 end;
   178                             if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) and
   179                             if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) and
   179                                 (Gear^.Hedgehog^.Effects[heInvulnerable] = 0) and (Gear^.Hedgehog^.Effects[heFrozen] = 0) and
   180                                 (Gear^.Hedgehog^.Effects[heInvulnerable] = 0) and (Gear^.Hedgehog^.Effects[heFrozen] = 0) and
   180                                 (Gear^.State and gstHHDeath = 0) then
   181                                 (Gear^.State and gstHHDeath = 0) then
   181                                 Gear^.Hedgehog^.Effects[hePoisoned] := 5;
   182                                     begin
       
   183                                     if Gear^.Hedgehog^.Effects[hePoisoned] = 0 then
       
   184                                         begin
       
   185                                         s:= ansistring(Gear^.Hedgehog^.Name);
       
   186                                         AddCaption(FormatA(GetEventString(eidPoisoned), s), cWhiteColor, capgrpMessage)
       
   187                                         end;
       
   188                                     Gear^.Hedgehog^.Effects[hePoisoned] := 5;
       
   189                                     end
   182                             end;
   190                             end;
   183 
   191 
   184                         end;
   192                         end;
   185                 gtGrave: if Mask and EXPLDoNotTouchAny = 0 then
   193                 gtGrave: if Mask and EXPLDoNotTouchAny = 0 then
   186 // Run the calcs only once we know we have a type that will need damage
   194 // Run the calcs only once we know we have a type that will need damage
   662                         else
   670                         else
   663                             begin
   671                             begin
   664                             DrownGear(Gear);
   672                             DrownGear(Gear);
   665                             Gear^.State := Gear^.State and (not gstHHDriven);
   673                             Gear^.State := Gear^.State and (not gstHHDriven);
   666                             s:= ansistring(Gear^.Hedgehog^.Name);
   674                             s:= ansistring(Gear^.Hedgehog^.Name);
   667                             AddCaption(FormatA(GetEventString(eidDrowned), s), cWhiteColor, capgrpMessage);
   675                             if Gear^.Hedgehog^.King then
       
   676                                 AddCaption(FormatA(GetEventString(eidKingDied), s), cWhiteColor, capgrpMessage)
       
   677                             else
       
   678                                 AddCaption(FormatA(GetEventString(eidDrowned), s), cWhiteColor, capgrpMessage);
   668                             end
   679                             end
   669                         end
   680                         end
   670                     else
   681                     else
   671                         DrownGear(Gear);
   682                         DrownGear(Gear);
   672                     if Gear^.Kind = gtFlake then
   683                     if Gear^.Kind = gtFlake then
   722 
   733 
   723 procedure ResurrectHedgehog(var gear: PGear);
   734 procedure ResurrectHedgehog(var gear: PGear);
   724 var tempTeam : PTeam;
   735 var tempTeam : PTeam;
   725     sparkles: PVisualGear;
   736     sparkles: PVisualGear;
   726     gX, gY: LongInt;
   737     gX, gY: LongInt;
       
   738     s: ansistring;
   727 begin
   739 begin
   728     if (Gear^.LastDamage <> nil) then
   740     if (Gear^.LastDamage <> nil) then
   729         uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true)
   741         uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true)
   730     else
   742     else
   731         uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true);
   743         uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true);
   758     if gear <> nil then
   770     if gear <> nil then
   759         begin
   771         begin
   760         AddVisualGear(hwRound(gear^.X), hwRound(gear^.Y), vgtExplosion);
   772         AddVisualGear(hwRound(gear^.X), hwRound(gear^.Y), vgtExplosion);
   761         PlaySound(sndWarp);
   773         PlaySound(sndWarp);
   762         RenderHealth(gear^.Hedgehog^);
   774         RenderHealth(gear^.Hedgehog^);
       
   775         s:= ansistring(gear^.Hedgehog^.Name);
       
   776         AddCaption(FormatA(GetEventString(eidResurrected), s), cWhiteColor, capgrpMessage);
   763         ScriptCall('onGearResurrect', gear^.uid);
   777         ScriptCall('onGearResurrect', gear^.uid);
   764         gear^.State := gstWait;
   778         gear^.State := gstWait;
   765         end;
   779         end;
   766     RecountTeamHealth(tempTeam);
   780     RecountTeamHealth(tempTeam);
   767 end;
   781 end;