// 초기화 할때 저항치를 계산해 둔다
void ZModule_Resistance::InitStatus()
{
	m_nFR = 0;
	m_nCR = 0;
	m_nPR = 0;
	m_nLR = 0;

	// 캐릭터가 아니라면 적절한방법으로 구해놓는다
	ZObject *pThisObj = MStaticCast(ZObject,m_pContainer);
	ZCharacterItem *pItems = pThisObj->GetItems();
	for(int i=0;i<MMCIP_END;i++)
	{
		ZItem *pItem = pItems->GetItem((CCMatchCharItemParts)i);
		if(pItem) {
			CCMatchItemDesc *pDesc = pItem->GetDesc();
			if(pDesc) {
				m_nFR += pDesc->m_nFR.Ref();
				m_nCR += pDesc->m_nCR.Ref();
				m_nLR += pDesc->m_nLR.Ref();
				m_nPR += pDesc->m_nPR.Ref();
			}
		}
	}

	m_nFR = max(min(m_nFR,100),0);
	m_nCR = max(min(m_nCR,100),0);
	m_nPR = max(min(m_nPR,100),0);
	m_nLR = max(min(m_nLR,100),0);
}
void ZCharacterObject::DrawEnchant(ZC_STATE_LOWER AniState_Lower,bool bCharged)
{
    ZItem* pItem = GetItems()->GetSelectedWeapon();

    if(!pItem || !pItem->GetDesc()) {
//		_ASSERT(0);
        return;
    }

    CCMatchItemDesc* pDesc = pItem->GetDesc();

    if (pDesc->m_nType.Ref() != MMIT_MELEE)
        return;

    if(m_pVMesh) {

        static rvector pOutPos[8];//º¸Åë ¾ç¼Õ ÃÖ´ë 4°³±îÁö¸¸ ¾´´Ù.

        bool bDoubleWeapon = m_pVMesh->IsDoubleWeapon();

        int cnt = m_pVMesh->GetLastWeaponTrackPos(pOutPos);

        bool bSlash = false;

        if( (AniState_Lower == ZC_STATE_SLASH) ||
                (AniState_Lower == ZC_STATE_JUMP_SLASH1) ||
                (AniState_Lower == ZC_STATE_JUMP_SLASH2) )
            bSlash = true;

        ZC_ENCHANT etype = GetEnchantType();

//		etype = ZC_ENCHANT_POISON;
//		etype = ZC_ENCHANT_COLD;
//		etype = ZC_ENCHANT_FIRE;
//		etype = ZC_ENCHANT_LIGHTNING;

        CCMatchItemDesc* pENDesc = GetEnchantItemDesc();
        if(pENDesc) {

            int nEFLevel = pENDesc->m_nEffectLevel.Ref();

            //		nEFLevel = 3;

            if( (nEFLevel > 2) || ((nEFLevel > 1) && bCharged ) )			// 3Àº Ç×»óº¸ÀÌ°í 2´Â ±â¸ð¾ÒÀ»¶§ ´Þ¸®¸é¼­µµ »Ñ¸®°í ´Ù´Ô..
            {
                EnChantMovingEffect(pOutPos,cnt,etype,bDoubleWeapon);		// Ä®µé°í ¶Ù¾î´Ù´Ò‹š..
            }

            if( bSlash )													// Ä® Èֵ見š...
            {
                EnChantSlashEffect(pOutPos,cnt,etype,bDoubleWeapon);
            }

            if( (nEFLevel > 1) || bCharged )								// ÀÌÆåÆ® ·¹º§ÀÌ 1º¸´Ù Å©°Å³ª ±â°¡ ¸ðÀÎ »óŶó¸é ÀÎþƮ ÀÌÆåÆ®
            {
                EnChantWeaponEffect(etype,nEFLevel);
            }
        }
    }
}
Esempio n. 3
0
bool ZCharacterItem::Reload()
{
	if ((m_nSelectedWeapon != MMCIP_PRIMARY) && (m_nSelectedWeapon != MMCIP_SECONDARY)) return false;

	ZItem* pItem = &m_Items[m_nSelectedWeapon];

	if (pItem->GetDesc() == NULL) return false;
	return pItem->Reload();
}
CCMatchItemDesc* ZCharacterObject::GetEnchantItemDesc()
{
    for(int i = MMCIP_CUSTOM1; i < MMCIP_CUSTOM2 + 1; i++)
    {
        ZItem *pItem = m_Items.GetItem((CCMatchCharItemParts)i);
        CCMatchItemDesc* pDesc = pItem->GetDesc();
        if( pDesc && pDesc->IsEnchantItem() ) return pDesc;
    }

    return NULL;
}
Esempio n. 5
0
bool ZWorldItem::ApplyWorldItem( ZCharacter* pCharacter )
{
	int max,maxBullet,maxMagazine,inc,currentBullet,currentMagazine;
	if( pCharacter == NULL || (
		(m_State != WORLD_ITEM_VALIDATE ) && (m_State != WORLD_ITEM_CANDIDATE)) )
		return false;	

	ZItem* pSeletedWeapon = 0;
	switch( m_Type ) 
	{
	case WIT_QUEST:
		break;
	case WIT_HP:
		pCharacter->SetHP( min(	 pCharacter->GetHP() + m_fAmount, pCharacter->GetMaxHP() ) );
		break;
	case WIT_AP:
		pCharacter->SetAP( min(	 pCharacter->GetAP() + m_fAmount, pCharacter->GetMaxAP() ) );
		break;
	case WIT_HPAP:
		pCharacter->SetHP( min(	 pCharacter->GetHP() + m_fAmount, pCharacter->GetMaxHP() ) );
		pCharacter->SetAP( min(	 pCharacter->GetAP() + m_fAmount, pCharacter->GetMaxAP() ) );
		break;
	case WIT_BULLET:
		pSeletedWeapon = pCharacter->GetItems()->GetSelectedWeapon();
		if( pSeletedWeapon && pSeletedWeapon->GetItemType() != MMIT_RANGE )
		{
			if( !pCharacter->GetItems()->GetItem(MMCIP_PRIMARY)->IsEmpty() )
				pSeletedWeapon = pCharacter->GetItems()->GetItem(MMCIP_PRIMARY);
			else if( !pCharacter->GetItems()->GetItem(MMCIP_PRIMARY)->IsEmpty() )
				pSeletedWeapon = pCharacter->GetItems()->GetItem(MMCIP_SECONDARY);
			else
				pSeletedWeapon = 0;
		}

		if( pSeletedWeapon )
		{
			currentBullet	= pSeletedWeapon->GetBulletCurrMagazine();		// 현재 착용한 탄창안의 총알수
			currentMagazine	= pSeletedWeapon->GetBulletSpare();				// 현재 착용하지 않은 탄창안의 총알수
			
			inc = pSeletedWeapon->GetDesc()->m_nMagazine.Ref();		// 총알 증가분
			max = pSeletedWeapon->GetDesc()->m_nMaxBullet.Ref();		// 전체 채워질수 있는 총알의 갯수

			maxBullet = min((max - currentMagazine),inc);
			maxMagazine = max - maxBullet;

			int nBullet = (int)m_fAmount;
			if( currentBullet < inc ) 
			{
				pSeletedWeapon->SetBulletCurrMagazine( maxBullet );				// 현재 탄창의 총알수 채우기			
				--nBullet;
			}

			if( nBullet > 0 )
				pSeletedWeapon->SetBulletSpare( min( ( nBullet*inc + currentMagazine ), maxMagazine));

			//// MEMORYHACK 방지엔진에 알려준다.
			//if (pCharacter->GetUID() == ZGetMyUID()) {
			//	MDataChecker* pChecker = ZGetGame()->GetDataChecker();
			//	pChecker->RenewCheck((BYTE*)pSeletedWeapon->GetBulletPointer(), sizeof(int));
			//	pChecker->RenewCheck((BYTE*)pSeletedWeapon->GetAMagazinePointer(), sizeof(int));
			//}
		}
		break;

	default:
		mlog("정의 되지 않은 아이템 타입입니다\n");
		return false;
	}

	if( pCharacter == ZGetGame()->m_pMyCharacter ) {
		ZGetSoundEngine()->PlaySound("fx_itemget");
	}

	return true;

}