86 function RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt; inline; |
86 function RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt; inline; |
87 function RealRateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt; |
87 function RealRateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt; |
88 function RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt; |
88 function RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt; |
89 function RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt; |
89 function RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt; |
90 function RateSeduction(Me: PGear): LongInt; |
90 function RateSeduction(Me: PGear): LongInt; |
|
91 function RateResurrector(Me: PGear): LongInt; |
91 function RateHammer(Me: PGear): LongInt; |
92 function RateHammer(Me: PGear): LongInt; |
92 |
93 |
93 function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean; |
94 function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean; |
94 function AIrndSign(num: LongInt): LongInt; inline; |
95 function AIrndSign(num: LongInt): LongInt; inline; |
95 function AIrndOffset(targ: TTarget; Level: LongWord): LongInt; inline; |
96 function AIrndOffset(targ: TTarget; Level: LongWord): LongInt; inline; |
100 bonuses: TBonuses; |
101 bonuses: TBonuses; |
101 |
102 |
102 walkbonuses: Twalkbonuses; |
103 walkbonuses: Twalkbonuses; |
103 |
104 |
104 const KillScore = 200; |
105 const KillScore = 200; |
|
106 ResurrectScore = 100; |
105 var friendlyfactor: LongInt = 300; |
107 var friendlyfactor: LongInt = 300; |
106 var dmgMod: real = 1.0; |
108 var dmgMod: real = 1.0; |
107 |
109 |
108 implementation |
110 implementation |
109 uses uCollisions, uVariables, uUtils, uGearsUtils; |
111 uses uCollisions, uVariables, uUtils, uGearsUtils; |
135 begin |
137 begin |
136 if (((Gear^.Kind = gtHedgehog) and |
138 if (((Gear^.Kind = gtHedgehog) and |
137 (Gear <> ThinkingHH) and |
139 (Gear <> ThinkingHH) and |
138 (Gear^.Health > Gear^.Damage) and |
140 (Gear^.Health > Gear^.Damage) and |
139 (not Gear^.Hedgehog^.Team^.hasgone)) or |
141 (not Gear^.Hedgehog^.Team^.hasgone)) or |
|
142 ((Gear^.Kind = gtGrave) and |
|
143 (Gear^.Health = 0)) or |
140 ((Gear^.Kind = gtExplosives) and |
144 ((Gear^.Kind = gtExplosives) and |
141 (Gear^.Health > Gear^.Damage)) or |
145 (Gear^.Health > Gear^.Damage)) or |
142 ((Gear^.Kind = gtMine) and |
146 ((Gear^.Kind = gtMine) and |
143 (Gear^.Health = 0) and |
147 (Gear^.Health = 0) and |
144 (Gear^.Damage < 35)) |
148 (Gear^.Damage < 35)) |
168 begin |
172 begin |
169 Score:= Gear^.Health - Gear^.Damage; |
173 Score:= Gear^.Health - Gear^.Damage; |
170 inc(e) |
174 inc(e) |
171 end; |
175 end; |
172 end |
176 end |
|
177 else if Gear^.Kind = gtGrave then |
|
178 if (Gear^.Hedgehog^.Team^.Clan = CurrentTeam^.Clan) then |
|
179 begin |
|
180 Score:= ResurrectScore; |
|
181 inc(f); |
|
182 end |
|
183 else |
|
184 begin |
|
185 Score:= -ResurrectScore; |
|
186 inc(e); |
|
187 end |
173 else if Gear^.Kind = gtExplosives then |
188 else if Gear^.Kind = gtExplosives then |
174 Score:= Gear^.Health - Gear^.Damage |
189 Score:= Gear^.Health - Gear^.Damage |
175 else if Gear^.Kind = gtMine then |
190 else if Gear^.Kind = gtMine then |
176 Score:= max(0,35-Gear^.Damage); |
191 Score:= max(0,35-Gear^.Damage); |
177 end; |
192 end; |
921 RateSeduction:= BadTurn |
936 RateSeduction:= BadTurn |
922 else |
937 else |
923 RateSeduction:= rate * 1024; |
938 RateSeduction:= rate * 1024; |
924 end; |
939 end; |
925 |
940 |
|
941 function RateResurrector(Me: PGear): LongInt; |
|
942 var i, r, rate, pX, pY: LongInt; |
|
943 meX, meY: hwFloat; |
|
944 hadSkips: boolean; |
|
945 begin |
|
946 meX:= Me^.X; |
|
947 meY:= Me^.Y; |
|
948 rate:= 0; |
|
949 for i:= 0 to Targets.Count do |
|
950 if (Targets.ar[i].Kind = gtGrave) and (not Targets.ar[i].dead) then |
|
951 with Targets.ar[i] do |
|
952 begin |
|
953 pX:= Point.X; |
|
954 pY:= Point.Y; |
|
955 |
|
956 if (not matters) then |
|
957 hadSkips:= true |
|
958 else if matters and (abs(pX - hwRound(meX)) + abs(pY - hwRound(meY)) < cResurrectorDist) then |
|
959 begin |
|
960 r:= trunc(sqrt(sqr(abs(pX - hwRound(meX)))+sqr(abs(pY - hwRound(meY))))); |
|
961 if r < cResurrectorDist then |
|
962 begin |
|
963 if Score > 0 then |
|
964 inc(rate, Score * 1024) |
|
965 else |
|
966 inc(rate, Score * friendlyFactor div 100 * 1024); |
|
967 // a "dead" grave is a grave that we have resurrected |
|
968 dead:= true; |
|
969 Targets.reset:= true; |
|
970 end; |
|
971 end; |
|
972 end; |
|
973 |
|
974 if hadSkips and (rate <= 0) then |
|
975 RateResurrector:= BadTurn |
|
976 else |
|
977 RateResurrector:= rate * 1024; |
|
978 end; |
|
979 |
926 function RateHammer(Me: PGear): LongInt; |
980 function RateHammer(Me: PGear): LongInt; |
927 var x, y, i, r, rate: LongInt; |
981 var x, y, i, r, rate: LongInt; |
928 hadSkips: boolean; |
982 hadSkips: boolean; |
929 begin |
983 begin |
930 // hammer hit shift against attecker hog is 10 |
984 // hammer hit shift against attecker hog is 10 |