//=============================================================================
// Heinekens in cans, example
//=============================================================================

class Heineken extends Health;

#exec  TEXTURE IMPORT NAME=Jheineken1 FILE=\unreal-edit\heineken\heineken99.BMP GROUP="Skins" FLAGS=2

var() int HealingAmount;
var() bool bSuperHeal;

event float BotDesireability(Pawn Bot)
{
	local float desire;
	local int HealMax;

	HealMax = Bot.Default.Health;
	if (bSuperHeal) HealMax = HealMax * 2.0;
	desire = Min(HealingAmount, HealMax - Bot.Health);

	if ( (Bot.Weapon != None) && (Bot.Weapon.AIRating > 0.5) )
		desire *= 1.7;
	if ( Bot.Health < 40 )
		return ( FMin(0.03 * desire, 2.2) );
	else
		return ( FMin(0.015 * desire, 2.0) ); 
}

function PlayPickupMessage(Pawn Other)
{
	Other.ClientMessage(PickupMessage$HealingAmount, 'Pickup');
}

auto state Pickup
{	
	function Touch( actor Other )
	{
		local int HealMax;
		local Pawn P;
			
		if ( ValidTouch(Other) ) 
		{	
			P = Pawn(Other);	
			HealMax = P.default.health;
			if (bSuperHeal) HealMax = HealMax * 2.0;
			if (P.Health < HealMax) 
			{
				if (Level.Game.LocalLog != None)
					Level.Game.LocalLog.LogPickup(Self, P);
				if (Level.Game.WorldLog != None)
					Level.Game.WorldLog.LogPickup(Self, P);
				P.Health += HealingAmount;
				if (P.Health > HealMax) P.Health = HealMax;
				PlayPickupMessage(P);
				PlaySound (PickupSound,,2.5);
				if ( Level.Game.Difficulty > 1 )
					Other.MakeNoise(0.1 * Level.Game.Difficulty);		
				SetRespawn();
			}
		}
	}
}

defaultproperties
{
     HealingAmount=25
     PickupMessage="You drink a Heineken's +"
     RespawnTime=20.000000
     PickupViewMesh=LodMesh'UnrealShare.steelbarrelM'
     MaxDesireability=0.500000
     PickupSound=Sound'UnrealShare.Pickups.Health2'


     RemoteRole=ROLE_DumbProxy
	
     	Mesh=LodMesh'UnrealShare.steelbarrelM'
	
	MultiSkins(0)=Texture'Heineken.jHeineken1'

	DrawScale=0.25
	
	PickUpViewScale=0.25

     AmbientGlow=64
     CollisionRadius=22.000000
     CollisionHeight=8.000000
     Mass=10.000000
}
