コード例 #1
0
//0051dcd0	->
BOOL CObjBaseAttack::PkCheck(LPOBJ lpObj, LPOBJ lpTargetObj)
{
	if ( gLanguage == 0 || gLanguage == 2 || gLanguage == 4)
	{
		if ( lpObj->Type == OBJ_USER )
		{
			BOOL bPlayerKiller = FALSE; //Season 2.5 add-on
	
			if(lpObj->PartyNumber >= 0) //Season 2.5 add-on
			{
				if(gParty.GetPKPartyPenalty(lpObj->PartyNumber) >= 6)
				{
					bPlayerKiller = TRUE;
				}
			}
			else if(lpObj->m_PK_Level >= 6)
			{
				bPlayerKiller = TRUE;
			}

			if(bPlayerKiller == TRUE) //Season 2.5 add-on
			{
				if (lpObj->PartyNumber >= 0 )
				{
					if ( gPkLimitFree == FALSE )
					{
						return FALSE;
					}
				}
				else if ( lpObj->m_PK_Count >= 3 )
				{
					if ( gPkLimitFree == FALSE )
					{
						return FALSE;
					}
				}
			}
		}
	}

	if ( lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER)
	{
		if ( lpTargetObj->Level <= 5 || lpObj->Level <= 5 )
		{
			return FALSE;
		}

		if ( gObjGetRelationShip(lpObj, lpTargetObj) == 2 ) // Rivals
		{
			if ( gNonPK == FALSE )
			{
				return TRUE;
			}
		}

		if ( lpObj->lpGuild != NULL && lpTargetObj->lpGuild != NULL )
		{
			if ( lpObj->lpGuild->WarState == 1 && lpTargetObj->lpGuild->WarState == 1 )
			{
				if ( lpObj->lpGuild->Number == lpTargetObj->lpGuild->Number )
				{
					return FALSE;
				}
			}
		}

		if ( gObjTargetGuildWarCheck(lpObj, lpTargetObj) == FALSE && lpTargetObj->lpGuild != NULL && lpTargetObj->lpGuild->WarState != 0)
		{
			if ( lpTargetObj->lpGuild->WarType == 1 )
			{
				if ( lpTargetObj->MapNumber != 6 )
				{
					if ( !gNonPK )
					{
						return TRUE;
					}
				}
			}

			if ( CC_MAP_RANGE(lpTargetObj->MapNumber) == FALSE )
			{
				return FALSE;
			}
		}

		if ( IT_MAP_RANGE(lpObj->MapNumber) != FALSE ) //season2.5 add-on
		{
			//
		}
		else if ( CC_MAP_RANGE(lpObj->MapNumber) != FALSE )
		{
			if ( g_ChaosCastle.GetCurrentState(g_ChaosCastle.GetChaosCastleIndex(lpObj->MapNumber)) != 2 )
			{
				return FALSE;
			}
		}
		else if ( gNonPK != FALSE )
		{
			return FALSE;
		}

		if ( DS_MAP_RANGE(lpObj->MapNumber) ) // DEvil
		{
			return FALSE;
		}

		if ( BC_MAP_RANGE(lpObj->MapNumber) )
		{
			return FALSE;
		}

		if ( gObjDuelCheck(lpObj, lpTargetObj) == FALSE )
		{
			if ( gObjDuelCheck(lpTargetObj) )
			{
				return FALSE;
			}
		}

		if ( gLanguage == 0 || gLanguage == 2 )
		{
			BOOL bPlayerKiller = FALSE; //Season 2.5 add-on
	
			if(lpObj->PartyNumber >= 0) //Season 2.5 add-on
			{
				if(gParty.GetPKPartyPenalty(lpObj->PartyNumber) >= 6)
				{
					bPlayerKiller = TRUE;
				}
			}
			else if(lpObj->m_PK_Level >= 6)
			{
				bPlayerKiller = TRUE;
			}

			if(bPlayerKiller == TRUE) //Season 2.5 add-on
			{
				if (lpObj->PartyNumber >= 0 )
				{
					if ( gPkLimitFree == FALSE )
					{
						return FALSE;
					}
				}
				else if ( lpObj->m_PK_Count >= 3 )
				{
					if ( gPkLimitFree == FALSE )
					{
						return FALSE;
					}
				}
			}

			bPlayerKiller = FALSE; //Season 2.5 add-on
	
			if(lpTargetObj->PartyNumber >= 0) //Season 2.5 add-on
			{
				if(gParty.GetPKPartyPenalty(lpTargetObj->PartyNumber) >= 6)
				{
					bPlayerKiller = TRUE;
				}
			}
			else if(lpTargetObj->m_PK_Level >= 6)
			{
				bPlayerKiller = TRUE;
			}

			if(bPlayerKiller == 1) //Season 2.5 add-on
			{
				if (lpTargetObj->PartyNumber >= 0 )
				{
					if ( gPkLimitFree == FALSE )
					{
						if(g_CastleSiege.GetCastleState() != CASTLESIEGE_STATE_STARTSIEGE)
						{
							return FALSE;
						}
					}
				}
				else if ( lpTargetObj->m_PK_Count >= 3 )
				{
					if ( gPkLimitFree == FALSE )
					{
						if(g_CastleSiege.GetCastleState() != CASTLESIEGE_STATE_STARTSIEGE)
						{
							return FALSE;
						}
					}
				}
			}


		}
	}
	return TRUE;
}
コード例 #2
0
// ----------------------------------------------------------------------------------------------------------------------
void CDarkSpirit::ModeAttackRandom()
{
	LPOBJ lpObj = &gObj[this->m_iMasterIndex];
	int tObjNum;
	int count = 0;
	int FindObj[MAX_VIEWPORT];
	int FindObjCount = 0;
	int dis;
	int DuelIndex = lpObj->m_iDuelUser;
	BOOL EnableAttack;
	int criticaldamage = 0;

	if ( (rand()%10) < 3 )
	{
		criticaldamage = 1;
	}

	while ( true )
	{
		if ( lpObj->VpPlayer2[count].state != 0 )
		{
			if ( lpObj->VpPlayer2[count].type == OBJ_MONSTER )
			{
				tObjNum = lpObj->VpPlayer2[count].number;

				if ( tObjNum >= 0 )
				{
					EnableAttack = FALSE;

					if ( gObj[tObjNum].Life > 0.0f && (gObj[tObjNum].Class < 100 || gObj[tObjNum].Class  > 110 ) )
					{
						if ( lpObj->VpPlayer2[count].type == OBJ_MONSTER && gObj[tObjNum].m_RecallMon < 0)
						{
							EnableAttack = TRUE;
						}
						else if ( DuelIndex == tObjNum )
						{
							EnableAttack = TRUE;
						}
						else
						{
							int lc85 = gObj[tObjNum].m_Index;

							if ( gObj[tObjNum].Type == OBJ_MONSTER )
							{
								if ( gObj[tObjNum].m_RecallMon >= 0 )
								{
									lc85 = gObj[gObj[tObjNum].m_RecallMon].m_Index; 
								}
							}

							if ( gObjTargetGuildWarCheck(lpObj, &gObj[lc85]) == TRUE )
							{
								EnableAttack = TRUE;
							}
						}

						if ( EnableAttack != FALSE )
						{
							if ( lpObj->MapNumber == gObj[tObjNum].MapNumber )
							{
								dis = gObjCalDistance(lpObj, &gObj[tObjNum]);

								if ( dis < RAVEN_ATTACK_DISTANCE-2 )
								{
									FindObj[FindObjCount] = tObjNum;
									FindObjCount++;
								}
							}
						}
					}
				}
			}
		}

		count++;

		if ( count > MAX_VIEWPORT-1 )
		{
			break;
		}
	}

	if ( FindObjCount != 0 )
	{
		if ( criticaldamage != 0 )
		{
			int target = FindObj[rand()%FindObjCount];
			this->SendAttackMsg( lpObj->m_Index, target, criticaldamage, 0);
		}
		else
		{
			int target = FindObj[rand()%FindObjCount];
			this->RangeAttack( lpObj->m_Index, target);
		}
	}
}
コード例 #3
0
// ----------------------------------------------------------------------------------------------------------------------
void CDarkSpirit::RangeAttack(int aIndex, int aTargetIndex)
{
	LPOBJ lpObj = &gObj[aIndex];
	int StartDis = 1;
	int tObjNum;
	int count = 0;
	int loopcount = 0;
	int attackcheck;
	int EnableAttack;
	int HitCount = 0;

	this->SendAttackMsg(lpObj->m_Index, aTargetIndex, 0, 0);

	while ( true )
	{
		if ( lpObj->VpPlayer2[count].state != 0 )
		{
			tObjNum = lpObj->VpPlayer2[count].number;

			if ( tObjNum >= 0 && aTargetIndex != tObjNum )
			{
				EnableAttack = FALSE;
				
				if ( lpObj->VpPlayer2[count].type == OBJ_MONSTER && gObj[tObjNum].m_RecallMon < 0)
				{
					EnableAttack = TRUE;
				}
				else if ( tObjNum == aTargetIndex )
				{
					EnableAttack = TRUE;
				}
				else
				{
					int lc10 = gObj[tObjNum].m_Index;

					if ( gObj[tObjNum].Type == OBJ_MONSTER )
					{
						if ( gObj[tObjNum].m_RecallMon >= 0 )
						{
							lc10 = gObj[gObj[tObjNum].m_RecallMon].m_Index;
						}
					}

					if ( gObjTargetGuildWarCheck(lpObj, &gObj[lc10]) == TRUE )
					{
						EnableAttack = TRUE;
					}
				}

				if ( EnableAttack != FALSE )
				{
					attackcheck = FALSE;

					if ( loopcount == 0 )
					{
						attackcheck = TRUE;
					}
					else if ( (rand()%3) == 0 )
					{
						attackcheck = TRUE;
					}

					if ( attackcheck != FALSE )
					{
						if ( gObjCalDistance(&gObj[aTargetIndex], &gObj[tObjNum]) < RAVEN_ATTACK_DISTANCE-3 )
						{
							this->SendAttackMsg(lpObj->m_Index, tObjNum, 2, 0);
							HitCount++;

							if ( HitCount > 3 )
							{
								break;
							}
						}
					}
				}
			}				
		}

		count++;

		if ( count > MAX_VIEWPORT-1 )
		{
			break;
		}
	}
}
コード例 #4
0
bool CObjBaseAttack::PkCheck(LPOBJ lpObj, LPOBJ lpTargetObj)
{
	/*if ( gLanguage == 0 || gLanguage == 2 || gLanguage == 4)
	{
		if ( lpObj->Type == OBJ_USER )
		{
			if (lpObj->m_PK_Level >= 6 )
			{
				if ( lpObj->m_PK_Count >= 3 )
				{
					if ( gPkLimitFree == FALSE )
					{
						return false;
					}
				}
			}
		}
	}*/

	if ( lpObj->Type == OBJ_USER && lpTargetObj->Type == OBJ_USER)
	{
		if ( lpTargetObj->Level <= 5 || lpObj->Level <= 5 )
		{
			return false;
		}
		else if ( gObjGetRelationShip(lpObj, lpTargetObj) == 2 ) // Rivals
		{
			/*if ( gNonPK == FALSE )
			{
				return true;
			}*/
		}
		else if ( lpObj->lpGuild != NULL && lpTargetObj->lpGuild != NULL )
		{
			if ( lpObj->lpGuild->WarState == 1 && lpTargetObj->lpGuild->WarState == 1 )
			{
				if ( lpObj->lpGuild->Number == lpTargetObj->lpGuild->Number )
				{
					return false;
				}
			}
		}
		
		if ( gObjTargetGuildWarCheck(lpObj, lpTargetObj) == FALSE && lpTargetObj->lpGuild != NULL && lpTargetObj->lpGuild->WarState != 0)
		{
			if ( lpTargetObj->lpGuild->WarType == 1 )
			{
				if ( lpTargetObj->MapNumber != 6 )
				{
					/*if ( !gNonPK )
					{
						return true;
					}*/
				}
			}

			if ( gUser.ChaosCastleMapRange(lpTargetObj->MapNumber) == false )
			{
				return false;
			}
		}

		if ( gUser.ChaosCastleMapRange(lpObj->MapNumber) == true )
		{
			if ( g_ChaosCastle.GetCurrentState(g_ChaosCastle.GetChaosCastleIndex(lpObj->MapNumber)) != 2 )
			{
				return FALSE;
			}
		}
		/*else if ( gNonPK != FALSE )
		{
			return false;
		}*/

		if ( DS_MAP_RANGE(lpObj->MapNumber) ) // DEvil
		{
			return false;
		}

		if ( gUser.BloodCastleMapRange(lpObj->MapNumber) == true )
		{
			return false;
		}

		if ( gDuel.AreOnDuel(lpObj, lpTargetObj) == false )
		{
			if ( gDuel.IsOnDuel(lpTargetObj) == true )
			{
				return false;
			}
		}

		if ( gLanguage == 0 || gLanguage == 2 )
		{
			if (lpObj->m_PK_Level >= 6 )
			{
				if ( lpObj->m_PK_Count >= 3 )
				{
					/*if ( gPkLimitFree == FALSE )
					{
						return false;
					}*/
				}
			}
			
			if (lpTargetObj->m_PK_Level >= 6 )
			{
				if ( lpTargetObj->m_PK_Count >= 3 )
				{
					/*if ( gPkLimitFree == FALSE )
					{
#if(GS_CASTLE)
						if(g_CastleSiege.GetCastleState() != 7)
						{
							return false;
						}
#else
						return false;
#endif
					}*/
				}
			}

		}
	}
	return true;
}