From 7b0d4a5c9fbeac330eb0cd01f5e547deba25ceef Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Mon, 21 Dec 2009 22:29:55 +0000 Subject: [PATCH] objects, wieldable git-svn-id: http://svn.net-core.org/repos/t-engine4@137 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/engine/Actor.lua | 2 + game/engine/Zone.lua | 3 +- game/engine/interface/ActorInventory.lua | 39 +++++++- game/engine/resolvers.lua | 10 +-- game/modules/tome/class/Player.lua | 6 +- game/modules/tome/class/interface/Combat.lua | 6 +- .../tome/data/general/massive-armor.lua | 64 +++++++++++++ game/modules/tome/data/general/objects.lua | 20 +---- game/modules/tome/data/general/staves.lua | 89 +++++++++++++++++++ game/modules/tome/data/general/swords.lua | 59 +++++++++--- game/modules/tome/data/talents/spells/air.lua | 5 +- .../tome/data/talents/spells/arcane.lua | 4 +- .../tome/data/talents/spells/earth.lua | 6 +- .../modules/tome/data/talents/spells/fire.lua | 12 +-- .../tome/data/talents/spells/water.lua | 12 +-- .../tome/data/zones/ancient_ruins/npcs.lua | 4 +- game/modules/tome/resolvers.lua | 8 ++ src/map.c | 4 +- 18 files changed, 285 insertions(+), 68 deletions(-) create mode 100644 game/modules/tome/data/general/massive-armor.lua create mode 100644 game/modules/tome/data/general/staves.lua create mode 100644 game/modules/tome/resolvers.lua diff --git a/game/engine/Actor.lua b/game/engine/Actor.lua index 4c870ac89b..d021c46998 100644 --- a/game/engine/Actor.lua +++ b/game/engine/Actor.lua @@ -148,6 +148,7 @@ function _M:addTemporaryValue(prop, v, noupdate) if type(v) == "number" then -- Simple addition self[prop] = (self[prop] or 0) + v + print("addTmpVal", prop, v) -- elseif type(v) == "boolean" then -- -- False has precedence over true -- if v == false then @@ -173,6 +174,7 @@ function _M:removeTemporaryValue(prop, id, noupdate) if not noupdate then if type(oldval) == "number" then self[prop] = self[prop] - oldval + print("delTmpVal", prop, oldval) -- elseif type(oldval) == "boolean" then else error("unsupported temporary value type: "..type(oldval)) diff --git a/game/engine/Zone.lua b/game/engine/Zone.lua index 1672a4623e..4dbc53f713 100644 --- a/game/engine/Zone.lua +++ b/game/engine/Zone.lua @@ -38,7 +38,8 @@ function _M:computeRarities(list, level, ood, filter) local r = { total=0 } print("******************", level) for i, e in ipairs(list) do - if e.rarity and (not filter or filter(e)) then + if e.rarity and e.level_range and (not filter or filter(e)) then +-- print("computing rarity of", e.name) local lev = level -- Out of Depth chance -- if ood and rng.percent(ood.chance) then diff --git a/game/engine/interface/ActorInventory.lua b/game/engine/interface/ActorInventory.lua index d47154216a..b012fc9e23 100644 --- a/game/engine/interface/ActorInventory.lua +++ b/game/engine/interface/ActorInventory.lua @@ -60,6 +60,10 @@ function _M:addObject(inven, o) -- Ok add it table.insert(self.inven[inven], o) + + -- Do whatever is needed when wearing this object + if self.inven[inven].worn then self:onWear(o) end + return true end @@ -86,7 +90,13 @@ end -- @return the object removed or nil if no item existed function _M:removeObject(inven, item) if type(inven) == "number" then inven = self.inven[inven] end - return table.remove(inven, item) + local o = table.remove(inven, item) + + -- Do whatever is needed when takingoff this object + print("remove object", inven, inven.max, inven.worn, item, o) + if inven.worn then self:onTakeoff(o) end + + return o end --- Drop an object on the floor @@ -143,7 +153,30 @@ end --- Takeoff item function _M:takeoffObject(inven, item) - inven = self:getInven(inven) - local o = table.remove(inven, item) + local o = self:removeObject(inven, item) return o end + +--- Call when an object is worn +function _M:onWear(o) + -- Apply wielder properties + if o.wielder then + o.wielded = {} + for k, e in pairs(o.wielder) do + o.wielded[k] = self:addTemporaryValue(k, e) + print("wear id", k, o.wielded[k]) + end + end +end + +--- Call when an object is taken off +function _M:onTakeoff(o) + print("takeoff", o.name) + if o.wielded then + for k, id in pairs(o.wielded) do + print("take of id", k, id) + self:removeTemporaryValue(k, id) + end + end + o.wielded = nil +end diff --git a/game/engine/resolvers.lua b/game/engine/resolvers.lua index d1dfce2951..da80b3918d 100644 --- a/game/engine/resolvers.lua +++ b/game/engine/resolvers.lua @@ -17,10 +17,6 @@ function resolvers.calc.rngavg(t) return rng.avg(t[1], t[2]) end ---- Random around level -function resolvers.rngavg(x, y) - return {__resolver="rngavg", x, y} -end -function resolvers.calc.rngavg(t) - return rng.avg(t[1], t[2]) -end +-- Load resolvers of the module, if any +local mod_resolver = loadfile("mod.resolvers") +if mod_resolver then mod_resolver() end diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua index 6c9e84bb34..0c07b32ab7 100644 --- a/game/modules/tome/class/Player.lua +++ b/game/modules/tome/class/Player.lua @@ -31,9 +31,9 @@ function _M:init(t) self.image="player.png" -- Default regen - self.mana_regen = 1 - self.stamina_regen = 1 - self.life_regen = 0.5 + self.mana_regen = 0.5 + self.stamina_regen = 0.5 + self.life_regen = 0.1 self.life_rating = 10 self.fixed_rating = true diff --git a/game/modules/tome/class/interface/Combat.lua b/game/modules/tome/class/interface/Combat.lua index c677dd25e0..0ced13f230 100644 --- a/game/modules/tome/class/interface/Combat.lua +++ b/game/modules/tome/class/interface/Combat.lua @@ -122,13 +122,13 @@ end --- Gets the attack function _M:combatAttack(weapon) weapon = weapon or self.combat - return self.combat_atk + weapon.atk + (self:getStr(50) - 5) + (self:getDex(50) - 5) + return self.combat_atk + (weapon.atk or 0) + (self:getStr(50) - 5) + (self:getDex(50) - 5) end --- Gets the armor penetration function _M:combatAPR(weapon) weapon = weapon or self.combat - return self.combat_apr + weapon.apr + return self.combat_apr + (weapon.apr or 0) end --- Gets the weapon speed @@ -152,7 +152,7 @@ function _M:combatDamage(weapon) add = add + (self:getStat(stat) - 10) * mod end end - return self.combat_armor + weapon.dam + add + return self.combat_armor + (weapon.dam or 1) + add end --- Gets spellpower diff --git a/game/modules/tome/data/general/massive-armor.lua b/game/modules/tome/data/general/massive-armor.lua new file mode 100644 index 0000000000..183addba94 --- /dev/null +++ b/game/modules/tome/data/general/massive-armor.lua @@ -0,0 +1,64 @@ +newEntity{ + define_as = "BASE_MASSIVE_ARMOR", + slot = "BODY", + type = "armor", subtype="massive", + display = "[", color=colors.SLATE, + encumber = 17, + rarity = 5, + desc = [[A suit of armour made of metal plates.]], +} + +newEntity{ base = "BASE_MASSIVE_ARMOR", + name = "iron plate armour", + level_range = {1, 10}, + require = { stat = { str=22 }, }, + wielder = { + combat_def = 3, + combat_armor = 7, + fatigue = 20, + }, +} + +newEntity{ base = "BASE_MASSIVE_ARMOR", + name = "steel plate armour", + level_range = {10, 20}, + require = { stat = { str=28 }, }, + wielder = { + combat_def = 4, + combat_armor = 9, + fatigue = 22, + }, +} + +newEntity{ base = "BASE_MASSIVE_ARMOR", + name = "dwarven-steel plate armour", + level_range = {20, 30}, + require = { stat = { str=35 }, }, + wielder = { + combat_def = 5, + combat_armor = 11, + fatigue = 24, + }, +} + +newEntity{ base = "BASE_MASSIVE_ARMOR", + name = "galvorn plate armour", + level_range = {30, 40}, + require = { stat = { str=48 }, }, + wielder = { + combat_def = 7, + combat_armor = 13, + fatigue = 26, + }, +} + +newEntity{ base = "BASE_MASSIVE_ARMOR", + name = "mithril plate armour", + level_range = {40, 50}, + require = { stat = { str=60 }, }, + wielder = { + combat_def = 9, + combat_armor = 16, + fatigue = 26, + }, +} diff --git a/game/modules/tome/data/general/objects.lua b/game/modules/tome/data/general/objects.lua index 4bbc6c2b43..fad7be9ff4 100644 --- a/game/modules/tome/data/general/objects.lua +++ b/game/modules/tome/data/general/objects.lua @@ -1,4 +1,6 @@ +load("/data/general/staves.lua") load("/data/general/swords.lua") +load("/data/general/massive-armor.lua") newEntity{ name = "& tower shield~", @@ -12,24 +14,6 @@ newEntity{ }, } -newEntity{ - name = "& staff~ of fire", - type = "weapon", - display = "/", color_b=255, - level_range = {1, 10}, - rarity = 2, - encumber = 4, - combat = { - dam = 1, - atk = 1, - apr = 0, - dammod = {wil=1}, - }, - wielder = { - stats = {mag=3, wil=2}, - } -} - newEntity{ name = "& Staff of Olorin", type = "weapon", diff --git a/game/modules/tome/data/general/staves.lua b/game/modules/tome/data/general/staves.lua new file mode 100644 index 0000000000..e0837b4612 --- /dev/null +++ b/game/modules/tome/data/general/staves.lua @@ -0,0 +1,89 @@ +newEntity{ + define_as = "BASE_STAFF", + slot = "MAINHAND", + type = "weapon", subtype="staff", + display = "\\", color=colors.LIGHT_RED, + encumber = 5, + rarity = 3, + desc = [[Staves designed for wielders of magic, by the greats of the art.]], +} + +newEntity{ base = "BASE_STAFF", + name = "elm staff", + level_range = {1, 10}, + require = { stat = { mag=11 }, }, + combat = { + dam = resolvers.rngavg(3,5), + apr = 2, + physcrit = 2.5, + dammod = {mag=1}, + }, + wielder = { + combat_spellpower = 1, + combat_spellcrit = 1, + }, +} + +newEntity{ base = "BASE_STAFF", + name = "ash staff", + level_range = {10, 20}, + require = { stat = { mag=16 }, }, + combat = { + dam = resolvers.rngavg(7,11), + apr = 3, + physcrit = 3, + dammod = {mag=1}, + }, + wielder = { + combat_spellpower = 2, + combat_spellcrit = 2, + }, +} + +newEntity{ base = "BASE_STAFF", + name = "yew staff", + level_range = {20, 30}, + require = { stat = { mag=24 }, }, + combat = { + dam = resolvers.rngavg(14,22), + apr = 4, + physcrit = 3.5, + dammod = {mag=1}, + }, + wielder = { + combat_spellpower = 3, + combat_spellcrit = 3, + }, +} + +newEntity{ base = "BASE_STAFF", + name = "elven-wood staff", + level_range = {30, 40}, + require = { stat = { mag=35 }, }, + combat = { + dam = resolvers.rngavg(24,28), + apr = 5, + physcrit = 4.5, + dammod = {mag=1}, + }, + wielder = { + combat_spellpower = 4, + combat_spellcrit = 4, + }, +} + +newEntity{ base = "BASE_STAFF", + name = "dragonbone staff", + level_range = {40, 50}, + require = { stat = { mag=48 }, }, + combat = { + dam = resolvers.rngavg(32,38), + apr = 6, + physcrit = 5, + dammod = {mag=1}, + }, + wielder = { + combat_spellpower = 7, + combat_spellcrit = 5, + }, +} diff --git a/game/modules/tome/data/general/swords.lua b/game/modules/tome/data/general/swords.lua index 938c3ebe31..c33bc3c818 100644 --- a/game/modules/tome/data/general/swords.lua +++ b/game/modules/tome/data/general/swords.lua @@ -1,30 +1,69 @@ newEntity{ - define_as = "BASE_SWORD", + define_as = "BASE_LONGSWORD", slot = "MAINHAND", - type = "weapon", subtype="sword", + type = "weapon", subtype="longsword", display = "/", color=colors.SLATE, encumber = 3, + rarity = 3, desc = [[Sharp, long, and deadly.]], } -newEntity{ base = "BASE_SWORD", - name = "rapier", +newEntity{ base = "BASE_LONGSWORD", + name = "iron longsword", level_range = {1, 10}, - rarity = 3, + require = { stat = { str=11 }, }, combat = { dam = resolvers.rngavg(7,11), - apr = 3, + apr = 2, + physcrit = 2.5, dammod = {str=1}, }, } -newEntity{ base = "BASE_SWORD", - name = "rapier", - level_range = {1, 10}, - rarity = 3, +newEntity{ base = "BASE_LONGSWORD", + name = "steel longsword", + level_range = {10, 20}, + require = { stat = { str=16 }, }, combat = { dam = resolvers.rngavg(10,20), apr = 3, + physcrit = 3, + dammod = {str=1}, + }, +} + +newEntity{ base = "BASE_LONGSWORD", + name = "dwarven-steel longsword", + level_range = {20, 30}, + require = { stat = { str=24 }, }, + combat = { + dam = resolvers.rngavg(25,35), + apr = 4, + physcrit = 3.5, + dammod = {str=1}, + }, +} + +newEntity{ base = "BASE_LONGSWORD", + name = "galvorn longsword", + level_range = {30, 40}, + require = { stat = { str=35 }, }, + combat = { + dam = resolvers.rngavg(40,55), + apr = 5, + physcrit = 4.5, + dammod = {str=1}, + }, +} + +newEntity{ base = "BASE_LONGSWORD", + name = "mithril longsword", + level_range = {40, 50}, + require = { stat = { str=48 }, }, + combat = { + dam = resolvers.rngavg(60,75), + apr = 6, + physcrit = 5, dammod = {str=1}, }, } diff --git a/game/modules/tome/data/talents/spells/air.lua b/game/modules/tome/data/talents/spells/air.lua index e9dfe93d30..0e02a5bbd6 100644 --- a/game/modules/tome/data/talents/spells/air.lua +++ b/game/modules/tome/data/talents/spells/air.lua @@ -9,6 +9,7 @@ newTalent{ action = function(self) local duration = 5 + self:combatSpellpower(0.1) local radius = 3 + local dam = 4 + self:combatSpellpower(0.6) local t = {type="ball", range=15, radius=radius} local x, y = self:getTarget(t) if not x or not y then return nil end @@ -16,7 +17,7 @@ newTalent{ -- Add a lasting map effect game.level.map:addEffect(self, x, y, duration, - DamageType.NATURE, 4 + self:combatSpellpower(0.3), + DamageType.NATURE, dam, radius, 5, nil, engine.Entity.new{alpha=100, display='', color_br=30, color_bg=180, color_bb=60} @@ -27,6 +28,6 @@ newTalent{ info = function(self) return ([[Noxious fumes raises from the ground doing %0.2f nature damage in a radius of 3 each turns for %d turns. Cooldown: 8 turns - The damage and duration will increase with the Magic stat]]):format(4 + self:combatSpellpower(0.3), 5 + self:combatSpellpower(0.1)) + The damage and duration will increase with the Magic stat]]):format(4 + self:combatSpellpower(0.6), 5 + self:combatSpellpower(0.1)) end, } diff --git a/game/modules/tome/data/talents/spells/arcane.lua b/game/modules/tome/data/talents/spells/arcane.lua index f03b6cde58..8730e07340 100644 --- a/game/modules/tome/data/talents/spells/arcane.lua +++ b/game/modules/tome/data/talents/spells/arcane.lua @@ -11,13 +11,13 @@ newTalent{ if self:knowTalent(Talents.T_ARCANE_LANCE) then t.type = "beam" end local x, y = self:getTarget(t) if not x or not y then return nil end - self:project(t, x, y, DamageType.ARCANE, self:spellCrit(10 + self:combatSpellpower())) + self:project(t, x, y, DamageType.ARCANE, self:spellCrit(10 + self:combatSpellpower(2))) return true end, require = { stat = { mag=10 }, }, info = function(self) return ([[Conjures up mana into a powerful bolt doing %0.2f arcane damage - The damage will increase with the Magic stat]]):format(10 + self:combatSpellpower()) + The damage will increase with the Magic stat]]):format(10 + self:combatSpellpower(2)) end, } newTalent{ diff --git a/game/modules/tome/data/talents/spells/earth.lua b/game/modules/tome/data/talents/spells/earth.lua index 632860a3be..e8e835b63a 100644 --- a/game/modules/tome/data/talents/spells/earth.lua +++ b/game/modules/tome/data/talents/spells/earth.lua @@ -34,12 +34,12 @@ newTalent{ local t = {type="bolt", range=20} local x, y = self:getTarget(t) if not x or not y then return nil end - self:project(t, x, y, DamageType.SPELLKNOCKBACK, self:spellCrit(8 + self:combatSpellpower(0.3))) + self:project(t, x, y, DamageType.SPELLKNOCKBACK, self:spellCrit(8 + self:combatSpellpower(0.6))) return true end, require = { stat = { mag=24 }, level=5 }, info = function(self) - return ([[Conjures up a fist of stone doing %0.2f physical damage in a radius of %d. - The damage will increase with the Magic stat]]):format(8 + self:combatSpellpower(0.7), math.min(6, 3 + self:combatSpellpower(0.06))) + return ([[Conjures up a fist of stone doing %0.2f physical damage and knocking the target back. + The damage will increase with the Magic stat]]):format(8 + self:combatSpellpower(0.6)) end, } diff --git a/game/modules/tome/data/talents/spells/fire.lua b/game/modules/tome/data/talents/spells/fire.lua index fd98eb6455..da376bfbcf 100644 --- a/game/modules/tome/data/talents/spells/fire.lua +++ b/game/modules/tome/data/talents/spells/fire.lua @@ -42,13 +42,13 @@ newTalent{ local t = {type="bolt", range=20} local x, y = self:getTarget(t) if not x or not y then return nil end - self:project(t, x, y, DamageType.FIREBURN, self:spellCrit(15 + self:combatSpellpower())) + self:project(t, x, y, DamageType.FIREBURN, self:spellCrit(15 + self:combatSpellpower(2.1))) return true end, require = { stat = { mag=10 }, }, info = function(self) return ([[Conjures up a bolt of fire setting the target ablaze and doing %0.2f fire damage over 3 turns. - The damage will increase with the Magic stat]]):format(15 + self:combatSpellpower()) + The damage will increase with the Magic stat]]):format(15 + self:combatSpellpower(2.1)) end, } @@ -64,13 +64,13 @@ newTalent{ local t = {type="ball", range=15, radius=math.min(6, 3 + self:combatSpellpower(0.06))} local x, y = self:getTarget(t) if not x or not y then return nil end - self:project(t, x, y, DamageType.FIRE, self:spellCrit(28 + self:combatSpellpower(0.7))) + self:project(t, x, y, DamageType.FIRE, self:spellCrit(28 + self:combatSpellpower(1.2))) return true end, require = { stat = { mag=24 }, level=5, }, info = function(self) return ([[Conjures up a flash of fire doing %0.2f fire damage in a radius of %d. - The damage will increase with the Magic stat]]):format(8 + self:combatSpellpower(0.7), math.min(6, 3 + self:combatSpellpower(0.06))) + The damage will increase with the Magic stat]]):format(28 + self:combatSpellpower(1.2), math.min(6, 3 + self:combatSpellpower(0.06))) end, } @@ -85,7 +85,7 @@ newTalent{ action = function(self) local duration = 5 + self:combatSpellpower(0.25) local radius = 5 - local dam = 15 + self:combatSpellpower(0.25) + local dam = 15 + self:combatSpellpower(1.6) local t = {type="ball", range=20, radius=radius} local x, y = self:getTarget(t) if not x or not y then return nil end @@ -104,6 +104,6 @@ newTalent{ info = function(self) return ([[Raging flames burn foes and allies alike doing %0.2f netherflame damage in a radius of 5 each turns for %d turns. Cooldown: 8 turns - The damage and duration will increase with the Magic stat]]):format(15 + self:combatSpellpower(0.25), 5 + self:combatSpellpower(0.25)) + The damage and duration will increase with the Magic stat]]):format(15 + self:combatSpellpower(1.6), 5 + self:combatSpellpower(0.25)) end, } diff --git a/game/modules/tome/data/talents/spells/water.lua b/game/modules/tome/data/talents/spells/water.lua index 94a2da14c5..54b4724cf5 100644 --- a/game/modules/tome/data/talents/spells/water.lua +++ b/game/modules/tome/data/talents/spells/water.lua @@ -24,14 +24,14 @@ newTalent{ local t = {type="hit", range=20} local x, y = self:getTarget(t) if not x or not y then return nil end - self:project(t, x, y, DamageType.COLD, self:spellCrit(7 + self:combatSpellpower(0.7))) + self:project(t, x, y, DamageType.COLD, self:spellCrit(7 + self:combatSpellpower(1.2))) self:project(t, x, y, DamageType.FREEZE, 2) return true end, require = { stat = { mag=14 }, }, info = function(self) return ([[Condenses ambiant water on a target, freezing it for a short while. - The damage will increase with the Magic stat]]):format(7 + self:combatSpellpower(0.7)) + The damage will increase with the Magic stat]]):format(7 + self:combatSpellpower(1.2)) end, } @@ -46,7 +46,7 @@ newTalent{ action = function(self) local duration = 5 + self:combatSpellpower(0.05) local radius = 1 - local dam = 1--12 + self:combatSpellpower(0.20) + local dam = 12 + self:combatSpellpower(0.5) -- Add a lasting map effect game.level.map:addEffect(self, self.x, self.y, duration, @@ -64,7 +64,7 @@ newTalent{ require = { stat = { mag=34 }, level=25 }, info = function(self) return ([[A furious ice storm rages around the caster doing %0.2f cold damage in a radius of 3 each turns for %d turns. - The damage and duration will increase with the Magic stat]]):format(12 + self:combatSpellpower(0.20), 5 + self:combatSpellpower(0.25)) + The damage and duration will increase with the Magic stat]]):format(12 + self:combatSpellpower(0.5), 5 + self:combatSpellpower(0.05)) end, } @@ -79,7 +79,7 @@ newTalent{ action = function(self) local duration = 5 + self:combatSpellpower(0.25) local radius = 3 - local dam = 12 + self:combatSpellpower(0.20) + local dam = 12 + self:combatSpellpower(0.8) -- Add a lasting map effect game.level.map:addEffect(self, self.x, self.y, duration, @@ -98,6 +98,6 @@ newTalent{ require = { stat = { mag=34 }, level=25 }, info = function(self) return ([[A furious ice storm rages around the caster doing %0.2f cold damage in a radius of 3 each turns for %d turns. - The damage and duration will increase with the Magic stat]]):format(12 + self:combatSpellpower(0.20), 5 + self:combatSpellpower(0.25)) + The damage and duration will increase with the Magic stat]]):format(12 + self:combatSpellpower(0.8), 5 + self:combatSpellpower(0.25)) end, } diff --git a/game/modules/tome/data/zones/ancient_ruins/npcs.lua b/game/modules/tome/data/zones/ancient_ruins/npcs.lua index 0815638bf4..0e402a1f9f 100644 --- a/game/modules/tome/data/zones/ancient_ruins/npcs.lua +++ b/game/modules/tome/data/zones/ancient_ruins/npcs.lua @@ -2,7 +2,7 @@ newEntity{ group = "dragon", name = "dragon of death", display = "D", color_r=255, - level_range = {3, 10}, exp_worth = 100, + level_range = {3, 10}, exp_worth = 1, rarity = 4, autolevel = "warrior", ai = "simple", @@ -37,7 +37,7 @@ newEntity{ group = "icky things", name = "white icky", display = "i", color=colors.YELLOW, - level_range = {1, 7}, exp_worth = 100, + level_range = {1, 7}, exp_worth = 1, rarity = 1, autolevel = "warrior", ai = "simple", diff --git a/game/modules/tome/resolvers.lua b/game/modules/tome/resolvers.lua new file mode 100644 index 0000000000..24ae49a7fe --- /dev/null +++ b/game/modules/tome/resolvers.lua @@ -0,0 +1,8 @@ +--- Random bonus based on level +resolvers.current_level = 1 +function resolvers.mbonus(max) + return {__resolver="mbonus", max} +end +function resolvers.calc.mbonus(t) + return rng.mbonus(t[1], resolvers.current_level, 50) +end diff --git a/src/map.c b/src/map.c index 2e6c67020a..428e651a11 100644 --- a/src/map.c +++ b/src/map.c @@ -94,8 +94,8 @@ static int map_set_grid(lua_State *L) int x = luaL_checknumber(L, 2); int y = luaL_checknumber(L, 3); GLuint *t = lua_isnil(L, 4) ? NULL : (GLuint*)auxiliar_checkclass(L, "gl{texture}", 4); - GLuint *a = lua_isnil(L, 5) ? NULL : (GLuint*)auxiliar_checkclass(L, "gl{texture}", 5); - GLuint *o = lua_isnil(L, 6) ? NULL : (GLuint*)auxiliar_checkclass(L, "gl{texture}", 6); + GLuint *o = lua_isnil(L, 5) ? NULL : (GLuint*)auxiliar_checkclass(L, "gl{texture}", 5); + GLuint *a = lua_isnil(L, 6) ? NULL : (GLuint*)auxiliar_checkclass(L, "gl{texture}", 6); map->grids_terrain[x][y] = t ? *t : 0; map->grids_actor[x][y] = a ? *a : 0; -- GitLab