summaryrefslogtreecommitdiffstats
path: root/demo/Unit.gd
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-07-20 12:26:48 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-07-20 12:26:48 +0200
commit89723ca94bd21f1ae14592a682e9c0e5c5f04a74 (patch)
tree7b5c67f9d05f253abc961c901336780755543d6d /demo/Unit.gd
parentf3c455fbfb8b28b095c161eb7769ed92f1acb862 (diff)
downloadgodot-hexgrid-89723ca94bd21f1ae14592a682e9c0e5c5f04a74.zip
godot-hexgrid-89723ca94bd21f1ae14592a682e9c0e5c5f04a74.tar.gz
move demo files into subdir demo
Diffstat (limited to 'demo/Unit.gd')
-rw-r--r--demo/Unit.gd25
1 files changed, 25 insertions, 0 deletions
diff --git a/demo/Unit.gd b/demo/Unit.gd
new file mode 100644
index 0000000..0b67053
--- /dev/null
+++ b/demo/Unit.gd
@@ -0,0 +1,25 @@
+#warning-ignore-all:unused_argument
+extends Piece
+
+class_name Unit, "res://godot/Piece.png"
+
+func get_mp() -> int:
+ return 2
+
+func road_march_bonus() -> int:
+ return 2
+
+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