hedgewars/uGears.pas
changeset 6453 11c578d30bd3
parent 6380 1ff5ad1d771b
child 6468 da1e7fe7cff7
equal deleted inserted replaced
6452:7c6f9b6672dc 6453:11c578d30bd3
   651         else
   651         else
   652             uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true);
   652             uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true);
   653 
   653 
   654         inc(KilledHHs);
   654         inc(KilledHHs);
   655         RecountTeamHealth(team);
   655         RecountTeamHealth(team);
   656         if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and not Gear^.Hedgehog^.Effects[heResurrectable] then
   656         if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and (not Gear^.Hedgehog^.Effects[heResurrectable]) then
   657             with CurrentHedgehog^ do 
   657             with CurrentHedgehog^ do 
   658                 begin
   658                 begin
   659                 inc(Team^.stats.AIKills);
   659                 inc(Team^.stats.AIKills);
   660                 FreeTexture(Team^.AIKillsTex);
   660                 FreeTexture(Team^.AIKillsTex);
   661                 Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
   661                 Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
   696             else
   696             else
   697                 dec(Gear^.Health, dmg);
   697                 dec(Gear^.Health, dmg);
   698 
   698 
   699             if (Gear^.Hedgehog^.Team = CurrentTeam) and
   699             if (Gear^.Hedgehog^.Team = CurrentTeam) and
   700                (Gear^.Damage <> Gear^.Karma) and
   700                (Gear^.Damage <> Gear^.Karma) and
   701                 not Gear^.Hedgehog^.King and
   701                 (not Gear^.Hedgehog^.King) and
   702                 not Gear^.Hedgehog^.Effects[hePoisoned] and
   702                 (not Gear^.Hedgehog^.Effects[hePoisoned]) and
   703                 not SuddenDeathDmg then
   703                 (not SuddenDeathDmg) then
   704                 Gear^.State:= Gear^.State or gstLoser;
   704                 Gear^.State:= Gear^.State or gstLoser;
   705 
   705 
   706             spawnHealthTagForHH(Gear, dmg);
   706             spawnHealthTagForHH(Gear, dmg);
   707 
   707 
   708             RenderHealth(Gear^.Hedgehog^);
   708             RenderHealth(Gear^.Hedgehog^);
   861             inc(step)
   861             inc(step)
   862             end;
   862             end;
   863     stHealth: begin
   863     stHealth: begin
   864             if (cWaterRise <> 0) or (cHealthDecrease <> 0) then
   864             if (cWaterRise <> 0) or (cHealthDecrease <> 0) then
   865                 begin
   865                 begin
   866                 if (TotalRounds = cSuddenDTurns) and not SuddenDeath and not isInMultiShoot then
   866                 if (TotalRounds = cSuddenDTurns) and (not SuddenDeath) and (not isInMultiShoot) then
   867                     begin
   867                     begin
   868                     SuddenDeath:= true;
   868                     SuddenDeath:= true;
   869                     if cHealthDecrease <> 0 then
   869                     if cHealthDecrease <> 0 then
   870                         begin
   870                         begin
   871                         SuddenDeathDmg:= true;
   871                         SuddenDeathDmg:= true;
   882                     AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
   882                     AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
   883                     playSound(sndSuddenDeath);
   883                     playSound(sndSuddenDeath);
   884                     MusicFN:= SDMusic;
   884                     MusicFN:= SDMusic;
   885                     ChangeMusic
   885                     ChangeMusic
   886                     end
   886                     end
   887                 else if (TotalRounds < cSuddenDTurns) and not isInMultiShoot then
   887                 else if (TotalRounds < cSuddenDTurns) and (not isInMultiShoot) then
   888                     begin
   888                     begin
   889                     i:= cSuddenDTurns - TotalRounds;
   889                     i:= cSuddenDTurns - TotalRounds;
   890                     s:= inttostr(i);
   890                     s:= inttostr(i);
   891                     if i = 1 then
   891                     if i = 1 then
   892                         AddCaption(trmsg[sidRoundSD], cWhiteColor, capgrpGameState)
   892                         AddCaption(trmsg[sidRoundSD], cWhiteColor, capgrpGameState)
   893                     else if i in [2, 5, 10, 15, 20, 25, 50, 100] then
   893                     else if (i = 2) or ((i > 0) and ((i mod 50 = 0) or ((i <= 25) and (i mod 5 = 0)))) then
   894                         AddCaption(Format(trmsg[sidRoundsSD], s), cWhiteColor, capgrpGameState);
   894                         AddCaption(Format(trmsg[sidRoundsSD], s), cWhiteColor, capgrpGameState);
   895                     end;
   895                     end;
   896                 end;
   896                 end;
   897             if bBetweenTurns
   897             if bBetweenTurns
   898                 or isInMultiShoot
   898                 or isInMultiShoot
   938         delay2:= cInactDelay * 50
   938         delay2:= cInactDelay * 50
   939     else
   939     else
   940         begin
   940         begin
   941         dec(delay2);
   941         dec(delay2);
   942 
   942 
   943         if ((delay2 mod cInactDelay) = 0) and (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and not CurrentHedgehog^.Unplaced then
   943         if ((delay2 mod cInactDelay) = 0) and (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (not CurrentHedgehog^.Unplaced) then
   944             begin
   944             begin
   945             if (CurrentHedgehog^.Gear^.State and gstAttacked <> 0) and (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0) then
   945             if (CurrentHedgehog^.Gear^.State and gstAttacked <> 0) and (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0) then
   946                 begin
   946                 begin
   947                 CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstHHChooseTarget;
   947                 CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstHHChooseTarget;
   948                 isCursorVisible := true
   948                 isCursorVisible := true
   949                 end;
   949                 end;
   950             CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and not gstAttacked;
   950             CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State and (not gstAttacked);
   951             end;
   951             end;
   952         if delay2 = 0 then
   952         if delay2 = 0 then
   953             begin
   953             begin
   954             if (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.Gear^.State and gstAttacked = 0) and (CurAmmoGear = nil) then SweepDirty;
   954             if (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.Gear^.State and gstAttacked = 0) and (CurAmmoGear = nil) then SweepDirty;
   955             CheckNoDamage;
   955             CheckNoDamage;
   967     end;
   967     end;
   968 
   968 
   969 if TurnTimeLeft > 0 then
   969 if TurnTimeLeft > 0 then
   970         if CurrentHedgehog^.Gear <> nil then
   970         if CurrentHedgehog^.Gear <> nil then
   971             if ((CurrentHedgehog^.Gear^.State and gstAttacking) = 0)
   971             if ((CurrentHedgehog^.Gear^.State and gstAttacking) = 0)
   972                 and not isInMultiShoot then
   972                 and (not isInMultiShoot) then
   973                 begin
   973                 begin
   974                 if (TurnTimeLeft = 5000)
   974                 if (TurnTimeLeft = 5000)
   975                     and (cHedgehogTurnTime >= 10000)
   975                     and (cHedgehogTurnTime >= 10000)
   976                     and (not PlacingHogs)
   976                     and (not PlacingHogs)
   977                     and (CurrentHedgehog^.Gear <> nil)
   977                     and (CurrentHedgehog^.Gear <> nil)
  1065             RenderHealth(t^.Hedgehog^);
  1065             RenderHealth(t^.Hedgehog^);
  1066             end;
  1066             end;
  1067         t:= t^.NextGear
  1067         t:= t^.NextGear
  1068         end;
  1068         end;
  1069    
  1069    
  1070     if ((GameFlags and gfResetWeps) <> 0) and not PlacingHogs then
  1070     if ((GameFlags and gfResetWeps) <> 0) and (not PlacingHogs) then
  1071         ResetWeapons;
  1071         ResetWeapons;
  1072 
  1072 
  1073     if (GameFlags and gfResetHealth) <> 0 then
  1073     if (GameFlags and gfResetHealth) <> 0 then
  1074         for i:= 0 to Pred(TeamsCount) do
  1074         for i:= 0 to Pred(TeamsCount) do
  1075             RecountTeamHealth(TeamsArray[i])
  1075             RecountTeamHealth(TeamsArray[i])
  1119                     end;
  1119                     end;
  1120                 end
  1120                 end
  1121             end;
  1121             end;
  1122         if ((GameFlags and gfKarma) <> 0) and
  1122         if ((GameFlags and gfKarma) <> 0) and
  1123            ((GameFlags and gfInvulnerable) = 0) and
  1123            ((GameFlags and gfInvulnerable) = 0) and
  1124            not CurrentHedgehog^.Gear^.Invulnerable then
  1124            (not CurrentHedgehog^.Gear^.Invulnerable) then
  1125            begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
  1125            begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid
  1126            inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
  1126            inc(CurrentHedgehog^.Gear^.Karma, tmpDmg);
  1127            CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
  1127            CurrentHedgehog^.Gear^.LastDamage := CurrentHedgehog;
  1128            spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
  1128            spawnHealthTagForHH(CurrentHedgehog^.Gear, tmpDmg);
  1129            end;
  1129            end;
  1326                                 if not Gear^.Invulnerable then
  1326                                 if not Gear^.Invulnerable then
  1327                                     Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner);
  1327                                     Gear^.State:= (Gear^.State or gstMoving) and (not gstWinner);
  1328                                 Gear^.Active:= true;
  1328                                 Gear^.Active:= true;
  1329                                 if Gear^.Kind <> gtFlame then FollowGear:= Gear
  1329                                 if Gear^.Kind <> gtFlame then FollowGear:= Gear
  1330                                 end;
  1330                                 end;
  1331                             if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) and not Gear^.Invulnerable then
  1331                             if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) and (not Gear^.Invulnerable) then
  1332                                 Gear^.Hedgehog^.Effects[hePoisoned] := true;
  1332                                 Gear^.Hedgehog^.Effects[hePoisoned] := true;
  1333                             end;
  1333                             end;
  1334 
  1334 
  1335                         end;
  1335                         end;
  1336                 gtGrave: begin
  1336                 gtGrave: begin
  1477                         ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg, dsShove)
  1477                         ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg, dsShove)
  1478                     else
  1478                     else
  1479                         Gear^.State:= Gear^.State or gstWinner;
  1479                         Gear^.State:= Gear^.State or gstWinner;
  1480                     if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then 
  1480                     if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then 
  1481                         begin
  1481                         begin
  1482                         if (Ammo^.Hedgehog^.Gear <> nil) then Ammo^.Hedgehog^.Gear^.State:= Ammo^.Hedgehog^.Gear^.State and not gstNotKickable;
  1482                         if (Ammo^.Hedgehog^.Gear <> nil) then Ammo^.Hedgehog^.Gear^.State:= Ammo^.Hedgehog^.Gear^.State and (not gstNotKickable);
  1483                         ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch
  1483                         ApplyDamage(Gear, Ammo^.Hedgehog, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch
  1484                         end;
  1484                         end;
  1485 
  1485 
  1486                     DeleteCI(Gear);
  1486                     DeleteCI(Gear);
  1487                     if (Gear^.Kind = gtHedgehog) and Gear^.Hedgehog^.King then
  1487                     if (Gear^.Kind = gtHedgehog) and Gear^.Hedgehog^.King then
  1962                     end
  1962                     end
  1963         until (x + Delta > Right);
  1963         until (x + Delta > Right);
  1964 
  1964 
  1965         dec(Delta, 60)
  1965         dec(Delta, 60)
  1966     until (cnt2 > 0) or (Delta < 70);
  1966     until (cnt2 > 0) or (Delta < 70);
  1967     if (cnt2 = 0) and skipProximity and not reallySkip then tryAgain:= true
  1967     if (cnt2 = 0) and skipProximity and (not reallySkip) then tryAgain:= true
  1968     else tryAgain:= false;
  1968     else tryAgain:= false;
  1969     reallySkip:= true;
  1969     reallySkip:= true;
  1970     end;
  1970     end;
  1971 
  1971 
  1972 if cnt2 > 0 then
  1972 if cnt2 > 0 then