void Player::CalculateFacingAngle() { DirectX::XMFLOAT3 v1 = DirectX::XMFLOAT3(1.0f, 0.0f, 0.0f); DirectX::XMFLOAT3 v2 = GetAttackDirection(); float x = (v1.x * v2.z) - (v2.x * v1.z); float y = (v1.x * v2.x) - (v1.z * v2.z); float faceAngle = atan2(y, x) - 1.57079632679f; SetFacingDirection(DirectX::XMFLOAT3(GetFacingDirection().x, faceAngle, GetFacingDirection().z)); }
void Player::SetMyAttackDirection(DirectX::XMFLOAT3 p_attackDir) { m_attackDir = p_attackDir; CalculateFacingAngle(); AnimatedObject::SetIkDirection(p_attackDir); if (Network::GetInstance()->IsConnected()) { DirectX::XMFLOAT3 dir = GetAttackDirection(); Network::GetInstance()->SendPlayerDir(dir.x, dir.y, dir.z); } }
///////////////////////////CREATED_BY_ABILITYTAO_AND_CYACM_2009_NOV/////////////////////////////////////////////// CLIENT_EXPORT_API void __stdcall AI() { //截获状态并生成策略 state=GetBasicInfo(); stategy=UpdateInfo(); //抓金色飞贼优先级最高,仅作尝试,小概率事件^_^ if(iGoldBall.b_visible==true) { if(iHero_1.b_snatch_goldball) if(Tc_SnatchBall(hHero_1,TC_GOLD_BALL)) return ; else if(iHero_2.b_snatch_goldball) if(Tc_SnatchBall(hHero_2,TC_GOLD_BALL)) return; } ////////////////////////////////////////////////////////////////////////// //这里貌似有问题,领先的时候也进入这个函数,奇怪! //if(iGoldBall.b_visible==true&&( ((int)iOwnGameInfo.score_enemy-(int)iOwnGameInfo.score_self)>=GRAB_GOLD_BALL_LIMITATION ) ) //{ // if(iHero_1.b_snatch_goldball) // Tc_SnatchBall(hHero_1,TC_GOLD_BALL); // if(iHero_2.b_snatch_goldball) // Tc_SnatchBall(hHero_2,TC_GOLD_BALL); // CATCH_GOLD_BALL.run(); // return; //} /* TC_Position t_h; TC_Position t_b; t_h.x=iHeroWithBall.pos.x+64; t_h.y=iHeroWithBall.pos.y+64; t_b.x=iFreeBall.pos.x+32; t_b.y=iFreeBall.pos.y+32; if(GetLineDis(&t_h,&t_b)<100) { int f=1; }//用来调试 */ //如果是从左向右攻 if(iAttackDirection==TC_DIRECTION_RIGHT) { switch (stategy) { case FORCE_ATTACK: { ////////////////////////////////////////////////////////////////////////// //优先级最低 Save_Move(hHeroWithBall,GetAttackDirection(&iHeroWithBall)); Save_Move(hHeroWithoutBall,GetPosToPosDirection(&iHeroWithoutBall.pos,&iHeroWithBall.pos)); //拿到球后尽可能往前传,节约时间 if(iHeroWithBall.pos.x<R_CS_LINE-TC_HERO_WIDTH) { TC_Position target; if(iHeroWithBall.pos.x+TC_PASSBALL_DISTANCE<R_FORBIDDEN_LINE) target.x=iHeroWithBall.pos.x+TC_PASSBALL_DISTANCE; else target.x=R_FORBIDDEN_LINE-1; target.y=iHeroWithBall.pos.y; if(iHeroWithBall.abnormal_type!=TC_SPELLED_BY_MALFOY&&iHeroWithBall.abnormal_type!=TC_SPELLED_BY_FREEBALL) Tc_PassBall(hHeroWithBall,target); } //如果在前场禁区右侧进攻时,形成混战,吹走一个人,局部二打一 if(iHero_2.b_ghostball==false&&iHero_2.b_can_spell==true&&iHero_2.curr_blue>2000&&GetLineDis(&iHero_1.pos,&iHero_2.pos)<TC_HERO_SPELL_DISTANCE&&iHero_1.pos.x>(R_CS_LINE+128)&&GetLineDis(&iHero_1.pos,&iEnemy_1.pos)<TC_HERO_WIDTH*2&&GetLineDis(&iHero_1.pos,&iEnemy_2.pos)<TC_HERO_WIDTH*2) { if(GetLineDis(&iHero_1.pos,&iEnemy_1.pos)<=GetLineDis(&iHero_1.pos,&iEnemy_2.pos)) Tc_Spell(hHero_2,hEnemy_1); else Tc_Spell(hHero_2,hEnemy_2); } //在禁区内遭遇吹球或吹人,如果不能交给队友则传到禁区下侧 if(iHeroWithBall.pos.x>R_CS_LINE&&iEnemy_1.b_is_spelling==true&&(iEnemy_1.type==TC_HERO_GINNY||iEnemy_1.type==TC_HERO_RON||iEnemy_1.type==TC_HERO_MALFOY)&&(iEnemyGate.x-iHeroWithBall.pos.x)>TC_HERO_WIDTH) { if( (iEnemy_1.type==TC_HERO_GINNY||iEnemy_1.type==TC_HERO_RON||iEnemy_1.type==TC_HERO_MALFOY)&&GetLineDis(&iHeroWithBall.pos,&iHeroWithoutBall.pos)>(TC_HERO_WIDTH-64) ) { TC_Position t; t.x=R_FORBIDDEN_LINE+128+64; t.y=640; Tc_PassBall(hHeroWithBall,t); } } else if(iHeroWithBall.pos.x>R_CS_LINE&&iEnemy_2.b_is_spelling==true&&(iEnemy_2.type==TC_HERO_GINNY||iEnemy_2.type==TC_HERO_RON||iEnemy_2.type==TC_HERO_MALFOY)&&(iEnemyGate.x-iHeroWithBall.pos.x)>TC_HERO_WIDTH) { if( (iEnemy_2.type==TC_HERO_GINNY||iEnemy_2.type==TC_HERO_RON||iEnemy_2.type==TC_HERO_MALFOY)&&GetLineDis(&iHeroWithBall.pos,&iHeroWithoutBall.pos)>(TC_HERO_WIDTH-64) ) { TC_Position t; t.x=R_FORBIDDEN_LINE+128+64; t.y=640; Tc_PassBall(hHeroWithBall,t); } } //如果持球队员被晕了或是被乌龟了,另一个队员夺走球继续进攻 if( ( ( warn==1&&iHeroBeingSpelled.b_ghostball==true)||(iHeroWithBall.abnormal_type==TC_SPELLED_BY_HERMIONE||iHeroWithBall.abnormal_type==TC_SPELLED_BY_MALFOY||iHeroWithBall.abnormal_type==TC_SPELLED_BY_FREEBALL||iHeroWithBall.abnormal_type==TC_SPELLED_BY_RON) ) &&GetLineDis(&iHeroWithBall.pos,&iHeroWithoutBall.pos)<=(TC_HERO_WIDTH-32)) { if(iHeroWithoutBall.b_snatch_ghostball==true) { bool test;//调试用1 test=Tc_SnatchBall(hHeroWithoutBall,TC_GHOST_BALL); int a=1;//调试用2 } else Save_Move(hHeroWithoutBall,GetPosToPosDirection(&iHeroWithoutBall.pos,&iHeroWithBall.pos)); } break; } case FORCE_DEFEND: { ////////////////////////////////////////////////////////////////////////// //暴抢,双人抢,优先级最低 Save_Move(hHero_1,GetEnemyDirection(&iHero_1,&iEnemyWithBall)); TC_Position centre; centre.x=CENTREX-TC_HERO_WIDTH/2;//让球员中心与中点重合 centre.y=CENTREY-TC_HERO_WIDTH/2;//同上 if(iHero_1.abnormal_type==TC_SPELLED_BY_NONE&&GetLineDis(&iHero_1.pos,&iEnemyWithBall.pos)<TC_HERO_SPELL_DISTANCE&&iEnemyWithBall.pos.x<L_CS_LINE&&(iHero_1.b_can_spell==true||iHero_1.b_is_spelling==true) ) { Save_Move(hHero_2,GetPosToPosDirection(&iHero_2.pos,¢re)); } else Save_Move(hHero_2,GetEnemyDirection(&iHero_2,&iEnemyWithBall)); //如果在中场混战,吹飞一人,二打一 //if( iEnemy_1.pos.x<CENTREX+TC_HERO_WIDTH && iEnemy_1.pos.x >CENTREX-TC_HERO_WIDTH && iEnemy_2.pos.x<CENTREX+TC_HERO_WIDTH && iEnemy_2.pos.x >CENTREX-TC_HERO_WIDTH&&iHero_1.pos.x<CENTREX+TC_HERO_WIDTH && iHero_1.pos.x >CENTREX-TC_HERO_WIDTH&&iHero_2.pos.x<CENTREX+TC_HERO_WIDTH && iHero_2.pos.x >CENTREX-TC_HERO_WIDTH&&GetLineDis(&iHero_1.pos,&iEnemy_1.pos)<TC_HERO_WIDTH&&GetLineDis(&iHero_1.pos,&iEnemy_2.pos)<TC_HERO_WIDTH&&GetLineDis(&iHero_2.pos,&iEnemy_1.pos)<TC_HERO_WIDTH&&GetLineDis(&iHero_2.pos,&iEnemy_2.pos)<TC_HERO_WIDTH&&iHero_2.curr_blue>2000&&iHero_2.b_can_spell==true) //{ // if(GetLineDis(&iEnemy_1.pos,&iHero_2.pos)<=GetLineDis(&iEnemy_2.pos,&iHero_2.pos) ) // { // Tc_Spell(hHero_2,hHeroWithBall); // } //} //珍妮施法将球吹回中场 if(iHero_1.type==TC_HERO_GINNY&&iHero_1.b_can_spell==true&&iEnemyWithBall.pos.x-iOwnGate.x<DANGERDIS&&iHero_2.b_is_spelling==false&&iEnemyWithBall.abnormal_type!=TC_SPELLED_BY_RON) { Tc_Spell(hHero_1,hEnemyWithBall); } //如果珍妮不能,RON协助将带球人吹回后场,争取时间,RON的danger值做了微调 else if(iHero_2.type==TC_HERO_RON&&iHero_2.b_can_spell==true&&iEnemyWithBall.pos.x-iOwnGate.x<(DANGERDIS+10)&&GetLineDis(&iHero_2.pos,&iHeroWithBall.pos)<TC_HERO_SPELL_DISTANCE&&iHero_1.b_is_spelling==false) { Tc_Spell(hHero_2,hEnemyWithBall); } if(iHero_1.b_snatch_ghostball==true) Tc_SnatchBall(hHero_1,TC_GHOST_BALL); else if(iHero_2.b_snatch_ghostball==true) Tc_SnatchBall(hHero_2,TC_GHOST_BALL); //抓金色飞贼优先级最高,仅作尝试,小概率事件^_^ if(iGoldBall.b_visible==true) { if(iHero_1.b_snatch_goldball) Tc_SnatchBall(hHero_1,TC_GOLD_BALL); else if(iHero_2.b_snatch_goldball) Tc_SnatchBall(hHero_2,TC_GOLD_BALL); } ////////////////////////////////////////////////////////////////////////// break; } case FORCE_GRAB_FREE_BALL: { ////////////////////////////////////////////////////////////////////////// int grabflag=0; if (iHero_1.b_snatch_ghostball == true) { if(IsBallInPassing(&iGhostBall)==true&&iGhostBall.speed.vx>0) Save_Move(hHero_1,GetBallDirection(&iHero_1,&iGhostBall)); else { Tc_SnatchBall(hHero_1,TC_GHOST_BALL); grabflag=1; } } else Save_Move(hHero_1,GetBallDirection(&iHero_1,&iGhostBall)); ////////////////////////////////////////////////////////////////////////// if (iHero_2.b_snatch_ghostball == true&&grabflag==0) { if(IsBallInPassing(&iGhostBall)==true&&iGhostBall.speed.vx>0) Save_Move(hHero_2,GetBallDirection(&iHero_2,&iGhostBall)); else { Tc_SnatchBall(hHero_2,TC_GHOST_BALL); } } else Save_Move(hHero_2,GetBallDirection(&iHero_2,&iGhostBall)); break; } } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// else if(iAttackDirection==TC_DIRECTION_LEFT) { /////////////////////////////////////////////////////// /*if(iEnemy_1.b_is_spelling==true||iEnemy_2.b_is_spelling==true) { int res=1; }//调试用 */ switch (stategy) { case FORCE_ATTACK: { ////////////////////////////////////////////////////////////////////////// //优先级最低 Save_Move(hHeroWithBall,GetAttackDirection(&iHeroWithBall)); Save_Move(hHeroWithoutBall,GetPosToPosDirection(&iHeroWithoutBall.pos,&iHeroWithBall.pos)); //拿到球后尽可能往前传,节约时间 if(iHeroWithBall.pos.x>L_CS_LINE+TC_HERO_WIDTH) { TC_Position target; if(iHeroWithBall.pos.x+TC_HERO_WIDTH/2-TC_PASSBALL_DISTANCE-30>L_FORBIDDEN_LINE) target.x=iHeroWithBall.pos.x+TC_HERO_WIDTH/2-TC_PASSBALL_DISTANCE-30; else target.x=L_FORBIDDEN_LINE+1; target.y=iHeroWithBall.pos.y; if(iHeroWithBall.abnormal_type!=TC_SPELLED_BY_MALFOY&&iHeroWithBall.abnormal_type!=TC_SPELLED_BY_FREEBALL) { bool test; test=Tc_PassBall(hHeroWithBall,target); int a=1; } } //如果在前场禁区左侧进攻时,形成混战,吹走一个人,局部二打一 if(iHero_2.b_ghostball==false&&iHero_2.b_can_spell==true&&iHero_2.curr_blue>2000&&GetLineDis(&iHero_1.pos,&iHero_2.pos)<TC_HERO_SPELL_DISTANCE&&iHero_1.pos.x<(L_CS_LINE-128)&&GetLineDis(&iHero_1.pos,&iEnemy_1.pos)<TC_HERO_WIDTH*2&&GetLineDis(&iHero_1.pos,&iEnemy_2.pos)<TC_HERO_WIDTH*2) { if(GetLineDis(&iHero_1.pos,&iEnemy_1.pos)<=GetLineDis(&iHero_1.pos,&iEnemy_2.pos)) Tc_Spell(hHero_2,hEnemy_1); else Tc_Spell(hHero_2,hEnemy_2); } //在禁区内遭遇吹球或吹人,如果不能交给队友则传到禁区下侧 if(iHeroWithBall.pos.x<L_CS_LINE+TC_HERO_WIDTH && iEnemy_1.b_is_spelling==true && (iEnemy_1.type==TC_HERO_GINNY||iEnemy_1.type==TC_HERO_RON||iEnemy_1.type==TC_HERO_MALFOY) && (iEnemyGate.x-iHeroWithBall.pos.x)<0) { if( (iEnemy_1.type==TC_HERO_GINNY||iEnemy_1.type==TC_HERO_RON||iEnemy_1.type==TC_HERO_MALFOY)&&GetLineDis(&iHeroWithBall.pos,&iHeroWithoutBall.pos)>(TC_HERO_WIDTH-64) ) { TC_Position t; t.x=L_FORBIDDEN_LINE-128-64; t.y=640; Tc_PassBall(hHeroWithBall,t); } } else if(iHeroWithBall.pos.x<L_CS_LINE+TC_HERO_WIDTH&&iEnemy_2.b_is_spelling==true&&(iEnemy_2.type==TC_HERO_GINNY||iEnemy_2.type==TC_HERO_RON||iEnemy_2.type==TC_HERO_MALFOY)&&iEnemyGate.x-iHeroWithBall.pos.x<0) { if( (iEnemy_2.type==TC_HERO_GINNY||iEnemy_2.type==TC_HERO_RON||iEnemy_2.type==TC_HERO_MALFOY)&&GetLineDis(&iHeroWithBall.pos,&iHeroWithoutBall.pos)>(TC_HERO_WIDTH-64) ) { TC_Position t; t.x=L_FORBIDDEN_LINE-128-64; t.y=640; Tc_PassBall(hHeroWithBall,t); } } //如果持球队员被晕了或是被乌龟了,另一个队员夺走球继续进攻 if( ( ( warn==1&&iHeroBeingSpelled.b_ghostball==true)||(iHeroWithBall.abnormal_type==TC_SPELLED_BY_HERMIONE||iHeroWithBall.abnormal_type==TC_SPELLED_BY_MALFOY||iHeroWithBall.abnormal_type==TC_SPELLED_BY_FREEBALL||iHeroWithBall.abnormal_type==TC_SPELLED_BY_RON) ) &&GetLineDis(&iHeroWithBall.pos,&iHeroWithoutBall.pos)<=(TC_HERO_WIDTH-32)) { if(iHeroWithoutBall.b_snatch_ghostball==true) { Tc_SnatchBall(hHeroWithoutBall,TC_GHOST_BALL); } else Save_Move(hHeroWithoutBall,GetPosToPosDirection(&iHeroWithoutBall.pos,&iHeroWithBall.pos)); } break; } case FORCE_DEFEND: { ////////////////////////////////////////////////////////////////////////// //暴抢,双人抢,优先级最低 Save_Move(hHero_1,GetEnemyDirection(&iHero_1,&iEnemyWithBall)); TC_Position centre; centre.x=CENTREX-TC_HERO_WIDTH/2;//让球员中心与中点重合 centre.y=CENTREY-TC_HERO_WIDTH/2;//同上 if(iHero_1.abnormal_type==TC_SPELLED_BY_NONE&&GetLineDis(&iHero_1.pos,&iEnemyWithBall.pos)<TC_HERO_SPELL_DISTANCE&&iEnemyWithBall.pos.x>R_CS_LINE&&(iHero_1.b_can_spell==true||iHero_1.b_is_spelling==true) ) { Save_Move(hHero_2,GetPosToPosDirection(&iHero_2.pos,¢re)); } else Save_Move(hHero_2,GetEnemyDirection(&iHero_2,&iEnemyWithBall)); //如果在中场混战,吹飞一人,二打一 //if( iEnemy_1.pos.x<CENTREX+TC_HERO_WIDTH && iEnemy_1.pos.x >CENTREX-TC_HERO_WIDTH && iEnemy_2.pos.x<CENTREX+TC_HERO_WIDTH && iEnemy_2.pos.x >CENTREX-TC_HERO_WIDTH&&iHero_1.pos.x<CENTREX+TC_HERO_WIDTH && iHero_1.pos.x >CENTREX-TC_HERO_WIDTH&&iHero_2.pos.x<CENTREX+TC_HERO_WIDTH && iHero_2.pos.x >CENTREX-TC_HERO_WIDTH&&GetLineDis(&iHero_1.pos,&iEnemy_1.pos)<TC_HERO_WIDTH&&GetLineDis(&iHero_1.pos,&iEnemy_2.pos)<TC_HERO_WIDTH&&GetLineDis(&iHero_2.pos,&iEnemy_1.pos)<TC_HERO_WIDTH&&GetLineDis(&iHero_2.pos,&iEnemy_2.pos)<TC_HERO_WIDTH&&iHero_2.curr_blue>2000&&iHero_2.b_can_spell==true) //{ // if(GetLineDis(&iEnemy_1.pos,&iHero_2.pos)<=GetLineDis(&iEnemy_2.pos,&iHero_2.pos) ) // { // Tc_Spell(hHero_2,hHeroWithBall); // } //} //珍妮施法将球吹回中场 if(iHero_1.type==TC_HERO_GINNY&&iHero_1.b_can_spell==true&&abs(iEnemyWithBall.pos.x-iOwnGate.x)<DANGERDIS+TC_HERO_WIDTH&&iHero_2.b_is_spelling==false&&iEnemyWithBall.abnormal_type!=TC_SPELLED_BY_RON) { Tc_Spell(hHero_1,hEnemyWithBall); } //如果珍妮不能,RON协助将带球人吹回后场,争取时间,RON的danger值做了微调 else if(iHero_2.type==TC_HERO_RON&&iHero_2.b_can_spell==true&&abs(iEnemyWithBall.pos.x-iOwnGate.x)<(DANGERDIS+10+TC_HERO_WIDTH)&&GetLineDis(&iHero_2.pos,&iHeroWithBall.pos)<TC_HERO_SPELL_DISTANCE&&iHero_1.b_is_spelling==false) { Tc_Spell(hHero_2,hEnemyWithBall); } if(iHero_1.b_snatch_ghostball==true) Tc_SnatchBall(hHero_1,TC_GHOST_BALL); else if(iHero_2.b_snatch_ghostball==true) Tc_SnatchBall(hHero_2,TC_GHOST_BALL); //抓金色飞贼优先级最高,仅作尝试,小概率事件^_^ if(iGoldBall.b_visible==true) { if(iHero_1.b_snatch_goldball) Tc_SnatchBall(hHero_1,TC_GOLD_BALL); else if(iHero_2.b_snatch_goldball) Tc_SnatchBall(hHero_2,TC_GOLD_BALL); } ////////////////////////////////////////////////////////////////////////// break; } case FORCE_GRAB_FREE_BALL: { ////////////////////////////////////////////////////////////////////////// int grabflag=0; if (iHero_1.b_snatch_ghostball == true) { if(IsBallInPassing(&iGhostBall)==true&&iGhostBall.speed.vx<0) Save_Move(hHero_1,GetBallDirection(&iHero_1,&iGhostBall)); else { Tc_SnatchBall(hHero_1,TC_GHOST_BALL); grabflag=1; } } else Save_Move(hHero_1,GetBallDirection(&iHero_1,&iGhostBall)); ////////////////////////////////////////////////////////////////////////// if (iHero_2.b_snatch_ghostball == true&&grabflag==0) { if(IsBallInPassing(&iGhostBall)==true&&iGhostBall.speed.vx<0) Save_Move(hHero_2,GetBallDirection(&iHero_2,&iGhostBall)); else { Tc_SnatchBall(hHero_2,TC_GHOST_BALL); } } else Save_Move(hHero_2,GetBallDirection(&iHero_2,&iGhostBall)); break; } } } }
CLIENT_EXPORT_API void __stdcall AI() { // // TODO: add your AI here // hHero_1 = Tc_GetHeroHandle(TC_MEMBER1); hHero_2 = Tc_GetHeroHandle(TC_MEMBER2); hEnemy_1 = Tc_GetEnemyHandle(TC_MEMBER1); hEnemy_2 = Tc_GetEnemyHandle(TC_MEMBER2); hFreeBall = Tc_GetBallHandle(TC_FREE_BALL); hGhostBall = Tc_GetBallHandle(TC_GHOST_BALL); hGoldBall = Tc_GetBallHandle(TC_GOLD_BALL); Tc_GetBallInfo(hGoldBall,&iGoldBall); Tc_GetBallInfo(hFreeBall,&iFreeBall); Tc_GetBallInfo(hGhostBall,&iGhostBall); Tc_GetHeroInfo(hHero_1,&iHero_1); Tc_GetHeroInfo(hHero_2,&iHero_2); Tc_GetEnemyInfo(hEnemy_1,&iEnemy_1); Tc_GetEnemyInfo(hEnemy_2,&iEnemy_2); Tc_GetOwnGate(hHero_1,&iOwnGate); Tc_GetEnemyGate(hEnemy_1,&iEnemyGate); Tc_GetForbiddenArea(&iForbiddenArea); Tc_GetGameInfo(hHero_1, &gameInfo); if (iOwnGate.x < iEnemyGate.x) { iAttackDirection = TC_DIRECTION_RIGHT; } else { iAttackDirection = TC_DIRECTION_LEFT; } double dish1,dish2,dise1,dise2; int state = GetState(); if(iGoldBall.b_visible){ dish1=timeToGold(&iHero_1); dish2=timeToGold(&iHero_2); dise1=timeToGold(&iEnemy_1); dise2=timeToGold(&iEnemy_2); if(dish1<dish2){ hHero_closer=hHero_1; hHero_farther=hHero_2; iHero_closer=iHero_1; iHero_farther=iHero_2; } else{ hHero_closer=hHero_2; hHero_farther=hHero_1; iHero_closer=iHero_2; iHero_farther=iHero_1; } if(dise1<dise2){ hEnemy_closer=hEnemy_1; hEnemy_farther=hEnemy_2; iEnemy_closer=iEnemy_1; iEnemy_farther=iEnemy_2; } else{ hEnemy_closer=hEnemy_2; hEnemy_farther=hEnemy_1; iEnemy_closer=iEnemy_2; iEnemy_farther=iEnemy_1; } dise1=min(dise1, dise2); dish1=min(dish1, dish2); if(iHero_1.b_snatch_goldball==true) { Tc_SnatchBall(hHero_1,TC_GOLD_BALL); } if(iHero_2.b_snatch_goldball==true) { Tc_SnatchBall(hHero_2,TC_GOLD_BALL); } if(gameInfo.score_self-gameInfo.score_enemy>2||gameInfo.score_enemy-gameInfo.score_self>2) { if(dise1<dish1) { if(iHero_2.b_can_spell && Tc_CanBeSpelled(hHero_2, hEnemy_closer)){ Tc_Spell(hHero_2,hEnemy_closer); if(iHero_2.b_ghostball)Tc_Move(hHero_2, GetAttackDirection(&iHero_2)); else Tc_Move(hHero_2, GetBallDirection(&iHero_2, &iGoldBall)); } else { if(iHero_1.b_ghostball)Tc_Move(hHero_1, GetAttackDirection(&iHero_1)); else Tc_Move(hHero_1, GetBallDirection(&iHero_1, &iGoldBall)); if(iHero_2.b_can_spell && Tc_CanBeSpelled(hHero_2, hEnemy_closer))Tc_Spell(hHero_2, hEnemy_closer); else Tc_Move(hHero_2, GetBallDirection(&iHero_2, &iGoldBall)); } } if(dish1<doubleINF){ if(Tc_SnatchBall(hHero_closer, TC_GOLD_BALL)==false){ Tc_Move(hHero_closer, GetBallDirection(&iHero_closer, &iGoldBall)); return; } } } } switch (state) { case GHOSTBALL_IN_SELF_TEAM: { TC_Position point1; if(iAttackDirection == TC_DIRECTION_RIGHT) point1.x=iHeroWithBall.pos.x+TC_PASSBALL_DISTANCE-100; else point1.x=iHeroWithBall.pos.x-TC_PASSBALL_DISTANCE+100; point1.y=iHeroWithBall.pos.y; TC_Position point2; if(iAttackDirection == TC_DIRECTION_RIGHT) point2.x=iForbiddenArea.right.left; else point2.x=iForbiddenArea.left.right; point2.y=iEnemyGate.y_lower-128; if(iHeroWithBall.abnormal_type==TC_SPELLED_BY_FREEBALL||iHeroWithBall.abnormal_type==TC_SPELLED_BY_MALFOY||iHeroWithBall.abnormal_type==TC_SPELLED_BY_HERMIONE) { if(iHeroWithoutBall.b_snatch_ghostball == true ) { Tc_SnatchBall(hHeroWithoutBall,TC_GHOST_BALL); break; } } /* if(iAttackDirection == TC_DIRECTION_RIGHT&&iHeroWithBall.pos.x>iForbiddenArea.right.left||iAttackDirection == TC_DIRECTION_LEFT&&iHeroWithBall.pos.x<iForbiddenArea.left.right) { if(GetEnemytoBallDist(&iEnemy_1)<GetEnemytoBallDist(&iEnemy_2)) Tc_Spell(hHero_1,hEnemy_1); else Tc_Spell(hHero_1,hEnemy_2); }*/ // Tc_Move(hHeroWithBall,GetAttackDirection(&iHeroWithBall)); // Tc_Move(hHeroWithoutBall,GetHeroDirection(&iHeroWithoutBall,&iHeroWithBall)); if((iAttackDirection == TC_DIRECTION_RIGHT&&iGhostBall.pos.x<iForbiddenArea.right.left-100)||(iAttackDirection==TC_DIRECTION_LEFT&&iGhostBall.pos.x>iForbiddenArea.left.right+100)) { if((iAttackDirection == TC_DIRECTION_RIGHT&&point1.x<iForbiddenArea.right.left-100)||(iAttackDirection==TC_DIRECTION_LEFT&&point1.x>iForbiddenArea.left.right+100)) Tc_PassBall(hHeroWithBall,point1); else Tc_PassBall(hHeroWithBall,point2); } else { if(iEnemy_1.type==TC_HERO_GINNY) { if(iEnemy_1.b_is_spelling==true&&iHeroWithoutBall.b_snatch_ghostball == true) { Tc_Stop(hHeroWithBall); Tc_SnatchBall(hHeroWithoutBall,TC_GHOST_BALL); break; } else { Tc_Move(hHeroWithBall,GetAttackDirection(&iHeroWithBall)); Tc_Move(hHeroWithoutBall,GetHeroDirection(&iHeroWithoutBall,&iHeroWithBall)); } } if(iEnemy_2.type==TC_HERO_GINNY) { if(iEnemy_2.b_is_spelling==true&&iHeroWithoutBall.b_snatch_ghostball == true) { Tc_Stop(hHeroWithBall); Tc_SnatchBall(hHeroWithoutBall,TC_GHOST_BALL); break; } else { Tc_Move(hHeroWithBall,GetAttackDirection(&iHeroWithBall)); Tc_Move(hHeroWithoutBall,GetHeroDirection(&iHeroWithoutBall,&iHeroWithBall)); } } if(iEnemy_1.type==TC_HERO_RON) { if(iEnemy_1.b_is_spelling==true&&iHeroWithoutBall.b_snatch_ghostball == true) { Tc_Stop(hHeroWithBall); Tc_SnatchBall(hHeroWithoutBall,TC_GHOST_BALL); break; } else { Tc_Move(hHeroWithBall,GetAttackDirection(&iHeroWithBall)); Tc_Move(hHeroWithoutBall,GetHeroDirection(&iHeroWithoutBall,&iHeroWithBall)); break; } } if(iEnemy_2.type==TC_HERO_RON) { if(iEnemy_2.b_is_spelling==true&&iHeroWithoutBall.b_snatch_ghostball == true) { Tc_Stop(hHeroWithBall); Tc_SnatchBall(hHeroWithoutBall,TC_GHOST_BALL); break; } else { Tc_Move(hHeroWithBall,GetAttackDirection(&iHeroWithBall)); Tc_Move(hHeroWithoutBall,GetHeroDirection(&iHeroWithoutBall,&iHeroWithBall)); break; } } Tc_Move(hHeroWithBall,GetAttackDirection(&iHeroWithBall)); Tc_Move(hHeroWithoutBall,GetHeroDirection(&iHeroWithoutBall,&iHeroWithBall)); } break; } case GHOSTBALL_IN_ENEMY_TEAM: { if (iAttackDirection == TC_DIRECTION_RIGHT) { if (iEnemyWithBall.pos.x<= iForbiddenArea.left.right && iHero_2.b_can_spell==true) { if(Tc_Spell(hHero_2,hEnemyWithBall)) { Tc_Move(hHeroWithBall,iAttackDirection); Tc_Move(hHeroWithoutBall,iAttackDirection); break; } } if (iEnemyWithBall.pos.x - iOwnGate.x <= 100 && iHero_1.b_can_spell==true) { if(Tc_Spell(hHero_1,hEnemyWithBall)) { Tc_Move(hHeroWithBall,iAttackDirection); Tc_Move(hHeroWithoutBall,iAttackDirection); break; } } } else { if (iEnemyWithBall.pos.x>= iForbiddenArea.right.left && iHero_2.b_can_spell==true) { if(Tc_Spell(hHero_2,hEnemyWithBall)) { Tc_Move(hHeroWithBall,iAttackDirection); Tc_Move(hHeroWithoutBall,iAttackDirection); break; } } else if (iOwnGate.x - iEnemyWithBall.pos.x <= 100 && iHero_1.b_can_spell==true) { if(Tc_Spell(hHero_1,hEnemyWithBall)) { Tc_Move(hHeroWithBall,iAttackDirection); Tc_Move(hHeroWithoutBall,iAttackDirection); break; } } } Tc_Move(hHero_1,GetBallDirection(&iHero_1,&iGhostBall)); Tc_Move(hHero_2,GetEnemyDirection(&iHero_2,&iEnemyWithBall)); if (iHero_1.b_snatch_ghostball == true) { if (Tc_SnatchBall(hHero_1,TC_GHOST_BALL) == true) { break; } } if (iHero_2.b_snatch_ghostball == true) { if (Tc_SnatchBall(hHero_2,TC_GHOST_BALL) == true) { break; } } Tc_Move(hHero_1,GetBallDirection(&iHero_1,&iGhostBall)); Tc_Move(hHero_2,GetEnemyDirection(&iHero_2,&iEnemyWithBall)); break; } case GHOSTBALL_IN_NO_TEAM: { if (iHero_1.b_snatch_ghostball == false) { Tc_Move(hHero_1,GetBallDirection(&iHero_1,&iGhostBall)); } else { Tc_SnatchBall(hHero_1,TC_GHOST_BALL); } if (iHero_2.b_snatch_ghostball == false) { Tc_Move(hHero_2,GetBallDirection(&iHero_2,&iGhostBall)); } else { Tc_SnatchBall(hHero_2,TC_GHOST_BALL); } break; } default: { break; } } }
CLIENT_EXPORT_API void __stdcall AI() { hHero_1 = Tc_GetHeroHandle(TC_MEMBER1); hHero_2 = Tc_GetHeroHandle(TC_MEMBER2); hEnemy_1 = Tc_GetEnemyHandle(TC_MEMBER1); hEnemy_2 = Tc_GetEnemyHandle(TC_MEMBER2); hGhostBall = Tc_GetBallHandle(TC_GHOST_BALL); Tc_GetBallInfo(hGhostBall,&iGhostBall); Tc_GetHeroInfo(hHero_1,&iHero_1); Tc_GetHeroInfo(hHero_2,&iHero_2); Tc_GetEnemyInfo(hEnemy_1,&iEnemy_1); Tc_GetEnemyInfo(hEnemy_2,&iEnemy_2); Tc_GetOwnGate(hHero_1,&iOwnGate); Tc_GetEnemyGate(hEnemy_1,&iEnemyGate); Tc_GetForbiddenArea(&iForbiddenArea); if (iOwnGate.x < iEnemyGate.x) { iAttackDirection = TC_DIRECTION_RIGHT; } else { iAttackDirection = TC_DIRECTION_LEFT; } int state = GetState(); switch(state) { case GHOSTBALL_IN_SELF_TEAM: { TC_Position iPos; if (iAttackDirection==TC_DIRECTION_LEFT) { if (iHeroWithBall.pos.x<=1024) //禁区-100后有人接近放魔 { /////////////////// if( GetBallDistance(iEnemy_1,iGhostBall)<=400) { if (Tc_CanBeSpelled(hHero_1,hEnemy_1)) { Tc_Spell(hHero_1,hEnemy_1); } } if( GetBallDistance(iEnemy_2,iGhostBall)<=400) { if (Tc_CanBeSpelled(hHero_1,hEnemy_2)) { Tc_Spell(hHero_1,hEnemy_1); } } } if (iHeroWithBall.pos.x<(iForbiddenArea.right.left-100)&&(iHeroWithBall.pos.x>(iForbiddenArea.left.right+100))) { iPos.x = iForbiddenArea.left.right+1; iPos.y = (iEnemyGate.y_upper+iEnemyGate.y_lower)/2; if ((iEnemy_1.pos.x<(iForbiddenArea.right.left+100))&(iEnemy_1.pos.x>(iForbiddenArea.right.left-100))) { if (iEnemy_1.pos.y<iPos.y) { iPos.y=iPos.y+100; Tc_PassBall(hHeroWithBall,iPos); } else { iPos.y=iPos.y-100; Tc_PassBall(hHeroWithBall,iPos); } break; } if ((iEnemy_2.pos.x<(iForbiddenArea.right.left+100))&(iEnemy_2.pos.x>(iForbiddenArea.right.left-100))) { if (iEnemy_2.pos.y<iPos.y) { iPos.y=iPos.y+100; Tc_PassBall(hHeroWithBall,iPos); } else { iPos.y=iPos.y-100; Tc_PassBall(hHeroWithBall,iPos); } break; } Tc_PassBall(hHeroWithBall,iPos); } Tc_Move(hHeroWithBall,GetAttackDirection(&iHeroWithBall)); } else //向右进攻 { if (iHeroWithBall.pos.x>=1024) //禁区+100后有人接近放魔 { /////////////////// if( GetBallDistance(iEnemy_1,iGhostBall)<=400) { if (Tc_CanBeSpelled(hHero_1,hEnemy_1)) { Tc_Spell(hHero_1,hEnemy_1); } } if( GetBallDistance(iEnemy_2,iGhostBall)<=400) { if (Tc_CanBeSpelled(hHero_1,hEnemy_2)) { Tc_Spell(hHero_1,hEnemy_2); } } } if (iHeroWithBall.pos.x>(iForbiddenArea.left.right+100)&&iHeroWithBall.pos.x<(iForbiddenArea.right.left-100)) { iPos.x = iForbiddenArea.right.left-1; iPos.y = (iEnemyGate.y_upper+iEnemyGate.y_lower)/2; if ((iEnemy_1.pos.x<(iForbiddenArea.right.left+100))&(iEnemy_1.pos.x>(iForbiddenArea.right.left-100))) { if (iEnemy_1.pos.y<iPos.y) { iPos.y=iPos.y+100; Tc_PassBall(hHeroWithBall,iPos); } else { iPos.y=iPos.y-100; Tc_PassBall(hHeroWithBall,iPos); } break; } if ((iEnemy_2.pos.x<(iForbiddenArea.right.left+100))&(iEnemy_2.pos.x>(iForbiddenArea.right.left-100))) { if (iEnemy_2.pos.y<iPos.y) { iPos.y=iPos.y+100; Tc_PassBall(hHeroWithBall,iPos); } else { iPos.y=iPos.y-100; Tc_PassBall(hHeroWithBall,iPos); } break; } Tc_PassBall(hHeroWithBall,iPos); } Tc_Move(hHeroWithBall,GetAttackDirection(&iHeroWithBall)); } break; } case GHOSTBALL_IN_ENEMY_TEAM: { if (iAttackDirection == TC_DIRECTION_RIGHT) { if (iEnemyWithBall.pos.x - iOwnGate.x <= 200) { if (Tc_Spell(hHero_2,hEnemyWithBall)) { break; } else { Tc_Spell(hHero_1,hEnemyWithBall); } if(iHero_1.pos.x!=iGhostBall.pos.x || iHero_1.pos.y!=iGhostBall.pos.y) Tc_Move(hHero_1,GetBallDirection(&iHero_1,&iGhostBall)); if(iHero_2.pos.x!=iGhostBall.pos.x || iHero_2.pos.y!=iGhostBall.pos.y) Tc_Move(hHero_2,GetBallDirection(&iHero_2,&iGhostBall)); break; } if (iEnemyWithBall.pos.x < iForbiddenArea.left.right && iEnemyWithBall.pos.x-iOwnGate.x > 200) { if (iHero_1.b_snatch_ghostball == true||iHero_2.b_snatch_ghostball == true) { if (Tc_SnatchBall(hHero_1,TC_GHOST_BALL) == true) { break; } else { if (Tc_SnatchBall(hHero_2,TC_GHOST_BALL) == true)//1眩晕,2吹飞 { break; } Tc_Spell(hHero_1,hEnemyWithBall); } } else { Tc_Spell(hHero_1,hEnemyWithBall); } } } else //向左进攻 { if (iOwnGate.x - iEnemyWithBall.pos.x <= 200) { if (Tc_Spell(hHero_2,hEnemyWithBall))//1眩晕,2吹飞 { break; } else { Tc_Spell(hHero_1,hEnemyWithBall); } if(iHero_1.pos.x!=iGhostBall.pos.x || iHero_1.pos.y!=iGhostBall.pos.y) Tc_Move(hHero_1,GetBallDirection(&iHero_1,&iGhostBall)); if(iHero_2.pos.x!=iGhostBall.pos.x || iHero_2.pos.y!=iGhostBall.pos.y) Tc_Move(hHero_2,GetBallDirection(&iHero_2,&iGhostBall)); break; } if (iEnemyWithBall.pos.x > iForbiddenArea.right.left && iOwnGate.x-iEnemyWithBall.pos.x > 200) { if (iHero_1.b_snatch_ghostball == true||iHero_2.b_snatch_ghostball==true) { if (Tc_SnatchBall(hHero_1,TC_GHOST_BALL) == true) { break; } else { if (Tc_SnatchBall(hHero_2,TC_GHOST_BALL)==true) { break; } Tc_Spell(hHero_1,hEnemyWithBall); } } else { Tc_Spell(hHero_1,hEnemyWithBall); } } } if (iHero_1.b_snatch_ghostball == true) { if (Tc_SnatchBall(hHero_1,TC_GHOST_BALL) == true) { break; } } if (iHero_2.b_snatch_ghostball == true) { if (Tc_SnatchBall(hHero_2,TC_GHOST_BALL) == true) { break; } } if(iHero_1.pos.x!=iGhostBall.pos.x || iHero_1.pos.y!=iGhostBall.pos.y) Tc_Move(hHero_1,GetBallDirection(&iHero_1,&iGhostBall)); Tc_Move(hHero_2,GetBallDirection(&iHero_1,&iGhostBall)); break; } case GHOSTBALL_IN_NO_TEAM: { if (iGameInfo.game_time_left>=89000) { if ((sqrt(double(iEnemy_1.pos.x-iGhostBall.pos.x))+sqrt(double(iEnemy_1.pos.y-iGhostBall.pos.y)))<=(sqrt(double(iEnemy_2.pos.x-iGhostBall.pos.x))+sqrt(double(iEnemy_2.pos.y-iGhostBall.pos.y)))) { Tc_Spell(hHero_2,hEnemy_1); } else { Tc_Spell(hHero_2,hEnemy_2); } } if (iHero_1.b_snatch_ghostball == false) { if(iHero_1.pos.x!=iGhostBall.pos.x || iHero_1.pos.y!=iGhostBall.pos.y) Tc_Move(hHero_1,GetBallDirection(&iHero_1,&iGhostBall)); } else { Tc_SnatchBall(hHero_1,TC_GHOST_BALL); } if (iHero_2.b_ghostball == false) { if(iHero_2.pos.x!=iGhostBall.pos.x || iHero_2.pos.y!=iGhostBall.pos.y) Tc_Move(hHero_2,GetBallDirection(&iHero_2,&iGhostBall)); } else { Tc_SnatchBall(hHero_2,TC_GHOST_BALL); } break; } default: { break; } } }