I'm trying to move my Heros system from proof-of-concept to actual implementation. Right now, each hero has his own unique list of promotions. It works fine as a prototype but has a number of problems, among them that there's no way to add a flat amount of strength and there's no way to restrict a choice between two promotions; with enough experience you could get them all.
So, what I'm trying to do is attach an event to the onUnitPromoted event that would check the unit, see if it's a hero, and if it is, change the actual unit based on what promotion was selected. Essentially I want to make the promotions an automatic unit upgrade, which allows me to precisely control what promotions and so on the unit can take, and allows me to directly modify the unit's strength.
Thing is, I can't figure out how to check what the unit is and what promotions it has, or how to actually change the unit. I have the algorithm but none of the implementation - typical.
So, what I'm trying to do is attach an event to the onUnitPromoted event that would check the unit, see if it's a hero, and if it is, change the actual unit based on what promotion was selected. Essentially I want to make the promotions an automatic unit upgrade, which allows me to precisely control what promotions and so on the unit can take, and allows me to directly modify the unit's strength.
Thing is, I can't figure out how to check what the unit is and what promotions it has, or how to actually change the unit. I have the algorithm but none of the implementation - typical.