Jump to content
  • 0

Old Anti-Freeze


lLoydxx

Question


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  36
  • Reputation:   1
  • Joined:  10/30/20
  • Last Seen:  

In the past I used this formula to spend a little time with the frozen character.

But this formula is not being accepted when compiling the error emulator in the following name SCDEF_LVL_DIFF , below is the complete formula used. Could anyone help me make it work? Please.

Directory: src/map/status.cpp

 

    case SC_FREEZE:
            sc_def = status->mdef*100;
            sc_def2 = status->luk*10 + SCDEF_LVL_DIFF(bl, src, 99, 10); // error > SCDEF_LVL_DIFF <
            tick_def = status->luk*10 + status_get_lv(bl)*10 - status_get_lv(src)*10;
            if(status->luk >= 300) {
                tick_def2 = INT_MIN;
            } else {
            tick_def2 = status->luk*30;
            }
            break;

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  745
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

On 2/3/2022 at 12:10 PM, lLoydxx said:

In the past I used this formula to spend a little time with the frozen character.

But this formula is not being accepted when compiling the error emulator in the following name SCDEF_LVL_DIFF , below is the complete formula used. Could anyone help me make it work? Please.

Directory: src/map/status.cpp

 

    case SC_FREEZE:
            sc_def = status->mdef*100;
            sc_def2 = status->luk*10 + SCDEF_LVL_DIFF(bl, src, 99, 10); // error > SCDEF_LVL_DIFF <
            tick_def = status->luk*10 + status_get_lv(bl)*10 - status_get_lv(src)*10;
            if(status->luk >= 300) {
                tick_def2 = INT_MIN;
            } else {
            tick_def2 = status->luk*30;
            }
            break;

On Latest Rathena

/**
 * Applies SC defense to a given status change
 * This function also determines whether or not the status change will be applied
 * @param src: Source of the status change [PC|MOB|HOM|MER|ELEM|NPC]
 * @param bl: Target of the status change
 * @param type: Status change (SC_*)
 * @param rate: Initial percentage rate of affecting bl (0~10000)
 * @param tick: Initial duration that the status change affects bl
 * @param flag: Value which determines what parts to calculate. See e_status_change_start_flags
 * @return adjusted duration based on flag values
 */
t_tick status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, t_tick tick, unsigned char flag)
{
    /// Resistance rate: 10000 = 100%
    /// Example:    50% (5000) -> sc_def = 5000 -> 25%;
    ///                5000ms -> tick_def = 5000 -> 2500ms
    int sc_def = 0, tick_def = -1; // -1 = use sc_def
    /// Fixed resistance value (after rate calculation)
    /// Example:    25% (2500) -> sc_def2 = 2000 -> 5%;
    ///                2500ms -> tick_def2=2000 -> 500ms
    int sc_def2 = 0, tick_def2 = 0;

    struct status_data *status, *status_src;
    struct status_change *sc;
    struct map_session_data *sd;

    nullpo_ret(bl);
    if (src == NULL)
        return tick?tick:1; // This should not happen in current implementation, but leave it anyway



on old formula
 

//Applies SC defense to a given status change.
//Returns the adjusted duration based on flag values.
//the flag values are the same as in status->change_start.
int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, int tick, int flag) {
    //Percentual resistance: 10000 = 100% Resist
    //Example: 50% -> sc_def=5000 -> 25%; 5000ms -> tick_def=5000 -> 2500ms
    int sc_def = 0, tick_def = -1; //-1 = use sc_def
    //Linear resistance substracted from rate and tick after percentual resistance was applied
    //Example: 25% -> sc_def2=2000 -> 5%; 2500ms -> tick_def2=2000 -> 500ms
    int sc_def2 = 0, tick_def2 = -1; //-1 = use sc_def2

    struct status_data *st;
    struct status_change *sc;
    struct map_session_data *sd;

    nullpo_ret(bl);

    if(!src)
        return tick ? tick : 1; // If no source, it can't be resisted (NPC given)

/// Returns the 'bl's level, capped to 'cap'
#define SCDEF_LVL_CAP(bl, cap) ( (bl) ? (status->get_lv(bl) > (cap) ? (cap) : status->get_lv(bl)) : 0 )
/// Renewal level modifier.
/// In renewal, returns the difference between the levels of 'bl' and 'src', both capped to 'maxlv', multiplied by 'factor'
/// In pre-renewal, returns zero.
#if VERSION == 1
#define SCDEF_LVL_DIFF(bl, src, maxlv, factor) ((SCDEF_LVL_CAP((bl), (maxlv)) - SCDEF_LVL_CAP((src), (maxlv)) ) * (factor))
#else
#define SCDEF_LVL_DIFF(bl, src, maxlv, factor) 0
#endif

 

Edited by Bringer
Added Few Details
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  36
  • Reputation:   1
  • Joined:  10/30/20
  • Last Seen:  

@Bringer

How would this formula that I used in the past look like?

Please can someone help me urgently.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  745
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

54 minutes ago, lLoydxx said:

@Bringer

How would this formula that I used in the past look like?

Find all the codes of SCDEF_LVL_DIFF on old rathena

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...