Skip to content

Commit

Permalink
Add more actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pbatch committed Sep 8, 2024
1 parent aaf8ef9 commit 9a03889
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clashroyalebuildabot/actions/cannon_action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from clashroyalebuildabot import Cards
from clashroyalebuildabot.actions.generic.defense_action import DefenseAction


class CannonAction(DefenseAction):
CARD = Cards.CANNON
20 changes: 20 additions & 0 deletions clashroyalebuildabot/actions/hungry_dragon_action.py
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit 9a03889

Please sign in to comment.