2018-08-10 20:09:56 +02:00
|
|
|
local room_builder = require "maproombuilder"
|
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
|
|
|
|
2018-05-19 17:55:10 +02:00
|
|
|
local behaviour = {
|
|
|
|
pacifist = 0,
|
|
|
|
normal = 1,
|
|
|
|
hostile = 2,
|
|
|
|
guerilla = 3,
|
2018-05-21 21:03:59 +02:00
|
|
|
coward = 4,
|
2018-08-15 07:19:44 +02:00
|
|
|
sentinel = 5,
|
2018-08-22 13:13:54 +02:00
|
|
|
fire_demon = 6,
|
2018-08-23 09:11:13 +02:00
|
|
|
sorcerer = 7,
|
|
|
|
assassin = 8
|
2017-12-18 12:12:24 +01:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
},
|
2018-05-21 21:03:59 +02:00
|
|
|
misc = {
|
|
|
|
hp = 18,
|
|
|
|
dmg = 2,
|
|
|
|
atk = 0,
|
|
|
|
def = 0,
|
|
|
|
speed = 1
|
|
|
|
},
|
2018-02-20 14:22:26 +01:00
|
|
|
dog = {
|
|
|
|
hp = 12,
|
|
|
|
dmg = 2,
|
|
|
|
atk = 0,
|
|
|
|
def = 0,
|
|
|
|
speed = 1
|
|
|
|
},
|
|
|
|
undead = {
|
|
|
|
hp = 24,
|
|
|
|
dmg = 1,
|
|
|
|
atk = 0,
|
|
|
|
def = 0,
|
|
|
|
speed = 1
|
|
|
|
},
|
2018-08-22 11:05:12 +02:00
|
|
|
orc = {
|
|
|
|
hp = 20,
|
|
|
|
dmg = 2,
|
|
|
|
atk = 0,
|
|
|
|
def = 0,
|
|
|
|
speed = 1
|
|
|
|
},
|
2018-08-15 07:19:44 +02:00
|
|
|
boss = {
|
|
|
|
hp = 60,
|
2018-08-22 13:13:54 +02:00
|
|
|
dmg = 3,
|
2018-08-15 07:19:44 +02:00
|
|
|
atk = 1,
|
|
|
|
def = 0,
|
|
|
|
speed = 1
|
|
|
|
},
|
2018-02-20 14:22:26 +01:00
|
|
|
platino = {
|
2018-08-22 20:54:39 +02:00
|
|
|
hp = 90,
|
|
|
|
dmg = 1,
|
2018-08-22 13:13:54 +02:00
|
|
|
atk = 0,
|
|
|
|
def = 0,
|
2018-08-22 20:54:39 +02:00
|
|
|
speed = 1
|
2018-02-20 14:22:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-25 13:46:28 +02:00
|
|
|
local function concat(table1, table2)
|
|
|
|
for i=1,#table2 do
|
|
|
|
table1[#table1+1] = table2[i]
|
|
|
|
end
|
|
|
|
return table1
|
|
|
|
end
|
|
|
|
|
2018-01-30 21:05:33 +01:00
|
|
|
local pests = {
|
2018-05-25 13:46:28 +02:00
|
|
|
{ stats.pest, 96, 0, "A Slim Worm", behaviour.pacifist },
|
|
|
|
{ stats.pest, 112, 0, "A Fat Worm", behaviour.pacifist },
|
|
|
|
|
|
|
|
{ stats.pest, 16, 16, "A Fly", behaviour.pacifist },
|
|
|
|
{ stats.pest, 48, 16, "A Moth", behaviour.pacifist },
|
|
|
|
{ stats.pest, 80, 16, "A Gnat", behaviour.pacifist },
|
|
|
|
|
|
|
|
{ stats.pest, 0, 32, "A Small Spider", behaviour.pacifist },
|
|
|
|
{ stats.pest, 16, 32, "A Medium Spider", behaviour.pacifist },
|
|
|
|
{ stats.pest, 32, 32, "A Large Spider", behaviour.pacifist },
|
|
|
|
{ stats.pest, 48, 32, "A Small Scorpion", behaviour.pacifist },
|
|
|
|
{ stats.pest, 64, 32, "A Medium Scorpion", behaviour.pacifist },
|
|
|
|
{ stats.pest, 80, 32, "A Large Scorpion", behaviour.pacifist },
|
|
|
|
|
|
|
|
{ stats.pest, 0, 48, "A Slug", behaviour.pacifist },
|
|
|
|
{ stats.pest, 16, 48, "A Large Slug", behaviour.pacifist },
|
|
|
|
{ stats.pest, 48, 48, "A Red Slug", behaviour.pacifist },
|
|
|
|
{ stats.pest, 64, 48, "A Large Red Slug", behaviour.pacifist },
|
|
|
|
|
|
|
|
{ stats.pest, 0, 64, "A Giant Brown Ant", behaviour.pacifist },
|
|
|
|
{ stats.pest, 16, 64, "A Giant Black Ant", behaviour.pacifist },
|
2018-01-30 21:05:33 +01:00
|
|
|
}
|
2018-05-25 13:46:28 +02:00
|
|
|
for i=1,#pests do
|
|
|
|
pests[i] = concat({ texturePaths.pest0, texturePaths.pest1 }, pests[i])
|
|
|
|
end
|
2017-12-17 13:43:41 +01:00
|
|
|
|
2018-08-22 11:05:12 +02:00
|
|
|
local avian = {
|
|
|
|
{ stats.default, 0, 11*16, "A Small Brown Bat", behaviour.pacifist },
|
|
|
|
{ stats.default, 16, 11*16, "A Big Brown Bat", behaviour.normal },
|
|
|
|
{ stats.default, 32, 11*16, "A Vampire Bat", behaviour.guerilla },
|
|
|
|
{ stats.default, 48, 11*16, "A Rabid Bat", behaviour.hostile },
|
|
|
|
}
|
|
|
|
for i=1,#avian do
|
|
|
|
avian[i] = concat({ texturePaths.avian0, texturePaths.avian1 }, avian[i])
|
|
|
|
end
|
|
|
|
|
2018-05-21 21:03:59 +02:00
|
|
|
local misc = {
|
2018-05-25 13:46:28 +02:00
|
|
|
{ stats.misc, 0, 0, "A Giant Black Rat", behaviour.sentinel },
|
|
|
|
{ stats.misc, 16, 0, "A Giant White Rat", behaviour.sentinel },
|
|
|
|
{ stats.misc, 64, 0, "An Owl Bear", behaviour.sentinel },
|
2018-05-21 21:03:59 +02:00
|
|
|
}
|
2018-05-25 13:46:28 +02:00
|
|
|
for i=1,#misc do
|
|
|
|
misc[i] = concat({ texturePaths.misc0, texturePaths.misc1 }, misc[i])
|
|
|
|
end
|
2018-05-21 21:03:59 +02:00
|
|
|
|
2018-08-22 14:02:55 +02:00
|
|
|
local reanimated = {
|
2018-08-15 07:19:44 +02:00
|
|
|
{ stats.undead, 0, 32, "A Skeleton", behaviour.normal },
|
|
|
|
{ stats.undead, 48, 32, "A Black Skeleton", behaviour.normal },
|
|
|
|
{ stats.undead, 64, 32, "A Zombie", behaviour.normal },
|
|
|
|
{ stats.undead, 80, 32, "A Zombie", behaviour.normal }
|
2017-12-14 09:48:49 +01:00
|
|
|
}
|
2018-08-22 14:02:55 +02:00
|
|
|
for i=1,#reanimated do
|
|
|
|
reanimated[i] = concat({ texturePaths.undead0, texturePaths.undead1 }, reanimated[i])
|
|
|
|
end
|
|
|
|
|
|
|
|
local undead = {
|
|
|
|
{ stats.undead, 5*16, 16, "A Mummy", behaviour.normal },
|
|
|
|
{ stats.undead, 6*16, 16, "A Two Headed Mummy", behaviour.sentinel },
|
|
|
|
{ stats.undead, 0*16, 32, "A Skeleton", behaviour.normal },
|
|
|
|
{ stats.misc, 1*16, 32, "A Burning Skeleton", behaviour.fire_demon },
|
|
|
|
{ stats.misc, 2*16, 32, "An Eldritch Skeleton", behaviour.sorcerer },
|
|
|
|
{ stats.misc, 3*16, 32, "A Black Skeleton", behaviour.guerilla },
|
|
|
|
{ stats.misc, 4*16, 32, "A Zombie", behaviour.coward },
|
|
|
|
{ stats.misc, 5*16, 32, "A Pale Zombie", behaviour.coward },
|
|
|
|
{ stats.misc, 7*16, 32, "A Scorched Zombie", behaviour.fire_demon },
|
|
|
|
{ stats.undead, 0*16, 4*16, "A Whight", behaviour.coward },
|
|
|
|
{ stats.undead, 1*16, 4*16, "A Ghast", behaviour.sentinel },
|
|
|
|
{ stats.misc, 1*16, 4*16, "A Ghost", behaviour.guerilla },
|
|
|
|
{ stats.misc, 0*16, 5*16, "A Spectre", behaviour.sentinel },
|
|
|
|
{ stats.undead, 1*16, 5*16, "An Eldritch Spectre", behaviour.sorcerer },
|
|
|
|
{ stats.undead, 2*16, 5*16, "A Scorched Spectre", behaviour.fire_demon },
|
|
|
|
}
|
2018-05-25 13:46:28 +02:00
|
|
|
for i=1,#undead do
|
|
|
|
undead[i] = concat({ texturePaths.undead0, texturePaths.undead1 }, undead[i])
|
|
|
|
end
|
2017-12-14 09:48:49 +01:00
|
|
|
|
2018-02-20 14:22:26 +01:00
|
|
|
local dogs = {
|
2018-08-15 07:19:44 +02:00
|
|
|
{ stats.dog, 0, 16, "A Rabid Dog", behaviour.normal },
|
|
|
|
{ stats.dog, 16, 16, "An Angry Rabid Dog", behaviour.hostile }
|
2018-02-20 14:22:26 +01:00
|
|
|
}
|
2018-05-25 13:46:28 +02:00
|
|
|
for i=1,#dogs do
|
2018-05-27 15:13:03 +02:00
|
|
|
dogs[i] = concat({ texturePaths.dog0, texturePaths.dog1 }, dogs[i])
|
2018-05-25 13:46:28 +02:00
|
|
|
end
|
2018-02-20 14:22:26 +01:00
|
|
|
|
|
|
|
local reptile = {
|
2018-08-15 07:19:44 +02:00
|
|
|
{ stats.default, 0, 64, "A Small Brown Snake", behaviour.coward },
|
|
|
|
{ stats.default, 16, 64, "A Medium Brown Snake", behaviour.guerilla },
|
|
|
|
{ stats.default, 32, 64, "A Large Brown Snake", behaviour.hostile },
|
|
|
|
{ stats.default, 48, 64, "A Small Black Snake", behaviour.coward },
|
|
|
|
{ stats.default, 64, 64, "A Medium Black Snake", behaviour.guerilla },
|
|
|
|
{ stats.default, 80, 64, "A Large Black Snake", behaviour.hostile },
|
2018-02-20 14:22:26 +01:00
|
|
|
}
|
2018-05-25 13:46:28 +02:00
|
|
|
for i=1,#reptile do
|
|
|
|
reptile[i] = concat({ texturePaths.reptile0, texturePaths.reptile1 }, reptile[i])
|
|
|
|
end
|
2018-02-20 14:22:26 +01:00
|
|
|
|
2018-01-30 21:05:33 +01:00
|
|
|
local demon = {
|
2018-08-15 07:19:44 +02:00
|
|
|
{ stats.default, 0, 0, "A Demon", behaviour.hostile },
|
|
|
|
{ stats.default, 16, 0, "A Demon", behaviour.hostile },
|
|
|
|
{ stats.default, 32, 0, "A Demon", behaviour.hostile },
|
|
|
|
{ stats.default, 48, 0, "A Demon", behaviour.hostile },
|
|
|
|
{ stats.default, 64, 0, "A Demon", behaviour.hostile },
|
|
|
|
{ stats.default, 80, 0, "A Demon", behaviour.hostile },
|
|
|
|
{ stats.default, 96, 0, "A Demon", behaviour.hostile },
|
|
|
|
{ stats.default, 112, 0, "A Demon", behaviour.hostile },
|
2018-01-30 21:05:33 +01:00
|
|
|
}
|
2018-05-25 13:46:28 +02:00
|
|
|
for i=1,#demon do
|
|
|
|
demon[i] = concat({ texturePaths.demon0, texturePaths.demon1 }, demon[i])
|
2018-01-30 21:05:33 +01:00
|
|
|
end
|
|
|
|
|
2018-08-22 11:05:12 +02:00
|
|
|
local orcs = {
|
|
|
|
{ stats.orc, 0, 4*16, "An Orc Guard", behaviour.normal },
|
|
|
|
{ stats.orc, 16, 4*16, "An Orc Seargeant", behaviour.coward },
|
|
|
|
{ stats.orc, 32, 4*16, "An Orc Militia", behaviour.hostile },
|
|
|
|
{ stats.orc, 48, 4*16, "An Orc Sentry", behaviour.sentinel },
|
|
|
|
{ stats.orc, 64, 4*16, "An Orc Brute", behaviour.guerilla },
|
|
|
|
{ stats.orc, 80, 4*16, "An Orc Captain", behaviour.hostile },
|
2018-08-22 13:13:54 +02:00
|
|
|
{ stats.orc, 96, 4*16, "An Orc Pyro", behaviour.fire_demon },
|
2018-08-22 11:05:12 +02:00
|
|
|
}
|
|
|
|
for i=1,#orcs do
|
|
|
|
orcs[i] = concat({ texturePaths.humanoid0, texturePaths.humanoid1 }, orcs[i])
|
|
|
|
end
|
|
|
|
|
2018-08-23 09:11:13 +02:00
|
|
|
local assassins = {
|
|
|
|
{ stats.misc, 1*16, 6*16, "A Reaper", behaviour.assassin },
|
|
|
|
{ stats.misc, 0*16, 7*16, "An Assassin", behaviour.assassin },
|
|
|
|
{ stats.misc, 1*16, 7*16, "A Royal Assassin", behaviour.assassin },
|
|
|
|
}
|
|
|
|
for i=1,#assassins do
|
|
|
|
assassins[i] = concat({ texturePaths.undead0, texturePaths.undead1 }, assassins[i])
|
|
|
|
end
|
|
|
|
|
2018-08-15 07:19:44 +02:00
|
|
|
local bosses = {
|
2018-08-22 11:05:12 +02:00
|
|
|
{ stats.boss, 16, 5*16, "The Hell Hound", behaviour.fire_demon, true },
|
2018-08-22 13:13:54 +02:00
|
|
|
{ stats.boss, 16, 23*16, "The Cleric", behaviour.sorcerer, true },
|
2018-08-23 09:11:13 +02:00
|
|
|
{ stats.boss, 16, 8*16, "The Shadow", behaviour.assassin, true },
|
2018-08-15 07:19:44 +02:00
|
|
|
}
|
|
|
|
bosses[1] = concat({ texturePaths.dog0, texturePaths.dog1 }, bosses[1])
|
2018-08-22 11:05:12 +02:00
|
|
|
bosses[2] = concat({ texturePaths.humanoid0, texturePaths.humanoid1 }, bosses[2])
|
2018-08-23 09:11:13 +02:00
|
|
|
bosses[3] = concat({ texturePaths.undead0, texturePaths.undead1 }, bosses[3])
|
2018-08-15 07:19:44 +02:00
|
|
|
|
2018-09-03 16:49:45 +02:00
|
|
|
local eastereggs = {
|
|
|
|
{ stats.misc, 6*16, 1*16, "Linus, the Developer", behaviour.passive },
|
2018-09-06 20:12:37 +02:00
|
|
|
{ stats.misc, 2*16, 3*16, "Lialynn, the Ranger", behaviour.passive },
|
|
|
|
{ stats.misc, 4*16, 3*16, "Miniel, the Paladin", behaviour.passive },
|
|
|
|
{ stats.misc, 2*16,12*16, "Feng, the Fighter", behaviour.passive },
|
|
|
|
{ stats.misc, 0*16, 7*16, "Adnis, the Ranger", behaviour.passive },
|
|
|
|
{ stats.misc, 7*16, 8*16, "Ti, the Mage", behaviour.passive },
|
2018-09-03 16:49:45 +02:00
|
|
|
}
|
|
|
|
for i=1,#eastereggs do
|
|
|
|
eastereggs[i] = concat({ texturePaths.player0, texturePaths.player1 }, eastereggs[i])
|
|
|
|
end
|
|
|
|
|
2018-09-06 20:12:37 +02:00
|
|
|
-- Add Platino
|
|
|
|
table.insert(eastereggs, {
|
2018-05-27 15:13:03 +02:00
|
|
|
texturePaths.reptile0,
|
|
|
|
texturePaths.reptile1,
|
|
|
|
stats.platino,
|
|
|
|
48,
|
|
|
|
12*16,
|
|
|
|
"Platino",
|
2018-08-22 13:13:54 +02:00
|
|
|
behaviour.sentinel,
|
|
|
|
true
|
2018-09-06 20:12:37 +02:00
|
|
|
})
|
2018-05-27 15:13:03 +02:00
|
|
|
|
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 "",
|
2018-05-19 17:55:10 +02:00
|
|
|
behaviour = data[7] or behaviour.normal,
|
2018-08-15 07:19:44 +02:00
|
|
|
boss = data[8] or false,
|
2017-12-14 09:48:49 +01:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-01-30 21:05:33 +01:00
|
|
|
-- Begin script
|
|
|
|
local enemies = {}
|
2018-08-18 20:53:13 +02:00
|
|
|
if(CURRENT_LEVEL > 0) then
|
2018-01-30 21:05:33 +01:00
|
|
|
if (CURRENT_LEVEL == 1) then
|
|
|
|
enemies = concat(enemies, pests)
|
2018-09-09 12:43:17 +02:00
|
|
|
enemies = concat(enemies, avian)
|
2018-05-21 21:03:59 +02:00
|
|
|
enemies = concat(enemies, misc)
|
2018-09-09 12:43:17 +02:00
|
|
|
enemies = concat(enemies, dogs)
|
2018-10-22 09:38:05 +02:00
|
|
|
elseif (CURRENT_LEVEL > 15 or (QUICK_MODE and CURRENT_LEVEL > 9)) then
|
2018-02-20 14:22:26 +01:00
|
|
|
enemies = {}
|
2018-08-22 14:02:55 +02:00
|
|
|
enemies = concat(enemies, undead)
|
|
|
|
enemies = concat(enemies, orcs)
|
2018-08-23 09:11:13 +02:00
|
|
|
enemies = concat(enemies, assassins)
|
2018-10-22 09:38:05 +02:00
|
|
|
elseif (CURRENT_LEVEL > 10 or (QUICK_MODE and CURRENT_LEVEL > 6)) then
|
2018-02-20 14:22:26 +01:00
|
|
|
enemies = {}
|
2018-08-22 14:02:55 +02:00
|
|
|
enemies = concat(enemies, undead)
|
|
|
|
enemies = concat(enemies, avian)
|
2018-10-22 09:38:05 +02:00
|
|
|
elseif (CURRENT_LEVEL > 5 or (QUICK_MODE and CURRENT_LEVEL > 3)) then
|
2018-01-30 21:05:33 +01:00
|
|
|
enemies = {}
|
2018-08-22 11:05:12 +02:00
|
|
|
enemies = concat(enemies, orcs)
|
|
|
|
enemies = concat(enemies, avian)
|
2018-01-30 21:05:33 +01:00
|
|
|
elseif (CURRENT_LEVEL > 1) then
|
|
|
|
enemies = {}
|
2018-08-22 14:02:55 +02:00
|
|
|
enemies = concat(enemies, reanimated)
|
2018-02-20 14:22:26 +01:00
|
|
|
enemies = concat(enemies, reptile)
|
2018-08-22 11:05:12 +02:00
|
|
|
enemies = concat(enemies, avian)
|
2018-05-21 21:03:59 +02:00
|
|
|
enemies = concat(enemies, misc)
|
2018-02-20 14:22:26 +01:00
|
|
|
enemies = concat(enemies, dogs)
|
2018-01-30 21:05:33 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-09-06 20:12:37 +02:00
|
|
|
local addSpecialInLevel = random(100) == 1
|
2018-09-03 16:49:45 +02:00
|
|
|
|
2018-09-06 20:12:37 +02:00
|
|
|
local function add_monster_to_tile(room, roomx, roomy, rx, ry, monster)
|
|
|
|
local x = (roomx * 512) + rx * 32
|
|
|
|
local y = (roomy * 384) + ry * 32
|
|
|
|
room.monsters[rx][ry] = {
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
monster
|
|
|
|
}
|
2018-02-20 14:22:26 +01:00
|
|
|
end
|
|
|
|
|
2018-07-31 14:25:29 +02:00
|
|
|
function module.add_monsters_to_room(room, roomx, roomy)
|
2018-09-06 20:12:37 +02:00
|
|
|
local addSpecial = addSpecialInLevel and random(5) == 1
|
2017-12-14 09:48:49 +01:00
|
|
|
local count = random(3)
|
2018-05-21 21:03:59 +02:00
|
|
|
if (CURRENT_LEVEL > 3) then
|
|
|
|
count = random(4)
|
|
|
|
end
|
2018-09-09 12:43:17 +02:00
|
|
|
count = count + 1
|
2018-07-31 14:25:29 +02:00
|
|
|
local i = 0
|
|
|
|
while i < count do
|
|
|
|
local rx = random(13) + 1
|
|
|
|
local ry = random(9) + 1
|
2018-08-10 20:09:56 +02:00
|
|
|
if room_builder.is_tile_avilable(room, rx, ry) then
|
2018-09-06 20:12:37 +02:00
|
|
|
if addSpecial then
|
|
|
|
addSpecialInLevel = false
|
|
|
|
addSpecial = false
|
|
|
|
add_monster_to_tile(room, roomx, roomy, rx, ry, eastereggs[random(#eastereggs)])
|
|
|
|
else
|
|
|
|
add_monster_to_tile(room, roomx, roomy, rx, ry, enemies[random(#enemies)])
|
|
|
|
end
|
2018-07-31 14:25:29 +02:00
|
|
|
i = i + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-08-15 07:19:44 +02:00
|
|
|
function module.add_boss_to_room(room, roomx, roomy)
|
2018-08-22 13:13:54 +02:00
|
|
|
local boss = bosses[CURRENT_LEVEL / 5]
|
2018-10-22 09:38:05 +02:00
|
|
|
if QUICK_MODE then
|
|
|
|
boss = bosses[CURRENT_LEVEL / 3]
|
|
|
|
end
|
2018-08-15 07:19:44 +02:00
|
|
|
local success = false
|
|
|
|
while not success do
|
|
|
|
local rx = random(13) + 1
|
|
|
|
local ry = random(9) + 1
|
|
|
|
if room_builder.is_tile_avilable(room, rx, ry) then
|
|
|
|
local x = (roomx * 512) + rx * 32
|
|
|
|
local y = (roomy * 384) + ry * 32
|
|
|
|
room.monsters[rx][ry] = {
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
boss
|
|
|
|
}
|
|
|
|
success = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-07-31 14:25:29 +02:00
|
|
|
function module.load_monsters(map, monsters)
|
|
|
|
for i=0,15 do
|
|
|
|
for j=0,11 do
|
|
|
|
monster = monsters[i][j]
|
|
|
|
if monster then
|
|
|
|
add_monster(map, monster[1], monster[2], repack(monster[3]))
|
|
|
|
end
|
|
|
|
end
|
2017-12-14 09:48:49 +01:00
|
|
|
end
|
2017-12-13 23:20:54 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return module
|
2018-08-22 14:02:55 +02:00
|
|
|
|