30 |
30 |
31 function ModifyDamage(dmg: Longword; Gear: PGear): Longword; |
31 function ModifyDamage(dmg: Longword; Gear: PGear): Longword; |
32 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource); |
32 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource); |
33 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword); |
33 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword); |
34 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource); |
34 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource); |
35 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: Longword; showMessage: boolean; vgTint: Longword); |
35 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: LongInt; showMessage: boolean; vgTint: Longword); |
36 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: Longword; showMessage: boolean); |
36 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: LongInt; showMessage: boolean); |
|
37 function IncHogHealth(Hedgehog: PHedgehog; healthBoost: LongInt): LongInt; |
37 procedure CheckHHDamage(Gear: PGear); |
38 procedure CheckHHDamage(Gear: PGear); |
38 procedure CalcRotationDirAngle(Gear: PGear); |
39 procedure CalcRotationDirAngle(Gear: PGear); |
39 procedure ResurrectHedgehog(var gear: PGear); |
40 procedure ResurrectHedgehog(var gear: PGear); |
40 |
41 |
41 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); inline; |
42 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); inline; |
288 vampDmg:= hwRound(int2hwFloat(tmpDmg)*_0_8); |
289 vampDmg:= hwRound(int2hwFloat(tmpDmg)*_0_8); |
289 if vampDmg >= 1 then |
290 if vampDmg >= 1 then |
290 begin |
291 begin |
291 // was considering pulsing on attack, Tiy thinks it should be permanent while in play |
292 // was considering pulsing on attack, Tiy thinks it should be permanent while in play |
292 //CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstVampiric; |
293 //CurrentHedgehog^.Gear^.State:= CurrentHedgehog^.Gear^.State or gstVampiric; |
293 inc(CurrentHedgehog^.Gear^.Health,vampDmg); |
294 vampDmg:= IncHogHealth(CurrentHedgehog, vampDmg); |
294 // Prevent overflow |
|
295 if (CurrentHedgehog^.Gear^.Health < 0) or (CurrentHedgehog^.Gear^.Health > cMaxHogHealth) then |
|
296 CurrentHedgehog^.Gear^.Health:= cMaxHogHealth; |
|
297 RenderHealth(CurrentHedgehog^); |
295 RenderHealth(CurrentHedgehog^); |
298 RecountTeamHealth(CurrentHedgehog^.Team); |
296 RecountTeamHealth(CurrentHedgehog^.Team); |
299 HHHeal(CurrentHedgehog, vampDmg, true, $FF0000FF); |
297 HHHeal(CurrentHedgehog, vampDmg, true, $FF0000FF); |
300 end |
298 end |
301 end; |
299 end; |
376 {- |
374 {- |
377 Show heal particles and message at hog gear. |
375 Show heal particles and message at hog gear. |
378 Hedgehog: Hedgehog which gets the health boost |
376 Hedgehog: Hedgehog which gets the health boost |
379 healthBoost: Amount of added health added |
377 healthBoost: Amount of added health added |
380 showMessage: Whether to show announcer message |
378 showMessage: Whether to show announcer message |
381 vgTint: Tint of heal particle |
379 vgTint: Tint of heal particle (if 0, don't render particles) |
382 -} |
380 -} |
383 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: Longword; showMessage: boolean; vgTint: Longword); |
381 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: LongInt; showMessage: boolean; vgTint: Longword); |
384 var i: LongInt; |
382 var i: LongInt; |
385 vg: PVisualGear; |
383 vg: PVisualGear; |
386 s: ansistring; |
384 s: ansistring; |
387 begin |
385 begin |
388 if healthBoost < 1 then |
386 if healthBoost < 1 then |
394 AddCaption(FormatA(trmsg[sidHealthGain], s), Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo) |
392 AddCaption(FormatA(trmsg[sidHealthGain], s), Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo) |
395 end; |
393 end; |
396 |
394 |
397 i:= 0; |
395 i:= 0; |
398 // One particle for every 5 HP. Max. 200 particles |
396 // One particle for every 5 HP. Max. 200 particles |
399 while (i < healthBoost) and (i < 1000) do |
397 if (vgTint <> 0) then |
400 begin |
398 while (i < healthBoost) and (i < 1000) do |
401 vg:= AddVisualGear(hwRound(Hedgehog^.Gear^.X), hwRound(Hedgehog^.Gear^.Y), vgtStraightShot); |
399 begin |
402 if vg <> nil then |
400 vg:= AddVisualGear(hwRound(Hedgehog^.Gear^.X), hwRound(Hedgehog^.Gear^.Y), vgtStraightShot); |
403 with vg^ do |
401 if vg <> nil then |
404 begin |
402 with vg^ do |
405 Tint:= vgTint; |
403 begin |
406 State:= ord(sprHealth) |
404 Tint:= vgTint; |
407 end; |
405 State:= ord(sprHealth) |
408 inc(i, 5) |
406 end; |
409 end; |
407 inc(i, 5) |
|
408 end; |
410 end; |
409 end; |
411 |
410 |
412 // Shorthand for the same above, but with tint implied |
411 // Shorthand for the same above, but with tint implied |
413 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: Longword; showMessage: boolean); |
412 procedure HHHeal(Hedgehog: PHedgehog; healthBoost: LongInt; showMessage: boolean); |
414 begin |
413 begin |
415 HHHeal(Hedgehog, healthBoost, showMessage, $00FF00FF); |
414 HHHeal(Hedgehog, healthBoost, showMessage, $00FF00FF); |
|
415 end; |
|
416 |
|
417 // Increase hog health by healthBoost (at least 1). |
|
418 // Resulting health is capped at cMaxHogHealth. |
|
419 // Returns actual amount healed. |
|
420 function IncHogHealth(Hedgehog: PHedgehog; healthBoost: LongInt): LongInt; |
|
421 var oldHealth: LongInt; |
|
422 begin |
|
423 if healthBoost < 1 then |
|
424 begin |
|
425 IncHogHealth:= 0; |
|
426 exit; |
|
427 end; |
|
428 oldHealth:= Hedgehog^.Gear^.Health; |
|
429 inc(Hedgehog^.Gear^.Health, healthBoost); |
|
430 // Prevent overflow |
|
431 if (Hedgehog^.Gear^.Health < 1) or (Hedgehog^.Gear^.Health > cMaxHogHealth) then |
|
432 Hedgehog^.Gear^.Health:= cMaxHogHealth; |
|
433 IncHogHealth:= Hedgehog^.Gear^.Health - oldHealth; |
416 end; |
434 end; |
417 |
435 |
418 procedure CheckHHDamage(Gear: PGear); |
436 procedure CheckHHDamage(Gear: PGear); |
419 var |
437 var |
420 dmg: LongInt; |
438 dmg: LongInt; |