2017-12-13 23:20:54 +01:00
|
|
|
local module = {}
|
2017-12-14 09:48:49 +01:00
|
|
|
local random = math.random
|
2017-12-13 23:20:54 +01:00
|
|
|
|
2017-12-14 09:48:49 +01:00
|
|
|
local texturePaths = {
|
2018-02-22 12:36:24 +01:00
|
|
|
aquatic0 = "Characters/Aquatic0.png",
|
|
|
|
aquatic1 = "Characters/Aquatic1.png",
|
|
|
|
avian0 = "Characters/Avian0.png",
|
|
|
|
avian1 = "Characters/Avian1.png",
|
|
|
|
cat0 = "Characters/Cat0.png",
|
|
|
|
cat1 = "Characters/Cat1.png",
|
|
|
|
demon0 = "Characters/Demon0.png",
|
|
|
|
demon1 = "Characters/Demon1.png",
|
|
|
|
dog0 = "Characters/Dog0.png",
|
|
|
|
dog1 = "Characters/Dog1.png",
|
|
|
|
elemental0 = "Characters/Elemental0.png",
|
|
|
|
elemental1 = "Characters/Elemental1.png",
|
|
|
|
humanoid0 = "Characters/Humanoid0.png",
|
|
|
|
humanoid1 = "Characters/Humanoid1.png",
|
|
|
|
misc0 = "Characters/Misc0.png",
|
|
|
|
misc1 = "Characters/Misc1.png",
|
|
|
|
pest0 = "Characters/Pest0.png",
|
|
|
|
pest1 = "Characters/Pest1.png",
|
|
|
|
pant0 = "Characters/Plant0.png",
|
|
|
|
plant1 = "Characters/Plant1.png",
|
|
|
|
player0 = "Characters/Player0.png",
|
|
|
|
player1 = "Characters/Player1.png",
|
|
|
|
quadroped0 = "Characters/Quadraped0.png",
|
|
|
|
quadroped1 = "Characters/Quadraped1.png",
|
|
|
|
reptile0 = "Characters/Reptile0.png",
|
|
|
|
reptile1 = "Characters/Reptile1.png",
|
|
|
|
rodent0 = "Characters/Rodent0.png",
|
|
|
|
rodent1 = "Characters/Rodent1.png",
|
|
|
|
slime0 = "Characters/Slime0.png",
|
|
|
|
slime1 = "Characters/Slime1.png",
|
|
|
|
undead0 = "Characters/Undead0.png",
|
|
|
|
undead1 = "Characters/Undead1.png",
|
2017-12-13 23:20:54 +01:00
|
|
|
}
|
|
|
|
|
2017-12-18 12:12:24 +01:00
|
|
|
|
|
|
|
local state = {
|
|
|
|
passive = 0,
|
|
|
|
agressive = 1,
|
|
|
|
scared = 2,
|
|
|
|
}
|
|
|
|
|
2018-02-20 14:22:26 +01:00
|
|
|
local stats = {
|
|
|
|
default = {
|
|
|
|
hp = 12,
|
|
|
|
dmg = 2,
|
|
|
|
atk = 0,
|
|
|
|
def = 0,
|
|
|
|
speed = 1
|
|
|
|
},
|
|
|
|
pest = {
|
|
|
|
hp = 6,
|
|
|
|
dmg = 1,
|
|
|
|
atk = 0,
|
|
|
|
def = 0,
|
|
|
|
speed = 1
|
|
|
|
},
|
|
|
|
dog = {
|
|
|
|
hp = 12,
|
|
|
|
dmg = 2,
|
|
|
|
atk = 0,
|
|
|
|
def = 0,
|
|
|
|
speed = 1
|
|
|
|
},
|
|
|
|
undead = {
|
|
|
|
hp = 24,
|
|
|
|
dmg = 1,
|
|
|
|
atk = 0,
|
|
|
|
def = 0,
|
|
|
|
speed = 1
|
|
|
|
},
|
|
|
|
platino = {
|
|
|
|
hp = 60,
|
|
|
|
dmg = 60,
|
|
|
|
atk = 60,
|
|
|
|
def = 60,
|
|
|
|
speed = 3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-30 21:05:33 +01:00
|
|
|
local pests = {
|
2017-12-18 09:11:00 +01:00
|
|
|
-- PESTS
|
2018-02-20 14:22:26 +01:00
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 0, 0, "A Beetle" },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 16, 0, "A Beetle" },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 32, 0, "A Beetle" },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 48, 0, "A Beetle" },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 64, 0, "A Large Grub" },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 80, 0, "A Small Grub" },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 96, 0, "A Slim Worm" },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 112, 0, "A Fat Worm" },
|
2018-01-17 09:32:49 +01:00
|
|
|
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 0, 16, "Female Dragonfly" },
|
2018-02-20 14:22:26 +01:00
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 16, 16, "A Fly" },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 32, 16, "A Larva" },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 48, 16, "A Moth" },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 64, 16 },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 80, 16, "A Gnat" },
|
|
|
|
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 0, 32, "A Small Spider" },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 16, 32, "A Medium Spider" },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 32, 32, "A Large Spider" },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 48, 32, "A Small Scorpion" },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 64, 32, "A Medium Scorpion" },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 80, 32, "A Large Scorpion" },
|
|
|
|
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 0, 48, "A Slug" },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 16, 48, "A Large Slug" },
|
2017-12-14 09:48:49 +01:00
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 32, 48 },
|
2018-02-20 14:22:26 +01:00
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 48, 48, "A Red Slug" },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 64, 48, "A Large Red Slug" },
|
2017-12-14 09:48:49 +01:00
|
|
|
|
2018-02-20 14:22:26 +01:00
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 0, 64, "A Giant Brown Ant" },
|
|
|
|
{ texturePaths.pest0, texturePaths.pest1, stats.pest, 16, 64, "A Giant Black Ant" },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 32, 64, "A Giant Gold Ant" },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, stats.pest, 48, 64, "A Giant Silver Ant" },
|
2017-12-14 09:48:49 +01:00
|
|
|
|
2018-01-17 09:32:49 +01:00
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 0, 80 },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 16, 80 },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 32, 80 },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 48, 80 },
|
2017-12-14 09:48:49 +01:00
|
|
|
|
2018-01-17 09:32:49 +01:00
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 0, 96 },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 16, 96 },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 32, 96 },
|
2017-12-14 09:48:49 +01:00
|
|
|
|
2018-01-17 09:32:49 +01:00
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 0, 112 },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 16, 112 },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 32, 112 },
|
|
|
|
--{ texturePaths.pest0, texturePaths.pest1, 48, 112 },
|
2018-01-30 21:05:33 +01:00
|
|
|
}
|
2017-12-17 13:43:41 +01:00
|
|
|
|
2018-01-30 21:05:33 +01:00
|
|
|
local undead = {
|
2017-12-18 09:11:00 +01:00
|
|
|
-- UNDEAD
|
2018-01-17 09:32:49 +01:00
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 0, 0, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 16, 0, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 32, 0, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 48, 0, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 64, 0, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 80, 0, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 96, 0, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 112, 0, "", state.passive, state.agressive };
|
|
|
|
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 0, 16, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 16, 16, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 32, 16, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 48, 16, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 64, 16, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 80, 16, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 96, 16, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 112, 16, "", state.passive, state.agressive };
|
|
|
|
|
2018-02-20 14:22:26 +01:00
|
|
|
{ texturePaths.undead0, texturePaths.undead1, stats.undead, 0, 32, "A Skeleton", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 16, 32, "An Umber Skeleton", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 32, 32, "A Caustic Skeleton", state.passive, state.agressive };
|
|
|
|
{ texturePaths.undead0, texturePaths.undead1, stats.undead, 48, 32, "A Black Skeleton", state.passive, state.agressive };
|
|
|
|
{ texturePaths.undead0, texturePaths.undead1, stats.undead, 64, 32, "A Zombie", state.passive, state.agressive };
|
|
|
|
{ texturePaths.undead0, texturePaths.undead1, stats.undead, 80, 32, "A Zombie", state.passive, state.agressive };
|
2018-01-17 09:32:49 +01:00
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 96, 32, "", state.passive, state.agressive };
|
|
|
|
--{ texturePaths.undead0, texturePaths.undead1, 112, 32, "", state.passive, state.scared };
|
2017-12-14 09:48:49 +01:00
|
|
|
}
|
|
|
|
|
2018-02-20 14:22:26 +01:00
|
|
|
local dogs = {
|
|
|
|
{ texturePaths.dog0, texturePaths.dog1, stats.dog, 0, 16, "A Rabid Dog", state.passive, state.agressive };
|
2018-03-13 10:01:17 +01:00
|
|
|
{ texturePaths.dog0, texturePaths.dog1, stats.dog, 16, 16, "An Angry Rabid Dog", state.agressive, state.agressive };
|
2018-02-20 14:22:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
local reptile = {
|
|
|
|
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 0, 64, "A Small Brown Snake", state.passive, state.agressive };
|
|
|
|
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 16, 64, "A Medium Brown Snake", state.passive, state.agressive };
|
|
|
|
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 32, 64, "A Large Brown Snake", state.passive, state.agressive };
|
|
|
|
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 48, 64, "A Small Black Snake", state.agressive, state.agressive };
|
|
|
|
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 64, 64, "A Medium Black Snake", state.agressive, state.agressive };
|
|
|
|
{ texturePaths.reptile0, texturePaths.reptile1, stats.default, 80, 64, "A Large Black Snake", state.agressive, state.agressive };
|
|
|
|
}
|
|
|
|
|
|
|
|
local platino = {
|
|
|
|
{ texturePaths.reptile0, texturePaths.reptile1, stats.platino, 48, 12*16, "Platino", state.agressive, state.agressive };
|
|
|
|
}
|
|
|
|
|
2018-01-30 21:05:33 +01:00
|
|
|
local demon = {
|
2018-02-20 14:22:26 +01:00
|
|
|
{ texturePaths.demon0, texturePaths.demon1, stats.default, 0, 0, "A Demon", state.agressive, state.agressive };
|
|
|
|
{ texturePaths.demon0, texturePaths.demon1, stats.default, 16, 0, "A Demon", state.agressive, state.agressive };
|
|
|
|
{ texturePaths.demon0, texturePaths.demon1, stats.default, 32, 0, "A Demon", state.agressive, state.agressive };
|
|
|
|
{ texturePaths.demon0, texturePaths.demon1, stats.default, 48, 0, "A Demon", state.agressive, state.agressive };
|
|
|
|
{ texturePaths.demon0, texturePaths.demon1, stats.default, 64, 0, "A Demon", state.agressive, state.agressive };
|
|
|
|
{ texturePaths.demon0, texturePaths.demon1, stats.default, 80, 0, "A Demon", state.agressive, state.agressive };
|
|
|
|
{ texturePaths.demon0, texturePaths.demon1, stats.default, 96, 0, "A Demon", state.agressive, state.agressive };
|
|
|
|
{ texturePaths.demon0, texturePaths.demon1, stats.default, 112, 0, "A Demon", state.agressive, state.agressive };
|
2018-01-30 21:05:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
local function concat(table1, table2)
|
2018-02-10 08:00:20 +01:00
|
|
|
for i=1,#table2 do
|
2018-01-30 21:05:33 +01:00
|
|
|
table1[#table1+1] = table2[i]
|
|
|
|
end
|
|
|
|
return table1
|
|
|
|
end
|
|
|
|
|
2017-12-14 09:48:49 +01:00
|
|
|
local function repack(data)
|
|
|
|
return {
|
|
|
|
texturePath1 = data[1],
|
|
|
|
texturePath2 = data[2],
|
2018-02-20 14:22:26 +01:00
|
|
|
stats = data[3],
|
|
|
|
clipX = data[4],
|
|
|
|
clipY = data[5],
|
|
|
|
label = data[6] or "",
|
|
|
|
nstate = data[7] or state.passive,
|
|
|
|
cstate = data[8] or state.scared,
|
2017-12-14 09:48:49 +01:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-01-30 21:05:33 +01:00
|
|
|
-- Begin script
|
|
|
|
local enemies = {}
|
|
|
|
if(CURRENT_LEVEL > 0 and CURRENT_LEVEL < 10) then
|
|
|
|
if (CURRENT_LEVEL == 1) then
|
|
|
|
enemies = concat(enemies, pests)
|
2018-02-20 14:22:26 +01:00
|
|
|
enemies = concat(enemies, dogs)
|
|
|
|
elseif (CURRENT_LEVEL > 5) then
|
|
|
|
enemies = {}
|
|
|
|
enemies = concat(enemies, demon)
|
2018-01-30 21:05:33 +01:00
|
|
|
enemies = concat(enemies, undead)
|
2018-02-20 14:22:26 +01:00
|
|
|
enemies = concat(enemies, reptile)
|
|
|
|
elseif (CURRENT_LEVEL > 3) then
|
|
|
|
enemies = {}
|
|
|
|
enemies = concat(enemies, undead)
|
|
|
|
enemies = concat(enemies, reptile)
|
|
|
|
enemies = concat(enemies, dogs)
|
2018-01-30 21:05:33 +01:00
|
|
|
elseif (CURRENT_LEVEL > 2) then
|
|
|
|
enemies = {}
|
|
|
|
enemies = concat(enemies, undead)
|
2018-02-20 14:22:26 +01:00
|
|
|
enemies = concat(enemies, reptile)
|
|
|
|
enemies = concat(enemies, dogs)
|
2018-01-30 21:05:33 +01:00
|
|
|
elseif (CURRENT_LEVEL > 1) then
|
|
|
|
enemies = {}
|
|
|
|
enemies = concat(enemies, undead)
|
2018-02-20 14:22:26 +01:00
|
|
|
enemies = concat(enemies, reptile)
|
|
|
|
enemies = concat(enemies, dogs)
|
2018-01-30 21:05:33 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-20 14:22:26 +01:00
|
|
|
if random(100) == 1 then
|
|
|
|
enemies = concat(enemies, platino);
|
|
|
|
end
|
|
|
|
|
2017-12-14 09:48:49 +01:00
|
|
|
function module.add_monster_to_room(map, roomx, roomy)
|
|
|
|
local count = random(3)
|
|
|
|
for i=0,count do
|
|
|
|
local x = (roomx * 512) + (random(13) + 1) * 32
|
|
|
|
local y = (roomy * 384) + (random(9) + 1) * 32
|
|
|
|
add_monster(map, x, y, repack(enemies[random(#enemies)]));
|
|
|
|
end
|
2017-12-13 23:20:54 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return module
|