This commit is contained in:
Jonas Zeunert
2022-06-02 21:28:44 +02:00
parent 3d2008dc4d
commit cfdcbcb5bd
17 changed files with 28 additions and 28 deletions

View File

@@ -11,18 +11,18 @@ class EndBallEvent(Event):
def trigger(self, target):
super().trigger(target)
if self.gameState.replayBall or not self.gameState.hasBallScored:
if self.gameState.currentPlayer.replayBall or not self.gameState.currentPlayer.hasBallScored:
StartBallEvent().trigger(None)
return
self.gameState.playerState.removeBall()
self.gameState.currentPlayer.removeBall()
self.scorePoints()
self.gameState.playerState.reset()
self.gameState.currentPlayer.reset()
if self.gameState.playerState.ballsLeft == 0:
if self.gameState.currentPlayer.ballsLeft == 0:
EndGameEvent().trigger(None)
def scorePoints(self):
bonus = self.gameState.playerState.bonus * self.gameState.playerState.bonusMultiplier * 1000
self.gameState.playerState.addPoints(bonus)
bonus = self.gameState.currentPlayer.bonus * self.gameState.currentPlayer.bonusMultiplier * 1000
self.gameState.currentPlayer.addPoints(bonus)