tdBattlePetScript

tdBattlePetScript

389k Downloads

Round counter skipping value

d00mw01f opened this issue · 2 comments

commented

Doing Dalaran WQ Fight Night: Sir Galveston (https://wow-petguide.com/index.php?Strategy=968) with Iron Starlet in first slot.
With following script:

ability(566) [!self(#1).dead & self.round=1]
ability(459) [!self(#1).dead & self.round=2]
ability(208) [!self(#1).dead & self.round=3]
ability(459) [!self(#1).dead & self.round<=6]

On turn 4 (round=4) starlet kills enemy pet. On next turn round=6, skipping 5 value. Tested with

test(1) [self.round=1]
test(1) [self.round=2]
test(1) [self.round=3]
test(1) [self.round=4]
test(1) [self.round=5]
test(1) [self.round=6]

before each turn.
Probably caused by dead enemy pet, but it's hard to debug.

commented

Do you used multi rounds alibity?

commented

I just observed this issue where round == 3, but self.round == 4. This might be a Blizzard issue though?!

OnBattleStart → [0, 0, 0]
ROUND_RESULTS(0) → [1, 1, 1]
PET_CHANGED(1) → [1, 1, 1]
PET_CHANGED(2) → [1, 1, 1]
---
ROUND_RESULTS(1) → [2, 2, 2]
---
ROUND_RESULTS(2)→ [3, 3, 3]    -- the enemy pet died, there *was* no round 3 yet!
ROUND_RESULTS(2)→ [3, 4, 4] 
PET_CHANGED(2) → [3, 4, 1]

So for some reason there was two ROUND_RESULTS when the enemy died, which leads to increasing self.round twice.

One workaround would be to check whether results for the given round were already seen and ignore the second event:

function Round:PET_BATTLE_PET_ROUND_RESULTS(_, round)
    -- for some reason, the event is fired twice if an enemy(?) pet dies,
    -- leading to increasing self.round counter twice. See issue #1.
    if round == self.rounds[0] - 1 then
        return
    end