Page 1 of 2

Moon and Star pairing

Posted: Fri Jan 07, 2011 5:35 am
by yufra
I know FinalMaster has been working on this for the past few days, and after a bit of poking and prodding I got this together. I don't know exactly what bonuses he wanted to add so I added lite (a total of 2), blind and 10% increased darkness damage to Moon, and confusion and 10% increased light damage to Star. If you want to tweak it change the activate_pair function. Cheers!

Code: Select all

local activate_pair = function(moon, star, who)
	local DamageType = require "engine.DamageType"
	moon.paired = {}
	star.paired = {}
	-- The Moon knife's bonuses
	moon.paired._special1 = {"lite", who:addTemporaryValue("lite", 1)}
	moon.paired._special2 = {"melee_project", who:addTemporaryValue("melee_project", {[DamageType.BLINDPHYSICAL]=2})}
	moon.paired._special3 = {"inc_damage", who:addTemporaryValue("inc_damage", {[DamageType.DARKNESS]=10}) }
	-- The Star knife's bonuses
	star.paired._special1 = {"lite", who:addTemporaryValue("lite", 1)}
	star.paired._special2 = {"melee_project", who:addTemporaryValue("melee_project", {[DamageType.CONFUSION]=25})}
	star.paired._special3 = {"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 bonuses
	for k, id in pairs(moon.paired) do
		if type(id) == "table" then
			who:removeTemporaryValue(id[1], id[2])
		else
			who:removeTemporaryValue(k, id)
		end
	end
	for k, id in pairs(star.paired) do
		if type(id) == "table" then
			who:removeTemporaryValue(id[1], id[2])
		else
			who:removeTemporaryValue(k, id)
		end
	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",
	unique = true,
	name = "Moon",
	define_as = "MOON",
	unided_name = "crescent blade",
	desc = [[A viciously curved blade that devours the light around it.]],
	level_range = {20, 30},
	rarity = 200,
	require = { stat = { dex=28, cun=20 }, },
	cost = 300,
	material_level = 3,
	combat = {
		dam = 24,
		apr = 15,
		physcrit = 5,
		dammod = {dex=0.45,str=0.45},
		melee_project={[DamageType.DARKNESS] = 20},
	},
	wielder = {
		lite = -1,
		inc_damage={
			[DamageType.DARKNESS] = 5,
		},
	},
	activate_pair = activate_pair,
	deactivate_pair = deactivate_pair,
	on_wear = function(self, who)
		-- Look for the Star knife
		local o, item, inven_id = who:findInAllInventoriesBy("define_as", "STAR")
		if o and who:getInven(inven_id).worn then
			self.activate_pair(self, o, who)
		end
	end,
	on_takeoff = function(self, who)
		if self.paired then
			local o, item, inven_id = who:findInAllInventoriesBy("define_as", "STAR")
			if o and who:getInven(inven_id).worn then
				self.deactivate_pair(self, o, who)
			end
		end
	end,
}

newEntity{ base = "BASE_KNIFE",
	unique = true,
	name = "Star",
	define_as = "STAR",
	unided_name = "jagged blade",
	desc = [[A bright blade with more teeth than the most savage troll.]],
	level_range = {20, 30},
	rarity = 200,
	require = { stat = { dex=20, cun=28 }, },
	cost = 300,
	material_level = 3,
	combat = {
		dam = 22,
		apr = 7,
		physcrit = 13,
		dammod = {dex=0.45,str=0.45},
		melee_project={[DamageType.LIGHT] = 20},
	},
	wielder = {
		lite = 1,
		inc_damage={
			[DamageType.LIGHT] = 5,
		},
	},
	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", "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", "MOON")
			if o and who:getInven(inven_id).worn then
				self.deactivate_pair(o, self, who)
			end
		end
	end,
}

Re: Moon and Star pairing

Posted: Fri Jan 07, 2011 8:38 am
by marchewka
Awww dammit, and my rogue wielding moon+star died yesterday...
(poked his nose into the crypt for the first time)

Re: Moon and Star pairing

Posted: Fri Jan 07, 2011 9:46 am
by coffee
I personally like much use double dagger style but I'm a bit disapointed since after add a lot of DEX stats and use good "unique" daggers like Moon/Star I still felt me like a bit underpowered so now I gave up and started to increase "STR" and use heavy weapons with good stats. At least STR can be used to inrease HP and carry more

Re: Moon and Star pairing

Posted: Fri Jan 07, 2011 1:47 pm
by Grey
yufra, just to check, does the getInven().worn function include checks of equipment in the swap slot?

Re: Moon and Star pairing

Posted: Fri Jan 07, 2011 4:16 pm
by yufra
marchewka and coffee: FinalMaster noted the same underwhelming nature of Moon and Star and set about pairing them, so be sure to thank him for the idea. :)

Grey: great suggestion! My first guess is yes it will (mistakenly) check the second set of weapons. I'll confirm and potentially fix this later. Cheers!

EDIT: I just checked and the secondary weapon slots are not marked as "worn", so the current code is fine in that regard.

Re: Moon and Star pairing

Posted: Fri Jan 07, 2011 4:32 pm
by coffee
yufra wrote:marchewka and coffee: FinalMaster noted the same underwhelming nature of Moon and Star and set about pairing them, so be sure to thank him for the idea. :)
I thank him right now, the Moon/Star set and usually Dex knive weapons are a lot underpowered. If daggers do less damage than any other weapons they have other compensations like extra stat features. Thanks for suggesting FinalMaster

