Page 1 of 1

Suspend Fix

PostPosted: 29 Oct 2010, 04:28
by friarsol
So it looks like Suspend needed a bit more of an update since I wrote the Restrictions recently. I updated a block of code to take this into account and tested to confirm the fix works.

However, my codebase right now is a wreck, I don't want to just submit this blind, and I can't really revert my code down just for this fix. So if someone could merge this in, and do a quick test with Lotus Bloom, and then submit for me that'd be great.

The change was only in canPlay() but I'll copy the whole function so it can be easier to find.

Code: Select all
    public static SpellAbility ability_suspend(final Card sourceCard, final String suspendCost, final int suspendCounters) {
       // be careful with Suspend ability, it will not hit the stack
        final SpellAbility suspend = new Ability_Static(sourceCard, suspendCost) {
         private static final long serialVersionUID = 21625903128384507L;

         @Override
         public boolean canPlay(){
              if (!(getRestrictions().canPlay(sourceCard, this)))     
                 return false;
            
            if (sourceCard.isInstant())
               return true;
            
            return Phase.canCastSorcery(sourceCard.getOwner());
         }
         
         @Override
            public boolean canPlayAI() {
                return false;
            }
           
            @Override
            public void resolve() {
               AllZone.GameAction.exile(sourceCard);
               sourceCard.addCounter(Counters.TIME, suspendCounters);
            }
        };
        suspend.setDescription("Suspend " +suspendCounters + ": "+ suspendCost);
        suspend.setStackDescription(sourceCard.getName() + " suspending for " + suspendCounters + " turns.)");
        suspend.getRestrictions().setActivateZone(Constant.Zone.Hand);
        return suspend;
    }//ability_suspend()
Thanks.

Re: Suspend Fix

PostPosted: 29 Oct 2010, 11:47
by slapshot5
friarsol wrote:So it looks like Suspend needed a bit more of an update since I wrote the Restrictions recently. I updated a block of code to take this into account and tested to confirm the fix works.

However, my codebase right now is a wreck, I don't want to just submit this blind, and I can't really revert my code down just for this fix. So if someone could merge this in, and do a quick test with Lotus Bloom, and then submit for me that'd be great.

The change was only in canPlay() but I'll copy the whole function so it can be easier to find.

Code: Select all
    public static SpellAbility ability_suspend(final Card sourceCard, final String suspendCost, final int suspendCounters) {
       // be careful with Suspend ability, it will not hit the stack
        final SpellAbility suspend = new Ability_Static(sourceCard, suspendCost) {
         private static final long serialVersionUID = 21625903128384507L;

         @Override
         public boolean canPlay(){
              if (!(getRestrictions().canPlay(sourceCard, this)))     
                 return false;
            
            if (sourceCard.isInstant())
               return true;
            
            return Phase.canCastSorcery(sourceCard.getOwner());
         }
         
         @Override
            public boolean canPlayAI() {
                return false;
            }
           
            @Override
            public void resolve() {
               AllZone.GameAction.exile(sourceCard);
               sourceCard.addCounter(Counters.TIME, suspendCounters);
            }
        };
        suspend.setDescription("Suspend " +suspendCounters + ": "+ suspendCost);
        suspend.setStackDescription(sourceCard.getName() + " suspending for " + suspendCounters + " turns.)");
        suspend.getRestrictions().setActivateZone(Constant.Zone.Hand);
        return suspend;
    }//ability_suspend()
Thanks.
Ok. Tested and it works. I'll submit.

-slapshot5

Re: Suspend Fix

PostPosted: 29 Oct 2010, 13:44
by friarsol
Thanks. Hopefully, I'll have this Phase stuff done soon so I can actually submit updates when I need to.