Issue information

Issue ID
#3272
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Jun 20, 2009 9:50
Last Post
Hercules Elf Bot
Jun 20, 2009 9:50
Confirmation
N/A

Hercules Elf Bot - Jun 20, 2009 9:50

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

CODE
static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
{
    TBL_MOB* md        = (TBL_MOB*)bl;
    struct block_list *tbl;
    int mobid        = va_arg(ap,int);
    int skillid        = va_arg(ap,int);
    int skilllv        = va_arg(ap,int);
    int casttime    = va_arg(ap,int);
    int cancel        = va_arg(ap,bool);
    int emotion        = va_arg(ap,int);
    int target        = va_arg(ap,int);

    if( md->class_ != mobid )
        return 0;

1->    if( md->ud.skilltimer != -1 ) // Cancel the casting skill.
1->        unit_skillcastcancel(bl,0);

    // 0:self, 1:target, 2:master, default:random
    switch( target )
    {
        case 0: tbl = map_id2bl(md->bl.id); break;
        case 1: tbl = map_id2bl(md->target_id); break;
        case 2: tbl = map_id2bl(md->master_id); break;
        default:tbl = battle_getenemy(&md->bl, DEFAULT_ENEMY_TYPE(md),skill_get_range2(&md->bl, skillid, skilllv)); break;
    }

2->    if( !tbl )
2->        return 0;
...


Is it done intentionally, that a monster, casting some skill, will cancel it with this function (1->), even if his target is undefined (2->)?
Maybe skill casting cancel function (1->) should be after (2->)?

Upd: And in this function there's also no skill id validation check (for example, skillid = 0 due to incorrect name or in some other case).

This post has been edited by Maistermind: Jun 20 2009, 02:53 AM