aboutsummaryrefslogtreecommitdiff
path: root/go/game/attack.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/game/attack.go')
-rw-r--r--go/game/attack.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/go/game/attack.go b/go/game/attack.go
index 9be465f2..6b33e8d9 100644
--- a/go/game/attack.go
+++ b/go/game/attack.go
@@ -32,6 +32,24 @@ func (a Attack) DamageInRange(r int) int {
return a.attacks[r-1]
}
+// Ranged reports if the attack has more range than 1.
+func (a Attack) Ranged() bool {
+ return a.MaxRange() > 1
+}
+
+// Extend increases the MaxRange by amount.
+func (a *Attack) Extend(amount int) {
+ d := a.DamageInRange(a.MaxRange())
+ for range amount {
+ a.attacks = append(a.attacks, d)
+ }
+}
+
+// Shorten decreases the MaxRange by amount.
+func (a *Attack) Shorten(amount int) {
+ a.attacks = a.attacks[:len(a.attacks)-amount]
+}
+
func (a Attack) String() string {
if INVALID_ATTACK(a) {
return "invalid attack"