Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct s_stat
- {
- float base;
- float increased;
- float more;
- };
- func s_stat make_stat()
- {
- s_stat stat;
- stat.base = 0;
- stat.increased = 0;
- stat.more = 1;
- return stat;
- }
- func float calculate_stat(s_stat stat)
- {
- float inc = (1 + stat.increased / 100);
- return stat.base * inc * stat.more;
- }
- func s_stat operator+(s_stat a, s_stat b)
- {
- s_stat result = make_stat();
- result.base = a.base + b.base;
- result.increased = a.increased + b.increased;
- result.more = a.more * b.more;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement