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

Check whether special is active by tag name or by id #3915

Closed
jostephd opened this issue Feb 9, 2019 · 4 comments · Fixed by #4476
Closed

Check whether special is active by tag name or by id #3915

jostephd opened this issue Feb 9, 2019 · 4 comments · Fixed by #4476
Labels
Engine General game engine issues that do not fit in any other category. Enhancement Issues that are requests for new features or changes to existing ones. Good first issue Issues deemed adequate for contributors without prior experience to work on. In-progress Issues for which a fix is currently being worked on. WML Issues involving the WML engine or WML APIs.

Comments

@jostephd
Copy link
Member

jostephd commented Feb 9, 2019

Currently, checking whether a weapon special is active is done by looking for a weapon special whose tag name or id match the specified value:

/**
* Returns whether or not @a *this has a special with a tag or id equal to
* @a special. If @a simple_check is set to true, then the check is merely
* for being present. Otherwise (the default), the check is for a special
* active in the current context (see set_specials_context), including
* specials obtained from the opponent's attack.
*/
bool attack_type::get_special_bool(const std::string& special, bool simple_check) const

For example, the initiative special in HttT would be matched by either special_active=initiative or special_active=firststrike:

[firststrike]
id=initiative
name= _ "initiative"
description= _ "All adjacent friendly units will strike first in melee combat, even when defending."
affect_self=no
[filter_second_weapon]
range=melee
[/filter_second_weapon]
[affect_adjacent]
[/affect_adjacent]
[/firststrike]

Which can be confusing, because some tag names are also used as ids:

[firststrike]
id=firststrike
name= _ "first strike"
description= _ "This unit always strikes first with this attack, even if they are defending."
[/firststrike]

It would be good to separate "search by tag name" and "search by id" and expose that in StandardWeaponFilter, as @gfgtdf said in #3800 (comment).

Labeling "Good first issue" since this isn't a difficult change, but it will require some work on the C++ side.

@jostephd jostephd added Enhancement Issues that are requests for new features or changes to existing ones. WML Issues involving the WML engine or WML APIs. Good first issue Issues deemed adequate for contributors without prior experience to work on. Engine General game engine issues that do not fit in any other category. labels Feb 9, 2019
newfrenchy83 added a commit to newfrenchy83/wesnoth that referenced this issue Feb 10, 2019
resolve wesnoth#3915 with add of special_id and special_tags( and idem for special_active)
@newfrenchy83
Copy link
Contributor

resolve in #3920

@newfrenchy83
Copy link
Contributor

@jostephd, please lookk also #4424, what this issue was reolved(or ot) BEFORE beta version

@jostephd jostephd added the In-progress Issues for which a fix is currently being worked on. label Oct 12, 2019
@jostephd jostephd added this to the pre-1.16.0 string freeze milestone Oct 12, 2019
@jostephd
Copy link
Member Author

Thanks for the reminder. Milestoned as requested.

jostephd added a commit that referenced this issue Oct 16, 2019
@jostephd
Copy link
Member Author

Reopening until documentation is updated, see #4424 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engine General game engine issues that do not fit in any other category. Enhancement Issues that are requests for new features or changes to existing ones. Good first issue Issues deemed adequate for contributors without prior experience to work on. In-progress Issues for which a fix is currently being worked on. WML Issues involving the WML engine or WML APIs.
Projects
None yet
2 participants