changeset 2726 | a84fc5113d01 |
parent 2716 | b9ca1bfca24f |
child 2728 | 640916bedea7 |
2725:89908847b155 | 2726:a84fc5113d01 |
---|---|
82 procedure FreeGearsList; |
82 procedure FreeGearsList; |
83 procedure AddMiscGears; |
83 procedure AddMiscGears; |
84 procedure AssignHHCoords; |
84 procedure AssignHHCoords; |
85 procedure InsertGearToList(Gear: PGear); |
85 procedure InsertGearToList(Gear: PGear); |
86 procedure RemoveGearFromList(Gear: PGear); |
86 procedure RemoveGearFromList(Gear: PGear); |
87 function ModifyDamage(dmg: Longword; Gear: PGear): Longword; |
|
87 |
88 |
88 implementation |
89 implementation |
89 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics, |
90 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics, |
90 uAIMisc, uLocale, uAI, uAmmos, uTriggers, uStats, uVisualGears, |
91 uAIMisc, uLocale, uAI, uAmmos, uTriggers, uStats, uVisualGears, |
91 {$IFDEF GLES11} |
92 {$IFDEF GLES11} |
421 AddGear:= gear; |
422 AddGear:= gear; |
422 end; |
423 end; |
423 |
424 |
424 procedure DeleteGear(Gear: PGear); |
425 procedure DeleteGear(Gear: PGear); |
425 var team: PTeam; |
426 var team: PTeam; |
426 t: Longword; |
427 t,i: Longword; |
427 begin |
428 begin |
428 DeleteCI(Gear); |
429 DeleteCI(Gear); |
429 |
430 |
430 if Gear^.Tex <> nil then |
431 if Gear^.Tex <> nil then |
431 begin |
432 begin |
451 end; |
452 end; |
452 |
453 |
453 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
454 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
454 if CurrentHedgehog^.Gear = Gear then |
455 if CurrentHedgehog^.Gear = Gear then |
455 FreeActionsList; // to avoid ThinkThread on drawned gear |
456 FreeActionsList; // to avoid ThinkThread on drawned gear |
457 |
|
458 if PHedgehog(Gear^.Hedgehog)^.King then |
|
459 for i:= 0 to Pred(team^.Clan^.TeamsNumber) do |
|
460 TeamGoneEffect(team^.Clan^.Teams[i]^); |
|
456 |
461 |
457 PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
462 PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
458 inc(KilledHHs); |
463 inc(KilledHHs); |
459 RecountTeamHealth(team) |
464 RecountTeamHealth(team) |
460 end; |
465 end; |
714 DeleteVisualGear(SpeechGear); // remove to restore persisting beyond end of turn. Tiy says was too much of a gameplay issue |
719 DeleteVisualGear(SpeechGear); // remove to restore persisting beyond end of turn. Tiy says was too much of a gameplay issue |
715 SpeechGear:= nil |
720 SpeechGear:= nil |
716 end; |
721 end; |
717 |
722 |
718 if (Gear <> nil) then |
723 if (Gear <> nil) then |
719 if (GameFlags and gfInvulnerable) = 0 then |
724 if ((GameFlags and gfInvulnerable) = 0) and (not King or (TotalRounds >= 0)) then // King is protected for one round |
720 Gear^.Invulnerable:= false; |
725 Gear^.Invulnerable:= false; |
721 end; |
726 end; |
722 end; |
727 end; |
723 |
728 |
724 procedure ApplyDamage(Gear: PGear; Damage: Longword); |
729 procedure ApplyDamage(Gear: PGear; Damage: Longword); |
1610 begin |
1615 begin |
1611 dmg:= dmgRadius + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))); |
1616 dmg:= dmgRadius + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))); |
1612 if (dmg > 1) and |
1617 if (dmg > 1) and |
1613 ((Gear^.State and gstNoDamage) = 0) then |
1618 ((Gear^.State and gstNoDamage) = 0) then |
1614 begin |
1619 begin |
1615 dmg:= modifyDamage(min(dmg div 2, Radius)); |
1620 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
1616 case Gear^.Kind of |
1621 case Gear^.Kind of |
1617 gtHedgehog, |
1622 gtHedgehog, |
1618 gtMine, |
1623 gtMine, |
1619 gtCase, |
1624 gtCase, |
1620 gtTarget, |
1625 gtTarget, |
1660 begin |
1665 begin |
1661 Gear^.Radius:= cShotgunRadius; |
1666 Gear^.Radius:= cShotgunRadius; |
1662 t:= GearsList; |
1667 t:= GearsList; |
1663 while t <> nil do |
1668 while t <> nil do |
1664 begin |
1669 begin |
1665 dmg:= modifyDamage(min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25)); |
1670 dmg:= ModifyDamage(min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25), Gear); |
1666 if dmg > 0 then |
1671 if dmg > 0 then |
1667 case t^.Kind of |
1672 case t^.Kind of |
1668 gtHedgehog, |
1673 gtHedgehog, |
1669 gtMine, |
1674 gtMine, |
1670 gtCase, |
1675 gtCase, |
1692 end; |
1697 end; |
1693 |
1698 |
1694 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); |
1699 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); |
1695 var t: PGearArray; |
1700 var t: PGearArray; |
1696 Gear: PGear; |
1701 Gear: PGear; |
1697 i: LongInt; |
1702 i, tmpDmg: LongInt; |
1698 begin |
1703 begin |
1699 t:= CheckGearsCollision(Ammo); |
1704 t:= CheckGearsCollision(Ammo); |
1700 i:= t^.Count; |
1705 i:= t^.Count; |
1701 |
1706 |
1702 Damage:= modifyDamage(Damage); |
|
1703 |
|
1704 if (Ammo^.Kind = gtFlame) and (i > 0) then Ammo^.Health:= 0; |
1707 if (Ammo^.Kind = gtFlame) and (i > 0) then Ammo^.Health:= 0; |
1705 while i > 0 do |
1708 while i > 0 do |
1706 begin |
1709 begin |
1707 dec(i); |
1710 dec(i); |
1708 Gear:= t^.ar[i]; |
1711 Gear:= t^.ar[i]; |
1712 tmpDmg:= ModifyDamage(Damage, Gear); |
|
1709 if (Gear^.State and gstNoDamage) = 0 then |
1713 if (Gear^.State and gstNoDamage) = 0 then |
1710 begin |
1714 begin |
1711 if (Gear^.Kind = gtHedgehog) and (Ammo^.State and gsttmpFlag <> 0) and (Ammo^.Kind = gtShover) then Gear^.FlightTime:= 1; |
1715 if (Gear^.Kind = gtHedgehog) and (Ammo^.State and gsttmpFlag <> 0) and (Ammo^.Kind = gtShover) then Gear^.FlightTime:= 1; |
1712 |
1716 |
1713 case Gear^.Kind of |
1717 case Gear^.Kind of |
1715 gtMine, |
1719 gtMine, |
1716 gtTarget, |
1720 gtTarget, |
1717 gtCase: begin |
1721 gtCase: begin |
1718 if (Ammo^.Kind = gtDrill) then begin Ammo^.Timer:= 0; exit; end; |
1722 if (Ammo^.Kind = gtDrill) then begin Ammo^.Timer:= 0; exit; end; |
1719 if (not Gear^.Invulnerable) then |
1723 if (not Gear^.Invulnerable) then |
1720 ApplyDamage(Gear, Damage) |
1724 ApplyDamage(Gear, tmpDmg) |
1721 else |
1725 else |
1722 Gear^.State:= Gear^.State or gstWinner; |
1726 Gear^.State:= Gear^.State or gstWinner; |
1723 |
1727 |
1724 DeleteCI(Gear); |
1728 DeleteCI(Gear); |
1725 Gear^.dX:= Ammo^.dX * Power * _0_01; |
1729 Gear^.dX:= Ammo^.dX * Power * _0_01; |
2042 DeleteGear(Gear); |
2046 DeleteGear(Gear); |
2043 Gear:= nil |
2047 Gear:= nil |
2044 end |
2048 end |
2045 end; |
2049 end; |
2046 |
2050 |
2051 function ModifyDamage(dmg: Longword; Gear: PGear): Longword; |
|
2052 begin |
|
2053 (* Invulnerability cannot be placed in here due to still needing kicks |
|
2054 Not without a new damage machine. |
|
2055 King check should be in here instead of ApplyDamage since Tiy wants them kicked less |
|
2056 *) |
|
2057 if (PHedgehog(Gear^.Hedgehog) <> nil) and (PHedgehog(Gear^.Hedgehog)^.King) then |
|
2058 ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * cDamagePercent * _0_5) |
|
2059 else |
|
2060 ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * cDamagePercent) |
|
2061 end; |
|
2062 |
|
2047 procedure init_uGears; |
2063 procedure init_uGears; |
2048 begin |
2064 begin |
2049 CurAmmoGear:= nil; |
2065 CurAmmoGear:= nil; |
2050 GearsList:= nil; |
2066 GearsList:= nil; |
2051 KilledHHs:= 0; |
2067 KilledHHs:= 0; |