Author Topic: Allow upgrades & attack boosts to apply effects to different sets of units  (Read 1215 times)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
As it stands, upgrades and attack boosts can only apply the same modifications to a set of units. So we could raise the HP of a swordman and a guard by 100 if we wanted. However, we can't, for example, raise the HP of the swordman by 100 and the armour of a guard by 10 in the same upgrade or attack boost.

Thus, I propose an alternative element, <enhancements>, which has children elements <enhancement>. Each of these children elements has the same <affects> and stats elements as the regular upgrade syntax. This is probably best explained with an example.

This here is the current syntax:
Code: [Select]
<upgrade>
<image path="images/image.bmp"/>
<image-cancel path="images/cancel.bmp"/>
<time value="300"/>
<unit-requirements />
<upgrade-requirements />
<resource-requirements />
<effects>
<unit name="unit_name" />
</effects>
<max-hp value="0" />
<max-ep value="0" />
<sight value="0" />
<attack-strenght value="0" />
<attack-range value="0" />
<armor value="0" />
<move-speed value="0" />
<production-speed value="0" />
</upgrade>

My alternative would look more like this:
Code: [Select]
<upgrade>
<image path="images/image.bmp"/>
<image-cancel path="images/cancel.bmp"/>
<time value="300"/>
<unit-requirements />
<upgrade-requirements />
<resource-requirements />
<enhancements>
<enhancement>
<effects>
<unit name="unit_name" />
</effects>
<max-hp value="0" />
<max-ep value="0" />
<sight value="0" />
<attack-strenght value="0" />
<attack-range value="0" />
<armor value="0" />
<move-speed value="0" />
<production-speed value="0" />
</enhancement>
<enhancement>
<effects>
<unit name="unit_name" />
</effects>
<max-hp value="0" />
<max-ep value="0" />
<sight value="0" />
<attack-strenght value="0" />
<attack-range value="0" />
<armor value="0" />
<move-speed value="0" />
<production-speed value="0" />
</enhancement>
</enhancements>
</upgrade>

Attack boosts are similar. Here's the current code:
Code: [Select]
<attack-boost>
<allow-multiple-boosts value="false" />
<radius value="5" />
<target value="ally" />
<max-hp value="0" />
<max-ep value="0" />
<sight value="0" />
<attack-strenght value="0" />
<attack-range value="0" />
<armor value="0" />
<move-speed value="0" />
<production-speed value="0" />
<particles value="false" />
</attack-boost>

With the enhancements element used:
Code: [Select]
<attack-boost>
<enhancements>
<enhancement>
<allow-multiple-boosts value="false" />
<radius value="5" />
<target value="ally" />
<max-hp value="0" />
<max-ep value="0" />
<sight value="0" />
<attack-strenght value="0" />
<attack-range value="0" />
<armor value="0" />
<move-speed value="0" />
<production-speed value="0" />
<particles value="false" />
</enhancement>
<enhancement>
<allow-multiple-boosts value="false" />
<radius value="5" />
<target value="ally" />
<max-hp value="0" />
<max-ep value="0" />
<sight value="0" />
<attack-strenght value="0" />
<attack-range value="0" />
<armor value="0" />
<move-speed value="0" />
<production-speed value="0" />
<particles value="false" />
</enhancement>
</enhancements>
</attack-boost>

A possibly easier way to do attack boosts would be to simply allow multiples of the attack boost element rather than using the enhancements element. Either way, the end result is the same: multiple attack boosts on a single skill.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
so basically GAE enhancements?

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Omega, in both examples you duplicated the enhancement (pointing to the same unit). I would expect that the enhancement would need to point to uniquely different units in the case where you specify multiple enhancement tags in a single upgrade or boost, would you agree?

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Omega, in both examples you duplicated the enhancement (pointing to the same unit). I would expect that the enhancement would need to point to uniquely different units in the case where you specify multiple enhancement tags in a single upgrade or boost, would you agree?

unit_name is a placeholder. each enhancement would have a different unit name there. I am almost sure he just copy pasted the GAE code.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Omega, in both examples you duplicated the enhancement (pointing to the same unit). I would expect that the enhancement would need to point to uniquely different units in the case where you specify multiple enhancement tags in a single upgrade or boost, would you agree?
Yup, it's just a placeholder.

And as Molaos pointed out, yes, it's the same method as GAE used.

The +100 HP for the swordman and +10 armour for the guard could be done with the following example:
Code: [Select]
<upgrade>
<image path="images/image.bmp"/>
<image-cancel path="images/cancel.bmp"/>
<time value="300"/>
<unit-requirements />
<upgrade-requirements />
<resource-requirements />
<enhancements>
<enhancement>
<effects>
<unit name="swordman" />
</effects>
<max-hp value="100" />
</enhancement>
<enhancement>
<effects>
<unit name="guard" />
</effects>
<armor value="10" />
</enhancement>
</enhancements>
</upgrade>
* Stat elements with values of zero have been excluded for clarity; they could presumably be set to be optional.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert