// Handles Monster "Leveling".
// Worthless Bums 2012.


// Mounts the specified weapon sprite to a monster sprite.
function mountWeaponToMonster (%weaponImagemap, %monster)
{//echo("mountWeaponToMonster()");
	// Create the weapon static sprite to mount.
	%weaponSprite = new Sprite("WeaponSprite")
	{
		SceneLayer = 0;
		position = "-4000, -4000";
		scenegraph = levelSceneGraph;
		imagemap = %weaponImagemap;
		visible = true;
		size = "4 4";
	};
	addObjectToScene(%weaponSprite);
	
	// Mount the specified weapon to the specified monster.
	%mountForce = 50;
	//%weaponSprite.mount(%monster, 0.0, 0.0, %mountForce, true, true, true, true);
	
	// Assign weapon to monster.
	%monster.weapon = %weaponSprite;
	
	// Upgrade this monster's stats based on the new weapon.
	%monster.armorRating += 5;
	%monster.baseDamage += 15;
	%monster.attackModifier -= 5;
}
// Level up a Frost Troll and make it pick up an Ice Club!
function levelUpFrostTroll (%frostTroll)
{//echo("levelUpFrostTroll()");
	// Attach ice club to the frost troll.
	%weaponImagemap = "Ice_ClubImageMap";
	mountWeaponToMonster(%weaponImagemap, %frostTroll);
	
	// Inform the player of the willy new beast!
	updateEventText($monsterColor @ %frostTroll.name @ $hostileActionColor @ " picks up an Ice Club" @ $defaultColor @ "!");
}