Open dpskane opened 4 years ago
agree its a bug, but to guess as to why it ended at 5 instead of 6, it seems that in the first turn, the DFUP was in between the 2 freezes, and that caused 2 of the freezes to be used the next turn to prevent river from attacking twice.
I cannot follow.... so tank gets buffs: taunt, freeze, def-up, freeze. next turn both freezes are removed. taunt and def-up are both still there. now freeze happens, def-up is prolonged and then freeze again: taunt, def-up, freeze, freeze. the following turn, imo, still both freezes should be removed.
The code of the battle system does it that way: when a freeze buff is created it gets a tag "just created". Which is meant to have a pet not being frozen right away. But at the end of every turn, the game goes through all buffs and removes that "just created" tag. Now... normally if it's the pet's turn to act in any way (activate shield, attack, ...) the game looks at the buffs and checks whether there is a freeze buff to determine whether the pet can act. if there is such a buff, but the "just created" tag exists, then the result of that determination is "yes, the pet can attack". If, however, the tag is missing, then the result is "no, it can't act", but at the same time the buff duration is reduced (to 0) and the buff is immediately removed. https://github.com/ChristopherBThai/Discord-OwO-Bot/blob/e845d2035e6fb86c65c1ac719e276e851f085fa1/src/commands/commandList/battle/buffs/Freeze.js#L23
Now, for all buffs at the end of the turn the postTurn method is called and I am confident that the "just created" tag is removed successfully from all the freezes received during the 1st and the 2nd round. But at the beginning of the 3rd round, for some reason, unlike for the beginning of the 2nd round, not all buffs that are "ready to be removed" are actually removed. You might very well be right that the change of order is the reason. When checking whether the pet can attack, it goes through all buffs in order: taunt, def-up, freeze1, freeze2. Now the first 2 buffs don't have anything to say, but the 3rd one does. When it does say "yes", then it might be related to how scoot handles postTurn effects: cycle over all buffs and remove them while cycling. Which is never a good idea. https://github.com/ChristopherBThai/Discord-OwO-Bot/blob/e845d2035e6fb86c65c1ac719e276e851f085fa1/src/commands/commandList/battle/BuffInterface.js#L111 So in turn 2 the iteration is: taunt (has nothing to say about "canAttack", then freeze1 (says: "no attack this turn" and removes itself from the list of looped buffs. def-up was on position 3 and is now in position 2. The code thinks it has already handled the buff in position 2 (freeze was in there) and goes to position 3 and asks the 2nd freeze. Now ... def-up has never been asked what its opinion about "canAttack" is, but we know it has no authority. So it's kinda fine, even though it's not good in the first place that def-up is not even asked about its opinion. In turn 3, though, with the order being taunt, def-up, freeze1, freeze2 the loop knows initially of 4 buffs, arrives at 3rd iteration, finds freeze1, removes it from the list and the iteration continues with the 4th element - which disappeared. Because when freeze1 was removed, freeze2 moved up. So that second buff is not removed even though it's no longer valid. Attacker 1 of my enemy attacks tank and gives it a brand new freeze1. In turn 4 the tank has buffs def-up, freeze2(old) and freeze1, tries to act and finally freeze2 is removed, but now freeze1 is left there for no good reason. So even while the axes ignore the tank in this turn, in turn 5 there is still a freeze. if it would not have been the spider that attacked the tank in turn 3, but the eagle (which hands out freeze2) then that freeze2 buff would have replaced the existing (yet "should-not-exist") freeze2, which would have gone away naturally in turn 4 and then the tank would have acted normally in turn 5. I am not sure that's how it happens, but it seems possible.
Mutating a list while iterating over it is bad practice, as pointed out in another issue (because it causes unexpected behavior). I find it sad that it finds zero attention from scoot, but what can one do. i'm not sure it's the cause of the problem, though. but ... after your comment, djradnad, i come to think that indeed the initial order already had my team lucky, because if i would have put sstaff first then shield in my team, then probably already in turn 2 only one freeze would have been removed... i know someone who runs stall with sstaff/shield/scepter, i can ask him to send me a log link when he notices to encounter a double axe team in the future...
I have a stall team (shield, sstaff, scepter, in that order, in case it matters at all) and encountered a team with: axe/rstaff/axe. My tank received a total amount of 5 freeze buffs in this battle: in rounds 1 (2 hits), 2 (2 hits) and 3 (1 hit). He should have been frozen in rounds 2, 3 and 4 according to the weapon description (frozen next turn). If the intention is to have freeze buffs stack in duration, then my tank should have been frozen in rounds 2, 3, 4, 5, and 6. Reality: he was frozen in rounds 2, 3, 4 and 5. In round 6 he was back in the tanking business. Which makes no sense in either interpretation.
For some reason in round 2 both freeze buffs expired (see logs), but the 2 new ones received in round 2 did not expire in round 3 as they should have. My guess into the blue is that in round 2 my tank would have attacked normally and there things are handled correctly, while in round 3 my tank tried to apply taunt - where the defrosting is maybe not taken care of in the same way
PS: It feels bad to lose an 11.4k streak to a bug....