I don't think that is necessary. As Jason pointed out, there are cases where not respecting the user's restore settings is allowed.Two is to change the code so that it returns the result of the recovery activities, and not continueValue.
I don't think that is necessary. As Jason pointed out, there are cases where not respecting the user's restore settings is allowed.Two is to change the code so that it returns the result of the recovery activities, and not continueValue.
the way UR stores the "always continue" and "trouble found" settings means they could be tested for in a script without messing things up for someone who ran it without Bale's UR set. Which is nifty to know.
if (to_float(my_hp()) / my_maxhp() < to_float(get_property("hpAutoRecovery")))
if (to_float(my_mp()) / my_maxmp() < to_float(get_property("mpAutoRecovery")))
I don't think that is necessary. As Jason pointed out, there are cases where not respecting the user's restore settings is allowed.
No, it is useful for the authors of other scripts, though the documentation on the wiki should have a note for both functions that mentions the return value can be overriden by a restoreScript, and it's up to a script author to clarify what, if any, such scripts they support. At least UR makes it possible to deal with such situations. One thing that might be nice, though, would be if Bale could post a function that checked for "should have returned false under normal circumstances but didn't because the user explicitly told UR not to" for use by other script authors, but meh.
public static Value restore_hp( final Value amount )
{
return new Value( RecoveryManager.recoverHP( amount.intValue() ) );
}
public static Value restore_mp( final Value amount )
{
int desiredMP = amount.intValue();
RecoveryManager.recoverMP( desiredMP );
return RuntimeLibrary.continueValue();
}
public static Value restore_hp( final Value amount )
{
return DataTypes.makeBooleanValue( RecoveryManager.recoverHP( amount.intValue() ) );
}
public static Value restore_mp( final Value amount )
{
return DataTypes.makeBooleanValue( RecoveryManager.recoverMP( amount.intValue() ) );
}
In my opinion, those should be:
Code:public static Value restore_hp( final Value amount ) { return DataTypes.makeBooleanValue( RecoveryManager.recoverHP( amount.intValue() ) ); } public static Value restore_mp( final Value amount ) { return DataTypes.makeBooleanValue( RecoveryManager.recoverMP( amount.intValue() ) ); }