It is currently 31 Oct 2025, 13:41
   
Text Size

Fixing the clones

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins

Re: Fixing the clones

Postby friarsol » 01 Jul 2012, 20:27

ArsenalNut wrote:I think it implies that the triggered ability should be using the LKI of the clone which would be the copied creature. This means I need to fix what Forge currently does but I was looking a definitive answer before I went down that path.

The Copying rules are giving me a headache :twisted:
Yep that's right, the creature that left the battlefield is whatever had been Cloned. "Cemetery Puca copies the printed values of the creature, plus any copy effects that have been applied to it." But not changes by other effects/tokens/etc.

And yes, copying rules and LKI are a pain.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Fixing the clones

Postby jeffwadsworth » 01 Jul 2012, 22:07

friarsol wrote:
ArsenalNut wrote:I think it implies that the triggered ability should be using the LKI of the clone which would be the copied creature. This means I need to fix what Forge currently does but I was looking a definitive answer before I went down that path.

The Copying rules are giving me a headache :twisted:
Yep that's right, the creature that left the battlefield is whatever had been Cloned. "Cemetery Puca copies the printed values of the creature, plus any copy effects that have been applied to it." But not changes by other effects/tokens/etc.

And yes, copying rules and LKI are a pain.
Game state...boy, would that fix a lot of things.
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: Fixing the clones

Postby ArsenalNut » 02 Jul 2012, 00:36

friarsol wrote:
ArsenalNut wrote:I think it implies that the triggered ability should be using the LKI of the clone which would be the copied creature. This means I need to fix what Forge currently does but I was looking a definitive answer before I went down that path.

The Copying rules are giving me a headache :twisted:
Yep that's right, the creature that left the battlefield is whatever had been Cloned. "Cemetery Puca copies the printed values of the creature, plus any copy effects that have been applied to it." But not changes by other effects/tokens/etc.

And yes, copying rules and LKI are a pain.
I was tracing through the issue I am having with Cemetery Puca and found the culprit. The LKI get stored perfectly in TriggeringObject. However, getDefinedCards calls AllZoneUtil.getCardState to find the current state which is now a Clone in the graveyard. Anybody now why the LKI version of the card isn't just returned?

Edit: If I return the LKI version, Cemetery Puca works fine, but is that the correct fix? This not a part of the code I am familiar with.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Fixing the clones

Postby Sloth » 02 Jul 2012, 11:35

ArsenalNut wrote:I was tracing through the issue I am having with Cemetery Puca and found the culprit. The LKI get stored perfectly in TriggeringObject. However, getDefinedCards calls AllZoneUtil.getCardState to find the current state which is now a Clone in the graveyard. Anybody now why the LKI version of the card isn't just returned?

Edit: If I return the LKI version, Cemetery Puca works fine, but is that the correct fix? This not a part of the code I am familiar with.
I think cards like Angelic Renewal need to find the card in the graveyard, so it would be better to add and use "TriggeredCardLKICopy" as an option for getDefinedCards.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Fixing the clones

Postby ArsenalNut » 04 Jul 2012, 19:21

I've got the all the hard code clones converted to scripts. The conversion has fixed issues with things like Undying and flicker-effects. Also Vesuvan Doppelganger adheres to the ruling text after the conversion.

With the addition of the Clone AF, I have been able to add the following card that can become copies
Cemetery Puca
Dimir Doppelganger
Sakashima's Student
Shapeshifter's Marrow
Unstable Shapeshifter
Vesuva

Here are the existing issues with copied cards
1) Copies of tokens cause a crash when they leave play. The source of issue is how the LKI copy gets created.
2) Leave play triggers don't work correct for clones e.g. when a clone of Doomed Traveler leaves play, no Spirit token is produced. I think this is really with a problem with leave play triggers in general (see my post in the Bug Report thread about Turn to Frog and Doomed Traveler).
3) Copies of equipment made via Copy Artifact or Phyrexian Metamorph cannot be equipped. This has to do with the way eqPump is implemented. This is the source of the issue with copies of Living Weapons. The 0/0 Germ cannot be equipped so it dies when state effects are checked.
4) Copies of cards that setup Zone Change triggers via addComesIntoPlayCommand and addLeavesPlayCommand will not function correctly. This applies to most of the hard coded cards and any cards that use keywords processed by forge.card.cardfactory.CardFactoryUtil.parseKeywords.

I've looked into all the above issue and there is no quick and easy fix for any of them. The existing hard coded implementation has all of these same issues so should I go ahead and merge my branch back into the Trunk or wait till I address the above issues? I am inclined to merge since we'll be in a better state but I want to give the other developers a chance to give their opinion before I merge.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Fixing the clones

Postby Sloth » 04 Jul 2012, 21:11

This sounds like a huge improvement. So i vote for a merge.

ArsenalNut wrote:3) Copies of equipment made via Copy Artifact or Phyrexian Metamorph cannot be equipped. This has to do with the way eqPump is implemented. This is the source of the issue with copies of Living Weapons. The 0/0 Germ cannot be equipped so it dies when state effects are checked.
Another reason to convert eqPump cards to AF Attach. It's only scripting work.

ArsenalNut wrote:1) Copies of tokens cause a crash when they leave play. The source of issue is how the LKI copy gets created.
This shouldn't be a problem that is really hard to fix or?

ArsenalNut wrote:2) Leave play triggers don't work correct for clones e.g. when a clone of Doomed Traveler leaves play, no Spirit token is produced. I think this is really with a problem with leave play triggers in general (see my post in the Bug Report thread about Turn to Frog and Doomed Traveler).
This is quiite a deep problem. I guess one day we have to split the changesZone triggers into entersZone (looks at the new object) and leavesZone (looks at the LKI copy).
Last edited by Sloth on 04 Jul 2012, 21:11, edited 1 time in total.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Fixing the clones

Postby Chris H. » 04 Jul 2012, 21:11

ArsenalNut wrote:I've looked into all the above issue and there is no quick and easy fix for any of them. The existing hard coded implementation has all of these same issues so should I go ahead and merge my branch back into the Trunk or wait till I address the above issues? I am inclined to merge since we'll be in a better state but I want to give the other developers a chance to give their opinion before I merge.
 
I vote for merging the clone fix branch into the trunk.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Fixing the clones

Postby friarsol » 04 Jul 2012, 23:07

I'm fine with merging too. As Sloth says, 3 should be fixed just by migrating eqPump (as we planned on doing anyway) and we can at least prevent the crash in 1 until we get that specific kink worked out.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Fixing the clones

Postby ArsenalNut » 04 Jul 2012, 23:32

friarsol wrote:I'm fine with merging too. As Sloth says, 3 should be fixed just by migrating eqPump (as we planned on doing anyway) and we can at least prevent the crash in 1 until we get that specific kink worked out.
I had similar thoughts about the eqPump problem. Is thought to change eqPump into a sorcery speed attach ability and use a continuous static effect to provide the equipped pump? I was going to test this to make it would solve the Living weapon problem.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Fixing the clones

Postby ArsenalNut » 05 Jul 2012, 07:08

The changes are merged back into the trunk. I used the Animate AF as a starting template so the AI methods are copies of whatever is in Animate. I noticed that the AI didn't seem to play Phantasmal Image. I suspect the AI methods are the culprit. The logic in the Copy AF is probably a good starting point. One of the these days I need to figure out how those AI methods work :?
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Fixing the clones

Postby ArsenalNut » 06 Jul 2012, 17:00

Sloth wrote:
ArsenalNut wrote:1) Copies of tokens cause a crash when they leave play. The source of issue is how the LKI copy gets created.
This shouldn't be a problem that is really hard to fix or?
I want to try to get this fixed over the weekend. The crash is caused because the getLKICopy method tries to get a copy of the card from the the card database by name. Since the plain tokens aren't in the database, Forge throws an exception when it can't find it.

It seems like getting an LKI copy and making a clone should be very similar (obviously the LKI version needs to copy the current status as well). The big difference between what getLKIcopy does versus making clones is that getLKIcopy runs a template card through all the methods that parse keywords and handle hard coded cards. I assume it was done this way in order to make a deep copy of a card. Between what I did for clones and what Hellfish did for ability stealers, I can make a copy of everything but the zone change triggers. Does an LKI copy really need all of its abilities instantiated, in particular the zone change triggers?
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Fixing the clones

Postby Sloth » 06 Jul 2012, 17:38

ArsenalNut wrote:Does an LKI copy really need all of its abilities instantiated, in particular the zone change triggers?
Definitely not.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Fixing the clones

Postby ArsenalNut » 07 Jul 2012, 02:47

I rewrote the getLKICopy method and that fixed the issue with clones of tokens leaving the battlefield. Before I check in the change, I'd like to test that I haven't somehow broken the use of LKI. Any suggestions of scenarios to test?
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Fixing the clones

Postby friarsol » 07 Jul 2012, 03:07

ArsenalNut wrote:I rewrote the getLKICopy method and that fixed the issue with clones of tokens leaving the battlefield. Before I check in the change, I'd like to test that I haven't somehow broken the use of LKI. Any suggestions of scenarios to test?
Altar of Dementia with something like Spike Feeder.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Fixing the clones

Postby ArsenalNut » 07 Jul 2012, 22:11

Sloth wrote:
ArsenalNut wrote:3) Copies of equipment made via Copy Artifact or Phyrexian Metamorph cannot be equipped. This has to do with the way eqPump is implemented. This is the source of the issue with copies of Living Weapons. The 0/0 Germ cannot be equipped so it dies when state effects are checked.
Another reason to convert eqPump cards to AF Attach. It's only scripting work.
As a test, I converted Batterskull to the following script
Batterskull using attach | Open
Name:Batterskull
ManaCost:5
Types:Artifact Equipment
Text:no text
K:Living Weapon
S:Mode$ Continuous | Affected$ Creature.AttachedBy | AddPower$ 4 | AddToughness$ 4 | AddKeyword$ Vigilance & Lifelink | Description$ Equipped creature gets +4/+4 and has vigilance and lifelink.
A:AB$ ChangeZone | Cost$ 3 | Origin$ Battlefield | Destination$ Hand | SpellDescription$ Return CARDNAME to its owner's hand.
A:AB$ Attach | Cost$ 5 | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SorcerySpeed$ True | AILogic$ Pump | SpellDescription$ Equip
SVar:Rarity:Mythic
SVar:Picture:http://www.wizards.com/global/images/magic/general/batterskull.jpg
SetInfo:NPH|Mythic|http://magiccards.info/scans/en/nph/130.jpg
Oracle:Living weapon (When this Equipment enters the battlefield, put a 0/0 black Germ creature token onto the battlefield, then attach this to it.)\nEquipped creature gets +4/+4 and has vigilance and lifelink.\n{3}: Return Batterskull to its owner's hand.\nEquip {5}
End

Cloning this version works perfectly. I am willing to taken on the task of converting all the equipment but I can see three ways to approach it.
1) Just add a raw script like I did for test to every card
2) Create a keyword script macro for Equip similar to how things like Living Weapon are handled. The equipment bonus would still have to be added via a Continuous static effect.
3) Convert existing eqPump keyword to a script macro that creates both the attach ability and the Continuous static effect. I would probably rename eqPump to Equip.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 31 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 31 users online :: 0 registered, 0 hidden and 31 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 31 guests

Login Form