This commit is contained in:
NikolajDanger
2020-08-05 19:41:09 +02:00
parent 591a3744cc
commit 517f0bb90a
2 changed files with 29 additions and 5 deletions

View File

@ -1,10 +1,10 @@
"""Functions for games Gwendolyn can play."""
__all__ = ["checkBalance", "giveMoney", "addMoney","triviaCountPoints", "triviaStart", "triviaAnswer", "blackjackShuffle", "blackjackStart", "blackjackPlayerDrawHand", "blackjackContinue", "blackjackFinish", "blackjackHit", "blackjackStand", "blackjackDouble", "blackjackSplit", "parseFourInARow", "fourInARowAI", "parseHex", "parseMonopoly", "monopolyContinue"]
__all__ = ["checkBalance", "giveMoney", "addMoney","triviaCountPoints", "triviaStart", "triviaAnswer", "blackjackShuffle", "blackjackStart", "blackjackPlayerDrawHand", "blackjackContinue", "blackjackFinish", "blackjackHit", "blackjackStand", "blackjackDouble", "blackjackSplit", "parseFourInARow", "fourInARowAI", "parseHex", "hexAI", "parseMonopoly", "monopolyContinue"]
from .money import checkBalance, giveMoney, addMoney
from .trivia import triviaCountPoints, triviaStart, triviaAnswer
from .blackjack import blackjackShuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackHit, blackjackStand, blackjackDouble, blackjackSplit
from .fourInARow import parseFourInARow, fourInARowAI
from .hex import parseHex, hexAI
from .monopoly import parseMonopoly, monopolyContinue
from .monopoly import parseMonopoly, monopo;lyContinue

View File

@ -1,18 +1,25 @@
class AvraeException(Exception):
"""A base exception class."""
def __init__(self, msg):
"""A."""
super().__init__(msg)
class NoCharacter(AvraeException):
"""Raised when a user has no active character."""
def __init__(self):
"""A."""
super().__init__("You have no character active.")
class NoActiveBrew(AvraeException):
"""Raised when a user has no active homebrew of a certain type."""
def __init__(self):
@ -20,6 +27,7 @@ class NoActiveBrew(AvraeException):
class ExternalImportError(AvraeException):
"""Raised when something fails to import."""
def __init__(self, msg):
@ -27,11 +35,13 @@ class ExternalImportError(AvraeException):
class InvalidArgument(AvraeException):
"""Raised when an argument is invalid."""
pass
class EvaluationError(AvraeException):
"""Raised when a cvar evaluation causes an error."""
def __init__(self, original):
@ -40,15 +50,15 @@ class EvaluationError(AvraeException):
class FunctionRequiresCharacter(AvraeException):
"""
Raised when a function that requires a character is called without one.
"""
"""Raised when a function that requires a character is called without one."""
def __init__(self, msg=None):
super().__init__(msg or "This alias requires an active character.")
class OutdatedSheet(AvraeException):
"""Raised when a feature is used that requires an updated sheet."""
def __init__(self, msg=None):
@ -71,11 +81,13 @@ class InvalidSaveType(AvraeException):
class ConsumableException(AvraeException):
"""A base exception for consumable exceptions to stem from."""
pass
class ConsumableNotFound(ConsumableException):
"""Raised when a consumable is not found."""
def __init__(self):
@ -83,6 +95,7 @@ class ConsumableNotFound(ConsumableException):
class CounterOutOfBounds(ConsumableException):
"""Raised when a counter is set to a value out of bounds."""
def __init__(self):
@ -90,6 +103,7 @@ class CounterOutOfBounds(ConsumableException):
class NoReset(ConsumableException):
"""Raised when a consumable without a reset is reset."""
def __init__(self):
@ -97,6 +111,7 @@ class NoReset(ConsumableException):
class InvalidSpellLevel(ConsumableException):
"""Raised when a spell level is invalid."""
def __init__(self):
@ -104,11 +119,13 @@ class InvalidSpellLevel(ConsumableException):
class SelectionException(AvraeException):
"""A base exception for message awaiting exceptions to stem from."""
pass
class NoSelectionElements(SelectionException):
"""Raised when get_selection() is called with no choices."""
def __init__(self, msg=None):
@ -116,6 +133,7 @@ class NoSelectionElements(SelectionException):
class SelectionCancelled(SelectionException):
"""Raised when get_selection() is cancelled or times out."""
def __init__(self):
@ -123,11 +141,13 @@ class SelectionCancelled(SelectionException):
class CombatException(AvraeException):
"""A base exception for combat-related exceptions to stem from."""
pass
class CombatNotFound(CombatException):
"""Raised when a channel is not in combat."""
def __init__(self):
@ -135,6 +155,7 @@ class CombatNotFound(CombatException):
class RequiresContext(CombatException):
"""Raised when a combat is committed without context."""
def __init__(self):
@ -142,6 +163,7 @@ class RequiresContext(CombatException):
class ChannelInCombat(CombatException):
"""Raised when a combat is started with an already active combat."""
def __init__(self):
@ -149,6 +171,7 @@ class ChannelInCombat(CombatException):
class CombatChannelNotFound(CombatException):
"""Raised when a combat's channel is not in the channel list."""
def __init__(self):
@ -156,6 +179,7 @@ class CombatChannelNotFound(CombatException):
class NoCombatants(CombatException):
"""Raised when a combat tries to advance turn with no combatants."""
def __init__(self):