mirror of
https://github.com/Jusctsch5/ironsphererpg.git
synced 2026-01-19 19:44:45 +00:00
T2RPG: Write RestoreMana method
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.
This commit is contained in:
parent
58bd654aa9
commit
10b64c4775
|
|
@ -19,6 +19,18 @@ 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))
|
||||
|
|
|
|||
|
|
@ -1581,6 +1581,7 @@ function DoFlowSpellCast(%client, %spell, %sdata, %params)
|
|||
// Make sure an existing flow isn't active.
|
||||
if (%client.flowActive == true)
|
||||
{
|
||||
restoreMANA($spelldata[%sdata, Cost]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1604,7 +1605,7 @@ function DoFlowSpellCast(%client, %spell, %sdata, %params)
|
|||
%client.player.getDataBlock().minImpactSpeed += %increase;
|
||||
|
||||
// Update that skill had been successfully cast
|
||||
UseSkill(%client, $skill::NeutralCasting, true, true, 1, false);
|
||||
// UseSkill(%client, $skill::NeutralCasting, true, true, 1, false);
|
||||
|
||||
// Set end of skill to terminate bonuses, want to close it slightly before.
|
||||
%duration = $spelldata[%sdata, duration] - (1 * 1000);
|
||||
|
|
@ -1631,7 +1632,8 @@ function DoBoundSpellCast(%client, %spell, %sdata, %params)
|
|||
// Make sure an existing Bound isn't active.
|
||||
if (%client.BoundActive == true)
|
||||
{
|
||||
return;
|
||||
restoreMANA($spelldata[%sdata, Cost]);
|
||||
return;
|
||||
}
|
||||
|
||||
%client.BoundActive = true;
|
||||
|
|
@ -1649,7 +1651,7 @@ function DoBoundSpellCast(%client, %spell, %sdata, %params)
|
|||
|
||||
|
||||
// Update that skill had been successfully cast
|
||||
UseSkill(%client, $skill::NeutralCasting, true, true, 1, false);
|
||||
// UseSkill(%client, $skill::NeutralCasting, true, true, 1, false);
|
||||
|
||||
// Set end of skill to terminate bonuses, want to close it slightly before.
|
||||
%duration = $spelldata[%sdata, duration] - (1 * 1000);
|
||||
|
|
|
|||
Loading…
Reference in a new issue