BTW how about a summoner druid class wielding dual daggers/claws/sickes?

Re: Moon and Star pairing

Posted: Fri Jan 07, 2011 10:40 pm
by Final Master
This is what I have right now, but something is buggy. If I do a normal attack - then I only attack with my main hand. If I do an attack that is a talent, it only uses the off hand. Blind is happening but confuse isn't. The proper texts show in the character sheet and in the ingame log. All the numbers are correct. Talents that I attack with aren't going on cooldown though - like flurry, sweep, whirlwind.

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 = {"lite", who:addTemporaryValue("lite", 1)}
   moon.paired._special2 = {"melee_project", who:addTemporaryValue("melee_project", {[DamageType.CONFUSION]=25})}
   moon.paired._special3 = {"inc_damage", who:addTemporaryValue("inc_damage", {[DamageType.DARKNESS]=10}) }
   -- The Star knife's bonuses
   star.paired._special1 = {"lite", who:addTemporaryValue("lite", 1)}
   star.paired._special2 = {"melee_project", who:addTemporaryValue("melee_project", {[DamageType.BLINDPHYSICAL]=5})}
   star.paired._special3 = {"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 bonuses
   for k, id in pairs(moon.paired) do
      if type(id) == "table" then
         who:removeTemporaryValue(id[1], id[2])
      else
         who:removeTemporaryValue(k, id)
      end
   end
   for k, id in pairs(star.paired) do
      if type(id) == "table" then
         who:removeTemporaryValue(id[1], id[2])
      else
         who:removeTemporaryValue(k, id)
      end
   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",
   unique = true,
   name = "Moon",
   define_as = "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=20, cun=20 }, },
   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 Star knife
      local o, item, inven_id = who:findInAllInventoriesBy("define_as", "STAR")
      if o and who:getInven(inven_id).worn then
         self.activate_pair(self, o, who)
      end
   end,
   on_takeoff = function(self, who)
      if self.paired then
         local o, item, inven_id = who:findInAllInventoriesBy("define_as", "STAR")
         if o and who:getInven(inven_id).worn then
            self.deactivate_pair(self, o, who)
         end
      end
   end,
}

newEntity{ base = "BASE_KNIFE",
   unique = true,
   name = "Star",
   define_as = "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=20, cun=20 }, },
   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", "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", "MOON")
         if o and who:getInven(inven_id).worn then
            self.deactivate_pair(o, self, who)
         end
      end
   end,
}

Re: Moon and Star pairing

Posted: Fri Jan 07, 2011 11:34 pm
by yufra
There is a bug in the CONFUSION code, and I am also looking at changing some of the T-Engine code to allow the confuse and blind damage types to be easily added to the respective daggers instead of the actor as a whole. Currently if either paired knife hits the target will have to save against blinding, and I think it should be limited to one knife. I'll wait to see if the T-Engine code changes before fixing Moon/Star.

Re: Moon and Star pairing

Posted: Sat Jan 08, 2011 10:40 pm
by yufra
Depending on if my suggested refactor is accepted, this code will work below. Here the blind and confuse effects are moved to the specific weapons and will only fire if the specific weapon hits.

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.BLINDPHYSICAL]=2}})}
	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_CONFUSION]=2}})}
	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

Re: Moon and Star pairing

Posted: Sat Jan 08, 2011 11:19 pm
by Final Master
I hope your code changes get accepted into the engine as that will open up a lot more possibilities for more truly fun and unique egos/artifacts. Especially with the ability to create a 'set' such as Moon/Star, and others. Thank you so much for all your help yuf, along with Pap, edge, DG, Zonk and a few others that I cannot recall currently.

I really want to make Star/Moon the first paired artifacts so that others can create their own set ideas using code similar to this, instead of going through all the hassle like I have.

Thanks again to everyone, and PLEASE add yuf's code suggestions. If nothing else, it'll be cool!

Re: Moon and Star pairing

Posted: Thu Jan 27, 2011 2:03 pm
by Grey
I've found the pair with an Anorithil, and was very keen to try it out, but alas the dex requirement is too prohibitive... Perhaps if I find some good dex-pumping equipment I'll give them a go. However I still don't see them rivalling a really good staff.

Perhaps we need a Night Ranger of sorts - a rogueish class with some of the darkness divine skills.

Re: Moon and Star pairing

Posted: Thu Jan 27, 2011 5:08 pm
by Final Master
Anorthils only need Magic, Con and Cun - you can afford to drop 10 points or so into dex - they are very VERY worth it on an Anorthil.

Re: Moon and Star pairing

Posted: Thu Jan 27, 2011 7:21 pm
by Grey
I think they'll be more useful at high levels, so I'll hang on to them till then.

Re: Moon and Star pairing

Posted: Thu Jan 27, 2011 7:32 pm
by shwqa
Grey wrote:I've found the pair with an Anorithil, and was very keen to try it out, but alas the dex requirement is too prohibitive... Perhaps if I find some good dex-pumping equipment I'll give them a go. However I still don't see them rivalling a really good staff.

Perhaps we need a Night Ranger of sorts - a rogueish class with some of the darkness divine skills.

This is a bit off topic but I'm still on the stance that the toles top staff (which is one handed) + lunar shield is the best combo for Anorithil. My Anorithil had it but it needs 35 strength and magic to pull off.

Re: Moon and Star pairing

Posted: Thu Jan 27, 2011 7:55 pm
by Grey
Looking at your char sheet.... yes, absolutely. Nothing else can compete with that.