eastern-flames/eastern flames/scripts/stat/stat.gml

47 lines
1.0 KiB
Plaintext

//exit;
global.stats = {}
function stat(name_, fullname_, desc_, replacements_=[]) constructor {
name = name_
fullname = fullname_;
desc = desc_;
replacements = replacements_;
global.stats[$name] = self;
add = function(val) {
return new unitstat(val, name, fullname, desc, replacements)
}
}
#macro st global.stats
function unitstat(val_, name_, fullname_, desc_, replacements_) : stat(name_, fullname_, desc_, replacements_) constructor {
val = val_;
cap = val_;
modifier = 0;
}
function statmod(stat__, val_, operation_=add) constructor {
name = stat__.name;
stat_ = stat__;
val = val_;
operation = operation_;
}
function add(val1, val2) {
return val1 + val2;
}
function sub(val1, val2) {
return val1 - val2;
}
function mult(val1, val2) {
return val1 * val2;
}
function divide(val1, val2) {
return val1 / val2;
}
function modulo(val1, val2) {
return val1 % val2;
}
nu stat("hp", "health", "vitality");
nu stat("str", "strength", "physical power");
nu stat("def", "defense", "physical defense");
nu stat("spd", "speed", "avoid and follow-up");