Skip to content
Snippets Groups Projects
Commit 146c93ee authored by dg's avatar dg
Browse files

money auto-pickup

git-svn-id: http://svn.net-core.org/repos/t-engine4@768 51575b47-30f0-44d4-a5cc-537603b46e54
parent 7903e482
No related branches found
No related tags found
No related merge requests found
......@@ -89,11 +89,23 @@ function _M:move(x, y, force)
if moved then
game.level.map:moveViewSurround(self.x, self.y, 8, 8)
local obj = game.level.map:getObject(self.x, self.y, 1)
if obj and game.level.map:getObject(self.x, self.y, 2) then
-- Autopickup money
local i, nb = 1, 0
local obj = game.level.map:getObject(self.x, self.y, i)
while obj do
if obj.auto_pickup then
self:pickupFloor(i, true)
self:sortInven()
else
nb = nb + 1
i = i + 1
end
obj = game.level.map:getObject(self.x, self.y, i)
end
if nb >= 2 then
game.logSeen(self, "There is more than one objects lying here.")
elseif obj then
game.logSeen(self, "There is an item here: %s", obj:getName{do_color=true})
elseif nb == 1 then
game.logSeen(self, "There is an item here: %s", game.level.map:getObject(self.x, self.y, 1):getName{do_color=true})
end
end
......
......@@ -48,13 +48,13 @@ newEntity{
newEntity{ base = "BASE_NPC_COLD_DRAKE",
name = "cold drake hatchling", color=colors.WHITE, display="d",
desc = [[A drake hatchling, not too powerful in itself, but it usually comes with its brothers and sisters.]],
level_range = {7, 50}, exp_worth = 1,
level_range = {8, 50}, exp_worth = 1,
rarity = 7,
rank = 1, size_category = 2,
max_life = resolvers.rngavg(40,60),
combat_armor = 5, combat_def = 0,
on_melee_hit = {[DamageType.COLD]=resolvers.mbonus(7, 2)},
combat = { dam=resolvers.rngavg(15,20), atk=15, apr=25, dammod={str=0.7} },
combat = { dam=resolvers.rngavg(10,15), atk=15, apr=5, dammod={str=0.6} },
make_escort = {
{type="dragon", subtype="cold", name="cold drake hatchling", number=3, no_subescort=true},
......
......@@ -27,6 +27,7 @@ newEntity{
desc = [[All that glitters is not gold, all that is gold does not glitter.]],
on_prepickup = function(self, who, id)
who.money = who.money + self.money_value / 10
game.logPlayer(who, "You pickup %0.2f gold pieces.", self.money_value / 10)
-- Remove from the map
game.level.map:removeObject(who.x, who.y, id)
if who.player then
......@@ -36,6 +37,7 @@ newEntity{
end
return true
end,
auto_pickup = true,
}
newEntity{ base = "BASE_MONEY", define_as = "MONEY_SMALL",
......
......@@ -19,9 +19,10 @@
load("/data/general/objects/objects.lua")
-- Artifact, droped by Rantha
local Stats = require "engine.interface.ActorStats"
newEntity{ base = "BASE_SHIELD",
-- Artifact, droped by Rantha
newEntity{ base = "BASE_LEATHER_BOOT",
define_as = "FROST_TREADS",
name = "Frost Treads", unique=true,
desc = [[A pair of leather boots. Cold to the touch, they radiate a cold blue light.]],
......@@ -40,5 +41,6 @@ newEntity{ base = "BASE_SHIELD",
[DamageType.COLD] = 20,
[DamageType.NATURE] = 10,
},
inc_stats = { [Stats.STAT_STR] = 4, [Stats.STAT_DEX] = 4, [Stats.STAT_CUN] = 4, },
},
}
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