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

59 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-08-15 02:35:57 +00:00
//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
2022-08-15 17:51:51 +00:00
function unitstat(val_, name_, fullname_, desc_, replacements_) : stat(name_, fullname_, desc_, replacements_) constructor {
val = val_;
2022-08-16 01:01:09 +00:00
cap = val_;
2022-08-15 02:35:57 +00:00
modifier = 0;
}
2022-08-16 03:25:26 +00:00
function statmod(stat__, val_, operation_=add) constructor {
2022-08-16 02:58:13 +00:00
name = stat__.name;
stat_ = stat__;
2022-08-16 03:25:26 +00:00
val = val_;
2022-08-16 02:58:13 +00:00
operation = operation_;
}
function add(val1, val2) {
2022-08-16 03:25:26 +00:00
return val1 + val2;
2022-08-16 02:58:13 +00:00
}
function sub(val1, val2) {
2022-08-16 03:25:26 +00:00
return val1 - val2;
2022-08-16 02:58:13 +00:00
}
function mult(val1, val2) {
2022-08-16 03:25:26 +00:00
return val1 * val2;
2022-08-16 02:58:13 +00:00
}
function divide(val1, val2) {
2022-08-16 03:25:26 +00:00
return val1 / val2;
2022-08-16 02:58:13 +00:00
}
function modulo(val1, val2) {
2022-08-16 03:25:26 +00:00
return val1 % val2;
2022-08-16 02:58:13 +00:00
}
2022-08-19 01:05:37 +00:00
function set(val1, val2) {
return val2;
}
function andop(val1, val2) {
return val1 & val2;
}
function orop(val1, val2) {
return val1 | val2;
}
2022-08-16 02:58:13 +00:00
2022-08-15 02:35:57 +00:00
nu stat("hp", "health", "vitality");
nu stat("str", "strength", "physical power");
2022-08-16 01:01:09 +00:00
nu stat("def", "defense", "physical defense");
2022-08-16 22:28:01 +00:00
nu stat("spd", "speed", "avoid and follow-up");
nu stat("hit", "hit rate", "chance to hit");
2022-08-19 01:05:37 +00:00
nu stat("mov", "movement", "distance travelable");
nu stat("rng", "range", "distance attackable");