@LabelIndex 140511
@StringIndex 18318
class 0 ai_event_xmas_santa_escape : default_npc {
parameter:
	int	START_DELAY = 15501;
	int	PHASE_SAY = 15502;
	int	PHASE_BUFF = 15503;
	int	PHASE_INVISIBLE = 15504;
	int	PHASE_DESPAWN = 15505;
	int	skill_XMAS_SANTA_REWARD = 401080321;
	int	debug_mode = 0;

handler:
	EventHandler CREATED() {
		myself::AddTimerEx(START_DELAY,( 3 * 1000 ));
	}

	EventHandler TIMER_FIRED_EX(timer_id) {
		if( timer_id == START_DELAY ) {
			myself::AddTimerEx(PHASE_SAY,( 2 * 1000 ));
		}
		if( timer_id == PHASE_SAY ) {
			myself::Shout(gg::MakeFString(1800738,"","","","",""));
			myself::AddEffectActionDesire(myself.sm,2,120,10000000);
			myself::AddTimerEx(PHASE_BUFF,( 5 * 1000 ));
		}
		if( timer_id == PHASE_BUFF ) {
			myself::AddUseSkillDesire(myself.sm,skill_XMAS_SANTA_REWARD,1,0,100000000);
			myself::AddTimerEx(PHASE_INVISIBLE,( 5 * 1000 ));
		}
		if( timer_id == PHASE_INVISIBLE ) {
			myself::SetVisible(0);
			if( myself::IsNullCreature(gg::GetCreatureFromIndex(myself.sm.param2)) == 0 ) {
				gg::SendScriptEvent(gg::GetCreatureFromIndex(myself.sm.param1),2008124,myself.sm.param2);
			} else {
				gg::SendScriptEvent(gg::GetCreatureFromIndex(myself.sm.param1),2008124,0);
			}
			myself::AddTimerEx(PHASE_DESPAWN,( 3 * 1000 ));
		}
		if( timer_id == PHASE_DESPAWN ) {
			myself::Despawn();
		}
	}

}
