sporchia / alttp_vt_randomizer

ALttP VT Randomizer and API
https://alttpr.com/
MIT License
314 stars 147 forks source link

Enemizer damage randomization/shuffle integration problem #788

Closed othertom closed 1 year ago

othertom commented 4 years ago

This is a little confusing because of the names, so let's start with some definitions.

ShuffleDamageGroups in Enemizer actually randomizes the damage values for the groups, to 0-8 hearts if EnemyDamageChaosMode is set and 0-4 hearts if it isn't. If AllowEnemyZeroDamage was false the minimum would be 1/2 heart, but it's always true when called via the website so it's 0 for our purposes. It also calculates scaled-down values for blue/red mail if EnemyDamageChaosMode is false. If EnemyDamageChaosMode is true, it just generates more random values for blue/red mail.

Code reference: https://github.com/sosuke3/Enimizer/blob/fa280859ab7110e8cd06e55623eadbfe006ae4ea/EnemizerLibrary/Randomization.cs#L469-L506

Randomize_Sprites_DMG in Enemizer shuffles enemies into different damage groups.

Code reference: https://github.com/sosuke3/Enimizer/blob/fa280859ab7110e8cd06e55623eadbfe006ae4ea/EnemizerLibrary/Randomization.cs#L1459-L1480

RandomizeEnemyDamage is set unless enemyDamage is "default", so it's set for both shuffled and random. ShuffleEnemyDamageGroups is set explicitly for both shuffled and random. EnemyDamageChaosMode is set for random only. Code reference: https://github.com/sporchia/alttp_vt_randomizer/blob/e501b18952ac72761cda2655f9bad74649af7baa/app/Enemizer.php#L149-L152

If RandomizeEnemyDamage and ShuffleEnemyDamageGroups are both set (and mode is not OHKO), ShuffleDamageGroups is run and the damage output of each group is randomized between 0-4/8 hearts

Code reference: https://github.com/sosuke3/Enimizer/blob/fa280859ab7110e8cd06e55623eadbfe006ae4ea/EnemizerLibrary/Randomization.cs#L222-L225

If RandomizeEnemyDamage is set, Randomize_Sprites_DMG is run and enemies are shuffled into different groups.

Code reference: https://github.com/sosuke3/Enimizer/blob/fa280859ab7110e8cd06e55623eadbfe006ae4ea/EnemizerLibrary/Randomization.cs#L191-L194

As a result, both "Shuffled" and "Random" actually reroll entirely new damage values, and the difference between them is that Shuffled randomizes between 0-4 hearts and calculates scaled-down values for other mail types, while "Random" randomizes between 0-8 hearts and generates random values for the other mail types.

Currently, the documentation doesn't mention the 0-4 or 0-8 heart ranges and both it and the names seem to imply that "Shuffled" shuffles the existing values rather than generating new random ones.

To match the behavior as documented on the website, this line: https://github.com/sporchia/alttp_vt_randomizer/blob/master/app/Enemizer.php#L151

should just be a $this->world->config('enemizer.enemyDamage') === 'random' comparison, so that "Shuffled" only calls Randomize_Sprites_DMG which actually does the shuffle and not ShuffleDamageGroups which generates new damage values.

Alternately, if the current behavior is desired, I think the options on the website should be renamed to "Easy" and "Hard" damage randomization and the options page updated accordingly.

Non-2:00am Edit: The names of the functions/options in Enemizer being basically backwards of what they actually do is obviously not great, but I limited the scope of this issue to what the randomizer web app can do to get behavior as documented on the options page without needing a coordinated change between multiple projects that would cause weird behavior for anyone with split versions.

sporchia commented 1 year ago

Closing this as v32 has all new ways of dealing with dmg groups and shuffling