Issue information

Issue ID
#3120
Status
Unable to Reproduce
Severity
None
Started
Hercules Elf Bot
May 24, 2009 16:30
Last Post
Hercules Elf Bot
Jun 23, 2012 9:24
Confirmation
N/A

Hercules Elf Bot - May 24, 2009 16:30

Originally posted by [b]PanA[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3120

Test:

Whitesmith
No any weapon
128 agi
131 dex
2 Medal of Honor (2725,Medal_Merchant,Medal of Honor, ...)
No any aspd buff

Result:

Asp = -6347.

Delay after skill - 66 second.
Unable to move and attack after normal attack - 66 second.

Because in status.c
CODE
// Basic ASPD value
int status_base_amotion_pc(struct map_session_data* sd, struct status_data* status)
{
    int amotion;
    
    // base weapon delay
    amotion = (sd->status.weapon < MAX_WEAPON_TYPE)
     ? (aspd_base[pc_class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
     : (aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype1] + aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype2])*7/10; // dual-wield
    
    // percentual delay reduction from stats
    amotion-= amotion * (4*status->agi + status->dex)/1000;
    
    // raw delay adjustment from bAspd bonus
    amotion+= sd->aspd_add;
    
    return amotion;
}
This function return amotion = -57.

But variable "status->amotion" is unsigned short (0...65535).
CODE
//For holding basic status (which can be modified by status changes)
struct status_data {
    unsigned int
        hp, sp,
        max_hp, max_sp;
    unsigned short
        str, agi, vit, int_, dex, luk,
        batk,
        matk_min, matk_max,
        speed,
        amotion, adelay, dmotion,
        mode;
    short
        hit, flee, cri, flee2,
        def2, mdef2,
        aspd_rate;
    unsigned char
        def_ele, ele_lv,
        size, race;
    signed char
        def, mdef;
    struct weapon_atk rhw, lhw; //Right Hand/Left Hand Weapon.
};


So amotion became (65536 - 57) = 65479

To prevent this in status.c should be:
CODE
// Basic ASPD value
int status_base_amotion_pc(struct map_session_data* sd, struct status_data* status)
{
    int amotion;
    
    // base weapon delay
    amotion = (sd->status.weapon < MAX_WEAPON_TYPE)
     ? (aspd_base[pc_class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
     : (aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype1] + aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype2])*7/10; // dual-wield
    
    // percentual delay reduction from stats
    amotion-= amotion * (4*status->agi + status->dex)/1000;
    
    // raw delay adjustment from bAspd bonus
    amotion+= sd->aspd_add;

    if (amotion < 0) amotion = 0;
    
    return amotion;
}

Hercules Elf Bot - Dec 9, 2011 4:47

Originally posted by [b]Ind[/b]
I couldn't reproduce this.