* Calculate the diplomatic rift offer amount * @param state - GameState * @param other - other organisation * @return - sum offered */
| 866 | * @return - sum offered |
| 867 | */ |
| 868 | int Organisation::diplomaticRiftOffer(GameState &state, const StateRef<Organisation> &other) const |
| 869 | { |
| 870 | float relationship = this->getRelationTo(other); |
| 871 | |
| 872 | // Organization won't offer this if relationship is good already |
| 873 | if (relationship > 25) |
| 874 | { |
| 875 | return 0; |
| 876 | } |
| 877 | |
| 878 | const int difficultyMod = state.difficulty + 1; |
| 879 | const int randomValue = randBoundsInclusive(state.rng, 0, (difficultyMod + 1) * 2000); |
| 880 | |
| 881 | return std::max((int)-relationship / 2, 1) * difficultyMod * clamp(balance / 1000, 1, 400) + |
| 882 | difficultyMod * 1000 + randomValue; |
| 883 | } |
| 884 | |
| 885 | /** |
| 886 | * The organisation is bribed by other org |
no test coverage detected