class GiveRewardEffector extends Effector
{
	var m_reward : TweakDBID;
	var m_target : EntityID;

	protected export override function Initialize( record : TweakDBID, game : GameInstance, parentRecord : TweakDBID )
	{
		var str : String;
		str = TweakDBInterface.GetString( record + T".reward", "" );
		m_reward = TDBID.Create( str );
	}

	protected export override function Uninitialize( game : GameInstance ) {}

	private function ProcessAction( owner : GameObject )
	{
		GetApplicationTarget( owner, 'Target', m_target );
		if( EntityID.IsDefined( m_target ) )
		{
			RPGManager.GiveReward( owner.GetGame(), m_reward, m_target );
		}
		else
		{
			RPGManager.GiveReward( owner.GetGame(), m_reward );
		}
	}

	protected override function RepeatedAction( owner : GameObject )
	{
		ProcessAction( owner );
	}

	protected override function ActionOn( owner : GameObject )
	{
		ProcessAction( owner );
	}

	protected override function ActionOff( owner : GameObject ) {}
}

