inferno8 / wesnoth-Era_of_Magic

add-on for Battle for Wesnoth
GNU General Public License v2.0
10 stars 4 forks source link

Dimensional gate recovers all advancements when load a savegame #36

Closed Toranks closed 1 year ago

Toranks commented 1 year ago

A Dimensional Gate recover all of its advancements and the ability to level up simply by loading a savegame.

I'm wondering if this is because the unit advances have been edited directly instead of using [object]

Maybe this is a better alternative:

[event]
    name=recruit,recall,unit placed
    id=eoma_soulcatcher_event4
    first_time_only=no
    [filter]
        ability=soul_catcher
    [/filter]

[modify_unit]
   [filter]
      x,y=$x1,$y1
   [/filter]
  [object]
    id=delete_advancements
    [effect]
       apply_to=remove_advancement
       types=EoMa_Rhami,EoMa_Fire_Elemental,EoMa_Water_Elemental,EoMa_Air_Elemental,EoMa_Earth_Elemental,EoMa_Jinn,EoMa_RhamiKai,EoMa_RhamiDatu,EoMa_Fire_Avatar,EoMa_Water_Avatar,EoMa_Air_Avatar,EoMa_Earth_Avatar,EoMa_Great_Jinn,EoMa_Efreet
    [/effect]
  [/object]
 [/modify_unit]

    [allow_undo]
    [/allow_undo]
[/event]

This need to change the code on other parts too (for example when kills a unit and advances, first delete the object then advances, and in the two last scenarios, when you pay 6 gold to a free advance), but from what i've seen in various parts of the code, the solution of using object is simpler than currently exists.

EDIT: Already tested and works

If you want, I can fix it in several parts and send a PR proposal @inferno8

This PR is related, because of it I discovered that neither my fix nor the original method works correctly: https://github.com/inferno8/wesnoth-To_Lands_Unknown/pull/17