* Calculate the cost of a bribe * @param state - GameState * @param other - other organisation * @return - minimum sum of the bribe */
| 831 | * @return - minimum sum of the bribe |
| 832 | */ |
| 833 | int Organisation::costOfBribeBy(GameState &state, const StateRef<Organisation> &other) const |
| 834 | { |
| 835 | float improvement; |
| 836 | float x = this->getRelationTo(other); |
| 837 | if (x < -50) // Hostile |
| 838 | { |
| 839 | improvement = -50.0f - x; |
| 840 | } |
| 841 | else if (x < -25) // Unfriendly |
| 842 | { |
| 843 | improvement = -25.0f - x; |
| 844 | } |
| 845 | else if (x < 25) // Neutral |
| 846 | { |
| 847 | improvement = 25.0f - x; |
| 848 | } |
| 849 | else if (x < 75) // Friendly |
| 850 | { |
| 851 | improvement = 75.0f - x; |
| 852 | } |
| 853 | else // Allied (relationship cannot be improved) |
| 854 | { |
| 855 | return 0; |
| 856 | } |
| 857 | |
| 858 | return (state.difficulty + 1) * std::max((int)improvement, 1) * clamp(balance / 1000, 1, 400) + |
| 859 | state.difficulty * 3000 + 5000; |
| 860 | } |
| 861 | |
| 862 | /** |
| 863 | * Calculate the diplomatic rift offer amount |
no test coverage detected