661 end; |
661 end; |
662 end; |
662 end; |
663 |
663 |
664 procedure ApplyDamage(Gear: PGear; Damage: Longword); |
664 procedure ApplyDamage(Gear: PGear; Damage: Longword); |
665 var s: shortstring; |
665 var s: shortstring; |
666 vampDmg: Longword; |
666 vampDmg, tmpDmg: Longword; |
667 begin |
667 begin |
668 if Gear^.Kind = gtHedgehog then |
668 if Gear^.Kind = gtHedgehog then |
669 begin |
669 begin |
670 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); |
670 AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); |
671 Damage:= min(Damage, max(0,Gear^.Health-Gear^.Damage)); |
671 tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage)); |
672 if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (Damage >= 1) then |
672 if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then |
673 begin |
673 begin |
674 if cVampiric then |
674 if cVampiric then |
675 begin |
675 begin |
676 vampDmg:= hwRound(int2hwFloat(Damage)*_0_8); |
676 vampDmg:= hwRound(int2hwFloat(tmpDmg)*_0_8); |
677 // was considering pulsing on attack, Tiy thinks it should be permanent while in play |
677 if vampDmg >= 1 then |
678 //CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstVampiric; |
678 begin |
679 inc(CurrentHedgehog^.Gear^.Health,vampDmg); |
679 // was considering pulsing on attack, Tiy thinks it should be permanent while in play |
680 str(vampDmg, s); |
680 //CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstVampiric; |
681 s:= '+' + s; |
681 inc(CurrentHedgehog^.Gear^.Health,vampDmg); |
682 AddCaption(s, CurrentHedgehog^.Team^.Clan^.Color, capgrpAmmoinfo); |
682 str(vampDmg, s); |
683 RenderHealth(CurrentHedgehog^); |
683 s:= '+' + s; |
684 RecountTeamHealth(CurrentHedgehog^.Team); |
684 AddCaption(s, CurrentHedgehog^.Team^.Clan^.Color, capgrpAmmoinfo); |
|
685 RenderHealth(CurrentHedgehog^); |
|
686 RecountTeamHealth(CurrentHedgehog^.Team); |
|
687 end |
685 end; |
688 end; |
686 if ((GameFlags and gfKarma) <> 0) and |
689 if ((GameFlags and gfKarma) <> 0) and |
687 ((GameFlags and gfInvulnerable) = 0) and |
690 ((GameFlags and gfInvulnerable) = 0) and |
688 not CurrentHedgehog^.Gear^.Invulnerable then |
691 not CurrentHedgehog^.Gear^.Invulnerable then |
689 begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid |
692 begin // this cannot just use Damage or it interrupts shotgun and gets you called stupid |
690 if CurrentHedgehog^.Gear^.Health < int(Damage) then |
693 if CurrentHedgehog^.Gear^.Health < int(tmpDmg) then |
691 begin |
694 begin |
692 // Add damage to trigger normal resolution |
695 // Add damage to trigger normal resolution |
693 CurrentHedgehog^.Gear^.Health := 0; |
696 CurrentHedgehog^.Gear^.Health := 0; |
694 inc(CurrentHedgehog^.Gear^.Damage); |
697 inc(CurrentHedgehog^.Gear^.Damage); |
695 end |
698 end |
696 else |
699 else |
697 dec(CurrentHedgehog^.Gear^.Health, Damage); |
700 dec(CurrentHedgehog^.Gear^.Health, tmpDmg); |
698 AddGear(hwRound(Gear^.X), |
701 AddGear(hwRound(CurrentHedgehog^.Gear^.X), |
699 hwRound(Gear^.Y), |
702 hwRound(CurrentHedgehog^.Gear^.Y), |
700 gtHealthTag, Damage, _0, _0, 0)^.Hedgehog:= CurrentHedgehog; |
703 gtHealthTag, tmpDmg, _0, _0, 0)^.Hedgehog:= CurrentHedgehog; |
701 RenderHealth(CurrentHedgehog^); |
704 RenderHealth(CurrentHedgehog^); |
702 RecountTeamHealth(CurrentHedgehog^.Team); |
705 RecountTeamHealth(CurrentHedgehog^.Team); |
703 end; |
706 end; |
704 end; |
707 end; |
705 end; |
708 end; |