Suspend Fix
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Suspend Fix
by friarsol » 29 Oct 2010, 04:28
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.
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()
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Suspend Fix
by slapshot5 » 29 Oct 2010, 11:47
Ok. Tested and it works. I'll submit.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.Thanks.
- 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()
-slapshot5
- slapshot5
- Programmer
- Posts: 1391
- Joined: 03 Jan 2010, 17:47
- Location: Mac OS X
- Has thanked: 25 times
- Been thanked: 68 times
Re: Suspend Fix
by friarsol » 29 Oct 2010, 13:44
Thanks. Hopefully, I'll have this Phase stuff done soon so I can actually submit updates when I need to.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 44 guests