Module:CryptogullJr/Data

From Caves of Qud Wiki
Jump to navigation Jump to search

local p = {}
local attrNames = {"Strength", "Agility", "Toughness", "Intelligence", "Willpower", "Ego"}
local subtypes = {
        --[The Toxic Arboreta of Ekuemekiyye, the Holy City]
        ['Horticulturist'] = { {0, 0, 0, 3, 0, 0}, "Harvestry, Axe Proficiency, Steady Hands, Draw a Bead, Wilderness Lore: Jungles", "Start with a bio-scanning bracelet, +2 bleed resist" },
        ['Priest of All Suns'] = { {0, 0, 0, 0, 0, 3}, "Cudgel Proficiency, Heal, Snake Oiler, Intimidate, Wilderness Lore: Jungles", "Start with a smiling sun mask, +2 bleed resist" },
        ['Priest of All Moons'] = { {0, 0, 2, 0, 2, 0}, "Axe Proficiency, Butchery, Lionheart, Poison Tolerance, Wilderness Lore: Jungles", "Start with a frowning moon mask, +2 bleed resist" },
        ['Syzygyrior'] = { {0, 3, 0, 0, 0, 0}, "Offhand Strikes, Ambidexterity, Wayfaring: Jungles", "" },
        --[he Ice-Sheathed Arcology of Ibul]
        ['Artifex'] = {{0, 0, 0, 3, 0, 0}, "Repair, Disassemble, Deploy Turret, Tinker I, Tinker II", "+15 cold resist" },
        ['Consul'] = {{0, 0, 0, 0, 0, 3}, "Inspiring Presence, Proselytize", "+15 cold resist" },
        ['Praetorian'] = {{2, 0, 1, 0, 1, 0}, "Long Blade Proficiency, Shield Slam, Steady Hands, Draw a Bead",  "+15 cold resist" },
        ['Eunuch'] = {{0, 2, 0, 2, 0, 0}, "Hobble, Weak Spotter, Spry, Hurdle", "+15 cold resist" },
        --[The Crustal Mortars of Yawningmoon]
        ['Child of the Hearth'] = {{3, 0, 0, 0, 0, 0}, "Slam, Calloused, Strapping Shoulders", "+15 heat resist" },
        ['Child of the Wheel'] = {{1, 2, 0, 0, 0, 1}, "Short Blades Proficiency, Cleave, Offhand Strikes, Iron Mind", "+15 heat resist" },
        ['Child of the Deep'] = {{0, 0, 3, 0, 0, 0}, "Tank, Strapping Shoulders, Shake It Off, Wilderness Lore: Mountains, Wilderness Lore: Canyons",  "+15 heat resist" },
        ['Fuming God-Child'] = {{0, 0, 0, 0, 4, 0}, "Fasting Way, Lionheart, Poison Tolerance, Intimidate","+15 heat resist" },
        --[Callings]
        ['Apostle'] = {{0, 0, 0, 0, 0, 2}, "Intimidate, Proselytize, Tactful", "" },
        ['Arconaut'] = {{0, 2, 0, 0, 0, 0}, "Short Blades Proficiency, Scavenger, Gadget Inspector, Spry", "Start with random junk and artifacts" },
        ['Greybeard'] = {{-1, 0, 0, 0, 3, 0}, "Cudgel Proficiency, Berate, Calloused", "Start with +100 bear reputation" },
        ['Gunslinger'] = {{0, 2, 0, 0, 0, 0}, "Weak Spotter", "Start with +200 reputation with mysterious strangers" },
        ['Marauder'] = {{2, 0, 0, 0, 0, 0}, "Dismember, Charge, Butchery", "" },
        ['Pilgrim'] = {{0, 0, 0, 0, 2, 0}, "Meditate, Fasting Way, Iron Mind, Mind's Compass","" },
        ['Nomad'] = {{0, 0, 2, 0, 0, 0}, "Mind's Compass, Wilderness Lore: Salt Pans, Harvestry, Weathered", "Starts with +200 Issachari reputation and a recycling suit" },
        ['Scholar'] = {{0, 0, 0, 2, 0, 0}, "Gadget Inspector, Heal, Harvestry, Hurdle, Tactful", "" },
        ['Tinker'] = {{0, 0, 0, 2, 0, 0}, "Gadget Inspector, Lay Mine, Disassemble, Repair, Tinker I","Begins with a number of random artifacts and scrap and +100 Barathrumites reputation" },
        ['Warden'] = {{2, 0, 0, 0, 0, 0}, "Long Blades Proficiency, Shield Slam, Steady Hands, Draw a Bead, Pistol Proficiency", "Starts with +300 Warden reputation" },
        ['Water Merchant'] = {{0, 0, 0, 0, 0, 2}, "Menacing Stare, Snake Oiler", "Starts with trade goods and a merchant's token" },
        ['Watervine Farmer'] = {{0, 0, 2, 0, 0, 0}, "Cooking and Gathering, Harvestry, Axe Proficiency, Wilderness Lore: Salt Marshes", "Starts with +100 reputation with the villagers of Joppa and a farmer's token" }
    }
local mutationBonus = {
	['Doubled-muscled'] = {2, 0, 0, 0, 0, 0},
	['Triple-jointed'] = {0, 2, 0, 0, 0, 0},
	['Two-hearted'] = {0, 0, 2, 0, 0, 0},
	['Beak'] = {0, 0, 0, 0, 0, 1},
	['No Cybernetic'] = {0, 0, 2, 0, 0, 0}
}

local defects = { "Amnesia", "Blinking Tic", "Dystechnia", "Evil Twin",
	"Narcolepsy", "Psionic Migraines", "Quantum Jitters", "Socially Repugnant",
	"Albino", "Amphibious", "Brittle Bones", "Carnivorous", "Cold Blooded",
	"Electromagnetic Impulse", "Hooks for Feet", "Irritable Genome", "Myopic",
	"Nerve Poppy", "Spontaneous Combustion", "Tonic Allergy"
}

function getAttributes(subtype)
	return subtypes[subtype][1]
end

function p.getSkills(subtype)
	return subtypes[subtype][2]
end

function p.getExtra(subtype)
	return subtypes[subtype][3]
end

function p.isDefect(mut)
	for i, v in ipairs(defects) do
		if mut == v then
			return true
		end
	end
	return false
end

function p.getTotalStatBonuses(subtype, exts)
	local bonuses = {
	}
	for i=1, 6 do
		bonuses[attrNames[i]] = getAttributes(subtype)[i]	
	end
	if #exts > 0 then
		for i=1, #exts do
			for j = 1, 6 do
				if mutationBonus[exts[i]] ~= nil then
				if mutationBonus[exts[i]][j] ~= 0 then
					bonuses[attrNames[j]] = bonuses[attrNames[j]] + mutationBonus[exts[i]][j]
				end
				end
			end
		end
	end
	return bonuses
end

--function p.test()
--	return p.getTotalStatBonuses("Greybeard", {"Two-hearted","Beak"})
--end

return p