summaryrefslogtreecommitdiffstats
path: root/Unit.gd
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-07-19 21:48:21 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-07-19 21:48:21 +0200
commitdc4c8275bf7fe7b22783b5ed366e3eb9c0b83a5b (patch)
treed8304166c647f39b564d078bf085bb31a45bc21b /Unit.gd
parentfcfcddfdae168cd42491210528ff51f476b4dfb8 (diff)
downloadgodot-hexgrid-dc4c8275bf7fe7b22783b5ed366e3eb9c0b83a5b.zip
godot-hexgrid-dc4c8275bf7fe7b22783b5ed366e3eb9c0b83a5b.tar.gz
implement range Of Influence
Diffstat (limited to 'Unit.gd')
-rw-r--r--Unit.gd12
1 files changed, 12 insertions, 0 deletions
diff --git a/Unit.gd b/Unit.gd
index e699f61..0b67053 100644
--- a/Unit.gd
+++ b/Unit.gd
@@ -11,3 +11,15 @@ func road_march_bonus() -> int:
func move_cost(src : Tile, dst : Tile, orientation : int) -> int:
return (1 if (src.has_road(orientation) and dst.type != 3) else dst.cost())
+
+func max_range_of_fire(category : int, from : Tile) -> int:
+ return 6 + from.range_modifier(category)
+
+func volume_of_fire(category : int, distance : int, src : Tile, src_o : int, dst : Tile, dst_o : int) -> int:
+ var fp : int = 10
+ if distance > 6: return -1
+ elif distance > 4: fp = 4
+ elif distance > 2: fp = 7
+ fp -= src.attack_modifier(category, src_o)
+ fp -= dst.defense_value(category, dst_o)
+ return fp