Jump to content

[C++] Block critical/penetration in duel


tierrilopes

Recommended Posts

NOTE: The following must be done twice because theres two occurrences of each "Look for" inside of the CHARACTER::Damage.

Go to file char_battle.cpp

Inside:

bool CHARACTER::Damage (LPCHARACTER pAttacker, int dam, EDamageType type)

Look for:

                        IsCritical = true;
                        dam *= 2;
                        EffectPacket (SE_CRITICAL);
                        if (IsAffectFlag (AFF_MANASHIELD)) {
                            RemoveAffect (AFF_MANASHIELD);
                        }


Replace with:
                    

LPCHARACTER ch = quest::CQuestManager::instance().GetCurrentCharacterPtr();
                    if (CPVPManager::Instance().IsFighting (ch)) {
                        IsCritical = false;
                        ChatPacket (CHAT_TYPE_INFO, "[Debug] A critical hit has been denied."); //You can remove this, is here for debug purposes to see if was working
                    }
                    else {
                        IsCritical = true;
                        dam *= 2;
                        EffectPacket (SE_CRITICAL);
                        if (IsAffectFlag (AFF_MANASHIELD)) {
                            RemoveAffect (AFF_MANASHIELD);
                        }
                    }

Look for:

                        IsPenetrate = true;
                        if (test_server) {
                            ChatPacket (CHAT_TYPE_INFO, LC_TEXT ("°üÅë Ãß°¡ µ¥¹ÌÁö %d"), GetPoint (POINT_DEF_GRADE) * (100 + GetPoint (POINT_DEF_BONUS)) / 100);
                        }
                        dam += GetPoint (POINT_DEF_GRADE) * (100 + GetPoint (POINT_DEF_BONUS)) / 100;
                        if (IsAffectFlag (AFF_MANASHIELD)) {
                            RemoveAffect (AFF_MANASHIELD);
                        }


                        
Replace with:

                    	LPCHARACTER ch = quest::CQuestManager::instance().GetCurrentCharacterPtr();
				if (CPVPManager::Instance().IsFighting (ch)) {
                        IsPenetrate = false;
                        ChatPacket (CHAT_TYPE_INFO, "[Debug] A penetration hit has been denied."); //You can remove this, is here for debug purposes to see if was working
                    }
                    else {
                        IsPenetrate = true;
                        if (test_server) {
                            ChatPacket (CHAT_TYPE_INFO, LC_TEXT ("°üÅë Ãß°¡ µ¥¹ÌÁö %d"), GetPoint (POINT_DEF_GRADE) * (100 + GetPoint (POINT_DEF_BONUS)) / 100);
                        }
                        dam += GetPoint (POINT_DEF_GRADE) * (100 + GetPoint (POINT_DEF_BONUS)) / 100;
                        if (IsAffectFlag (AFF_MANASHIELD)) {
                            RemoveAffect (AFF_MANASHIELD);
                        }
                    }


                    
Skip the following steps if you already installed IsFighting function.
Go to file pvp.cpp

Look for:
 

void CPVPManager::ConnectEx (LPCHARACTER pkChr, bool bDisconnect)

Add this BEFORE:

bool CPVPManager::IsFighting (LPCHARACTER pkChr)
{
    if (!pkChr) {
        return false;
    }
    return IsFighting (pkChr->GetPlayerID());
}

bool CPVPManager::IsFighting (DWORD dwPID)
{
    CPVPSetMap::iterator it = m_map_pkPVPSetByID.find (dwPID);
    if (it == m_map_pkPVPSetByID.end()) {
        return false;
    }
    TR1_NS::unordered_set<CPVP *>::iterator it2 = it->second.begin();
    while (it2 != it->second.end()) {
        CPVP *pkPVP = *it2++;
        if (pkPVP->IsFight()) {
            return true;
        }
    }
    return false;
}


Go to file pvp.h

Look for:
 

virtual ~CPVPManager();

Add this AFTER:
 

        bool            IsFighting (LPCHARACTER pkChr);
        bool            IsFighting (DWORD dwPID);

 

  • Like 2
  • Thanks 1
Link to comment
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...