forge icon indicating copy to clipboard operation
forge copied to clipboard

Refactor DifferentCardNames in AbilityUtils with hasNonLegendary Names

Open Hanmac opened this issue 3 years ago • 5 comments

Stuff like this that looks for "N with different names" should take care about hasNonLegendaryCreatureNames or should use SharesName with.

Hanmac avatar Sep 07 '22 11:09 Hanmac

This issue has not been updated in a while and has now been marked as stale. Stale messages will be auto closed.

github-actions[bot] avatar Jun 09 '23 09:06 github-actions[bot]

@tool4ever i think we should look into this too when we are trying to do Transmutation Font with "Sacrifice three artifact tokens with different names"

like you should not be able to sacrifice two Creature Token equipped with Spy Kit

Hanmac avatar Apr 08 '24 19:04 Hanmac

ugh this smells like an optimization problem?

tool4ever avatar Apr 09 '24 09:04 tool4ever

@tool4ever its about this part:

201.2b Some spells and abilities refer to two or more objects with different names. Those objects have different names only if each of them has at least one name and no two objects in that group have a name in common. Example: A player controls Liliana’s Contract, which says, in part, “At the beginning of your upkeep, if you control four or more Demons with different names, you win the game.” That player controls three Demons with different names and a face-down creature with no name, with an effect making it a Demon. Because the four creatures include one with no name, those four creatures don’t count as four Demons with different names. The ability of Liliana’s Contract won’t trigger.

201.2c Some spells or abilities check if one object has a different name than a second object or group of objects. The first object has a different name than those objects if the first object has at least one name and has no names in common with any of the other objects, even if one or more of the other objects have no names. If the first object has no name, it does not have a different name than any of the other objects, even if those other objects themselves have names.

The Function where it is currently used:

https://github.com/Card-Forge/forge/blob/56d67e26cc8b660143786ed42ee59f9e9da1f4cb/forge-game/src/main/java/forge/game/ability/AbilityUtils.java#L2780-L2792

An example for this: Liliana's Contract + 3 legendary Demons and 2 Demons Equipped with Spy Kit

What is the Max Different Names there?

  • is it 3, because both Spy Kit Demons got excluded
  • or is it 4, because you can still count one of the Spy Kit Demons if the normal 3 are legendary?

or in CostDiscard: (this shouldn't be much of a problem? Multiple Names should only happen while on the Battlefield) https://github.com/Card-Forge/forge/blob/56d67e26cc8b660143786ed42ee59f9e9da1f4cb/forge-game/src/main/java/forge/game/cost/CostDiscard.java#L153-L159

Hanmac avatar Apr 09 '24 09:04 Hanmac

What is the Max Different Names there?

I'd say it should still be 4 if we follow rulings like this:

To determine the number of differently named lands you control, count each land you control once, but only if its English name isn’t exactly the same as another land you’ve already counted this way. For example, if you control four lands named Plains, two named Island, and one named Drowned Catacomb, Awakened Amalgam is a 3/3 creature.

tool4ever avatar Apr 09 '24 09:04 tool4ever