Page 1 of 1

As long as <card name> is attacking

PostPosted: 22 Nov 2016, 04:34
by MTGfan
In looking at other cards for reference in coding other cards I encountered two different ways this is being handled. These cards are:

Kor Scythemaster, Siege Behemoth, Soltari Lancer, and Spirit of the Night.

Both are ConditionalContinuousEffect the condition being SourceAttackingCondition.getInstance() and new SourceMatchesFilterCondition(new FilterAttackingCreature()), rule). And one that isn't using ConditionalContiuousEffect at all: Wardscale Dragon. It contains the code I used in my original coding for Gaea's Liege that we ended up making a new condition AttackingCondition. Which has me thinking all of these cards could all be using one of the two. And the new AttackingCondition we made be deleted and Gaea's Liege be edited to use one of the other two, SourceAttackingCondition.getInstance() makes more sense to me. I'm assuming both SourceAttackingCondition.getInstance() and new SourceMatchesFilterCondition(new FilterAttackingCreature()), rule) have special cases that we need to have both of them?

Re: As long as <card name> is attacking

PostPosted: 22 Nov 2016, 16:22
by LevelX
SourceMatchesFilterCondition is more generic and can be used with all kind of Filters to check the condition.

SourceAttackingCondition.getInstance() is for the one condition and easier to use. That makes sense, if a condition is needed more than one or two times. It's also faster at execution as the generic condition.

So I would say yes, that makes sense.

Re: As long as <card name> is attacking

PostPosted: 22 Nov 2016, 20:33
by MTGfan
Cool beans so these all should be using the SourceAttackingCondition.getInstance() then. I wish we had known of this before when I coded Gaea's Liege. If I delete the AttackingCondition redundancy we created for it to use will that show as a delete it when I push to my fork and create the pull request?

Re: As long as <card name> is attacking

PostPosted: 23 Nov 2016, 11:14
by LevelX
MTGfan wrote:Cool beans so these all should be using the SourceAttackingCondition.getInstance() then. I wish we had known of this before when I coded Gaea's Liege. If I delete the AttackingCondition redundancy we created for it to use will that show as a delete it when I push to my fork and create the pull request?
I would say it should, sure.