Module nari.types.event.cast
Class for cast bars
Expand source code
"""Class for cast bars"""
from enum import IntEnum, auto
from nari.types import Timestamp
from nari.types.event import Event
from nari.types.actor import Actor
from nari.types.ability import Ability
class CastStart(Event): # pylint: disable=too-few-public-methods
"""Represents the preparation towards a cast"""
def __init__(self, *,
timestamp: Timestamp,
source_actor: Actor,
ability: Ability,
target_actor: Actor,
duration: float,
):
super().__init__(timestamp)
self.source_actor = source_actor
self.ability = ability
self.target_actor = target_actor
self.duration = duration
def __repr__(self):
return '<CastStart>'
# pylint: disable=invalid-name
class CastStopCategory(IntEnum):
"""Represents reasons a cast could be interrupted"""
Interrupted = auto()
Cancelled = auto()
Unknown = auto()
@classmethod
def value_from_name(cls, name: str):
"""Shorthand class method to get the string name from a matching int"""
return cls.__members__.get(name, cls.Unknown)
# pylint: enable=invalid-name
class CastStop(Event): # pylint: disable=too-few-public-methods
"""Represents a cast being stopped before completion"""
def __init__(self, *,
timestamp: Timestamp,
source_actor: Actor,
ability: Ability,
cause: CastStopCategory,
):
super().__init__(timestamp)
self.source_actor = source_actor
self.ability = ability
self.cause = cause
def __repr__(self):
return f'<CastStop {self.cause}>'
Classes
class CastStart (*, timestamp: int, source_actor: Actor, ability: Ability, target_actor: Actor, duration: float)
-
Represents the preparation towards a cast
Expand source code
class CastStart(Event): # pylint: disable=too-few-public-methods """Represents the preparation towards a cast""" def __init__(self, *, timestamp: Timestamp, source_actor: Actor, ability: Ability, target_actor: Actor, duration: float, ): super().__init__(timestamp) self.source_actor = source_actor self.ability = ability self.target_actor = target_actor self.duration = duration def __repr__(self): return '<CastStart>'
Ancestors
class CastStop (*, timestamp: int, source_actor: Actor, ability: Ability, cause: CastStopCategory)
-
Represents a cast being stopped before completion
Expand source code
class CastStop(Event): # pylint: disable=too-few-public-methods """Represents a cast being stopped before completion""" def __init__(self, *, timestamp: Timestamp, source_actor: Actor, ability: Ability, cause: CastStopCategory, ): super().__init__(timestamp) self.source_actor = source_actor self.ability = ability self.cause = cause def __repr__(self): return f'<CastStop {self.cause}>'
Ancestors
class CastStopCategory (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
Represents reasons a cast could be interrupted
Expand source code
class CastStopCategory(IntEnum): """Represents reasons a cast could be interrupted""" Interrupted = auto() Cancelled = auto() Unknown = auto() @classmethod def value_from_name(cls, name: str): """Shorthand class method to get the string name from a matching int""" return cls.__members__.get(name, cls.Unknown)
Ancestors
- enum.IntEnum
- builtins.int
- enum.Enum
Class variables
var Cancelled
var Interrupted
var Unknown
Static methods
def value_from_name(name: str)
-
Shorthand class method to get the string name from a matching int
Expand source code
@classmethod def value_from_name(cls, name: str): """Shorthand class method to get the string name from a matching int""" return cls.__members__.get(name, cls.Unknown)