Simplification/Unification of StaticAbility variants
- Dominant language
- Java
- Stars
- 2.7k
- Forks
- 1.1k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 158
Description
Example:
https://github.com/Card-Forge/forge/blob/5972acb0a26b89b55d0097eadfe48dc10e13bfed/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantAttach.java#L9-L21
most of the uses in these Static classes return a boolean if some static ability gets triggered by it
(in some cases, like this one, it returns the first one that does trigger it)
So shouldn't it be possible to make a helper version that uses stream of it?
Like this part is nearly identical in most versions (+some use extra LKI, but these can be added)
`target.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES).stream().flatMap(c -> c.getStaticAbilities().stream())`
And then use `anyMatch`/`filter` with a `Predicate` like this?
`stAb -> stAb.checkConditions(StaticAbilityMode.CantAttach) && applyCantAttachAbility(stAb, card, target, checkSBA)`
Maybe do the Mode check in a `filter` first?
Contributor guide
Assessment
This issue has not been assessed yet.