Skip to content

[don't merge] [LCC] Implement Paleontologist's Pick-Axe and changes of layer system (transform)#11677

Open
DominionSpy wants to merge 3 commits into
magefree:masterfrom
DominionSpy:paleontologists-pick-axe
Open

[don't merge] [LCC] Implement Paleontologist's Pick-Axe and changes of layer system (transform)#11677
DominionSpy wants to merge 3 commits into
magefree:masterfrom
DominionSpy:paleontologists-pick-axe

Conversation

@DominionSpy
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Member

@JayDi85 JayDi85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Miss of detailed reason and description, cards and use cases examples, tests -- all that should be given for such code changes.


// As Sanctuary Blade becomes attached to a creature, choose a color.
this.addAbility(new AttachedToCreatureSourceTriggeredAbility(new ChooseColorEffect(Outcome.Benefit), false));
this.addAbility(new AsAttachesToCreatureAbility(new ChooseColorEffect(Outcome.Benefit), "choose a color."));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must keep name convention for abilities:

  • name part (looks like a rules);
  • scope part (Source, All, Target);
  • class type (TriggeredAbility, AttachedAbility, ActivatedAbility, etc).

So new name must be like: BecomesAttachedToCreatureSourceTriggeredAbility.

For future refactor: there are few cards with same rules, so it can be shared between multiple cards
shot_240118_115016

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a triggered ability (at least in the rules), so should the name be something like: BecomesAttachedToCreatureSourceAbility?

Re: refactor:
The "whenever" or "when" rules above will cause a trigger, whereas the "as" ones will not. That is the only difference between the rules.

import mage.game.stack.StackObject;
import mage.players.Player;

public class AttachesToEffect extends ReplacementEffectImpl {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must make ref that it was copied from EntersBattlefieldEffect

activeLayerEffects = getLayeredEffects(game);
}

layer = filterLayeredEffects(activeLayerEffects, Layer.CopyEffects_1);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep game engine changes like that (without tests and detailed description in code and PR) smells very bad.

Why you need all that code instead usage of existing one (there are many other implementations with same "becomes attached to"). Even [[Sanctuary Blade]] already existed and worked in old code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback.
This change is because the copy effect needed for [[Dinosaur Headdress]] is currently in the same layer as the transform effect. Since there is only one pass of that layer, the copy effect (DinosaurHeaddressEffect) linked with the card on the battlefield does not get added to the layered effects until after the transform effect is processed.

The active layered effects are then re-populated before processing layer 2. This is why non-copy effects work on existing transformed equipment.

[[Sanctuary Blade]] is not the reason for the engine change. However, it currently causes a trigger when it is attached to a creature. This is not correct - it should not allow a response before resolution of the choice.


TransformEffect() {
super(Duration.WhileOnBattlefield, Layer.CopyEffects_1, SubLayer.CopyEffects_1a, Outcome.BecomeCreature);
super(Duration.WhileOnBattlefield, Layer.TransformEffects_0, SubLayer.NA, Outcome.BecomeCreature);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above, maybe related to copy effects rework from #10801 by @xenohedron but you don't write any reasons and details.

@JayDi85 JayDi85 changed the title [LCC] Implement Paleontologist's Pick-Axe [LCC] Implement Paleontologist's Pick-Axe and changes of layer system (tranform) Jan 18, 2024
@JayDi85 JayDi85 changed the title [LCC] Implement Paleontologist's Pick-Axe and changes of layer system (tranform) [LCC] Implement Paleontologist's Pick-Axe and changes of layer system (transform) Jan 18, 2024
@DominionSpy
Copy link
Copy Markdown
Contributor Author

Reasoning for Changes

Changes to Layer System
Before Paleontologist's Pick-Axe // Dinosaur Headdress, there was no transform card with a copy effect on the second side. The current logic within ContinuousEffects.apply() first processes the active layered effects for layer 1. This includes transform effects along with copy effects (both sub layer 1a and 1b).
During the processing of transform effects, if there are layered effects on a transformed card, these are added to ContinuousEffects.layeredEffects, but this is not rechecked until just before processing layer 2. This means that any copy effects from a transformed card are not processed at all.
The solution here creates a pseudo layer 0 that is used to process all tranform effects before rechecking the active layer effects and processing layer 1 effects (which will now include any copy effects from transformed cards).

@xenohedron xenohedron changed the title [LCC] Implement Paleontologist's Pick-Axe and changes of layer system (transform) [don't merge] [LCC] Implement Paleontologist's Pick-Axe and changes of layer system (transform) Jan 18, 2024
Copy link
Copy Markdown
Contributor

@xenohedron xenohedron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots happening in this PR - hard to review.

I recommend a separate PR for fixing Sanctuary Blade with new AsBecomesAttachedSourceAbility first, if that change is independent, including unit test for it.

Then open separate issue explaining the engine limitation preventing Dinosaur Headdress from working, and we can discuss best path for workaround.

Comment thread Mage.Sets/src/mage/cards/d/DinosaurHeaddress.java
* @author North
*/
public enum Layer {
TransformEffects_0,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not conform to 613.1 (interaction of continuous effects / layer system). If the workaround is necessary, needs clear explanation of the shortcomings of current mage engine implementation. Maybe related to 701.28 or 712.8e? Is the problem that defining TDFC characteristics shouldn't be a layer 1 effect in the first place?

@JayDi85
Copy link
Copy Markdown
Member

JayDi85 commented Feb 20, 2024

For info: looks like it can be PhysicalEffects_0 layer instead TransformEffects_0 to simulate all physical actions with real life cards like transform, meld, flip, morph/facedown, etc. (maybe mutate can use it too someday). Current logic uses multiple workarounds in many places and it big pain (bug example with face down: #11733 (comment), also see related topic from a copy problems #10801)

@xenohedron
Copy link
Copy Markdown
Contributor

For info: looks like it can be PhysicalEffects_0 layer instead TransformEffects_0 to simulate all physical actions with real life cards like transform, meld, flip, morph/facedown, etc. (maybe mutate can use it too someday). Current logic uses multiple workarounds in many places and it big pain (bug example with face down: #11733 (comment), also see related topic from a copy problems #10801)

Morph/facedown applies in layer 1b, not the same.

613.2b. Layer 1b: Face-down spells and permanents have their characteristics modified as defined in rule 708.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants