MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / diplomaticRiftOffer

Method diplomaticRiftOffer

game/state/shared/organisation.cpp:868–883  ·  view source on GitHub ↗

* Calculate the diplomatic rift offer amount * @param state - GameState * @param other - other organisation * @return - sum offered */

Source from the content-addressed store, hash-verified

866 * @return - sum offered
867 */
868int 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

Callers 1

beginMethod · 0.80

Calls 3

getRelationToMethod · 0.95
randBoundsInclusiveFunction · 0.85
clampFunction · 0.85

Tested by

no test coverage detected