First of all, thanks again for implementing my request of Customizable technology effect, Rseding. But a few days ago, I realized we will need to show the bonus on the Bonuses UI. So please allow me to make this request.
Here is my idea about the implementation. We will need a new prototype type. I'd call it "custom-bonus", and its structure will be like this:
Code: Select all
{
type = "custom-bonus",
name = "player-reach-distance-bonus",
entities = {"player"}, -- an array of entities that this bonus will apply to. Their icons will be shown on the UI. Bonuses with the same targets will be grouped into the same grid.
caption = {"reach-distance-bonus"}, -- caption of the bonus name with value, e.g. "Reach distance bonus: __VALUE__", where __VALUE__ will be replaced by the actual value.
bonuses = {3, 3, 6, 12} -- bonus values of each level. They are accumulative, so Lv1 shows "3", Lv2 shows "6", Lv3 shows "12" and Lv4 shows "24".
}
Code: Select all
effects =
{
{
type = "custom-bonus",
name = "player-reach-distance-bonus",
level = 3
}
}
Image
By not implementing the "custom-bonus" directly as a new technology effect type, we will be able to give custom bonuses to forces by ways other than researching technology. E.g. we can give bonus after 1000000 enemies are killed. Tho we will need API for that. E.g. LuaForce::set_custom_bonus_level(name, level)
Code: Select all
name :: string: name of the custom bonus, e.g. "player-reach-distance-bonus"
level :: uint: desired level of the bonus. Setting it to 0 will remove such bonus from the force.
(Or if you want to make things simpler, you can also make that "custom-bonus" shows the bonus on the Technology UI. But please keep the previous implementation, in case some technologies don't have bonus to be shown on the Bonuses UI.)