This repository has been archived by the owner on Oct 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It turns out as the functionality of mulligan-change that initialized the number of cards in each deck was extraneous, as that was already handled by the zone-change line parser. This did not affect our tests for 2 reasons. For the test that uses dummy.log, we were using an old format of the hearthstone log, where the line for mulligan-start came after all the cards were added to the deck and thus triggered the zone-change line parser, which resulted in the mulligan-start setting the deck count from 30 to 30. For the test that uses the newer togwaggle_deck_swap.log, where the cards were added to the deck after the mulligan, there was a single space at the end of the line for the mulligan start in the log, which made our parser ignore it, but the cards were still added through our zone-change line parser. Thus, it would make sense to remove the deck count setting of the MulliganStart parser, keep track of the mulligan start in the GameTagChange parser, and then use that to set the state of mulliganActive.
- Loading branch information
Showing
6 changed files
with
53 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import {AbstractLineParser} from './AbstractLineParser'; | ||
import {GameState} from '../GameState'; | ||
|
||
interface Parts { | ||
tag: string; | ||
value: string; | ||
} | ||
|
||
function formatParts(parts: string[]): Parts { | ||
return { | ||
tag: parts[1], | ||
value: parts[2].trim() | ||
}; | ||
} | ||
|
||
// Check for gamestate tag changes. | ||
export class GameTagChangeLineParser extends AbstractLineParser { | ||
regex = /^\[Power\] GameState.DebugPrintPower\(\) -\s+TAG_CHANGE Entity=GameEntity tag=(.*) value=(.*)/; | ||
|
||
eventName = 'game-tag-change' as const; | ||
|
||
lineMatched(parts: string[], gameState: GameState): void { | ||
const data = formatParts(parts); | ||
|
||
if (data.tag === 'STEP' && data.value === 'MAIN_READY') { | ||
gameState.mulliganActive = false; | ||
} | ||
|
||
if (data.tag === 'STEP' && data.value === 'BEGIN_MULLIGAN') { | ||
gameState.mulliganActive = true; | ||
} | ||
} | ||
|
||
formatLogMessage(parts: string[]): string { | ||
const data = formatParts(parts); | ||
return `Tag ${data.tag} of GameEntity set to ${data.value}`; | ||
} | ||
|
||
shouldEmit(): boolean { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters