aboutsummaryrefslogtreecommitdiff
path: root/src/a_brood.moon
blob: 4c94ca69aff8a6c8861cd9c2998a25ad6cd46ee0 (plain)
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
reg = require "ability_reg"
import Ability from reg

class Brood extends Ability
	@text = "Brood"
	@description = "brood"
	@hits_icon = {1,1,1,1,0,0,0,0}
	@speed = 5
	@distance = 1
	new: (...)=>
		super(...)
		@requirements = {
			{"consume_stat", "stamina", 1},
			{"status", "active"},
			{"distance", 1},
		}
	target: (world, party, char) =>
		room = world.player_party.room
		enemy_party = room.parties[1]
		if enemy_party == party
			enemy_party = room.parties[2]
	use: (world, party, char)->
		for i = 1,4
			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.player_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, hp_minus)
	load: ()=>
		print("TODO!")
	
	unload:()=>
		print("TODO!")