81 procedure initModule; |
81 procedure initModule; |
82 procedure freeModule; |
82 procedure freeModule; |
83 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
83 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
84 procedure ProcessGears; |
84 procedure ProcessGears; |
85 procedure EndTurnCleanup; |
85 procedure EndTurnCleanup; |
86 procedure ApplyDamage(Gear: PGear; Damage: Longword); |
86 procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource); |
87 procedure SetAllToActive; |
87 procedure SetAllToActive; |
88 procedure SetAllHHToActive; |
88 procedure SetAllHHToActive; |
89 procedure DrawGears; |
89 procedure DrawGears; |
90 procedure FreeGearsList; |
90 procedure FreeGearsList; |
91 procedure AddMiscGears; |
91 procedure AddMiscGears; |
633 procedure HealthMachine; |
633 procedure HealthMachine; |
634 var Gear: PGear; |
634 var Gear: PGear; |
635 team: PTeam; |
635 team: PTeam; |
636 i: LongWord; |
636 i: LongWord; |
637 flag: Boolean; |
637 flag: Boolean; |
638 begin |
638 tmp: LongWord; |
639 Gear:= GearsList; |
639 begin |
640 |
640 Gear:= GearsList; |
641 while Gear <> nil do |
641 |
642 begin |
642 while Gear <> nil do |
643 if Gear^.Kind = gtHedgehog then |
643 begin |
644 begin |
644 if Gear^.Kind = gtHedgehog then |
|
645 begin |
|
646 tmp:= 0; |
645 if PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] then |
647 if PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] then |
646 begin |
648 inc(tmp, min(ModifyDamage(5,Gear), max(0,Gear^.Health - 1 - Gear^.Damage))); |
647 inc(Gear^.Damage, min(ModifyDamage(5,Gear), max(0,Gear^.Health - 1 - Gear^.Damage))); |
649 inc(tmp, min(cHealthDecrease, max(0,Gear^.Health - 1 - Gear^.Damage))); |
648 if getRandom(2) = 0 then |
|
649 PlaySound(sndPoisonCough, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) |
|
650 else |
|
651 PlaySound(sndPoisonMoan, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); |
|
652 end; |
|
653 inc(Gear^.Damage, min(cHealthDecrease, max(0,Gear^.Health - 1 - Gear^.Damage))); |
|
654 if PHedgehog(Gear^.Hedgehog)^.King then |
650 if PHedgehog(Gear^.Hedgehog)^.King then |
655 begin |
651 begin |
656 flag:= false; |
652 flag:= false; |
657 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
653 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
658 for i:= 0 to Pred(team^.HedgehogsNumber) do |
654 for i:= 0 to Pred(team^.HedgehogsNumber) do |
659 if (team^.Hedgehogs[i].Gear <> nil) and |
655 if (team^.Hedgehogs[i].Gear <> nil) and |
660 (not team^.Hedgehogs[i].King) and |
656 (not team^.Hedgehogs[i].King) and |
661 (team^.Hedgehogs[i].Gear^.Health > team^.Hedgehogs[i].Gear^.Damage) |
657 (team^.Hedgehogs[i].Gear^.Health > team^.Hedgehogs[i].Gear^.Damage) |
662 then flag:= true; |
658 then flag:= true; |
663 if not flag then inc(Gear^.Damage, min(5, max(0,Gear^.Health - 1 - Gear^.Damage))) |
659 if not flag then inc(tmp, min(5, max(0,Gear^.Health - 1 - Gear^.Damage))) |
664 end; |
660 end; |
665 end; |
661 if tmp > 0 then ApplyDamage(Gear, tmp, dsPoison); |
666 |
662 end; |
667 Gear:= Gear^.NextGear |
663 |
668 end; |
664 Gear:= Gear^.NextGear |
|
665 end; |
669 end; |
666 end; |
670 |
667 |
671 procedure ProcessGears; |
668 procedure ProcessGears; |
672 const delay: LongWord = 0; |
669 const delay: LongWord = 0; |
673 step: (stDelay, stChDmg, stSweep, stTurnReact, |
670 step: (stDelay, stChDmg, stSweep, stTurnReact, |
889 t^.PortalCounter:= 0; |
886 t^.PortalCounter:= 0; |
890 t:= t^.NextGear |
887 t:= t^.NextGear |
891 end |
888 end |
892 end; |
889 end; |
893 |
890 |
894 procedure ApplyDamage(Gear: PGear; Damage: Longword); |
891 procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource); |
895 var s: shortstring; |
892 var s: shortstring; |
896 vampDmg, tmpDmg, i: Longword; |
893 vampDmg, tmpDmg, i: Longword; |
897 vg: PVisualGear; |
894 vg: PVisualGear; |
898 begin |
895 begin |
899 if (Gear^.Kind = gtHedgehog) and (Damage>=1) then |
896 if (Gear^.Kind = gtHedgehog) and (Damage>=1) then |
900 begin |
897 begin |
|
898 HHHurt(Gear^.Hedgehog, Source); |
901 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); |
899 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); |
902 tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage)); |
900 tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage)); |
903 if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then |
901 if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then |
904 begin |
902 begin |
905 if cVampiric then |
903 if cVampiric then |
1224 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
1222 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
1225 //{$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
1223 //{$IFDEF DEBUGFILE}AddFileLog('Damage: ' + inttostr(dmg));{$ENDIF} |
1226 if (Mask and EXPLNoDamage) = 0 then |
1224 if (Mask and EXPLNoDamage) = 0 then |
1227 begin |
1225 begin |
1228 if not Gear^.Invulnerable then |
1226 if not Gear^.Invulnerable then |
1229 ApplyDamage(Gear, dmg) |
1227 ApplyDamage(Gear, dmg, dsExplosion) |
1230 else |
1228 else |
1231 Gear^.State:= Gear^.State or gstWinner; |
1229 Gear^.State:= Gear^.State or gstWinner; |
1232 end; |
1230 end; |
1233 if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
1231 if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear^.Kind <> gtHedgehog) then |
1234 begin |
1232 begin |
1338 gtTarget, |
1336 gtTarget, |
1339 gtCase, |
1337 gtCase, |
1340 gtExplosives: begin |
1338 gtExplosives: begin |
1341 if (Ammo^.Kind = gtDrill) then begin Ammo^.Timer:= 0; exit; end; |
1339 if (Ammo^.Kind = gtDrill) then begin Ammo^.Timer:= 0; exit; end; |
1342 if (not Gear^.Invulnerable) then |
1340 if (not Gear^.Invulnerable) then |
1343 ApplyDamage(Gear, tmpDmg) |
1341 ApplyDamage(Gear, tmpDmg, dsShove) |
1344 else |
1342 else |
1345 Gear^.State:= Gear^.State or gstWinner; |
1343 Gear^.State:= Gear^.State or gstWinner; |
1346 if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then ApplyDamage(Gear, tmpDmg * 100); // crank up damage for explosives + blowtorch |
1344 if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then ApplyDamage(Gear, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch |
1347 |
1345 |
1348 DeleteCI(Gear); |
1346 DeleteCI(Gear); |
1349 if (Gear^.Kind = gtHedgehog) and PHedgehog(Gear^.Hedgehog)^.King then |
1347 if (Gear^.Kind = gtHedgehog) and PHedgehog(Gear^.Hedgehog)^.King then |
1350 begin |
1348 begin |
1351 Gear^.dX:= Ammo^.dX * Power * _0_005; |
1349 Gear^.dX:= Ammo^.dX * Power * _0_005; |