| 655 | } |
| 656 | |
| 657 | int Game_Party::GetFatigue() { |
| 658 | const auto& actors = GetActors(); |
| 659 | |
| 660 | if (actors.empty()) { |
| 661 | return 0; |
| 662 | } |
| 663 | |
| 664 | int hp = 0; |
| 665 | int total_hp = 0; |
| 666 | int sp = 0; |
| 667 | int total_sp = 0; |
| 668 | for (auto* a : actors) { |
| 669 | hp += a->GetHp(); |
| 670 | total_hp += a->GetMaxHp(); |
| 671 | sp += a->GetSp(); |
| 672 | total_sp += a->GetMaxSp(); |
| 673 | } |
| 674 | |
| 675 | // SP is always 33.3% of fatigue, which means a 0 SP actor is never above 66% |
| 676 | if (total_sp == 0) { |
| 677 | total_sp = 1; |
| 678 | } |
| 679 | |
| 680 | auto p = Utils::RoundTo<int>(100.0f * ((static_cast<double>(hp) / total_hp * 2.0 + static_cast<double>(sp) / total_sp) / 3.0f)); |
| 681 | return 100 - p; |
| 682 | } |
| 683 | |
| 684 | void Game_Party::RemoveInvalidData() { |
| 685 | // Remove non existing actors |