Jump to content

Official Like Absorbtion Calculation for Sash Combination


Recommended Posts

  • Premium

Hey guys,

with this snippet, the absorption chance is calculated nearly correctly using discrete distribution.
I quickly picked out the Lennt system and "adapted" it to it.
With other systems this shouldn't be too difficult either 🙂

in char_item.cpp

below #include "threeway_war.h"

#include <random>

replace

        switch (lVal)
        {
            case 2:
                {
                    lVal = SASH_GRADE_2_ABS;
                }
                break;
            case 3:
                {
                    lVal = SASH_GRADE_3_ABS;
                }
                break;
            case 4:
                {
                    lVal = number(SASH_GRADE_4_ABS_MIN, SASH_GRADE_4_ABS_MAX_COMB);
                }
                break;
            default:
                {
                    lVal = SASH_GRADE_1_ABS;
                }
                break;
        }
        
        SetSocket(SASH_ABSORPTION_SOCKET, lVal);

with

        long percentageAdd = 0;
        std::random_device rd;
        std::mt19937 gen(rd());
        std::discrete_distribution<> d({ 200, 100, 20, 10, 5, 1 });
        percentageAdd = d(gen);
        
        SetSocket(SASH_ABSORPTION_SOCKET, lVal + percentageAdd);

 

Absorption is possible from 0-5%.

You can adjust or expand the distribution here:

d({ 200, 100, 20, 10, 5, 1 });

 

  • Good 2
Link to comment
Share on other sites

  • Premium

 

3 hours ago, MrQuin said:

Rubinium says hi:
3VOlGcS.png

feel free to use it. i had it in my source for ages and someone asked me for this.

at least its an improvement for many who still use the lennt one.

if it´s not desired i won´t release such stuff.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Dislove 1
Link to comment
Share on other sites

  • Contributor
24 minutes ago, .colossus. said:

 

feel free to use it. i had it in my source for ages and someone asked me for this.

at least its an improvement for many who still use the lennt one.

if it´s not desired i won´t release such stuff.

Rubinium devs stole it from you i see.
KCGzfjo.png

Edited by Metin2 Dev
Core X - External 2 Internal

My only accounts are here and on M2D, Don't trust anyone else from other shitty sites.
266868740522639360.png

Link to comment
Share on other sites

how do i have to understand? sash scales from lvl 4 sashes are 11-25%, so how can i add this properly?

 

lVal = number(SASH_GRADE_4_ABS_MIN, SASH_GRADE_4_ABS_MAX_COMB);

1e0f1552ec.gif

did i miss something? xD

 

edit: interesting, it only gives the correct absorption when i use the npc to refine them, when i create them with command, it gives low values on it. Is this changeable? like i have higher sashes in chests and they get low values

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Premium
On 8/14/2021 at 10:04 PM, Mafuyu said:

how do i have to understand? sash scales from lvl 4 sashes are 11-25%, so how can i add this properly?

 

lVal = number(SASH_GRADE_4_ABS_MIN, SASH_GRADE_4_ABS_MAX_COMB);

1e0f1552ec.gif

did i miss something? xD

 

edit: interesting, it only gives the correct absorption when i use the npc to refine them, when i create them with command, it gives low values on it. Is this changeable? like i have higher sashes in chests and they get low values

this depends on your system.

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Active+ Member

😂

The code you posted can be explained like this: When I get a sash (mostly with /item command) I will get (1,2,3 or 4) absortion based on sash type (wtf???) and with that discrete_distribution I have a change to get +abs. Example: I have a small change to get a type 1 sash with 6 absortion 😂

Please don't copy code from other files if you don't know what it does. Rubinum used discrete_distribution when you combine two level 4 sashes for the +abs

PS: the code you posted is from item.cpp not char_item.cpp 

Edited by Abel(Tiger)
  • Metin2 Dev 1
  • Good 2
Link to comment
Share on other sites

Announcements



×
×
  • 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.