// 抉择
ZMJAI_OnEvent(int zmjEvt)
{
	//Say(1, "Recv event : ", zmjEvt);
	return zmjEvt-0;
}
#include "..\PScriptLib\zmjeve.pst"
#include "..\PScriptLib\zmjcfg.pst"

int Rule = 1;
int RoundTime = 900;
int PlayerSpawn = 0;
int PlayerSpawnDir = 180;
int PlayerWeapon 	= 0;
int PlayerHP 		= 3000;

int partner;
int counter=0;
int timer=2;
int pw=0;
int nw;
int switch=0;
int npchp;
int npcchp;
int n=0;
int damage;
OnUpdate()
{
	LoadplayerWeapon();
	LoadnpcWeapon();
	int evt = ZMJAI_OnHandler();
        int c1=GetChar("陪练");
        int ca1=GetAnyChar("陪练");
	int player = GetAnyChar("player");
	if (player < 0)
	{
		return 0;
	}
	/*if((GetHP(player)<=0||GetHP(c1)<=0)&&counter>=5)
	{GameOver(-1);}*/
	if(evt>=9001&&pw==0)
	{
		int key = evt-9000;
		if(key == 1&&switch==0)	
		{
                        ZMJAI_SwitchWeapon(5);
			Say(player, "你选择使用匕首");
			evt =0;
                        switch++;
                        return 0;
		}
		if(key == 2&&switch==0)	
		{
                        ZMJAI_SwitchWeapon(6);
			PlayerPerform("say", "你选择使用剑");
			evt =0;
                        switch++;
                        return 0;
		}
		if(key == 3&&switch==0)	
		{
                        ZMJAI_SwitchWeapon(7);
			PlayerPerform("say", "你选择使用枪");
			evt =0;
                        switch++;
                        return 0;
		}
		if(key == 4&&switch==0)	
		{
                        ZMJAI_SwitchWeapon(8);
			PlayerPerform("say", "你选择使用刀");
			evt =0;
                        switch++;
                        return 0;
		}
		if(key == 5&&switch==0)	
		{
                        ZMJAI_SwitchWeapon(9);
			PlayerPerform("say", "你选择使用锤");
			evt =0;
                        switch++;
                        return 0;
		}
		if(key == 6&&switch==0)	
		{
                        ZMJAI_SwitchWeapon(47);
			PlayerPerform("say", "你选择使用乾坤刀");
			evt =0;
                        switch++;
                        return 0;
		}
		if(key == 7&&switch==0)	
		{
                        ZMJAI_SwitchWeapon(51);
			PlayerPerform("say", "你选择使用指虎");
			evt =0;
                        switch++;
                        return 0;
		}
		if(key == 8&&switch==0)	
		{
                        ZMJAI_SwitchWeapon(55);
			PlayerPerform("say", "你选择使用忍刀");
			evt =0;
                        switch++;
                        return 0;
		}
		if(key == 9&&switch==0)	
		{
                        ZMJAI_SwitchWeapon(4);
			PlayerPerform("say", "你选择使用双刺");
			evt =0;
                        switch++;
                        return 0;
		}
		if(key == 1&&switch==3)	
		{
			PlayerPerform("say", "你的陪练使用匕首");
                        switch++;
                        return 0;
		}
		if(key == 2&&switch==3)	
		{
			PlayerPerform("say", "你的陪练使用剑");
                        switch++;
                        return 0;
		}
		if(key == 3&&switch==3)	
		{
			PlayerPerform("say", "你的陪练使用枪");
                        switch++;
                        return 0;
		}
		if(key == 4&&switch==3)	
		{
			PlayerPerform("say", "你的陪练使用刀");
                        switch++;
                        return 0;
		}
		if(key == 5&&switch==3)	
		{
			PlayerPerform("say", "你的陪练使用锤");
                        switch++;
                        return 0;
		}
		if(key == 6&&switch==3)	
		{
			PlayerPerform("say", "你的陪练使用乾坤刀");
                        switch++;
                        return 0;
		}
		if(key == 7&&switch==3)	
		{
			PlayerPerform("say", "你的陪练使用指虎");
                        switch++;
                        return 0;
		}
		if(key == 8&&switch==3)	
		{
			PlayerPerform("say", "你的陪练使用忍刀");
                        switch++;
                        return 0;
		}
		if(key == 9&&switch==3)	
		{
			PlayerPerform("say", "你的陪练使用双刺");
                        switch++;
                        return 0;
		}
	}
	if(counter==0&&GetGameTime()>timer)
	{
		evt = 0;
		PlayerPerform("say"," 1匕首；2剑；3枪；4刀；5锤；6乾坤刀；7指虎；8忍刀；9双刺。");
		PlayerPerform("pause",4);
		PlayerPerform("say"," 好了，接下来就进入单挑环节，所谓工欲善其事必先利其器，首先选择自己的武器吧，按大键盘上的“1-9”来选择吧。");
		PlayerPerform("pause",4);
		PlayerPerform("say"," 最后就是不允许用暗器，这会被视为不尊重对手，如果遇到暴躁老哥，对线都是轻的，当然还有其他注意事项，详情参看目录下的“”。");
		PlayerPerform("pause",4);
		PlayerPerform("say"," 然后就是单挑的时候不允许作弊，任何修改器，无限气等指令和改pose都是不允许的，对战中只允许使用换武器指令。");
		PlayerPerform("pause",4);
		PlayerPerform("say"," 其次就是单挑的时候不允许双绝，也就是说一局之内不允许使用两次大绝。");
		PlayerPerform("pause",4);
		PlayerPerform("say"," 首先就是单挑的时候不允许吃任何道具，也不允许双武器，双方都用中庸属性武器。");
		PlayerPerform("pause",4);
		PlayerPerform("say"," 既然如此我们当然要遵守咯，毕竟无规矩不成方圆对吧？");
		PlayerPerform("pause",4);
		PlayerPerform("say"," 说到规则，其实也都是老一辈玩家们默认的通识。");
		PlayerPerform("pause",4);
		PlayerPerform("say"," 欢迎来到流星单挑训练营，这里将让你熟悉流星单挑基本规则与基本操作。");
		counter++;
		timer=GetGameTime()+35;
	}
	if(counter==1&&GetGameTime()>timer&&GetWeapon(player)>0)
	{
		PlayerPerform("block",1);
		PlayerPerform("say"," 接下来就来第一项训练吧，看看你懂的破防不。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 众多资深高手都推荐鼠标左键是跳跃，右键是普通攻击。（本菜鸟已经习惯了空格跳跃了，就是不改，就是倔强，哼~）");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 什么？跳的很高，没办法跳低些？那么就去游戏里边更改下设置吧。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 推荐对战时多使用小跳来对付手，小跳就是轻微跳一下，然后接一下普通攻击。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 对战的时候，招式可以不华丽，但是必须有效，何为有效？自然是出招快，收招快，有伤害，或者能让对手倒地咯。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 拿到自己喜欢的武器了也可以先试试招数熟悉一下。");
		counter++;
		timer=GetGameTime()+18;
	}
	if(counter==2&&GetGameTime()>timer)
	{
		switch=3;
		counter++;
		timer=GetGameTime()+2;
	}
	if(counter==3&&GetGameTime()>timer)
	{
		if(GetWeapon(player)==5&&switch==4)
		{
			PlayerPerform("say"," 所谓扫头，指你将对手击倒后站在特定角度可以实现前前A（攻击）将对手带起来继续连的行为。");
			PlayerPerform("pause",3);
			PlayerPerform("say"," 匕首的禁招就是禁止扫头。");
			switch++;
		}
		if(GetWeapon(player)==6&&switch==4)
		{
			PlayerPerform("say"," 当然咯，如果对手处于防御状态，你也不可以通过后前A+左A实现破防。");
			PlayerPerform("pause",3);
			PlayerPerform("say"," 所谓扫地剑，指你将对手击倒后站在特定角度以及运用解锁可以实现后前A（攻击）+单A（攻击）无限连的行为。");
			PlayerPerform("pause",3);
			PlayerPerform("say"," 剑的禁招就是禁止无限扫地剑，扫地剑可以用，但是有段数限制。");
			switch++;
		}
		if(GetWeapon(player)==7&&switch==4)
		{
			PlayerPerform("say"," 而下扎三连，指的是你不可以，跳跃然后接空中后A（攻击）落地后继续接前A（攻击）前前A（攻击）后后前A（攻击）的行为。");
			PlayerPerform("pause",3);
			PlayerPerform("say"," 所谓无限下扎，指的是你不可以一直跳跃然后接空中后A（攻击）的行为。");
			PlayerPerform("pause",3);
			PlayerPerform("say"," 枪的禁招就是禁止无限下扎和下扎三连。");
			switch++;
		}
		if(GetWeapon(player)==8&&switch==4)
		{
			PlayerPerform("say"," 刀基本没有禁招。");
			switch++;
		}
		if(GetWeapon(player)==9&&switch==4)
		{
			PlayerPerform("say"," 锤基本没有禁招。");
			switch++;
		}
		if(GetWeapon(player)==47&&switch==4)
		{
			PlayerPerform("say"," 乾坤刀基本没有禁招。");
			switch++;
		}
		if(GetWeapon(player)==51&&switch==4)
		{
			PlayerPerform("say"," 指虎的禁招就是禁止前前A（攻击）后接左右前A（攻击），以及嗜血（后后前A状态下）时使用大小绝。");
			switch++;
		}
		if(GetWeapon(player)==55&&switch==4)
		{
			PlayerPerform("say"," 隐身，自爆也都不允许。");
			PlayerPerform("pause",3);
			PlayerPerform("say"," 忍刀的禁招就是禁止在对手未被破防的情况下后前前A（攻击）将对手僵直然后破防连招。");
			switch++;
		}
		if(GetWeapon(player)==4&&switch==4)
		{
			PlayerPerform("say"," 双刺基本上不允许使用，当然你跟朋友玩玩没关系。");
			switch++;
		}
		counter++;
		timer=GetGameTime()+8;
	}
	if(counter==4&&GetGameTime()>timer)
	{
		PlayerPerform("block",0);
		if(GetWeapon(player)==5&&switch==5)
		{
			AddNPC("sn14_01");
			PlayerPerform("say"," 接下来就开始训练吧，通过破防加连招让对手损失至少一百点血。");
			switch++;
		}
		if(GetWeapon(player)==6&&switch==5)
		{
			AddNPC("sn14_02");
			PlayerPerform("say"," 接下来就开始训练吧，通过破防加连招让对手损失至少一百点血。");
			switch++;
		}
		if(GetWeapon(player)==7&&switch==5)
		{
			AddNPC("sn14_03");
			PlayerPerform("say"," 接下来就开始训练吧，通过破防加连招让对手损失至少一百点血。");
			switch++;
		}
		if(GetWeapon(player)==8&&switch==5)
		{
			AddNPC("sn14_04");
			PlayerPerform("say"," 接下来就开始训练吧，通过破防加连招让对手损失至少一百点血。");
			switch++;
		}
		if(GetWeapon(player)==9&&switch==5)
		{
			AddNPC("sn14_05");
			PlayerPerform("say"," 接下来就开始训练吧，通过破防加连招让对手损失至少一百点血。");
			switch++;
		}
		if(GetWeapon(player)==47&&switch==5)
		{
			AddNPC("sn14_06");
			PlayerPerform("say"," 接下来就开始训练吧，通过破防加连招让对手损失至少一百点血。");
			switch++;
		}
		if(GetWeapon(player)==51&&switch==5)
		{
			AddNPC("sn14_07");
			PlayerPerform("say"," 接下来就开始训练吧，通过破防加连招让对手损失至少一百点血。");
			switch++;
		}
		if(GetWeapon(player)==55&&switch==5)
		{
			AddNPC("sn14_08");
			PlayerPerform("say"," 接下来就开始训练吧，通过破防加连招让对手损失至少一百点血。");
			switch++;
		}
		if(GetWeapon(player)==4&&switch==5)
		{
			AddNPC("sn14_09");
			PlayerPerform("say"," 接下来就开始训练吧，通过破防加连招让对手损失至少一百点血。");
			switch++;
		}
		counter++;
		timer=GetGameTime()+3;
	}
	if(counter==5&&GetGameTime()>timer)
	{

		if(switch==6&&GetMaxHP(c1)-GetHP(c1)<1000)
		{
			Perform(c1,"guard",10);
		}
		if(switch==6&&GetMaxHP(c1)-GetHP(c1)>=1000)
		{
			Perform(c1,"use",15);
			Perform(c1,"use",15);
			PlayerPerform("say"," 注意：只使用小跳（极低的跳跃然后空中接一下单A）让对手损失至少两百血。");
			PlayerPerform("pause",3);
			PlayerPerform("say"," 好了，那么接下来就开始小跳训练咯。");
			PlayerPerform("block",1);
			switch++;
			counter++;
			timer=GetGameTime()+3;
		}
	}
	if(counter==6&&GetGameTime()>timer)
	{
		Perform(c1,"use",15);
		ChangeBehavior(c1,"follow",player);
		Perform(c1,"guard",3);
		PlayerPerform("block",0);
		npchp = GetHP(c1);
		counter++;
		timer=GetGameTime()+3;
	}
	npcchp=GetHP(c1);
	if(counter==7&&GetGameTime()>timer)
	{
		if(npchp!=npcchp&&n<=0)
		{
			Say(c1,"伤血",(npchp-npcchp)/10);
			damage=npchp-npcchp;
			npchp=npcchp;
			n=1;
		}
		if(npchp!=npcchp&&n>0&&damage==(npchp-npcchp))
		{
			Say(c1,"伤血",(npchp-npcchp)/10);
			npchp=npcchp;
		}
		if(npchp!=npcchp&&n>0&&damage!=(npchp-npcchp))
		{
			PlayerPerform("use",38);
			PlayerPerform("use",38);
			PlayerPerform("use",38);
			PlayerPerform("use",38);
			Perform(c1,"guard",3);
			PlayerPerform("use",15);
			Perform(c1,"say"," 既然决定要好好练习小跳，可不能不专心哟~，我吃包子了，你重新用小跳伤我二百血吧。");
			Perform(c1,"use",15);
			n=0;
			counter=6;
			timer=GetGameTime()+3;
		}
		if(GetMaxHP(c1)-GetHP(c1)>=2000)
		{
			PlayerPerform("block",0);
			Perform(c1,"use",15);
			Perform(c1,"use",15);
			Perform(c1,"guard",12);
			PlayerPerform("use",15);
			PlayerPerform("say"," 友情提醒：若是你蒙混过了这阶段，下个阶段可就没办法蒙混咯。（不需要攻击对手，这里允许你最多损失二十血量）");
			PlayerPerform("pause",3);
			PlayerPerform("say"," 友情提醒：你锁定敌人时肯定没办法跑位，要先解锁哦，跑位练习持续一分钟，在此期间希望你能正经练习而不是躲到安全的地方。");
			PlayerPerform("pause",3);
			PlayerPerform("say"," 注意：跑位就是跟对手保持一个合适的距离，然后在对手出招时迅速做出反应，绕着对手跑一段距离，跑出对手的伤害范围。");
			PlayerPerform("pause",3);
			PlayerPerform("say"," 做的好，小跳练习就到这里咯，接下来进行跑位练习。（安心啦，电脑现在不会攻击你，可要认真看下对话咯）");
			PlayerPerform("block",1);
			counter++;
			timer=GetGameTime()+12;
		}
	}
	if(counter==8&&timer<GetGameTime())
	{
		ChangeBehavior(c1,"follow",player);
		Perform(c1,"say"," 准备好，我上了。");
		Perform(c1,"guard",3);
		counter++;
		timer=GetGameTime()+60;
	}
	if(counter==9&&GetMaxHP(player)-GetHP(player)>200)
	{
		Perform(c1,"use",15);
		PlayerPerform("use",15);
		Perform(c1,"guard",3);
		Perform(c1,"say"," 少侠不必心急，我们重新来过。");
		counter=8;
		timer=GetGameTime()+3;
	}
	if(counter==9&&timer<GetGameTime()&&GetMaxHP(player)-GetHP(player)<=200)
	{
		Perform(c1,"use",15);
		Perform(c1,"use",15);
		Perform(c1,"use",15);
		Perform(c1,"use",15);
		Perform(c1,"guard",12);
		PlayerPerform("block",0);
		PlayerPerform("say"," 这里也不需要攻击对方，当然咯，要是你觉得太难了，想跳过的话直接让他损失些血量就行了。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 要是这项训练你都能通过的话，去平台单挑肯定不会再被单方面虐待了。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 这项训练要求你在伤血三十以内将怒气积攒到九十点，这可是非常非常有挑战性的呢。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 太棒了，接下来就是最后一项训练了要加油哦。");
		PlayerPerform("block",1);

		counter++;
		timer=GetGameTime()+12;
	}
	if(counter==10&&timer<GetGameTime())
	{
		ChangeBehavior(c1,"follow",player);
		PlayerPerform("use",38);
		PlayerPerform("use",38);
		PlayerPerform("use",38);
		PlayerPerform("use",38);
		PlayerPerform("use",15);
		Perform(c1,"use",15);
		Perform(c1,"use",15);
		Perform(c1,"use",15);
		Perform(c1,"use",15);
		Perform(c1,"say"," 最后一项了，少侠可要加油阿。");
		Perform(c1,"guard",3);
		counter++;
		timer=GetGameTime()+3;
	}
	if(counter==11&&GetMaxHP(c1)-GetHP(c1)>0)
	{
		Perform(c1,"guard",999);
		counter=21;
		timer=GetGameTime()+3;
	}
	if(counter==11&&GetMaxHP(player)-GetHP(player)>=300)
	{
		Perform(c1,"guard",3);
		Perform(c1,"say"," 少侠莫要灰心，我们重新来过。");
		counter=10;
		timer=GetGameTime()+3;
	}
	if(counter==11&&timer<GetGameTime()&&GetMaxHP(c1)-GetHP(c1)<=0&&GetAnger(player)>=90&&GetAnger(player)<100)
	{
		Perform(c1,"guard",999);
		PlayerPerform("block",0);
		PlayerPerform("say"," 愿一切安好，流星人。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 有了这些基本技巧，希望你在流行道路上越走越远。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 推荐你去互动平台上玩单挑，哪里人比较多，环境也好。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 无论你之后是只玩单机虐电脑，还是去平台跟玩家对战，都不要忘记用你的智慧去击败对手，而不仅仅是莽着打。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 至于那些骗出招，破招，等等心理战，就要靠你自己在实战种慢慢积累咯。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 太精彩了，那么从现在起，你已经掌握了单挑的基本技巧了。");
		PlayerPerform("block",1);
		counter++;
		timer=GetGameTime()+21;
	}
	if(counter==12&&timer<GetGameTime())
	{
		GameOver(1);
	}
	if(counter==21&&timer<GetGameTime())
	{
		Perform(c1,"guard",999);
		PlayerPerform("block",0);
		PlayerPerform("say"," 愿一切安好，流星人。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 有了这些基本技巧，希望你在流行道路上越走越远。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 推荐你去互动平台上玩单挑，哪里人比较多，环境也好。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 无论你之后是只玩单机虐电脑，还是去平台跟玩家对战，都不要忘记用你的智慧去击败对手，而不仅仅是莽着打。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 你需要学习的还很多哦，至于那些骗出招，破招，等等心理战，就要靠你自己在实战种慢慢积累咯。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 不过，就算是你只是认认真真过了前两项训练也能在大部分单机叱咤风云了吧，想要玩平台跟玩家对战也不是不行。");
		PlayerPerform("pause",3);
		PlayerPerform("say"," 果然呢，你还是选择了跳过，不过没关系，最后一项是在太难了。");
		PlayerPerform("block",1);
		counter++;
		timer=GetGameTime()+21;
	}
	if(counter==22&&timer<GetGameTime())
	{
		GameOver(1);
	}


}