-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
202 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
from enum import Enum | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from ..character import Character | ||
|
||
|
||
class ReactionType(Enum): | ||
NOTHING = 0 | ||
DODGE = 1 | ||
FIGHT_BACK = 2 | ||
|
||
|
||
class ReactionStrategy: | ||
def reply(self, character: Character, attacker: Character) -> ReactionType: | ||
def reply(self, character: "Character", attacker: "Character") -> ReactionType: | ||
raise NotImplementedError() | ||
|
||
|
||
class NothingReactionStrategy(ReactionStrategy): | ||
def reply(self, character: Character, attacker: Character) -> ReactionType: | ||
def reply(self, character: "Character", attacker: "Character") -> ReactionType: | ||
return ReactionType.NOTHING | ||
|
||
|
||
class DodgeReactionStrategy(ReactionStrategy): | ||
def reply(self, character: Character, attacker: Character) -> ReactionType: | ||
def reply(self, character: "Character", attacker: "Character") -> ReactionType: | ||
return ReactionType.DODGE | ||
|
||
|
||
class FightBackReactionStrategy(ReactionStrategy): | ||
def reply(self, character: Character, attacker: Character) -> ReactionType: | ||
return ReactionType.FIGHT_BACK | ||
def reply(self, character: "Character", attacker: "Character") -> ReactionType: | ||
return ReactionType.FIGHT_BACK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.