Card-Forge / Card-Forge/forge

CantBeTargetedBy: Unify Logic with Message

Open
#8,646 2 comments 0 reactions 2 assignees Claimed by @tool4ever View on GitHub
Game Mechanics GUI keep
Dominant language
Java
Stars
2.7k
Forks
1.1k
Avg merge
1d 1h
Merged PRs (30d)
158

Description

SpellAbility::canTarget
https://github.com/Card-Forge/forge/blob/15d4e1ac20e96d48c7b19341bcd7f02f9c2e66cb/forge-game/src/main/java/forge/game/spellability/SpellAbility.java#L1378

InputSelectTargets::onCardSelected
https://github.com/Card-Forge/forge/blob/15d4e1ac20e96d48c7b19341bcd7f02f9c2e66cb/forge-gui/src/main/java/forge/gamemodes/match/input/InputSelectTargets.java#L163

Share a lot of similar checks with TargetRestriction and similar flags

I try to move the whole logic into a `SpellAbility::cantTargetMsg` function that returns a String if the target would be fail
so `canTarget` returns true if the String is null

Affected from this are these StaticAbilties:
* StaticAbilityCantTarget
* StaticAbilityCantAttach

i want them to have functions to return the First StaticAbility where the condition is true.
so the `cantTargetMsg` can be which Static/Keyword is causing it to not be targeted Shroud/Hexproof/Protection

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.