magefree / magefree/mage

Cards that look for hexproof ability can't find midified hexproof versions (Kathril, Aspect Warper, Eater of Virtue, etc)

Open
#12,197 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
2.4k
Forks
940
Avg merge
2d 12h
Merged PRs (30d)
160

Description

There are multiple versions of hexproof ability ("modified" hexproof):
![shot_240429_223334](https://github.com/magefree/mage/assets/8344157/470781cb-e3d7-4b2b-a6b5-ad4ecd46e858)

If you look at ruling from Kathril, Aspect Warper -- "hexproof" means any versions of hexproof:
> If cards in your graveyard have multiple hexproof abilities (such as hexproof, hexproof from white, and hexproof from black), a counter of each variant kind will be put onto a creature. (2020-06-23)

**Problem 1 - wrong class usages**

All modified versions uses `HexproofBaseAbility` as a parent, not `HexproofAbility`. So all searches will fail.

Wrong code usage:
* `HexproofAbility.class`
* `instanceof HexproofAbility`

Good code usage:
* `HexproofBaseAbility.class`
* `instanceof HexproofBaseAbility`

Maybe other usage code exists too (usages in streams, usages of `HexproofAbility.getInstance()`, etc).

How to fix: just replace one class by another.

Rules:
> 702.11e Any effect that causes an object to lose hexproof will cause an object to lose all “hexproof from [quality]” abilities. Any effect that allows a player to choose a creature with hexproof as a target as though it didn’t have hexproof will allow a player to choose a creature with a “hexproof from [quality]” ability. Any effect that looks for a card with hexproof will find a card with a “hexproof from [quality]” ability.

**Problem 2 - wrong ability counter usage**

Some cards must found hexproof and put related counter. Current implementations check only one hexproof counter and can lost all other types.

Some of the affected cards (all used own implementations):
* [[Odric, Blood-Cursed]]
* [[Kathril, Aspect Warper]]
* [[Eater of Virtue]]
* [[Wretched Bonemass]] -- may works fine cause copy founded hexproof ability;
* [[Indominus Rex, Alpha]] (see PR #12119)

More:
* Selective Adaptation
* Urborg Scavengers

Current implementation find all hexproof, but add only basic counter ability (e.g. will lost hexproof from white and other versions):
![shot_240429_222857](https://github.com/magefree/mage/assets/8344157/1113ab17-0c40-4a7a-9796-05dbb381f94d)

How to fix: rework ability counter creating (current engine supports any ability, so only affected cards must be fixed).

P.S. All other used abilities like flying has only single version, so only hexproof affected.

Contributor guide

No contributing guide indexed for this repository

Research direction

Search usages of HexproofAbility and HexproofBaseAbility, then inspect the implementations for Odric, Blood-Cursed, Kathril, Aspect Warper, Eater of Virtue, Wretched Bonemass, Indominus Rex, Alpha, Selective Adaptation, and Urborg Scavengers. Confirm that hexproof variants are found and that each relevant card preserves the appropriate ability counters, including the behavior discussed in PR #12119.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.