Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canuse attack #343

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

aaron-hwang
Copy link
Collaborator

Fixes #269

Copy link
Collaborator

@kdovtdc kdovtdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CanUse part looks fine to me – but I think with the way ExecuteAction was designed, we might also need to address the "fallback" logic now.

At the moment, if Skill is called, the ExecuteAction checks for canUseSkill first, and if it fails, falls back to using Attack (which is desired).
Now, if Attack is called but fails at canUseAttack (e.g. a Jingliu in her Enhanced state), ideally we want to fall back to Skill, otherwise we won't have anything to return.

For that, I wouldn't do a big refactor for now, as this part might (or might not) see an overhaul someday.

Comment on lines +86 to +89
canUseAttack, err := mgr.engine.CanUseAttack(id)
if err != nil || !canUseAttack {
return target.ExecutableAction{}, err
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to return a custom error message somewhere in case both canUseSkill and canUseAttack fail (which should never happen ingame)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CanUse field for Attack, similar to CanUse for Skill
2 participants