Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExtendContractController #93

Open
dannyx93 opened this issue Sep 6, 2020 · 0 comments
Open

ExtendContractController #93

dannyx93 opened this issue Sep 6, 2020 · 0 comments

Comments

@dannyx93
Copy link

dannyx93 commented Sep 6, 2020

It seems to me that contract extensions are wrongly counted. The salary should depend on the number of games played (including assists and goals) and the strength of the player.

`$averageSalary = $this->getAverageSalary($player["player_strength"]);

	// if salary is already higher than average, then just expect 10% more
	if ($player["player_contract_salary"] > $averageSalary) {
		$salaryFactor = 1.10;
	} else {
		// make minimum salary dependent on happiness
		$salaryFactor = (200 - $satisfaction) / 100;
	}
	$salaryFactor = max(1.1, $salaryFactor);
	$minSalary = round($player["player_contract_salary"] * $salaryFactor);
		
	// the salary should be at least 90% of the average, except if this would douple the salary
	if ($averageSalary < ($parameters["salary"] * 2)) {
		$minSalaryOfAverage = round(0.9 * $averageSalary);
		$minSalary = max($minSalary, $minSalaryOfAverage);
	}
	
	if ($parameters["salary"] < $minSalary) {
		// decrease satisfaction
		$this->decreaseSatisfaction($player["player_id"], $player["player_strength_satisfaction"]);
		throw new Exception($this->_i18n->getMessage("extend-contract_salary_too_low"));
	}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant