aboutsummaryrefslogtreecommitdiff
path: root/src/a_hackysacks.moon
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2024-01-29 16:20:10 -0600
committerAlexander M Pickering <alex@cogarr.net>2024-01-29 16:20:10 -0600
commitc2926c5ec74d7e37da395c8c32a7ff2b4cae7d06 (patch)
treeac2bb208dab1274cdc5e9059ffe014ae19181a4c /src/a_hackysacks.moon
downloadfools_rush_in-c2926c5ec74d7e37da395c8c32a7ff2b4cae7d06.tar.gz
fools_rush_in-c2926c5ec74d7e37da395c8c32a7ff2b4cae7d06.tar.bz2
fools_rush_in-c2926c5ec74d7e37da395c8c32a7ff2b4cae7d06.zip
All the files
Diffstat (limited to 'src/a_hackysacks.moon')
-rw-r--r--src/a_hackysacks.moon50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/a_hackysacks.moon b/src/a_hackysacks.moon
new file mode 100644
index 0000000..2939c80
--- /dev/null
+++ b/src/a_hackysacks.moon
@@ -0,0 +1,50 @@
+reg = require "ability_reg"
+import Ability from reg
+
+mod = ...
+print("In tubmle, reg is",reg)
+
+class Juggle extends Ability
+ @text = "Juggle Balls"
+ @description = "Juggle some balls"
+ @hits_icon = {0,0,0,0,1,1,0,0}
+ @sprite = "data/juggler.png"
+ @speed = 4
+ @distance = 1
+ new: (...)=>
+ super("Juggle",{})
+ @requirements = {
+ {"status", "active"},
+ }
+ target: (world, party, char) =>
+ room = world.player_party.room
+ my_pos = char.location
+ --search outward for a target
+ char_tbl1, char_tbl2 = nil, nil
+ for distance = 1, 8
+ char_tbl1 = room\at_location(my_pos + distance)
+ char_tbl2 = room\at_location(my_pos - distance)
+ if (char_tbl1 and #char_tbl1 > 0) or (char_tbl2 and #char_tbl2 > 0)
+ break
+
+ use: (world, party, char)->
+ for i = 5,6
+ chars_at_loc = world.room.data.locations[i]
+ print("chars at loc:",chars_at_loc)
+ if world.server
+ a_chars_at_loc = {}
+ for _,v in ipairs(chars_at_loc)
+ table.insert(a_chars_at_loc,world.enemy_party\member(v.uname))
+ chars_at_loc = a_chars_at_loc
+ hp_minus = () ->
+ for _, char in pairs(chars_at_loc)
+ char\set_field("hp",char.data.hp - 1)
+ if world.server
+ hp_minus!
+ if world.client
+ ui = ui or require "ui"
+ ui.tween_hit(char,i-4, hp_minus)
+
+mod.Tumble = Tumble
+
+mod