⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 npc_18.cpp

📁 国内著名网络游戏dragon的客户端登陆用完整源码 配套一起上传的服务端部分可开服 无说明文档
💻 CPP
📖 第 1 页 / 共 4 页
字号:
					}
					break;					
				}						
										
				if( n->bossid != -1)								
				{											
					LPCHARACTER tch = ReturnCharacterPoint( n->bossid );
					if( tch )								
					if( !IsDead( tch ) )// 趣矫 Boss啊 磷栏搁....
					{												
						LPCHARACTER tch = Hero; // ReturnCharacterPoint( n->bossid );
						while( tch )
						{				
							if( tch->type == SPRITETYPE_MONSTER && !IsDead( tch ) )
							{
								if( tch->bossid == n->bossid )
								{
											tch->bossid   = -1;
											tch->targetid = -1;
											tch->patterntype = NPC_PATTERN_BACKDRAW_8_;
											SendNPC_parameter( n->id, NPC_PARAMETER_BOSSID, n->bossid);
											SendNPC_parameter( n->id, NPC_PARAMETER_TARGETID, n->targetid );

								}
							}
							tch = tch->lpNext;
						}
						break;								
					}						
				}							
												
												
				if( NPC_IsAttackableRange( n )  )// 傍拜 啊瓷茄 芭府鳖瘤 吭唱 ?
				{											
ATTACK_8_NEXT__:					
					if( NPC_StillAttack(n) )
					{											
						SendNPCAttack( n->id );
						n->attackcount ++;
					}								
					else							
					{			
						int ex, ey;
						LPCHARACTER tempch = ReturnCharacterPoint( n->targetid );
						if( NPC_NearBackCh( n, tempch, &ex, &ey, 5 ) )
						{										
							n->MoveP = 60 + Random(30 );
							NPC_MakePath( n, ex, ey, Random(2)+2 );

						}									
						else						
						{							
							n->patterntype =NPC_PATTERN_TOBOSS_8_;		//WANDER_8_;

						}		
					}			
				}				
				else			
				{				

Attack_access_pc_:
					if( n->targetid != -1 )
					{	
						int ex, ey;
						LPCHARACTER tempch = ReturnCharacterPoint( n->targetid );
						if( !IsDead( tempch )) 
						{		
							if( NPC_NearCh( n, tempch, &ex, &ey ) )
							{		
								//if( NPC_EnemyOnMyWay( 		
								// 聪刀匙 傍拜惑措俊霸 立辟窍扁 困茄 风凭阑 持绰促. ( 'ぁ' 'い'栏肺 

								NPC_MakePath( n, ex, ey, Random(6)+2 );
								
							}			
							else		
							{	
//								n->patterntype = NPC_PATTERN_WANDER_8_;

//								n->bossid	 = -1;
//								n->id = -1;
//								JustMessage( " %d狼 Pattern锅龋 %d ", n->id, n->patterntype );
//								JustMessage( " %d狼 Pattern锅龋 %d ", n->patterntype );
							}				
						}
						else 
						{
							n->patterntype =NPC_PATTERN_TOBOSS_8_;		//WANDER_8_;

						}
					}					
					else
					{
						n->targetid = NPC_IsWhoNearPC( n, 10 );
						if( n->targetid != -1 ) goto Attack_access_pc_;
						else 
						{
						}
					}
				}
			}						
			break;					
								
		case NPC_PATTERN_BACKDRAW_8_ :
			{					
			if( g_ClientTime - n->aitimedelay > n->aidelayhowmuch ) 
			{	
				n->aitimedelay = g_ClientTime;
				n->aidelayhowmuch = 1500  + (rand()%500);

								
					if( NPC_IsMoving( n ) )
					{			
								
					}			
					else		
					{			
						if( n->targetid != -1 )
						{		
							int ex, ey;
							LPCHARACTER tempch = ReturnCharacterPoint( n->targetid );
							if( InDistance( n, tempch,  TILE_SIZE * 10 ) )	// 弊 PC啊  10 鸥老救俊 乐促搁.
							{	
								if( NPC_NearBackCh( n, tempch, &ex, &ey, 7 ) )
								{	
									n->MoveP = 60 + Random(30 );
									NPC_MakePath( n, ex, ey, Random(5)+5 );
								}	
								else 
								{
								
								}
							}
							else	// 面盒洒 钢府乐焙.
							{
								n->patterntype = NPC_PATTERN_WANDER_8_;

							}
						}		
						else	
						{		
							n->patterntype = NPC_PATTERN_WANDER_8_;
						}		
					}				
				}				
				break;			
			}				

	} // switch
}

