It is currently 17 Oct 2019, 22:36
   
Text Size

Wardscale Dragon and Xantid Swarm

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

Wardscale Dragon and Xantid Swarm

Postby MTGfan » 27 Nov 2016, 01:10

Should Wardscale Dragon be edited to use ConditionalContinuousEffect? Or is the way it is coded the better way to handle it. Functionally I believe it would be the same the difference would be in what code is executed. But I could be wrong. Basically the card's code would change with the ability line being:
Code: Select all
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(<effect>, SourceAttackingCondition.getInstance(), "As long as {this} is attacking, defending player can't cast spells")));
And the effect class at the bottom would change from this:
Code: Select all
    public boolean applies(GameEvent event, Ability source, Game game) {
        Permanent sourcePermanent = game.getPermanent(source.getSourceId());
        if (sourcePermanent != null && sourcePermanent.isAttacking()) {
            return event.getPlayerId().equals(game.getCombat().getDefendingPlayerId(sourcePermanent.getId(), game));
        }
        return false;
    }
to this:
Code: Select all
    public boolean applies(GameEvent event, Ability source, Game game) {
        return event.getPlayerId().equals(game.getCombat().getDefendingPlayerId(sourcePermanent.getId(), game));
    }
At first I thought about having some sort of CantCastSpellsEffect in the framework. There are 40 cards that contain the phrase "can't cast spells" but there probably isn't framework for all the variations. The closest variation to this creature being Xantid Swarm but it is not a ConditionalContinuousEffect it is an AttacksTriggeredAbility.

However Xantid Swarm code doesn't use AttacksTriggeredAbility it appears to me to be redundantly doing it with class XantidSwarmTriggeredAbility. So my guess is that it should be for sure changed to at the ability line from:
Code: Select all
        Ability ability = new XantidSwarmTriggeredAbility(new XantidSwarmReplacementEffect());       
        this.addAbility(ability);
to this:
Code: Select all
this.addAbility(new AttacksTriggeredAbility(new XantidSwarmReplacementEffect(), false));
Wardscale Dragon's WardscaleDragonRuleEffect and Xantid Swarm's XantidSwarmReplacementEffect are functionally equivalent except for the duration. I assume that means they can't be encapsulated into a CantCastSpellsDefenderEffect unless there is a way to set it up to pass duration as a parameter so that within CantCastSpellsDefenderEffect it sets the duration based on that. Outside of these two I'm not sure if there are any that share a common factor like defending play.
MTGfan
 
Posts: 28
Joined: 25 Oct 2016, 03:39
Has thanked: 1 time
Been thanked: 0 time

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