/*
This Script is Copyright by Tub (spam@authmann.de).

see index.html for full copyright information.
*/

var skillnames_1A9 = new Array();
skillnames_1A9[1] = new Array("", // Amazon
"Ghost Arrow",
"Barrage",
"Phalanx",
"Trinity",
"Dragon Force",
"Triumphant Strike",
"Prowl",
"Pounce",
"Lioness",
"Lightswarm",
"Starstreak",
"Ricochet",
"Enfilade",
"Moon Warrior",
"Fairy Ring",
"Death Ray",
"Bloodlust",
"Bloodstorm",
"Bacchanalia",
"Magic Missiles",
"Defensive Harmony",
"Blood Elementals",
"Balance",
"Pact of Blood",
"Wings of Wrath",
"Curare",
"Paragon",
"Spirit of Vengeance",
"Leadership",
"War Spirit"
);

skillnames_1A9[2] = new Array("", // Assassin
"Batstrike",
"Crucify",
"Queen of Blades",
"Hades Gate",
"Doom",
"Way of the Spider",
"Shadow Refuge",
"Black Lotus Strike",
"Death Blossom",
"Way of the Phoenix",
"Scorpion Blade",
"Storm Crows",
"Wychwind",
"Rocket Blade",
"Broadside",
"Seal of Fire",
"Rune of Ice",
"Nova Bomb",
"Immolation Bomb",
"Singularity",
"Blink",
"Starburst",
"Premeditation",
"Rain of Bombs",
"Perfect Being",
"Beacon",
"Way of the Gryphon",
"Phase Bomb",
"Vampiric Icon",
"Way of the Raven"
);

skillnames_1A9[3] = new Array("", // Barbarian
"Titan Strike",
"Blood Hatred",
"Thunder Slam",
"Shower of Rocks",
"Stormblast",
"Bear Claw",
"Stampede",
"Rebound",
"Screaming Eagle",
"Hawk Talons",
"Guardian Spirit",
"Defender Spirit",
"Protector Spirit",
"Greater Manifestations",
"Shamans Path",
"Ancient Blood",
"Lion Stance",
"Snake Stance",
"Bear Stance",
"Eagle Stance",
"Wolf Companion",
"Predator",
"Fortress",
"Spirit Guide",
"Mountain King",
"Kraken Stance",
"Runemaster",
"Shamanic Trance",
"Wolf Stance",
"Thundergod"
);

skillnames_1A9[4] = new Array("", // Druid
"Charm",
"Call Leprechaun",
"Havoc",
"Dominate",
"Elvensong",
"Mark of the Wild",
"Killer Instinct",
"Culling of the Herd",
"Brambles",
"Thrill of the Hunt",
"Elemental",
"Hunting Banshee",
"Pagan Rites",
"Fire Fountain",
"Hailstorm",
"Poison Flash",
"Circle of Life",
"Plague Avatar",
"Gamma Field",
"Summon Acid Fiends",
"Blindside",
"Cascade",
"Spore Shot",
"Elfin Arrows",
"Nova Shot",
"Force of Nature",
"Faerie Fire",
"Tremor",
"Goodberry",
"Lifeshield"
);

skillnames_1A9[5] = new Array("", // Necromancer
"Deaths Fury Totem",
"Blood Tide Totem",
"Mana Tide Totem",
"Elemental Totem",
"Howling Totem",
"Totemic Mastery",
"Frostclaw Totem",
"Fireheart Totem",
"Exploding Totem",
"Stormeye Totem",
"Buckshot",
"Angel of Death",
"Widowmaker",
"Soulshatter",
"Deathstrike",
"Unholy Armor",
"Sacrifices",
"Famine",
"Bend The Shadows",
"Talons Hold",
"Summon Shadows",
"Summon Darklings",
"Summon Rampagor",
"Summon Lamia",
"Summon Void Archon",
"Summon Jinn",
"Rathmas Chosen",
"Death Ward",
"Unholy Prayer",
"Liche Form"
);

skillnames_1A9[6] = new Array("", // Paladin
"Retaliate",
"Holy Insanity",
"Edict of Forbiddance",
"Lionheart",
"Blessed Life",
"Searing Glow",
"Ring of Light",
"Holy Trap",
"Wrath",
"Vindicate",
"Terror Strike",
"Black Sleep",
"Lemures",
"Blood Thorns",
"Shadowfiends",
"Tainted Blood",
"Mind Flay",
"Punisher",
"Slayer",
"Dark King",
"Vessel of Judgement",
"Rapture",
"Light and Shadow",
"Holy Armor",
"Hymn",
"Resurrect",
"Superbeast",
"Plague",
"Divine Apparition",
"Scourge"
);

skillnames_1A9[7] = new Array("", // Sorceress
"Flamefront",
"Fear of Fire",
"Flamestrike",
"Pyroblast",
"Illumination",
"Ice Lance",
"Shatter the Flesh",
"Frigid Sphere",
"Abyss",
"Summon Ice Elementals",
"Forked Lightning",
"Thunderstone",
"Lightning Cascade",
"Warp Armor",
"Nova Charge",
"Diseased Cattle",
"Lorenado",
"Hex",
"Carpet of Spiders",
"Hive",
"Moonstrike",
"Wiccaning",
"Arcane Torrent",
"Mana Sweep",
"Spiral Dance",
"Time Field",
"Full Force",
"Bladestorm",
"Symbol of Esu",
"Arcane Fury"
);

