Botpack
Class TournamentHealth

source: e:\games\UnrealTournament\Botpack\Classes\TournamentHealth.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Pickup
            |
            +--Botpack.TournamentHealth
Direct Known Subclasses:HealthPack, HealthVial, MedBox

class TournamentHealth
extends Engine.Pickup


Variables
 int HealingAmount
 bool bSuperHeal

States
Pickup

Function Summary
 void PlayPickupMessage(Pawn Other)


State Pickup Function Summary
 void Touch(Actor Other)



Source Code


00001	class TournamentHealth extends PickUp
00002		abstract;
00003	
00004	var() int HealingAmount;
00005	var() bool bSuperHeal;
00006	
00007	event float BotDesireability(Pawn Bot)
00008	{
00009		local float desire;
00010		local int HealMax;
00011	
00012		HealMax = Bot.Default.Health;
00013		if (bSuperHeal) HealMax = Min(199, HealMax * 2.0);
00014		desire = Min(HealingAmount, HealMax - Bot.Health);
00015	
00016		if ( (Bot.Weapon != None) && (Bot.Weapon.AIRating > 0.5) )
00017			desire *= 1.7;
00018		if ( Bot.Health < 45 )
00019			return ( FMin(0.03 * desire, 2.2) );
00020		else
00021		{
00022			if ( desire > 6 )
00023				desire = FMax(desire,25);
00024			return ( FMin(0.017 * desire, 2.0) ); 
00025		}
00026	}
00027	
00028	function PlayPickupMessage(Pawn Other)
00029	{
00030		Other.ReceiveLocalizedMessage( class'PickupMessageHealthPlus', 0, None, None, Self.Class );
00031	}
00032	
00033	auto state Pickup
00034	{	
00035		function Touch( actor Other )
00036		{
00037			local int HealMax;
00038			local Pawn P;
00039				
00040			if ( ValidTouch(Other) ) 
00041			{	
00042				P = Pawn(Other);	
00043				HealMax = P.default.health;
00044				if (bSuperHeal) HealMax = Min(199, HealMax * 2.0);
00045				if (P.Health < HealMax) 
00046				{
00047					if (Level.Game.LocalLog != None)
00048						Level.Game.LocalLog.LogPickup(Self, P);
00049					if (Level.Game.WorldLog != None)
00050						Level.Game.WorldLog.LogPickup(Self, P);
00051					P.Health += HealingAmount;
00052					if (P.Health > HealMax) P.Health = HealMax;
00053					PlayPickupMessage(P);
00054					PlaySound (PickupSound,,2.5);
00055					Other.MakeNoise(0.2);		
00056					SetRespawn();
00057				}
00058			}
00059		}
00060	}
00061	
00062	defaultproperties
00063	{
00064	     HealingAmount=20
00065	     PickupMessage="You picked up a Health Pack +"
00066	     RespawnTime=20.000000
00067	     MaxDesireability=0.500000
00068	     PickupSound=Sound'UnrealShare.Pickups.Health2'
00069	     Icon=Texture'UnrealShare.Icons.I_Health'
00070	     RemoteRole=ROLE_DumbProxy
00071	     AmbientGlow=64
00072	     CollisionRadius=22.000000
00073	     CollisionHeight=8.000000
00074	     Mass=10.000000
00075	}

End Source Code