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

Comments

@jostephd
Copy link
Member

@jostephd 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.

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

This comment has been minimized.

Copy link
Contributor

@newfrenchy83 newfrenchy83 commented Feb 10, 2019

resolve in #3920

@newfrenchy83

This comment has been minimized.

Copy link
Contributor

@newfrenchy83 newfrenchy83 commented Oct 12, 2019

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

@jostephd jostephd added this to the pre-1.16.0 string freeze milestone Oct 12, 2019
@jostephd

This comment has been minimized.

Copy link
Member Author

@jostephd jostephd commented Oct 12, 2019

Thanks for the reminder. Milestoned as requested.

@jostephd jostephd closed this in a87be48 Oct 16, 2019
jostephd added a commit that referenced this issue Oct 16, 2019
@jostephd

This comment has been minimized.

Copy link
Member Author

@jostephd jostephd commented Oct 16, 2019

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
Projects
None yet
2 participants
You can’t perform that action at this time.