1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
reg = require "ability_reg"
ui = require "ui"
import Ability from reg
mod = ...
class Dance extends Ability
@text = "Dance"
@description = "Shake your body!"
@hits_icon = {0,0,0,0,0,1,1,0}
@sprite = "data/body-balance.png"
@speed = 7
@distance = 1
new: (...)=>
super("Dance",{})
@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 in pairs({6,7})
chars_at_loc = world.room.data.locations[i]
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,1, hp_minus)
mod.Tumble = Tumble
mod
|