function check_constraints_1A9()
{
	if (classnr == 1) // Amazon
	{
		// 2 Spear skills add to lioness
		raiseMax(9, Math.floor((slvl[6] + slvl[7] + slvl[8] + slvl[10]) / 2));
		// 100 Energy to the blood skills
		add = Math.floor(energy / 100);
		raiseMax(16, add);
		raiseMax(18, add);
		raiseMax(20, add);
		// Devotion skills
		if (slvl[4] > 0) // Trinity
		{
			lockout(6, 20);
		}
		if (slvl[9] > 0) // Lioness
		{
			lockout(1, 5);
			lockout(11, 20);
		}
		if (slvl[14] > 0) // Moon Warrior
		{
			lockout(1, 10);
			lockout(16, 20);
		}
		if (slvl[19] > 0) // Bacchanalia
		{
			lockout(1, 15);
		}
		// regular skills lock out devotion
		for (var i=1;i<=3;i++)
			if (slvl[i] > 0)
			{
				lockout(9);lockout(14);lockout(19);
			}
		for (var i=6;i<=8;i++)
			if (slvl[i] > 0)
			{
				lockout(4);lockout(14);lockout(19);
			}
		for (var i=11;i<=13;i++)
			if (slvl[i] > 0)
			{
				lockout(4);lockout(9);lockout(19);
			}
		for (var i=16;i<=18;i++)
			if (slvl[i] > 0)
			{
				lockout(4);lockout(9);lockout(14);
			}
		return;
	}

	if (classnr == 3) // Barbarian
	{
		// Ancient Blood to all skills
		if (slvl[16] > 0)
			slvlskillbonus += Math.floor(slvl[16] / 4) + 1;
		// Shamanic Trance to the Spirits
		if (slvl[28] > 0)
		{
			var add = Math.floor(slvl[28] / 2);
			raiseMax(11, add);
			raiseMax(12, add);
			raiseMax(13, add);
		}
		return;
	}
	
	if (classnr == 4) // Druid
	{
		// the Druid's bow skills to Elfin Arrows
		raiseMax(24, Math.floor((slvl[21] + slvl[22] + slvl[23] + slvl[25]) / 2));
		return;
	}

	if (classnr == 5) // Necromancer
	{
		// offensive totems
		raiseMax(7, Math.floor(slvl[8]/2));
		raiseMax(8, Math.floor(slvl[10]/2));
		raiseMax(10, Math.floor(slvl[7]/2));
		return;
	}
	
	if (classnr == 6) // Paladin
	{
		// 2 Retaliate/Edict of Forbiddance to Blessed Life/Lionheart
		var add = Math.floor(slvl[1]/2) + Math.floor(slvl[3] / 2);
		raiseMax(4, add);
		raiseMax(5, add);
		// 2 Light and Shadow to Scourge
		raiseMax(30, Math.floor(slvl[23] / 2));
		// holy/unholy lockouts
		var holy = new Array(1,2,3,4,5,6,7,8,9,10,26);
		var unholy = new Array(11,12,13,14,15,16,17,18,19,20,27);
		var has_holy = false;
		var has_unholy = false;
		// resurrect and superbeast do not unlock Light and Shadow -> check them later
		for (var i=0;i<holy.length-1;i++)
			if (slvl[holy[i]] > 0)
				has_holy = true;
		for (var i=0;i<unholy.length-1;i++)
			if (slvl[unholy[i]] > 0)
				has_unholy = true;
		if (!has_unholy && !has_holy)
			lockout(23); // Light and Shadow
		has_holy = has_holy || (slvl[ holy[holy.length-1] ] > 0);
		has_unholy = has_unholy || (slvl[ unholy[unholy.length-1] ] > 0);
		if (has_unholy)
			for (var i=0;i<holy.length;i++)
				lockout(holy[i]);
		if (has_holy)
			for (var i=0;i<unholy.length;i++)
				lockout(unholy[i]);
		return;
	}

	if (classnr == 7) // Sorceress
	{
		// Wiccanning to all skills
		if (slvl[22] > 0)
			slvlskillbonus += Math.floor(slvl[22] / 4) + 1;
		// max two Elements
		var numElement = 0;
		for (var i=0;i<4;i++)
			for (var s=0;s<5;s++)
				if (slvl[ i*5+s+1 ] > 0)
				{
					numElement++;
					break;
				}
		if (numElement >= 2)
		{
			var ElementsUsed = 0;
			for (var i=0;i<4;i++)
			{
				var thisUsed = false;
				for (var s=0;s<5;s++)
				{
					if (slvl[ i*5+s+1 ] > 0)
					{
						thisUsed++;
						break;
					}
				}
				if (!thisUsed || ElementsUsed >= 2)
					lockout(i*5+1, i*5+5);
				else if (thisUsed)
					ElementsUsed++;
			}
		}
		return;
	}
}