////////////////////////////////////////////////////////////////////////////////////////////////

void NPC_Pattern_18( CHARACTER *n )
{
//	int movep;
	int ex, ey;
				
	switch( n->patterntype )
	{			
	case NPC_PATTERN_WANDER_18_ :
		{		
			int bossid;
			int attacker = NPC_WhoIsAttackMyBaby( n );
				
			if( n->attacked != -1 ) 
			{	
				n->patterntype = NPC_PATTERN_ATTACK_PC_18_;
				break;
			}	
				
			if( g_ClientTime - n->aitimedelay > n->aidelayhowmuch ) 
			{	
				n->aitimedelay = g_ClientTime;
				n->aidelayhowmuch = 100 + (rand()%100);
				// 弊成 硅雀茄促. 
				if( NPC_IsMoving( n ) )
				{
				}
				else 
				{
					bossid = NPC_WhoIsBoss( n );
					if( bossid != -1 )	// Yes.. 焊胶甫 茫疽绢!!
					{	
						if( bossid != n->id )	// 澜. 唱焊促 Exp啊 臭篮 仇捞 乐焙.. 
						{
							n->bossid = bossid;
							n->patterntype = NPC_PATTERN_TOBOSS_18_;
							n->targetid = -1;
							SendNPC_parameter( n->id, NPC_PARAMETER_BOSSID, n->bossid);
							SendNPC_parameter( n->id, NPC_PARAMETER_TARGETID, n->targetid );

							break;
						}
						else  // 郴啊 Boss捞促. 
						{
							n->bossid = bossid;
							n->patterntype = NPC_PATTERN_IAM_BOSS_18_;
							n->targetid = -1;
							SendNPC_parameter( n->id, NPC_PARAMETER_BOSSID, n->bossid);
							SendNPC_parameter( n->id, NPC_PARAMETER_TARGETID, n->targetid );
							break;
						}
					}
					else	// 雷. 焊胶啊 绝绢...
					{
						int dir;
						int how;
						int tx, ty;
							
						dir = Random(8);
						how = Random(4)+2;
						tx = n->x/TILE_SIZE;
						ty = n->y/TILE_SIZE;
						switch( dir )
						{
							case 0 :			ty +=how; break;
							case 1 : tx -=how;	ty +=how; break;
							case 2 : tx -=how;            break;
							case 3 : tx -=how;	ty -=how; break;
							case 4 :			ty -=how; break;
							case 5 : tx +=how;	ty -=how; break;
							case 6 : tx +=how;		      break;
							case 7 : tx +=how;	ty +=how; break;
						}
									
						NPC_MakePathBumn( n, tx, ty, how );
					}
				}
			}	
		}		
		break;	
				
	case NPC_PATTERN_IAM_BOSS_18_ :
		{		
			int bossid;
				
			if( g_ClientTime - n->aitimedelay > n->aidelayhowmuch ) 
			{	
				n->aitimedelay = g_ClientTime;
				n->aidelayhowmuch = 100  + (rand()%400);
				if( NPC_IsMoving( n ) )
				{
				}
				else 
				{
					int attacker = NPC_WhoIsAttackMyBaby( n );
					if( attacker != -1) // 郴 酒啊甸吝 嘎绰局啊 乐栏搁..
					{
						LPCHARACTER tch = Hero; // ReturnCharacterPoint( n->bossid );
						while( tch )
						{				
							if( tch != n )
							if( tch->type == SPRITETYPE_MONSTER && !IsDead( tch ) )
							{
								if( tch->bossid == n->id )
								{
									tch->targetid		= attacker;
									tch->patterntype	= NPC_PATTERN_ATTACK_PC_18_;
								}
							}
							tch = tch->lpNext;
						}
					}
					else
					{
					}
					
				
					bossid = NPC_WhoIsBoss( n );
					if( bossid == -1 )	 // 唱去磊焙..
					{	
						n->patterntype	= NPC_PATTERN_WANDER_18_;
						
						n->targetid		= -1;
						n->bossid		= -1;
						SendNPC_parameter( n->id, NPC_PARAMETER_BOSSID, n->bossid);
						SendNPC_parameter( n->id, NPC_PARAMETER_TARGETID, n->targetid );

						break;
					}
					else if( bossid != n->id )	// dld澜. 唱焊促 Exp啊 臭篮 仇捞 乐焙.. 
					{
							n->bossid		= bossid;
							n->patterntype	= NPC_PATTERN_TOBOSS_18_;
							SendNPC_parameter( n->id, NPC_PARAMETER_BOSSID, n->bossid);
									
							break;
					}
					else  // 开浆 郴啊 Boss促 !  弊烦 焊胶狼 老阑 秦具瘤.
					{
						n->bossid = bossid;
						n->targetid = NPC_IsWhoNearPC( n, 10 );
						SendNPC_parameter( n->id, NPC_PARAMETER_BOSSID, n->bossid);
						SendNPC_parameter( n->id, NPC_PARAMETER_TARGETID, n->targetid );
					
						if( n->targetid != -1 )
						{
							LPCHARACTER tch = ReturnCharacterPoint( n->targetid );
							if( InDistance( n, tch, TILE_SIZE * 10 ) )	// 弊 PC啊  5 鸥老救俊 乐促搁.
							{	
								LPCHARACTER tempch = Hero;
								while( tempch )
								{
									if( tempch != n )
									if( tempch->type == SPRITETYPE_MONSTER && !IsDead( tempch ))
									{
										if( tempch->bossid == n->bossid )
										{
											tempch->targetid	= n->targetid;
											SendNPC_parameter( tempch->id, NPC_PARAMETER_TARGETID, tempch->targetid );

											tempch->patterntype = NPC_PATTERN_ACCESS_PC_18_;
										}
									}
									tempch = tempch->lpNext;
								}
								break;
							}
							else if( !InDistance( n, tch,  TILE_SIZE * 15 ) )	// 弊 PC啊  15 鸥老救俊 绝促搁..
							{
								LPCHARACTER tempch = Hero;
								while( tempch )
								{
									if( tempch != n )
									if( tempch->type == SPRITETYPE_MONSTER && !IsDead( tempch ))
									{
										if( tempch->bossid == n->id )
										{
											LPCHARACTER temp2ch = ReturnCharacterPoint(n->bossid );
											if( NPC_NearPosition( tempch, temp2ch, &ex, &ey ))
											{
												tempch->targetid = n->targetid;
												SendNPC_parameter( tempch->id, NPC_PARAMETER_TARGETID, n->targetid );

												tempch->patterntype = NPC_PATTERN_TOBOSS_18_;
												tempch->MoveP = 60 + Random(30 );
												NPC_MakePath( tempch, ex, ey, Random(6) + 2 );
												break;
											}
										}
									}
									tempch = tempch->lpNext;
								}
							}
							else
							{
								if( Random(5) == 0 )
								{// 焊胶瘤父 距埃究 巩流牢促. 
									int dir;
									int how;
									int tx, ty;
				
									dir = Random(8);
									how = Random(2)+2;
									tx = n->x/TILE_SIZE;
									ty = n->y/TILE_SIZE;
									switch( dir )
									{
										case 0 :			ty +=how; break;
										case 1 : tx -=how;	ty +=how; break;
										case 2 : tx -=how;            break;
										case 3 : tx -=how;	ty -=how; break;
										case 4 :			ty -=how; break;
										case 5 : tx +=how;	ty -=how; break;
										case 6 : tx +=how;		      break;
										case 7 : tx +=how;	ty +=how; break;
									}
							
									NPC_MakePathBumn( n, tx, ty, how );

								}
								// 澜.. 酒穿巴档 窍瘤臼绰促. 
							}
						}
						else	// 促矫 焊胶俊霸肺 葛捞扼绊 茄促. 
						{
						}
					}
				}
			}
		}	
		break;
			
	case NPC_PATTERN_TOBOSS_18_ :
		{	
			int bossid;
			
			if( g_ClientTime - n->aitimedelay > n->aidelayhowmuch ) 
			{	
				n->aitimedelay = g_ClientTime;
				n->aidelayhowmuch = 1000  + (rand()%400);
					
				if( NPC_IsMoving( n ) )
				{
						
				}
				else 
				{
					if( NPC_IsInBossRange( n ) )	// Boss救俊 甸绢吭栏搁..
					{
						bossid = NPC_WhoIsBoss( n );
						if( bossid != -1 )	
						{	
							if( bossid != n->id )	// 澜. 唱焊促 Exp啊 臭篮 仇捞 乐焙.. 
							{
								n->bossid = bossid;
								n->patterntype = NPC_PATTERN_TOBOSS_18_;
								SendNPC_parameter( n->id, NPC_PARAMETER_BOSSID, n->bossid);
		

								
								goto TO_BOSS_;
							}
							else  // 郴啊 Boss捞促. 
							{
								n->bossid = bossid;
								n->patterntype = NPC_PATTERN_IAM_BOSS_18_;
								n->targetid = -1;
								SendNPC_parameter( n->id, NPC_PARAMETER_BOSSID, n->bossid);
								SendNPC_parameter( n->id, NPC_PARAMETER_TARGETID, n->targetid );
							}
						}
						else 
						{
							n->patterntype = NPC_PATTERN_WANDER_18_;
							
							n->targetid = -1;
							n->bossid = -1;
							SendNPC_parameter( n->id, NPC_PARAMETER_BOSSID, n->bossid);
							SendNPC_parameter( n->id, NPC_PARAMETER_TARGETID, n->targetid );

							break;
						}
					}
					else //  Boss扮栏肺 啊具瘤...
					{
TO_BOSS_:
						if( n->bossid != -1 )
						{
							int ex, ey;
							LPCHARACTER tempch = ReturnCharacterPoint( n->bossid );

							if( NPC_NearPosition( n, tempch, &ex, &ey ))
							{
								 NPC_MakePath( n, ex, ey, Random(6) + 2 );
									break;
							}
						}
						else
						{
							int targetid = NPC_IsWhoNearPC( n, 10 );
							if( targetid != -1 )
							{
								if (n->bossid != -1 )
								{
									LPCHARACTER tempch = Hero;
									while( tempch )
									{
										if( tempch->type == SPRITETYPE_MONSTER && !IsDead( tempch ))
										{
											if( tempch->bossid == n->bossid )
											{
												tempch->targetid = targetid;
												SendNPC_parameter( tempch->id, NPC_PARAMETER_TARGETID, targetid );
												tempch->patterntype = NPC_PATTERN_ATTACK_PC_18_;
											}
										}

										tempch  = tempch->lpNext;
									}
									///
								}
								else 
								{
									n->patterntype = NPC_PATTERN_WANDER_18_;
									n->bossid = -1;
									n->targetid = -1;
									SendNPC_parameter( n->id, NPC_PARAMETER_BOSSID, n->bossid);
									SendNPC_parameter( n->id, NPC_PARAMETER_TARGETID, n->targetid );

								}
							}
							else 
							{
									n->patterntype = NPC_PATTERN_WANDER_18_;
									n->bossid = -1;
									n->targetid = -1;
									SendNPC_parameter( n->id, NPC_PARAMETER_BOSSID, n->bossid);
									SendNPC_parameter( n->id, NPC_PARAMETER_TARGETID, n->targetid );
	
							}
						}
					}	
				}		
			}			
		}				
		break;			
						
		//	公府瘤绢促囱促... 8
		case NPC_PATTERN_MURI_18_ :
		{				

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -