hedgewars/uGears.pas
changeset 4153 6bd94e4c5d65
parent 4148 eaff5615f976
child 4155 9160dbe77118
equal deleted inserted replaced
4152:07008cb354f9 4153:6bd94e4c5d65
   537                 gear^.dY:= int2hwfloat(-4 + longint(getRandom(8))) / 1000;
   537                 gear^.dY:= int2hwfloat(-4 + longint(getRandom(8))) / 1000;
   538                 end;
   538                 end;
   539  gtResurrector: begin
   539  gtResurrector: begin
   540                 gear^.Radius := 100;
   540                 gear^.Radius := 100;
   541                 end;
   541                 end;
       
   542      gtWaterUp: begin
       
   543                 gear^.Tag := 47;
       
   544                 end;
   542     end;
   545     end;
   543 
   546 
   544 InsertGearToList(gear);
   547 InsertGearToList(gear);
   545 AddGear:= gear;
   548 AddGear:= gear;
   546 
   549 
   660         if (not isInMultiShoot) then Gear^.Karma:= 0;
   663         if (not isInMultiShoot) then Gear^.Karma:= 0;
   661         Gear^.Damage:= 0
   664         Gear^.Damage:= 0
   662         end;
   665         end;
   663     Gear:= Gear^.NextGear
   666     Gear:= Gear^.NextGear
   664     end;
   667     end;
   665 SuddenDeathDmg:= false;
       
   666 end;
   668 end;
   667 
   669 
   668 procedure HealthMachine;
   670 procedure HealthMachine;
   669 var Gear: PGear;
   671 var Gear: PGear;
   670     team: PTeam;
   672     team: PTeam;
   682             if PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] then
   684             if PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] then
   683                 begin
   685                 begin
   684                 inc(tmp, ModifyDamage(5, Gear));
   686                 inc(tmp, ModifyDamage(5, Gear));
   685                 if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth)  // does not need a minimum check since <= 1 basically disables it
   687                 if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth)  // does not need a minimum check since <= 1 basically disables it
   686                 end;
   688                 end;
   687             inc(tmp, cHealthDecrease);
   689             if (TotalRounds > cSuddenDTurns - 1) then
   688             if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth, cHealthDecrease);
   690                 begin
       
   691                 inc(tmp, cHealthDecrease);
       
   692                 if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth, cHealthDecrease)
       
   693                 end;
   689             if PHedgehog(Gear^.Hedgehog)^.King then
   694             if PHedgehog(Gear^.Hedgehog)^.King then
   690                 begin
   695                 begin
   691                 flag:= false;
   696                 flag:= false;
   692                 team:= PHedgehog(Gear^.Hedgehog)^.Team;
   697                 team:= PHedgehog(Gear^.Hedgehog)^.Team;
   693                 for i:= 0 to Pred(team^.HedgehogsNumber) do
   698                 for i:= 0 to Pred(team^.HedgehogsNumber) do
   795             end;
   800             end;
   796     stWater: if (not bBetweenTurns) and (not isInMultiShoot) then
   801     stWater: if (not bBetweenTurns) and (not isInMultiShoot) then
   797                 begin
   802                 begin
   798                 if TotalRounds = cSuddenDTurns + 1 then bWaterRising:= true;
   803                 if TotalRounds = cSuddenDTurns + 1 then bWaterRising:= true;
   799 
   804 
   800                 if bWaterRising then
   805                 if bWaterRising and (cWaterRise > 0) then
   801                 AddGear(0, 0, gtWaterUp, 0, _0, _0, 0);
   806                     AddGear(0, 0, gtWaterUp, 0, _0, _0, 0)^.Tag:= cWaterRise;
   802 
   807 
   803                 inc(step)
   808                 inc(step)
   804                 end else inc(step);
   809                 end else inc(step);
   805     stChWin2: begin
   810     stChWin2: begin
   806             CheckForWin;
   811             CheckForWin;
   807             inc(step)
   812             inc(step)
   808             end;
   813             end;
   809     stHealth: begin
   814     stHealth: begin
   810             if (TotalRounds = cSuddenDTurns - 1) and (cHealthDecrease = 0) and not isInMultiShoot then
   815             if (TotalRounds = cSuddenDTurns) and not SuddenDeathDmg and not isInMultiShoot then
   811                 begin
   816                 begin
   812                 cHealthDecrease:= 5;
   817                 SuddenDeathDmg:= true;
   813                 AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
   818                 AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
   814                 playSound(sndSuddenDeath)
   819                 playSound(sndSuddenDeath)
   815                 end
   820                 end
   816             else if (TotalRounds < cSuddenDTurns - 1) and not isInMultiShoot then
   821             else if (TotalRounds < cSuddenDTurns) and not isInMultiShoot then
   817                 begin
   822                 begin
   818                 i:= cSuddenDTurns - TotalRounds - 1;
   823                 i:= cSuddenDTurns - TotalRounds;
   819                 s:= inttostr(i);
   824                 s:= inttostr(i);
   820                 if i = 1 then
   825                 if i = 1 then
   821                     AddCaption(trmsg[sidRoundSD], cWhiteColor, capgrpGameState)
   826                     AddCaption(trmsg[sidRoundSD], cWhiteColor, capgrpGameState)
   822                 else if i in [2, 5, 10, 15, 20, 25, 50, 100] then
   827                 else if i in [2, 5, 10, 15, 20, 25, 50, 100] then
   823                     AddCaption(Format(trmsg[sidRoundsSD], s), cWhiteColor, capgrpGameState);
   828                     AddCaption(Format(trmsg[sidRoundsSD], s), cWhiteColor, capgrpGameState);
   826                 or isInMultiShoot
   831                 or isInMultiShoot
   827                 or (TotalRounds = -1) then inc(step)
   832                 or (TotalRounds = -1) then inc(step)
   828             else begin
   833             else begin
   829                 bBetweenTurns:= true;
   834                 bBetweenTurns:= true;
   830                 HealthMachine;
   835                 HealthMachine;
   831                 if cHealthDecrease > 0 then SuddenDeathDmg:= true;
       
   832                 step:= stChDmg
   836                 step:= stChDmg
   833                 end
   837                 end
   834             end;
   838             end;
   835     stSpawn: begin
   839     stSpawn: begin
   836             if not isInMultiShoot then SpawnBoxOfSmth;
   840             if not isInMultiShoot then SpawnBoxOfSmth;