Moppu / SecretOfManaRandomizer

Randomizer for Secret of Mana
GNU Lesser General Public License v2.1
8 stars 4 forks source link

ElementSwaps is not respecting rElements=No #77

Open aschemschat opened 6 days ago

aschemschat commented 6 days ago

Hi,

i just started a vanilla-Rando-seed with no randomizers but after my first magic-element was not Undine but Salamando and i got stuck, i took a quick look in the code. The rElements/PROPERTYNAME_RANDOMIZE_ELEMENTS-Flag is not used in the ElementsSwap-class. This matches with my spoiler.txt (which i didn't see before starting the play :D), which has 16:34:58 - [spoiler] Element randomization: in it, despite unchecking all randomization.

I just added the doElementSwap-boolean and checked it in the Vanilla-Mode (Starting at line 63). I am unsure as to how this should be included in the other modes, so i just created a issue instead of a pull-request, sorry.

string randoMode = settings.get(CommonSettings.PROPERTYNAME_MODE);
bool doElementsSwap = settings.getBool(VanillaRandoSettings.PROPERTYNAME_RANDOMIZE_ELEMENTS);
if (randoMode == VanillaRandoSettings.MODE_KEY)
{
    if (!doElementsSwap)
        return false;
    ....

And on a final note: Thank you for your work in this awesome randomizer :) Greetings, Andre

aschemschat commented 6 days ago

Oh, i'm sorry, i just noticed another Bug with my fix above (don't ask me how i missed that :O ): FasterDialogueEvent.cs is accessing List<int> newElementMapping = context.workingData.getIntArray(ElementSwaps.VANILLARANDO_ELEMENTLIST).ToList(); which is not available when just skipping the element-swap.

I added the following block which seems(?) to work, but is probably not the best or nicest way to handle that :O

if (!doElementsSwap)
{
    List<int> originalEles = new List<int>();
    for(int i=0; i < 8; i++)
        originalEles.Add(i);
    context.workingData.setIntArray(VANILLARANDO_ELEMENTLIST, originalEles.ToArray());

    return false;
}