You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
473 B
25 lines
473 B
function combat(world, index)
|
|
world.hp[index] = world.hp[index] - world.damage[index]
|
|
end
|
|
|
|
function cull_dead(world, index)
|
|
if world.hp[index] < 0 then
|
|
world.dead[index] = true
|
|
end
|
|
end
|
|
|
|
|
|
function handler(world)
|
|
print("world count", world.count)
|
|
|
|
for i = 1, world.count + 1, 1
|
|
do
|
|
combat(world, i)
|
|
cull_dead(world, i)
|
|
|
|
print(world.name[i],
|
|
"HP now", world.hp[i],
|
|
"damage", world.damage[i],
|
|
"dead", world.dead[i])
|
|
end
|
|
end
|
|
|