Jump to content

Help Understanding FindAffect Function in C++ Code When Using Blend Item


Go to solution Solved by Amun,

Recommended Posts

Hi everyone,

I’m currently working on some C++ code for Metin2 and came across a section I’m having trouble understanding. Here’s the relevant part of the code:

if (FindAffect(affect_type, apply_type))
{
    ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù."));
}
else
{
    if (FindAffect(AFFECT_EXP_BONUS_EURO_FREE, POINT_RESIST_MAGIC))
    {
        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù."));
    }
    else
    {
        AddAffect(affect_type, apply_type, apply_value, 0, apply_duration, 0, false);
        item->SetCount(item->GetCount() - 1);
    }
}

 

I understand the general structure of checking for existing effects before applying new ones, but I’m specifically puzzled by the second condition:
 

if (FindAffect(AFFECT_EXP_BONUS_EURO_FREE, POINT_RESIST_MAGIC))

Could someone explain the purpose of this specific "FindAffect" check? Thanks in advance!

  • Metin2 Dev 1
Link to comment
Share on other sites

  • Contributor
  • Solution

That's part of the ITEM_BLEND, which are the potions that offer attack, critical, magic resistance, etc.

It basically says that you can't use any other potion of that kind(ITEM_BLEND) after using a magic resistance one. 

 

Why? No idea what the actual intention was, but I remember that all the players were using that potion last because of this.

Can you remove it? Yes, and it would probably make sense to do so.

Link to comment
Share on other sites

2 hours ago, Amun said:

That's part of the ITEM_BLEND, which are the potions that offer attack, critical, magic resistance, etc.

It basically says that you can't use any other potion of that kind(ITEM_BLEND) after using a magic resistance one. 

 

Why? No idea what the actual intention was, but I remember that all the players were using that potion last because of this.

Can you remove it? Yes, and it would probably make sense to do so.

thank you for the answer.

In the description of the blend item that provides magic resistance, I noticed a statement about it being increased by a percentage. However, when I examined the code and the proto, it was being increased by a fixed value.

The only explanation I could find is that if the blend item increases magic resistance by a percentage, it prevents excessive value increases that might occur if magic resistance has already been boosted by the "AFFECT_EXP_BONUS_EURO_FREE" type of affect.

 

Quote

Can you remove it? Yes, and it would probably make sense to do so.


i think i'll follow this way.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.