diff --git a/clashroyalebuildabot/actions/cannon_action.py b/clashroyalebuildabot/actions/cannon_action.py new file mode 100644 index 0000000..a51d28a --- /dev/null +++ b/clashroyalebuildabot/actions/cannon_action.py @@ -0,0 +1,6 @@ +from clashroyalebuildabot import Cards +from clashroyalebuildabot.actions.generic.defense_action import DefenseAction + + +class CannonAction(DefenseAction): + CARD = Cards.CANNON diff --git a/clashroyalebuildabot/actions/hungry_dragon_action.py b/clashroyalebuildabot/actions/hungry_dragon_action.py new file mode 100644 index 0000000..2043541 --- /dev/null +++ b/clashroyalebuildabot/actions/hungry_dragon_action.py @@ -0,0 +1,20 @@ +import math + +from clashroyalebuildabot import Cards +from clashroyalebuildabot.actions.generic.action import Action + + +class HungryDragonAction(Action): + CARD = Cards.HUNGRY_DRAGON + + def calculate_score(self, state): + for det in state.enemies: + distance = math.hypot( + det.position.tile_x - self.tile_x, + det.position.tile_y - self.tile_y, + ) + if 5 < distance < 6: + return [1] + if distance < 5: + return [0] + return [0]