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

Method costOfBribeBy

game/state/shared/organisation.cpp:833–860  ·  view source on GitHub ↗

* Calculate the cost of a bribe * @param state - GameState * @param other - other organisation * @return - minimum sum of the bribe */

Source from the content-addressed store, hash-verified

831 * @return - minimum sum of the bribe
832 */
833int 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

Callers 1

updateInfoMethod · 0.80

Calls 2

getRelationToMethod · 0.95
clampFunction · 0.85

Tested by

no test coverage detected