RiiakShiNal wrote:If we decide to recode all cards that refer to defender then we can actually completely replace it with a fake defender characteristic. Essentially, at the start of combat on our turn we would need to check cards for the fake defender characteristic as well as any effects that would allow it to attack as though it didn't have defender. If it has the fake defender characteristic and does not have any effects that would allow it to attack during this combat then we would temporarily set CHARACTERISTIC_CANT_ATTACK until end of combat (we could have it expire after attackers are declared, but I think the indicator might be nice just to show why they didn't attack), otherwise we don't set it. Do note, however, that due to the fake characteristics implementation any static ability checking for the fake defender characteristic would need to check on layer 8. We would want to continue to follow the rules for fake characteristics for setting of the flag.
I could do that, but I actually only intended to recode the 11 cards that count or target defenders.
RiiakShiNal wrote:I'm not exactly sure what you are trying to say here, but layers work by executing code on the lowest layer first in the order in which the card/effect entered play (later used cards/effects work later). Once a given layer has been completely executed then you execute the next layer up as per the previous rule. Layer 7 is an exception in that it is composed of sub-layers which execute in order from 7a through 7e and is used exclusively for determining power/toughness. Layer 8 is the last layer I am aware of (there might be a layer 9, but I have never seen it).
One of the tricky layers is layer 6 as that is where most abilities get granted and where LoseAllAbilities() operates so careful testing is required there.
That's how I thought they worked. I was just saying that I wasn't 100% certain if it would be necessary, but if a creature with defender is given the ability to attack as though it didn't have defender until end of turn, and then the same creature loses defender, it would still have the fake characteristic which shouldn't be there.
Activate
Wakestone Gargoyle.
Wakestone Gargoyle removes intrinsic defender characteristic from
Gargoyle Sentinel and replace it with a fake defender characteristic and a "can attack as though..." fake characteristic.
Activate
Gargoyle Sentinel, which tries to remove the intrinsic defender, but it's already gone. Now,
Gargoyle Sentinel will still count for
Vent Sentinel even though it shouldn't. It could attack, which it should be able to do, and that much works, but it's still a potential for the same problem the current method has.
What I was asking about is if it would be possible to check on layer 1 if
Gargoyle Sentinel has the intrinsic defender characteristic each continuous action iteration before removing and replacing it on layer 6. If it doesn't have it, then don't grant the fake one because it's been removed somehow. This is only if we don't want to recode all of the cards with defender. Which I'd rather avoid.
RiiakShiNal wrote:Theoretically, it may be possible to access and read those tables using Lua functions as long as the C objects that are exposed through the table structure support those built-in Lua functions. For example it may be possible to get a listing of all items in the table by using the table.unpack function. Unfortunately this won't necessarily tell you what a specific item is for example it could be an integer, string, table, or function pointer. So parsing and trying to figure out what is there could be very difficult.
Yeah, I figured that if it was possible to get some arbitrary element, it would have to be tested to see what it is. I was thinking that it would be easiest to take a few simple cards and get as many elements as possible and compare them to the cards and try to spot a pattern.
Zambooo wrote:I coded an "approximation" of
Assault Formation (already in the CW), and the best I could do without fake characteristics was to remove Defender for the shortest amount possible: from the beginning of combat to the Defenders declared step (excluded)
Recoding all cards with Defender didn't not seem like an affordable idea IMO :/
Yes, the point of the layer questions was to avoid recoding all cards with defender. Only 11 or so would need redone to grant and/or check the fake characteristic. Everything else would stay as it is.