equal
deleted
inserted
replaced
106 gtExplosives, |
106 gtExplosives, |
107 gtStructure: begin |
107 gtStructure: begin |
108 // Run the calcs only once we know we have a type that will need damage |
108 // Run the calcs only once we know we have a type that will need damage |
109 tdX:= Gear^.X-fX; |
109 tdX:= Gear^.X-fX; |
110 tdY:= Gear^.Y-fY; |
110 tdY:= Gear^.Y-fY; |
111 if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then |
111 if (tdX.Round + tdY.Round + 2) < dmgBase then |
112 dmg:= dmgBase - hwRound(Distance(tdX, tdY)); |
112 dmg:= dmgBase - hwRound(Distance(tdX, tdY)); |
113 if dmg > 1 then |
113 if dmg > 1 then |
114 begin |
114 begin |
115 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
115 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
116 //AddFileLog('Damage: ' + inttostr(dmg)); |
116 //AddFileLog('Damage: ' + inttostr(dmg)); |
140 end; |
140 end; |
141 gtGrave: begin |
141 gtGrave: begin |
142 // Run the calcs only once we know we have a type that will need damage |
142 // Run the calcs only once we know we have a type that will need damage |
143 tdX:= Gear^.X-fX; |
143 tdX:= Gear^.X-fX; |
144 tdY:= Gear^.Y-fY; |
144 tdY:= Gear^.Y-fY; |
145 if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then |
145 if (tdX.Round + tdY.Round + 2) < dmgBase then |
146 dmg:= dmgBase - hwRound(Distance(tdX, tdY)); |
146 dmg:= dmgBase - hwRound(Distance(tdX, tdY)); |
147 if dmg > 1 then |
147 if dmg > 1 then |
148 begin |
148 begin |
149 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
149 dmg:= ModifyDamage(min(dmg div 2, Radius), Gear); |
150 Gear^.dY:= - _0_004 * dmg; |
150 Gear^.dY:= - _0_004 * dmg; |
239 end; |
239 end; |
240 uStats.HedgehogDamaged(Gear, AttackerHog, Damage, false); |
240 uStats.HedgehogDamaged(Gear, AttackerHog, Damage, false); |
241 end; |
241 end; |
242 end |
242 end |
243 else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure |
243 else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure |
244 begin |
|
245 Gear^.Hedgehog:= AttackerHog; |
244 Gear^.Hedgehog:= AttackerHog; |
246 end; |
|
247 inc(Gear^.Damage, Damage); |
245 inc(Gear^.Damage, Damage); |
248 |
246 |
249 ScriptCall('onGearDamage', Gear^.UID, Damage); |
247 ScriptCall('onGearDamage', Gear^.UID, Damage); |
250 end; |
248 end; |
251 |
249 |
319 |
317 |
320 procedure CalcRotationDirAngle(Gear: PGear); |
318 procedure CalcRotationDirAngle(Gear: PGear); |
321 var |
319 var |
322 dAngle: real; |
320 dAngle: real; |
323 begin |
321 begin |
324 dAngle := (Gear^.dX.QWordValue + Gear^.dY.QWordValue) / $80000000; |
322 // Frac/Round to be kind to JS as of 2012-08-27 where there is yet no int64/uint64 |
|
323 dAngle := (Gear^.dX.Round + Gear^.dY.Round) / 2 + (Gear^.dX.Frac+Gear^.dY.Frac) / $80000000; |
325 if not Gear^.dX.isNegative then |
324 if not Gear^.dX.isNegative then |
326 Gear^.DirAngle := Gear^.DirAngle + dAngle |
325 Gear^.DirAngle := Gear^.DirAngle + dAngle |
327 else |
326 else |
328 Gear^.DirAngle := Gear^.DirAngle - dAngle; |
327 Gear^.DirAngle := Gear^.DirAngle - dAngle; |
329 |
328 |