Skip to content
Snippets Groups Projects
Commit 11e7975f authored by dg's avatar dg
Browse files

west portal done

git-svn-id: http://svn.net-core.org/repos/t-engine4@1269 51575b47-30f0-44d4-a5cc-537603b46e54
parent 2205448e
No related branches found
No related tags found
No related merge requests found
...@@ -119,32 +119,34 @@ end ...@@ -119,32 +119,34 @@ end
function _M:decay(what, check) function _M:decay(what, check)
local total, nb = 0, 0 local total, nb = 0, 0
for i = 0, self.map.w - 1 do for j = 0, self.map.h - 1 do for i = 0, self.map.w - 1 do for j = 0, self.map.h - 1 do
if what == self.map.OBJECT then if not self.map.attrs(i, j, "no_decay") then
for z = self.map:getObjectTotal(i, j), 1, -1 do if what == self.map.OBJECT then
local e = self.map:getObject(i, j, z) for z = self.map:getObjectTotal(i, j), 1, -1 do
local e = self.map:getObject(i, j, z)
if e and not e.no_decay and util.getval(check, e, i, j) then
print("[DECAY] decaying", e.uid, e.name)
self.map:removeObject(i, j, z)
e:removed()
nb = nb + 1
elseif e then
total = total + 1
end
end
else
local e = self.map(i, j, what)
if e and not e.no_decay and util.getval(check, e, i, j) then if e and not e.no_decay and util.getval(check, e, i, j) then
print("[DECAY] decaying", e.uid, e.name) print("[DECAY] decaying", e.uid, e.name)
self.map:removeObject(i, j, z) if self:hasEntity(e) then
self:removeEntity(e)
else
self.map:remove(i, j, what)
end
e:removed() e:removed()
nb = nb + 1 nb = nb + 1
elseif e then elseif e then
total = total + 1 total = total + 1
end end
end end
else
local e = self.map(i, j, what)
if e and not e.no_decay and util.getval(check, e, i, j) then
print("[DECAY] decaying", e.uid, e.name)
if self:hasEntity(e) then
self:removeEntity(e)
else
self.map:remove(i, j, what)
end
e:removed()
nb = nb + 1
elseif e then
total = total + 1
end
end end
end end end end
return nb, total return nb, total
......
...@@ -17,17 +17,37 @@ ...@@ -17,17 +17,37 @@
-- Nicolas Casalini "DarkGod" -- Nicolas Casalini "DarkGod"
-- darkgod@te4.org -- darkgod@te4.org
local function remove_materials(npc, player)
local gem_o, gem_item, gem_inven_id = player:findInAllInventories("Resonating Diamond")
player:removeObject(gem_inven_id, gem_item, true)
gem_o:removed()
local athame_o, athame_item, athame_inven_id = player:findInAllInventories("Blood-Runed Athame")
player:removeObject(athame_inven_id, athame_item, true)
athame_o:removed()
end
local function check_materials(npc, player)
local gem_o, gem_item, gem_inven_id = player:findInAllInventories("Resonating Diamond")
local athame_o, athame_item, athame_inven_id = player:findInAllInventories("Blood-Runed Athame")
return gem_o and athame_o and player.money >= 200
end
-----------------------------------------------------------------
-- Main dialog
-----------------------------------------------------------------
newChat{ id="welcome", newChat{ id="welcome",
text = [[#LIGHT_GREEN#*A slot in the door opens and a pair of wild eyes peer out.*#WHITE# text = [[#LIGHT_GREEN#*A slot in the door opens and a pair of wild eyes peer out.*#WHITE#
What do you want, @playerdescriptor.race@?]], What do you want, @playerdescriptor.race@?]],
answers = { answers = {
{"Paladin Aeryn told me that you could help me. I need to get to Middle Earth.", jump="help", cond=function(npc, player) return not player:hasQuest("west-portal") end}, {"Paladin Aeryn told me that you could help me. I need to get to Middle Earth.", jump="help", cond=function(npc, player) return not player:hasQuest("west-portal") end},
{"I found the Blood-Runed Athame, but there was no Resonating Diamond.", jump="athame", cond=function(npc, player) return player:hasQuest("west-portal") and player:hasQuest("west-portal"):isCompleted("athame") end}, {"I found the Blood-Runed Athame, but there was no Resonating Diamond.", jump="athame", cond=function(npc, player) return player:hasQuest("west-portal") and player:hasQuest("west-portal"):isCompleted("athame") end},
{"I have a Resonating Diamond.", jump="complete", cond=function(npc, player) return player:hasQuest("west-portal") and player:hasQuest("west-portal"):isCompleted("gem") end},
{"Sorry, I have to go!"}, {"Sorry, I have to go!"},
} }
} }
----------------------------------------------------------------- -----------------------------------------------------------------
-- Give quest -- Give quest
----------------------------------------------------------------- -----------------------------------------------------------------
...@@ -101,13 +121,19 @@ newChat{ id="athame3", ...@@ -101,13 +121,19 @@ newChat{ id="athame3",
----------------------------------------------------------------- -----------------------------------------------------------------
-- Return gem -- Return gem
----------------------------------------------------------------- -----------------------------------------------------------------
newChat{ id="help", newChat{ id="complete",
text = [[Pfaugh! Her goal in life is to waste my time! Middle Earth? Why not Narnia or Chicago? Just as easy to send you someplace entirely fictional as Middle Earth. Go away. text = [[[Yes? You got the athame, the gem and 200 gold?]],
#LIGHT_GREEN#*Slot slams shut.*#WHITE#]],
answers = { answers = {
{"I got here from Middle Earth, didn't I? I have this magic Orb I looted from a dead orc, see, and...", jump="offer"}, {"[Give him the gem, the athame and 200 gold]", jump="complete2", cond=check_materials, action=remove_materials},
{"Sorry it seems I miss some stuff. I will be back."},
}
}
newChat{ id="complete2",
text = [[#LIGHT_GREEN#*The door opens and a shabby elf emerges.*#WHITE#
Off we go to prepare the portal!]],
answers = {
{"[follow him]", action=function(npc, player) player:hasQuest("west-portal"):create_portal(npc, player) end},
} }
} }
return "welcome" return "welcome"
...@@ -71,6 +71,53 @@ wyrm_lair = function(self, who) ...@@ -71,6 +71,53 @@ wyrm_lair = function(self, who)
game.logPlayer(game.player, "Zemekkys points the location of Briagh lair on your map.") game.logPlayer(game.player, "Zemekkys points the location of Briagh lair on your map.")
end end
create_portal = function (npc, player)
-- Farportal
local g = mod.class.Grid.new{
name = "Farportal: Minas Tirith",
display = '&', color_r=255, color_g=0, color_b=220, back_color=colors.VIOLET,
notice = true,
always_remember = true,
show_tooltip = true,
desc = [[A farportal is a way to travel incredible distances in the blink of an eye. They usually require an external item to use.
This one seems to go near the town of Minas Tirith in the West.]],
orb_portal = {
change_level = 1,
change_zone = "wilderness",
change_wilderness = {
x = 60, y = 54,
},
message = "#VIOLET#You enter the swirling portal and in the blink of an eye you set foot on the outskirts of Minas Tirith, with no trace of the portal...",
on_use = function(self, who)
end,
},
}
g:resolve() g:resolve(nil, true)
game.logPlayer(game.player, "#VIOLET#Zemekkys starts to draw runes on the floor using the athame and gem dust.")
game.logPlayer(game.player, "#VIOLET#The whole area starts to shake!")
game.logPlayer(game.player, "#VIOLET#Zemekkys says: 'The portal is done!'")
-- Zemekkys is not in his home anymore
npc.on_move = nil
-- Add Zemekkys near the portal
local zemekkys = mod.class.NPC.new{
type = "humanoid", subtype = "elf",
display = "p", color=colors.AQUAMARINE,
name = "High Chronomancer Zemekkys",
size_category = 3, rank = 3,
ai = "none",
faction = "sunwall",
can_talk = "zemekkys-done",
}
zemekkys:resolve() zemekkys:resolve(nil, true)
game.zone:addEntity(game.level, zemekkys, "actor", 41, 17)
game.zone:addEntity(game.level, g, "terrain", 41, 16)
end
on_status_change = function(self, who, status, sub) on_status_change = function(self, who, status, sub)
if sub then if sub then
-- if self:isCompleted() then -- if self:isCompleted() then
......
...@@ -43,6 +43,7 @@ return function(gen, id) ...@@ -43,6 +43,7 @@ return function(gen, id)
local e = gen.zone:makeEntity(gen.level, "actor", ispit, nil, true) local e = gen.zone:makeEntity(gen.level, "actor", ispit, nil, true)
if e then if e then
gen.zone:addEntity(gen.level, e, "actor", i-1+x, j-1+y) gen.zone:addEntity(gen.level, e, "actor", i-1+x, j-1+y)
gen.map.attrs(i-1+x, j-1+y, "no_decay", true)
end end
end end
end end
......
...@@ -47,6 +47,7 @@ return function(gen, id, lev, old_lev) ...@@ -47,6 +47,7 @@ return function(gen, id, lev, old_lev)
for i = x, x + w - 1 do for j = y, y + h - 1 do for i = x, x + w - 1 do for j = y, y + h - 1 do
gen.map.room_map[i][j].special = true gen.map.room_map[i][j].special = true
gen.map.room_map[i][j].room = id gen.map.room_map[i][j].room = id
gen.map.attrs(i, j, "no_decay", true)
end end end end
if vault.gen_map.startx and vault.gen_map.starty then if vault.gen_map.startx and vault.gen_map.starty then
gen.spots[#gen.spots+1] = {x=vault.gen_map.startx + x, y=vault.gen_map.starty + y, check_connectivity="entrance", type="vault", subtype="greater"} gen.spots[#gen.spots+1] = {x=vault.gen_map.startx + x, y=vault.gen_map.starty + y, check_connectivity="entrance", type="vault", subtype="greater"}
......
...@@ -47,6 +47,7 @@ return function(gen, id, lev, old_lev) ...@@ -47,6 +47,7 @@ return function(gen, id, lev, old_lev)
for i = x, x + w - 1 do for j = y, y + h - 1 do for i = x, x + w - 1 do for j = y, y + h - 1 do
gen.map.room_map[i][j].special = true gen.map.room_map[i][j].special = true
gen.map.room_map[i][j].room = id gen.map.room_map[i][j].room = id
gen.map.attrs(i, j, "no_decay", true)
end end end end
if vault.gen_map.startx and vault.gen_map.starty then if vault.gen_map.startx and vault.gen_map.starty then
gen.spots[#gen.spots+1] = {x=vault.gen_map.startx + x, y=vault.gen_map.starty + y, check_connectivity="entrance", type="vault", subtype="lesser"} gen.spots[#gen.spots+1] = {x=vault.gen_map.startx + x, y=vault.gen_map.starty + y, check_connectivity="entrance", type="vault", subtype="lesser"}
......
...@@ -34,6 +34,7 @@ return function(gen, id) ...@@ -34,6 +34,7 @@ return function(gen, id)
gen.map(i-1+x, j-1+y, Map.TERRAIN, gen:resolve('.')) gen.map(i-1+x, j-1+y, Map.TERRAIN, gen:resolve('.'))
end end
if is_lit then gen.map.lites(i-1+x, j-1+y, true) end if is_lit then gen.map.lites(i-1+x, j-1+y, true) end
gen.map.attrs(i-1+x, j-1+y, "no_decay", true)
end end
end end
......
...@@ -217,7 +217,7 @@ newTalent{ ...@@ -217,7 +217,7 @@ newTalent{
end, end,
info = function(self) info = function(self)
return ([[Call upon the luck and cunning of the Little Folk to increase your physical and spell critical strike chance by %d%% for 5 turns. return ([[Call upon the luck and cunning of the Little Folk to increase your physical and spell critical strike chance by %d%% for 5 turns.
The bonus will increase with the Cunning stat]]):format(10 + self:getCon() / 5, 10 + self:getCon() / 5) The bonus will increase with the Cunning stat]]):format(10 + self:getCun() / 5, 10 + self:getCun() / 5)
end, end,
} }
......
...@@ -498,7 +498,7 @@ newEffect{ ...@@ -498,7 +498,7 @@ newEffect{
status = "beneficial", status = "beneficial",
parameters = { power=10 }, parameters = { power=10 },
on_gain = function(self, err) return "#Target# radiates power." end, on_gain = function(self, err) return "#Target# radiates power." end,
on_lose = function(self, err) return "#Target# aura of power vanishes." end, on_lose = function(self, err) return "#Target#'s aura of power vanishes." end,
activate = function(self, eff) activate = function(self, eff)
eff.pid1 = self:addTemporaryValue("inc_damage", {all=eff.power}) eff.pid1 = self:addTemporaryValue("inc_damage", {all=eff.power})
eff.pid2 = self:addTemporaryValue("resists", {all=eff.power}) eff.pid2 = self:addTemporaryValue("resists", {all=eff.power})
...@@ -1431,14 +1431,14 @@ newEffect{ ...@@ -1431,14 +1431,14 @@ newEffect{
parameters = { hateLoss = 0, critical = 0, damage = 0, speed = 0, attack = 0, evasion = 0 }, -- use percentages not fractions parameters = { hateLoss = 0, critical = 0, damage = 0, speed = 0, attack = 0, evasion = 0 }, -- use percentages not fractions
on_gain = function(self, err) return "#F53CBE##Target# begins rampaging!", "+Rampage" end, on_gain = function(self, err) return "#F53CBE##Target# begins rampaging!", "+Rampage" end,
on_lose = function(self, err) return "#F53CBE##Target# is no longer rampaging.", "-Rampage" end, on_lose = function(self, err) return "#F53CBE##Target# is no longer rampaging.", "-Rampage" end,
activate = function(self, eff) activate = function(self, eff)
if eff.hateLoss or 0 > 0 then eff.hateLossId = self:addTemporaryValue("hate_regen", -eff.hateLoss) end if eff.hateLoss or 0 > 0 then eff.hateLossId = self:addTemporaryValue("hate_regen", -eff.hateLoss) end
if eff.critical or 0 > 0 then eff.criticalId = self:addTemporaryValue("combat_physcrit", eff.critical) end if eff.critical or 0 > 0 then eff.criticalId = self:addTemporaryValue("combat_physcrit", eff.critical) end
if eff.damage or 0 > 0 then eff.damageId = self:addTemporaryValue("inc_damage", {[DamageType.PHYSICAL]=eff.damage}) end if eff.damage or 0 > 0 then eff.damageId = self:addTemporaryValue("inc_damage", {[DamageType.PHYSICAL]=eff.damage}) end
if eff.speed or 0 > 0 then eff.speedId = self:addTemporaryValue("energy", {mod=eff.speed * 0.01}) end if eff.speed or 0 > 0 then eff.speedId = self:addTemporaryValue("energy", {mod=eff.speed * 0.01}) end
if eff.attack or 0 > 0 then eff.attackId = self:addTemporaryValue("combat_atk", self.combat_atk * eff.attack * 0.01) end if eff.attack or 0 > 0 then eff.attackId = self:addTemporaryValue("combat_atk", self.combat_atk * eff.attack * 0.01) end
if eff.evasion or 0 > 0 then eff.evasionId = self:addTemporaryValue("evasion", eff.evasion) end if eff.evasion or 0 > 0 then eff.evasionId = self:addTemporaryValue("evasion", eff.evasion) end
eff.particle = self:addParticles(Particles.new("rampage", 1)) eff.particle = self:addParticles(Particles.new("rampage", 1))
end, end,
deactivate = function(self, eff) deactivate = function(self, eff)
...@@ -1448,7 +1448,7 @@ newEffect{ ...@@ -1448,7 +1448,7 @@ newEffect{
if eff.speedId then self:removeTemporaryValue("energy", eff.speedId) end if eff.speedId then self:removeTemporaryValue("energy", eff.speedId) end
if eff.attackId then self:removeTemporaryValue("combat_atk", eff.attackId) end if eff.attackId then self:removeTemporaryValue("combat_atk", eff.attackId) end
if eff.evasionId then self:removeTemporaryValue("evasion", eff.evasionId) end if eff.evasionId then self:removeTemporaryValue("evasion", eff.evasionId) end
self:removeParticles(eff.particle) self:removeParticles(eff.particle)
end, end,
} }
...@@ -1488,7 +1488,7 @@ newEffect{ ...@@ -1488,7 +1488,7 @@ newEffect{
end end
end end
end end
if bestDistance then if bestDistance then
target:move(bestX, bestY, true) target:move(bestX, bestY, true)
if not target.did_energy then target:useEnergy() end if not target.did_energy then target:useEnergy() end
......
...@@ -70,7 +70,7 @@ newEntity{ ...@@ -70,7 +70,7 @@ newEntity{
see_invisible = 100, see_invisible = 100,
instakill_immune = 1, instakill_immune = 1,
stun_immune = 0.5, stun_immune = 0.5,
blind_immune = 1 blind_immune = 1,
body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1, HEAD=1, FEET=1 }, body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1, HEAD=1, FEET=1 },
resolvers.equip{ resolvers.equip{
...@@ -135,7 +135,7 @@ newEntity{ ...@@ -135,7 +135,7 @@ newEntity{
see_invisible = 100, see_invisible = 100,
instakill_immune = 1, instakill_immune = 1,
stun_immune = 0.5, stun_immune = 0.5,
blind_immune = 1 blind_immune = 1,
body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1 }, body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1 },
resolvers.equip{ resolvers.equip{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment