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

Allow Shield2Gold_Factor to depend on the unit #769

Closed
lmoureaux opened this issue Dec 11, 2021 · 1 comment · Fixed by #2030
Closed

Allow Shield2Gold_Factor to depend on the unit #769

lmoureaux opened this issue Dec 11, 2021 · 1 comment · Fixed by #2030
Labels
enhancement New feature or request good first issue Good for newcomers server This issue requires changes to the server spec-file Related to Rulesets, Tilesets, Musicsets, Soundsets, etc.

Comments

@lmoureaux
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Corbeau tried to use that in Sim but it doesn't work.

Describe the solution you'd like

The effect is Shield2Gold_Factor. The following is written by someone who has only a rough understanding of how the game works internally (that'd be me): The only place where I could find it used is when calculating unit upkeep in common/unittype.cpp, line 145. You could probably change the call from get_player_bonus to get_unittype_bonus. I don't know if it would have any unintended consequences or whether it's even possible. Seems like you'd have to retrieve the tile the unit is on, since that's not used in that piece of code at all.

My notes:

  • Looks like the AI doesn't know about Shield2Gold_Factor anyway
  • Getting the tile the unit is on is easy, need to be careful that it could be nullptr

Describe alternatives you've considered

Doing nothing.

Additional context

Discussion on Discord

@lmoureaux lmoureaux added enhancement New feature or request good first issue Good for newcomers server This issue requires changes to the server labels Dec 11, 2021
@lmoureaux lmoureaux changed the title Allow Shield2Gold_Factor do depend on the unit Allow Shield2Gold_Factor to depend on the unit Jan 23, 2022
@jwrober jwrober added the spec-file Related to Rulesets, Tilesets, Musicsets, Soundsets, etc. label Jan 23, 2022
@lmoureaux
Copy link
Contributor Author

More Discord discussion

The issue is the effect is evaluated using get_player_bonus, while it should really be get_unit_bonus (or get_unittype_bonus if changes for a unit bonus are too deep):

gold_upkeep_factor = get_player_bonus(pplayer, EFT_SHIELD2GOLD_FACTOR);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers server This issue requires changes to the server spec-file Related to Rulesets, Tilesets, Musicsets, Soundsets, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants