Skip to content

Commit

Permalink
Properties should restore up to a hundred health points
Browse files Browse the repository at this point in the history
Fixes #442
  • Loading branch information
RussellLVP committed Jan 11, 2017
1 parent 5e048fe commit 8ded695
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pawn/Interface/Math.pwn
Expand Up @@ -42,4 +42,8 @@ class Math {
public inline random(minimum, maximum) {
return (minimum + random(maximum - minimum));
}

public inline min(Float: a, Float: b) {
return ((a) < (b) ? (a) : (b));
}
};
6 changes: 3 additions & 3 deletions pawn/Interface/functions.pwn
Expand Up @@ -345,7 +345,7 @@ FortCarsonUpdate() {
GetPlayerHealth(ownerId, health);

if (health < 100)
SetPlayerHealth(ownerId, health + 2);
SetPlayerHealth(ownerId, Math->min(100.0, health + 2));

// LVP HQ.
propertyId = PropertyManager->propertyForSpecialFeature(HealthProtectionFeature);
Expand All @@ -356,7 +356,7 @@ FortCarsonUpdate() {

GetPlayerHealth(ownerId, health);
if (health < 100)
SetPlayerHealth(ownerId, health + 2);
SetPlayerHealth(ownerId, Math->min(100.0, health + 2));

// Ammunation.
propertyId = PropertyManager->propertyForSpecialFeature(ArmourFeature);
Expand All @@ -369,7 +369,7 @@ FortCarsonUpdate() {
GetPlayerArmour(ownerId, armour);

if (armour < 100)
SetPlayerArmour(ownerId, armour + 2);
SetPlayerArmour(ownerId, Math->min(100.0, armour + 2));

return 1;
}
Expand Down

0 comments on commit 8ded695

Please sign in to comment.