SotMSteamMods / CauldronMods

Mod adaptations of the Cauldron decks for Sentinels of the Multiverse for Steam Workshop
MIT License
15 stars 9 forks source link

Tiamat cutouts not displaying #1639

Open origamiswami opened 1 year ago

origamiswami commented 1 year ago

Describe the bug Only one of the Tiamat head cutouts showed up (the cold one). Once I rewound the game, it went back to normal

What does it affect Card(s): Tiamat Deck(s): Tiamat

To Reproduce Steps to reproduce the behavior:

  1. Play against Tiamat

Screenshots

image image

After rewinding:

image image

Logs Player.log

jamespicone commented 7 months ago

When the game is started UICharacterPanel.ConfigureWithTurnTaker is called on a panel for each turntaker, which walks through all the character cards in play and makes a cutout for each of them. With Tiamat, only one character card is in play until StartGame() is called and the supplemental setup happens, so only one cutout is made. When you load the game (e.g. because you rewound), it re-creates all the character panels, and now everything is in play so they all get cutouts.

ReplaceTurnTaker also makes the character panels reconfigure, but using it to replace Tiamat with Tiamat doesn't work; we end up adding triggers for everything twice (the bit at the end of ReplaceTurnTakerAction.DoActionOnSuccess that adds triggers for character cards for the new turntaker). Not sure we can make this workaround work.

We could possibly just grab the relevant object and make it update directly:

var panel = UIGameView.Instance.GetCharacterPanel(TurnTaker);
panel.ConfigureWithTurnTaker(TurnTaker);

UIGameView is in the main assembly-csharp, not sentinelsengine. ConfigureWithTurnTaker is public, as is GetCharacterPanel and Instance, so we'd probably want to just use Type.GetType.

Another approach might be to use the extraCutouts stuff in ShouldUpdateCutout and have the one tiamat character card that starts in play manage the cutouts.

Or maybe we could ask MigrantP to give us a way to do it.

Not sure what the best approach is. The reflection thing is pretty flimsy, replaceturntaker games are probably also pretty flimsy, cutout stuff is a bit silly and annoying but is at least not flimsy.

origamiswami commented 7 months ago

I had the idea to use ShouldChangeCutout on the storm and inferno heads to just make them show the cutouts, so I added this to StormTiamatCharacterCardController:

public override bool ShouldChangeCutout(CutoutInfo currentInfo, GameAction action, ActionTiming timing, out CutoutInfo changedInfo, out CutoutAnimation animation)
        {
            Log.Debug($"Storm Tiamat: currentInfo = {currentInfo.ToString()}");
            return base.ShouldChangeCutout(currentInfo, action, timing, out changedInfo, out animation);
        }

I was expecting this to output to the log on every GameAction, but it only did once I rewound the game. I guess it only checks character cards that already have cutouts or something. I couldn't find where ShouldChangeCutout() is called, just where it's overridden.

jamespicone commented 7 months ago

Yeah that doesn't work because the cutout doesn't exist. UICharacterCutout.UpdateCutout calls ShouldChangeCutout; there's one UICharacterCutout for every CharacterCard that got a cutout, and they get updated on some event that I don't know what it is.

I'm kind of surprised that CharacterCards entering play don't get a cutout added by default. The Chairman can enter and leave play, that might be an angle for finding a weird behaviour we can report to Handelabra against base game content. Are there any other character cards that enter and leave play? Oblivaeon has special handling unfortunately.

jamespicone commented 7 months ago

Specifically, i think if you get the Chairman character card out of play, then save and load, then play until the chairman re-enters play, he won't have a cutout.

origamiswami commented 7 months ago

You're right, the cutout doesn't reappear

image
jamespicone commented 7 months ago

You might want to report an issue in-game

origamiswami commented 7 months ago

Already on it

origamiswami commented 7 months ago

Confirmed that the Chairman cutout does reappear on reload. The only thing I haven't tried is playing through the whole game without rewinding to see if the cutout still fails to reappear in that case.