mirror of
https://github.com/Jusctsch5/ironsphererpg.git
synced 2026-01-20 03:54:45 +00:00
Provide method to restore mana and use it as a refund when casting Flow and Bound more than once during its duration. The application of this method in this way is kind of a kludge, but it works and the method is definitely helpful.
53 lines
1.1 KiB
C#
53 lines
1.1 KiB
C#
function setMANA(%client, %val)
|
|
{
|
|
%armor = %client.player.getDataBlock();
|
|
|
|
if(%val $= "")
|
|
%val = fetchData(%client, "MaxMANA");
|
|
|
|
%a = %val * %armor.maxEnergy;
|
|
%b = %a / fetchData(%client, "MaxMANA");
|
|
|
|
if(%b < 0)
|
|
%b = 0;
|
|
else if(%b > %armor.maxEnergy)
|
|
%b = %armor.maxEnergy;
|
|
|
|
%client.player.setEnergyLevel(%b);
|
|
}
|
|
function refreshMANA(%client, %value)
|
|
{
|
|
setMANA(%client, (fetchData(%client, "MANA") - %value));
|
|
}
|
|
|
|
// Positively increase mana and not worry about overrunning the maximum allowed.
|
|
function restoreMANA(%client, %value)
|
|
{
|
|
%maxMana = fetchData(%client, "MaxMANA");
|
|
%currentMana = fetchData(%client, "MANA");
|
|
if (%value + %currentMana > %maxMana)
|
|
setMANA(%client, %maxMana);
|
|
else
|
|
setMANA(%client, %currentMana + %value);
|
|
}
|
|
|
|
function refreshMANAREGEN(%client)
|
|
{
|
|
if(isobject(%client) && isobject(%client.player))
|
|
{
|
|
%b = 0;
|
|
|
|
if(%client.sleepMode $= 1)
|
|
%b = 1.0;
|
|
else if(%client.sleepMode $= 2)
|
|
%b = 2.25;
|
|
|
|
%c = AddPoints(%client, 11) / 10000;
|
|
%r = %b/20 + %c + 0.02;
|
|
|
|
%client.player.setRechargeRate(%r);
|
|
return true;
|
|
}
|
|
else
|
|
return false;
|
|
} |