print("running repair script");

plyrSrct = getMobStructure(player); 
plyerMax = getMobMaxStructure(player);
playerHealth = plyrSrct / plyerMax;


repairPercent = .50

if getRepairs() == 0 then
repairPercent = .50
messageQ("Field Repairs 50%", 10);
elseif getRepairs() == 1 then
repairPercent = .66
messageQ("Field Repairs 66%", 10);
elseif getRepairs() == 2 then
repairPercent = .75
messageQ("Field Repairs 75%", 10);
else
repairPercent = .80
messageQ("Field Repairs 80%", 10);
end

lastHealth = getPlayerHealth();
newHealth = playerHealth;

if playerHealth <= lastHealth then
newHealth = playerHealth + ((lastHealth - playerHealth) * repairPercent);
end

if newHealth > 1 then
newHealth = 1;
end

setPlayerHealth(newHealth);