sorcery  resonance.lua at [032f54d1d5]

File data/resonance.lua artifact a891ed08b5 part of check-in 032f54d1d5


-- resonance is a mechanic whereby items which 'resonate' can be
-- transformed into each other by use of the divide/meld wands

local function
undersign(signs) return function(ctx)
	local stars = sorcery.calendar.stars(ctx.today);
	for _,s in pairs(signs) do
		if stars.sign.id == s then return true end
	end
	return false
end end

local function
undermoon(min,max) return function(ctx)
	local date = sorcery.calendar.date(ctx.today);
	return date.lunar_phase >= min and date.lunar_phase <= max
end end

-- TODO: add value annotations, make high spell power prefer items of higher value
return {
	divide = {
		-- remember to check for leftovers!
		['sorcery:flame_oil'] = {
			mode = 'random';
			give = {
				{value = 1, item = 'sorcery:ash'};
				{value = 2, item = 'sorcery:essence_flame'};
			};
		};
		['bucket:bucket_lava'] = {
			mode = 'random';
			replacement = 'bucket:bucket_empty';
			give = {
				{value = 1, item = 'sorcery:essence_flame'};
				{value = 2, item = 'sorcery:powder_firestorm'};
			};
		};
		['sorcery:inferno_crystal'] = {
			mode = 'set';
			give = {
				'sorcery:essence_flame';
				'sorcery:essence_flame';
				'sorcery:gem_ruby';
			};
		};
		['default:mese_crystal'] = {
			mode = 'random';
			give = {
				{value = 1; item = 'default:mese_crystal_fragment'};
				{value = 2; item = 'sorcery:essence_force'};
			};
		};
	};

	meld = {
		{
			set = { 'sorcery:gem_ruby', 'sorcery:ingot_lithium', 'tnt:gunpowder' };
			restrict = undersign {'wyvern','wserpent'};
			results = { {value = 1, item = 'sorcery:inferno_crystal'} };
		};
		{
			set = {
				'default:snow', 'default:ice', {
					take = 'bucket:bucket_water';
					replacement = 'bucket:bucket_empty';
				};
			};
			results = { {value = 1, item = 'sorcery:essence_frost' } };
		};
		-- {
		-- 	set = { 'sorcery:essence_flame', 'sorcery:essence_frost', 'sorcery:essence_force' };
		-- 	restrict = undersign {'wolfprince'};
		-- 	results = (something very powerful?) "Elemental? Dynamo"
		-- };
	};
};