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

see index.html for full copyright information.
*/

var skillnames_1F9 = new Array();
skillnames_1F9[1] = new Array("", // Amazon
"Ghost Arrow",
"Barrage",
"Phalanx",
"Trinity",
"Dragon Force",

"Moonbeam",
"Ricochet",
"Enfilade",
"Moon Warrior",
"Fairy Ring",

"Triumphant Strike",
"Prowl",
"Pounce",
"Lioness",
"Great Hunt",

"Magic Missiles",
"Balefire",
"Bloodstorm",
"Bacchanalia",
"Lava Pit",

"Defensive Harmony",
"Summon Fire Elementals",
"Balance",
"Pact of Blood",
"Wings of Wrath",

"Curare",
"Paragon",
"Spirit of Vengeance",
"Leadership",
"War Spirit"
);

skillnames_1F9[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",
"Maelstrom2",
"Broadside",

"Seal of Fire",
"Cryo Beam",
"Storm Cloud Sentry",
"Fireball Sentry",
"Singularity",

"Blink",
"Starburst",
"Premeditation",
"Psionic Storm",
"Perfect Being",

"Beacon",
"Way of the Gryphon",
"Phase Bomb",
"Vampiric Icon",
"Way of the Raven"
);

skillnames_1F9[3] = new Array("", // Barbarian
"Earthquake",
"Bloodhatred",
"Thunder Slam",
"Shower of Rocks",
"Stormblast",

"Bear Claw",
"Stampede",
"Rebound",
"Screaming Eagle",
"Overkill",

"Guardian Spirit",
"Defender Spirit",
"Protector Spirit",
"Greater Manifestations",
"Spirit Walk",

"Lion Stance",
"Snake Stance",
"Bear Stance",
"Eagle Stance",
"Wolf Stance",

"Wolf Companion",
"Ancient Blood",
"Fortress",
"Spirit Guide",
"Mountain King",

"Kraken Stance",
"Runemaster",
"Shamanic Trance",
"Immortal",
"Thundergod"
);

skillnames_1F9[4] = new Array("", // Druid
"Treewarden Form",
"Pummel",
"Circle of Life",
"Wildfire",
"Rampage",

"Trap Rat Form",
"Quill Storm",
"Egg Trap",
"Ferocity",
"Thorn Wall",

"Elemental",
"Hunting Banshee",
"Pagan Rites",
"Rain of Fire",
"Hailstorm",

"Poison Flash",
"Charm",
"Plague Avatar",
"Gamma Field",
"Summon Acid Fiends",

"Blindside",
"Cascade",
"Spore Shot",
"Elfin Weapons",
"Nova Shot",

"Force of Nature",
"Faerie Fire",
"Tremor",
"Goodberry",
"Lifeshield"
);

skillnames_1F9[5] = new Array("", // Necromancer
"Deaths Fury Totem",
"Frostclaw Totem",
"Fireheart Totem",
"Howling Totem",
"Stormeye Totem",

"Embalming",
"Sacrifices",
"Bend the Shadows",
"Oathbreaker Totem",
"Talons Hold",

"Massacre",
"Angel of Death",
"Famine",
"Parasite",
"Deathlord",

"Buckshot",
"Flametail Shot",
"Dragonfire Oil",
"Fragmentation Shot",
"Widowmaker",

"Summon Shadows",
"Summon Rampagor",
"Summon Lamia",
"Summon Veil King",
"Summon Void Archon",

"Summon Jinn",
"Rathmas Chosen",
"Death Ward",
"Unholy Prayer",
"Liche Form"
);

skillnames_1F9[6] = new Array("", // Paladin
"Retaliate",
"Hammerstrike",
"Merkabah",
"Lionheart",
"Blessed Life",
"Searing Glow",
"Ring of Light",
"Brimstone",
"Wrath",
"Rising Dawn",

"Terror Strike",
"Black Sleep",
"Lemures",
"Blood Thorns",
"Shadowfiends",
"Tainted Blood",
"Mind Flay",
"Punisher",
"Slayer",
"Dark King",

"Vessel of Judgement",
"Rapture",
"Light and Shadow",
"Sacred  Armor",
"Hymn",
"Resurrect",
"Superbeast",
"Plague",
"Divine Apparition",
"Scourge"
);

skillnames_1F9[7] = new Array("", // Sorceress
"Flamefront",
"Living Flame",
"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",
"Bladestorm",

"Time Field",
"Mystic Blood",
"Baneblade",
"Symbol of Esu",
"Arcane Fury"
);



function check_constraints_1F9()
{
	if (classnr == 1) // Amazon
	{
		// 2 Spear skills add to Lioness
		raiseMax(14, Math.floor((slvl[11] + slvl[12] + slvl[13] + slvl[15]) / 2));
		// Devotion skills
		if (slvl[4] > 0) // Trinity
		{
			lockout(6, 20);
		}
		if (slvl[9] > 0) // Moon Warrior
		{
			lockout(1, 5);
			lockout(11, 20);
		}
		if (slvl[14] > 0) // Lioness
		{
			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[22] > 0)
			slvlskillbonus += Math.floor(slvl[22] / 4) + 1;
		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(2, Math.floor(slvl[3]/2)); // Fireheart to Frostclaw
		raiseMax(3, Math.floor(slvl[5]/2)); // Stormeye to Fireheart
		raiseMax(5, Math.floor(slvl[2]/2)); // Frostclaw to Stormeye
		return;
	}
	
	if (classnr == 6) // Paladin
	{
		// 2 Retaliate/Merkabah 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;
	}
}
