OrianaVenture / VentureValheim

Mods for Valheim
MIT License
4 stars 4 forks source link

World Advancement Progression compatibility with Passive Powers by Smoothbrain #33

Closed nbusseneau closed 3 months ago

nbusseneau commented 3 months ago

Hey, thanks for the awesome mods.

It seems there is an incompatibility between Passive Powers and World Advancement Progression. PP allows multiple powers to be grabbed at the same time (2 by default), and optionally allows activating one of them for a short burst of power.

With WAP's UsePrivateKeys + LockGuardianPower enabled, and provided the appropriate private player keys are registered:

Reproduction steps used

Sanity check

  1. Install World Advancement Progression.
  2. In WAP config, set:
    UsePrivateKeys = true
    LockGuardianPower = true
  3. Create new character and start new world.
  4. In console, use:
    devcommands
    spawn TrophyEikthyr
    spawn TrophyTheElder
  5. Hook trophies.
  6. Try to grab both powers: this is blocked by WAP, as expected.
  7. In console, use:
    setprivatekey defeated_eikthyr
  8. Try to grab both powers: Eikthyr is allowed by WAP but The Elder is blocked, as expected.
  9. Try to use Eikthyr power with F: this is allowed by WAP, as expected.
  10. In console, use:
    setprivatekey defeated_gdking
    setpower GP_Eikthyr
  11. Try to grab The Elder power: The Elder is now allowed by WAP, as expected.
  12. Try to use The Elder power with F: this is allowed by WAP, as expected.

Compatibility check

  1. Prerequisite: steps 1 and 2 from sanity check above.
  2. Install Passive Powers.
  3. In PP config, set:
    Boss powers can be activated = On
    Cooldown for boss powers (seconds) = 30
    Duration for active boss powers (seconds) = 10
    Power loss duration after boss power activation (seconds) = 20
    Shortcut for boss power 1 = F
    Shortcut for boss power 2 = F + LeftShift
  4. Create new character and start new world.
  5. In console, use:
    devcommands
    spawn TrophyEikthyr
    spawn TrophyTheElder
  6. Try to grab both powers: this is blocked by WAP, as expected.
  7. In console, use:
    setprivatekey defeated_eikthyr
  8. Try to grab both powers: Eikthyr is allowed by WAP but The Elder is blocked, as expected.
  9. Try to use Eikthyr power with F: this is allowed by WAP, as expected.
  10. In console, use:
    setprivatekey defeated_gdking
  11. Try to The Elder power: The Elder is now allowed by WAP, as expected.
  12. Try to use both powers with F and F + LeftShift: both are blocked by WAP.
    • Expected: either activation should not be blocked by WAP.
  13. Release either power: activation is now allowed by WAP again, as expected.

Potential source of conflict

Note: I've only glanced at WAP's code and the code at https://github.com/blaxxun-boop/PassivePowers/ so this might be completely wrong, but I think PP registers multiple powers by having m_guardianPower in Player be a comma-separated string of the powers, e.g. GP_Eikthyr,GP_TheElder when grabbing both as in the reproduction steps above. Trying to manually change powers via the console using setpower GP_Eikthyr,GP_TheElder at least seems to confirm this hypothesis. WAP then fails to match this because it of course does not know the power GP_Eikthyr,GP_TheElder when trying to match it in HasGuardianKey: https://github.com/OrianaVenture/VentureValheim/blob/ab9ccea04b2f51e57ce251356db21c39eda3fefd/Progression/src/KeyLockingManager.cs#L216-L229

OrianaVenture commented 3 months ago

Thank you for the detailed bug report. This has been a known issue with low priority to fix. It does appear the list is stored comma separated, which should be very easy for me to add compatibility in a future update.

nbusseneau commented 3 months ago

Cheers, I sent a pull request for this at #34, hopefully this will be a good enough stopgap solution until you revisit this later.

OrianaVenture commented 3 months ago

Merged, added in version 0.2.9