Skip to content

buggly behaviour in SelectHeroSkill #189

@shuen4

Description

@shuen4

opening issue instead of pr due to no idea how to write it

before learning/levelup ability, internal code check if any condition meet:

  1. ability(1) not exist
  2. ability (returned by 1) not yet reach its max level

(1): this check include item ability and ignore ability ID(called alias in internal)
if such case occur this native might behave wrongly than expected e.g:

  1. current ability(2) level up to a invalid level (> max level) does not seem going to happen
  2. do nothing

(2): this check has nothing wrong (exclude item ability, and does check for ability ID)
except: AUfa is treated as AUfu (probably because ROC/TFT ?)
this will cause issue if hero ability list's AUfu in front of AUfa (learn/level up AUfa will learn/level up AUfu instead, and when AUfu in max levels, do nothing)

AUfa replace to AUfu is done before perform learn/level up
some simple code for this behavior:

int get_index(uint32_t ability_id) {
    for (int i = 0; i < heroAbilList_count; i++)
        if (ability_id == heroAbilList[i] || (ability_id == 'AUfa' && heroAbilList[i] == 'AUfu'))
            return i;
    return -1;
}
// ...
// from SelectHeroSkill
auto ability_1 = ...;
if (ability_1 && ability_1->GetLevel() >= ability_1->GetMaxLevels() - 1)
    return;
// called from any place when learn/level up ability
int index = get_index(...);
if (index != -1) {
    // learn ability or level up
    auto ability_2 = ...;
    if (ability_2)
        ability_2->IncreaseLevel();
    else
        ability_2 = hero->AddAbility(heroAbilList[index]);
    hero->DispatchTriggerEventHeroSkill(ability_2->GetLevel());
}
// ...

first one affect only learning skill by SelectHeroSkill
second one affact learning skill by any means (include AI)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions