Need More Info Bandit party template 3 stack limitation

Users who are viewing this thread

tase

Recruit
Game version: e1.2.0 (present in previous version too)

Not a straight crash, but an issue that can cause crashes in the future.
I.e a bandit party template with 4 stacks, its first three stacks having a min of 0, possibly leading to parties with 0 units, which causes a crash when interacting with them.

Anyway, anything in the party template beyond the 3rd stack is ignored.

MobileParty.cs
C#:
        private void FillPartyStacks(PartyTemplateObject pt, PartyTypeEnum partyType, int troopNumberLimit = -1)
        {
            switch (partyType)
            {
            case PartyTypeEnum.Bandit:
            {
(...random numbers f, f2, f3 generated...)
                AddElementToMemberRoster(pt.Stacks[0].Character, MBRandom.RoundRandomized(f));
                if (pt.Stacks.Count > 1)
                {
                    AddElementToMemberRoster(pt.Stacks[1].Character, MBRandom.RoundRandomized(f2));
                }
                if (pt.Stacks.Count > 2)
                {
                    AddElementToMemberRoster(pt.Stacks[2].Character, MBRandom.RoundRandomized(f3));
                }
                return;
            }
(...)

I can't assume why it was done like this. A more flexible implementation would look like this.

C#:
(...)
            case PartyTypeEnum.Bandit:
            {
                var gameProcess = MiscHelper.GetGameProcess();
                var num = 0.33f + 0.67f * gameProcess;
                var num2 = MBRandom.RandomInt(2);
                var num3 = (num2 == 0) ? MBRandom.RandomFloat : (MBRandom.RandomFloat * MBRandom.RandomFloat * MBRandom.RandomFloat * 4f);
                var num4 = (num2 == 0) ? (num3 * 0.8f + 0.2f) : (1f + num3);
                foreach(var stack in pt.Stacks)
                {
                    var randomFloat = MBRandom.RandomFloat;
                    float f = ((float)stack.MinValue + num * num4 * randomFloat * (float)(stack.MaxValue - stack.MinValue));
                    AddElementToMemberRoster(stack.Character, MBRandom.RoundRandomized(f));
                }
                return;
            }
(...)

I've tested this implementation with Harmony and it had the desired effect.
 
Last edited:
Hello, thanks for reporting this problem. Unfortunately, we were unable to respond to this thread when it was first created. We believe the issue may have been resolved since the creation of this topic. If you are currently experiencing this issue with the latest live or beta versions of the game, please update this thread so we can forward this issue to the team for investigation.
 
Back
Top Bottom