It is currently 17 Jun 2019, 22:40
   
Text Size

As long as <card name> is attacking

Moderators: TheElk801, BetaSteward, LevelX, North, noxx, JayDi, jeffwadsworth, CCGHQ Admins

As long as <card name> is attacking

Postby 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?
MTGfan
 
Posts: 28
Joined: 25 Oct 2016, 03:39
Has thanked: 1 time
Been thanked: 0 time

Re: As long as <card name> is attacking

Postby 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.
User avatar
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

Postby 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?
MTGfan
 
Posts: 28
Joined: 25 Oct 2016, 03:39
Has thanked: 1 time
Been thanked: 0 time

Re: As long as <card name> is attacking

Postby LevelX » 23 Nov 2016, 11:14

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.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times


Return to Developers Talk

Who is online

Users browsing this forum: No registered users and 1 guest


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 287 on 31 Mar 2019, 04:11

Users browsing this forum: No registered users and 1 guest

Login Form