Code: Select all
-- The Twin blades Moon and Star
local activate_pair = function(moon, star, who)
local DamageType = require "engine.DamageType"
moon.paired = {}
star.paired = {}
-- The Moon knife's bonuses
moon.paired._special1 = {who, "lite", who:addTemporaryValue("lite", 1)}
moon.paired._special2 = {moon, "combat", moon:addTemporaryValue("combat", {melee_project={[DamageType.RANDOM_CONFUSION]=3}})}
moon.paired._special3 = {who, {"inc_damage", DamageType.DARKNESS}, who:addTemporaryValue({"inc_damage", DamageType.DARKNESS}, 10)}
-- The Star knife's bonuses
star.paired._special1 = {who, "lite", who:addTemporaryValue("lite", 1)}
star.paired._special2 = {star, "combat", star:addTemporaryValue("combat", {melee_project={[DamageType.RANDOM_BLINDPHYSICAL]=3}})}
star.paired._special3 = {who, "inc_damage", who:addTemporaryValue("inc_damage", {[DamageType.LIGHT]=10}) }
game.log("The two blades glow brightly as they are brought close together.")
end
local deactivate_pair = function(moon, star, who)
-- Remove the paired bonusese
for k, id in pairs(moon.paired) do
id[1]:removeTemporaryValue(id[2], id[3])
end
for k, id in pairs(star.paired) do
id[1]:removeTemporaryValue(id[2], id[3])
end
moon.paired = nil
star.paired = nil
game.log("The light from the two blades fades as they are separated.")
end
newEntity{ base = "BASE_KNIFE", define_as = "ART_PAIR_MOON",
unique = true,
name = "Moon",
unided_name = "crescent blade",
desc = [[A viciously curved blade that a folk story says is made from a material that originates from the moon. Devouring the light abound, it fades.]],
level_range = {20, 30},
rarity = 200,
require = { stat = { dex=24, cun=24 }, },
cost = 300,
material_level = 3,
combat = {
dam = 30,
apr = 30,
physcrit = 10,
dammod = {dex=0.45,cun=0.45},
melee_project={[DamageType.DARKNESS] = 20},
},
wielder = {
lite = -1,
inc_damage={
[DamageType.DARKNESS] = 10,
},
},
activate_pair = activate_pair,
deactivate_pair = deactivate_pair,
on_wear = function(self, who)
-- Look for the Moon knife
local o, item, inven_id = who:findInAllInventoriesBy("define_as", "ART_PAIR_STAR")
if o and who:getInven(inven_id).worn then
self.activate_pair(o, self, who)
end
end,
on_takeoff = function(self, who)
if self.paired then
local o, item, inven_id = who:findInAllInventoriesBy("define_as", "ART_PAIR_STAR")
if o and who:getInven(inven_id).worn then
self.deactivate_pair(o, self, who)
end
end
end,
}
newEntity{ base = "BASE_KNIFE", define_as = "ART_PAIR_STAR",
unique = true,
name = "Star",
unided_name = "jagged blade",
desc = [[Legend tells of a blade, shining bright as a star. Forged from a material fallen from the skies, it glows.]],
level_range = {20, 30},
rarity = 200,
require = { stat = { dex=24, cun=24 }, },
cost = 300,
material_level = 3,
combat = {
dam = 25,
apr = 20,
physcrit = 20,
dammod = {dex=0.45,cun=0.45},
melee_project={[DamageType.LIGHT] = 20},
},
wielder = {
lite = 1,
inc_damage={
[DamageType.LIGHT] = 10,
},
},
activate_pair = activate_pair,
deactivate_pair = deactivate_pair,
on_wear = function(self, who)
-- Look for the Moon knife
local o, item, inven_id = who:findInAllInventoriesBy("define_as", "ART_PAIR_MOON")
if o and who:getInven(inven_id).worn then
self.activate_pair(o, self, who)
end
end,
on_takeoff = function(self, who)
if self.paired then
local o, item, inven_id = who:findInAllInventoriesBy("define_as", "ART_PAIR_MOON")
if o and who:getInven(inven_id).worn then
self.deactivate_pair(o, self, who)
end
end
end,
}
Sorry for messing up, and thanks again for including them!
I'm unsure how to do that, but I do have an 'armor set' designed already, in fact the first piece of it is posted here. It will be a Massive Helmet, Massive Armor, Massive Boots and Massive Gloves [obviously this is for those that are heavy on str and defense minded] -Sirrocco wrote:I'd suggest that if you do include armor sets, you also include a bit of code to make them encourage themselves - ie, once you have one or two of a given set, getting the rest of that set becomes more likely (perhaps at the cost of items from other sets). That way, at the end of the game, you have two or three full or nearly full sets, rather than one or two items out of every set there is. You'd also be able to sell the items from sets you don't want in order to encourage the ones you do.
Thanks again DG
FM