Monster shopkeeper logic

This commit is contained in:
Linus Probert 2019-03-07 15:31:09 +01:00
parent 7e1dffb45e
commit 447c1a773c
1 changed files with 36 additions and 0 deletions

View File

@ -106,6 +106,13 @@ local stats = {
atk = 0, atk = 0,
def = 0, def = 0,
speed = 1 speed = 1
},
shopkeeper = {
hp = 100,
dmg = 10,
atk = 2,
def = 0,
speed = 1
} }
} }
@ -266,10 +273,21 @@ local eastereggs = {
{ stats.misc, 0*16, 7*16, "Adnis, the Ranger", behaviour.passive }, { stats.misc, 0*16, 7*16, "Adnis, the Ranger", behaviour.passive },
{ stats.misc, 7*16, 8*16, "Ti, the Mage", behaviour.passive }, { stats.misc, 7*16, 8*16, "Ti, the Mage", behaviour.passive },
} }
for i=1,#eastereggs do for i=1,#eastereggs do
eastereggs[i] = concat({ texturePaths.player0, texturePaths.player1 }, eastereggs[i]) eastereggs[i] = concat({ texturePaths.player0, texturePaths.player1 }, eastereggs[i])
end end
local shopkeeper = {
texturePaths.humanoid1,
texturePaths.humanoid2,
stats.shopkeeper,
12*16,
16,
"The Trader",
behaviour.passive
}
-- Add Platino -- Add Platino
table.insert(eastereggs, { table.insert(eastereggs, {
texturePaths.reptile0, texturePaths.reptile0,
@ -384,6 +402,24 @@ function module.add_boss_to_room(room, roomx, roomy)
end end
end end
function module.add_shopkeeper_to_room(room, roomx, roomy)
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,
shopkeeper
}
success = true
end
end
end
function module.load_monsters(map, monsters) function module.load_monsters(map, monsters)
for i=0,15 do for i=0,15 do
for j=0,11 do for j=0,11 do