Page 1 of 2

Multi-Targeting Issue

PostPosted: 13 May 2011, 04:25
by friarsol
For everyone who has ever reported an issue with multi-targeting: I'm currently working on this issue.

I'm not sure how long it will take, but I've gotten it far enough to proof of concept that my solution works. Gorilla Shaman was ale to target two different Moxen on the stack and kill both of them properly.

Now I just need to expand it for all of the AFs. I don't look forward to doing it in CardFactories so hopefully that won't be a major problem. I'm not certain if this will fix the multi-Triggering problem, but it is possible (and I'm hopeful that it will).

This certainly will not be making it into the next Release, so maybe I can recruit some helpers once I do all the AFs to replicate the need changes throughout everywhere else it needs to go.

Re: Multi-Targeting Issue

PostPosted: 13 May 2011, 04:47
by slapshot5
I'll volunteer to help with the needed changes. Let me know.

Re: Multi-Targeting Issue

PostPosted: 13 May 2011, 06:26
by Sloth
friarsol wrote:For everyone who has ever reported an issue with multi-targeting: I'm currently working on this issue.

I'm not sure how long it will take, but I've gotten it far enough to proof of concept that my solution works. Gorilla Shaman was ale to target two different Moxen on the stack and kill both of them properly.

Now I just need to expand it for all of the AFs. I don't look forward to doing it in CardFactories so hopefully that won't be a major problem. I'm not certain if this will fix the multi-Triggering problem, but it is possible (and I'm hopeful that it will).

This certainly will not be making it into the next Release, so maybe I can recruit some helpers once I do all the AFs to replicate the need changes throughout everywhere else it needs to go.
Thanks for always taking care of the complicated stuff Sol. Of course I will help.

Re: Multi-Targeting Issue

PostPosted: 15 May 2011, 01:38
by friarsol
So I'm starting to think that we're going to have some further complications down the line with SpellAbilities the way they currently are handled. I may just take the plunge and revamp how SpellAbilities live on the Stack. Right now we just add a SpellAbility (which normally is attached to a Card) to the Stack. This causes the current issue I was looking into resolving with the Target, where things are overwritten.

I'm thinking of creating a SpellAbility_Choices which would have a pointer to the original SA, but would also have things like specific Cost payments, specific Targets, and would be an centralized place for other related things. Then instead of adding the SA to the Stack, we would add the SA_Choices.

I'm starting to lean on taking this route, but it's going to be much larger changes and take longer than the original Target stuff.

Re: Multi-Targeting Issue

PostPosted: 15 May 2011, 07:09
by Hellfish
Just throwing out a random thought here, maybe that Spellability_Choices could have a list of SAs to point to instead, which we could add other SAs to for "Splice to Arcane" cards.

Re: Multi-Targeting Issue

PostPosted: 15 May 2011, 12:31
by friarsol
Hellfish wrote:Just throwing out a random thought here, maybe that Spellability_Choices could have a list of SAs to point to instead, which we could add other SAs to for "Splice to Arcane" cards.
If I can think of an elegant way to do it, I'll try to add hooks there for Splice into Arcane. I think it'll be more similar to how SubAbilities work right now though. This is already big enough that I'm starting to worry about it, so hopefully I'll be able to get it done.

Re: Multi-Targeting Issue

PostPosted: 26 May 2011, 02:49
by friarsol
So originally I was planning on just making this a Stack of Targets and pushing/popping as appropriate. But there's a design flaw in this which could cause some major issues. So I'm scrapping this for possibly a larger overhaul.

The ultimate goal is to not use SpellAbilities in MagicStack, and instead use something I'm calling SpellAbility_StackInstance. A StackInstance has things like: a pointer to the original SpellAbility, Targets, Cost Related information, SubStackInstances. Part of these plans entail narrowing the entry points into adding Abilities to the Stack. Ideally, we can be passing SpellAbilities in to Stack.add() and I can convert the SpellAbility on the fly to a StackInstance (and clear out SA related information at the same time). This would require the least amount of changes in the existing AF code.

Right now it looks like the biggest piece of groundwork is converting all remaining hardcoded SAs to Cost/Target system. I know there will be some hardcoded cards we can't handle in the system, I'll figure out a way to handle those when I get there, but if I can get some people to help go through and convert any remaining SAs to use Cost/Target I think that will help get everything in the same entry point.

Edit: Specifically, these functions I want to completely remove:
CardFactoryUtil.input_targetPlayer
CardFactoryUtil.input_targetCreaturePlayer
CardFactoryUtil.input_targetCreature

and if possible everything after the following codeBlock in GameAction.playSpellAbilityForFree

The last part will require moving everything over to Cost. The other three should be moving any hardcoded Spells that Target over to Target.

Code: Select all
if (sa.getPayCosts() != null){
   Target_Selection ts = new Target_Selection(sa.getTarget(), sa);          
   Cost_Payment payment = new Cost_Payment(sa.getPayCosts(), sa);

   SpellAbility_Requirements req = new SpellAbility_Requirements(sa, ts, payment);
   req.setFree(true);
   req.fillRequirements();
}

Re: Multi-Targeting Issue

PostPosted: 03 Jun 2011, 16:17
by friarsol
Ok. So I think I'm on the next phase of this, as the three input_target functions are no longer used, and I've restricted the "problem" cards in playSAForFree to just a few of them, which I can handle in the separate functions that they are already using. Now to the fun part of actually ripping up MagicStack to use Instances.

Re: Multi-Targeting Issue

PostPosted: 10 Jun 2011, 18:05
by friarsol
So my local build now has a functional multi-targeting system, as tested via Gorilla Shaman. As usual, some serious changes went into this so if you can think of any good test cases for me, especially corner cases I might not think of, feel free to recommend so I can give this a fair testing.

I definitely have more work, related to handling specific SA info, but I feel like testing some working code before I finish that off.

Re: Multi-Targeting Issue

PostPosted: 11 Jun 2011, 07:47
by SoulStorm
Thanks for working on this Sol!

Here are some test cases for you that suffered from the multi-targeting problem:

Ronin Cliffrider with a Sword of Kaldra equipped (would only exile one creature no matter how many were damaged).

Thrashing Wumpus with Rite of Passage on the Battlefield (all the counters are added to one creature no matter how many are in play). Note that this is using the revision of Rite of Passage by Keybone which uses a trigger. I later changed Rite of Passage to keyword due to the multi-targeting problem.

Patron Wizard (currently need to let the stack resolve for each mana spent).

Forgotten Ancient (must resolve the stack for each counter transferred or each counter after the first is lost).

Re: Multi-Targeting Issue

PostPosted: 11 Jun 2011, 13:23
by friarsol
So Patron Wizard now works as well as Masticore and Phelddagrif and a few others I tried. I'll probably wait till after Chris posts the new Beta to commit these changes so if something slips through the cracks it won't affect the Beta. Forgotten Ancient should "work" now, even though it's Upkeep trigger is completely incorrect (Not an Activated Ability. Removing the Counter isn't a Cost.)

The Multi-targeting currently doesn't handle triggers. Basically it can use the same idea where the StackInstance "stores" the Triggering Object, but I'd have to look through the Trigger code to see what's going on. Does anyone know why the TriggeringObject is stored on the Card and not the Trigger/SA? Do some TriggeringObjects need to remain on the Card after the Trigger resolves?

It might be easiest testing-wise to focus on SAs first, then bring Triggers along afterwards. Since the structure would be in place, making Triggers work should be much faster.

Re: Multi-Targeting Issue

PostPosted: 11 Jun 2011, 17:57
by jeffwadsworth
Cheers.

Re: Multi-Targeting Issue

PostPosted: 11 Jun 2011, 19:10
by friarsol
Jeff that isn't quite right either since it isn't targeted either and you can transfer to any number of creatures as it resolves

Re: Multi-Targeting Issue

PostPosted: 12 Jun 2011, 21:00
by friarsol
Since Chris has declared a Revision to base the next Beta on, I'm committing my Target changes as r9630. Please check them out. The situations that were fixed are ONLY for Activated Abilities being activated multiple times (Umezawa's Jitte, Masticore, Gorilla Shaman, etc) NOT Triggered Abilities triggering multiple times (No Mercy, some others SoulStorm suggested).

If you see anything that looks weird relating to this, I'd prefer you post them in this Thread so it's easier for me to find.

Re: Multi-Targeting Issue

PostPosted: 13 Jun 2011, 09:04
by Sloth
friarsol wrote:Since Chris has declared a Revision to base the next Beta on, I'm committing my Target changes as r9630. Please check them out. The situations that were fixed are ONLY for Activated Abilities being activated multiple times (Umezawa's Jitte, Masticore, Gorilla Shaman, etc) NOT Triggered Abilities triggering multiple times (No Mercy, some others SoulStorm suggested).

If you see anything that looks weird relating to this, I'd prefer you post them in this Thread so it's easier for me to find.
I found something very weird:
For some reason this fixed the issues with the human input killing spells on the stack (unless costs, Ulamog, the Infinite Gyre and Deathbringer Liege). Maybe someone else can double check this. It would be fantastic, if it is true. =D>