Advertisement
Tkap1

Untitled

Oct 14th, 2022 (edited)
850
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. struct s_stat
  2. {
  3.     float base;
  4.     float increased;
  5.     float more;
  6. };
  7.  
  8. func s_stat make_stat()
  9. {
  10.     s_stat stat;
  11.     stat.base = 0;
  12.     stat.increased = 0;
  13.     stat.more = 1;
  14.     return stat;
  15. }
  16.  
  17. func float calculate_stat(s_stat stat)
  18. {
  19.     float inc = (1 + stat.increased / 100);
  20.     return stat.base * inc * stat.more;
  21. }
  22.  
  23. func s_stat operator+(s_stat a, s_stat b)
  24. {
  25.     s_stat result = make_stat();
  26.     result.base = a.base + b.base;
  27.     result.increased = a.increased + b.increased;
  28.     result.more = a.more * b.more;
  29.     return result;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement