As long as <card name> is attacking
Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins
As long as <card name> is attacking
by MTGfan » 22 Nov 2016, 04:34
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?
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
by LevelX » 22 Nov 2016, 16:22
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.
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.
-
LevelX - DEVELOPER
- Posts: 1677
- Joined: 08 Dec 2011, 15:08
- Has thanked: 174 times
- Been thanked: 374 times
Re: As long as <card name> is attacking
by MTGfan » 22 Nov 2016, 20:33
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
by LevelX » 23 Nov 2016, 11:14
I would say it should, sure.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?
-
LevelX - DEVELOPER
- Posts: 1677
- Joined: 08 Dec 2011, 15:08
- Has thanked: 174 times
- Been thanked: 374 times
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests