Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create cards table, and support cards parsing #377

Merged
merged 9 commits into from
Aug 13, 2024
Prev Previous commit
Next Next commit
Raise exception if move not set
  • Loading branch information
shaldengeki committed Aug 12, 2024
commit a27034d3d3aa617421ae9925ee1b7ba536c4c3ba
4 changes: 4 additions & 0 deletions ark_nova_stats/bga_log_parser/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ class BGALogParserError(BaseException):
pass


class MoveNotSetError(BGALogParserError):
pass


class NonArkNovaReplayError(BGALogParserError):
pass

Expand Down
6 changes: 5 additions & 1 deletion ark_nova_stats/bga_log_parser/game_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Iterator, Optional

from ark_nova_stats.bga_log_parser.exceptions import (
MoveNotSetError,
NonArkNovaReplayError,
PlayerNotFoundError,
)
Expand Down Expand Up @@ -119,7 +120,7 @@ class GameLogPlayer:
class GameLogCardPlay:
card: GameLogEventDataCard
player: GameLogPlayer
move: Optional[int] = None
move: int


@dataclass
Expand Down Expand Up @@ -155,6 +156,9 @@ def card_plays(self) -> Iterator[GameLogCardPlay]:
continue

for c in d.played_cards:
if log.move_id is None:
raise MoveNotSetError()

if d.player is None:
raise PlayerNotFoundError()

Expand Down