-
Notifications
You must be signed in to change notification settings - Fork 4
/
action.py
37 lines (26 loc) · 943 Bytes
/
action.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import unit
from typing import Tuple
from abc import ABC
class Action(ABC):
pass
class Attack(Action):
def __init__(self, attacking: unit.Unit, defending: unit.Unit):
super().__init__()
self.attacking: unit.Unit = attacking
self.defending: unit.Unit = defending
def __str__(self):
return f"{self.attacking.name} vs {self.defending.name}"
class Move(Action):
def __init__(self, who: unit.Unit, where: Tuple[int, int]):
super().__init__()
self.who: unit.Unit = who
self.where: Tuple[int, int] = where
def __str__(self):
return f"Move {self.who.name} to {self.where}"
class Entangle(Action):
def __init__(self, parent: unit.Unit, child: unit.Unit):
super().__init__()
self.parent: unit.Unit = parent
self.child: unit.Unit = child
def __str__(self):
return f"Entangled {self.parent.name} with {self.child.name}"