Weird behavior of the Stack
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
11 posts
• Page 1 of 1
Weird behavior of the Stack
by Sloth » 19 Sep 2011, 17:05
I've just noticed a change in the behavior of the stack:
- When there are two abilities on the stack, I can only see the description of the last (even when I mouse over the other). Also the first ability takes the color of the second.
- When I cast Counterspell I get this error:
- I also noticed a lot of cases where I can't cast certain spells in my hand.
I guess your changes are responsible for this Max.
- When there are two abilities on the stack, I can only see the description of the last (even when I mouse over the other). Also the first ability takes the color of the second.
- When I cast Counterspell I get this error:
- | Open
- java.lang.NullPointerException
at forge.AllZoneUtil.getCardsIn(AllZoneUtil.java:83)
at forge.card.spellability.Target_Selection.chooseValidInput(Target_Selection.java:191)
at forge.card.spellability.Target_Selection.chooseTargets(Target_Selection.java:158)
at forge.card.spellability.SpellAbility_Requirements.fillRequirements(SpellAbility_Requirements.java:90)
at forge.card.spellability.SpellAbility_Requirements.fillRequirements(SpellAbility_Requirements.java:62)
at forge.GameAction.playSpellAbility(GameAction.java:2111)
at forge.GameAction.playCard(GameAction.java:1598)
at forge.gui.input.Input_PassPriority.selectCard(Input_PassPriority.java:57)
- I also noticed a lot of cases where I can't cast certain spells in my hand.
I guess your changes are responsible for this Max.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Weird behavior of the Stack
by Max mtg » 19 Sep 2011, 17:51
Most definetelly, give me a WTR for each, I'll check them.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Weird behavior of the Stack
by Sloth » 19 Sep 2011, 18:05
What do you want a Weapons Test Range for? (sorry I don't know this abbreviation)Max mtg wrote:Most definetelly, give me a WTR for each, I'll check them.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Weird behavior of the Stack
by Hellfish » 19 Sep 2011, 18:08
Way To Reproduce? 

So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: Weird behavior of the Stack
by Sloth » 19 Sep 2011, 18:19
Ah.Hellfish wrote:Way To Reproduce?
Use this in a setup game state file:
- | Open
- HumanCardsInHand=Arcbound Worker; Chaotic Goo; Counterspell; Brainstorm; Avian Changeling; Vindicate; Melira, Sylvok Outcast
Cast something then cast Brainstorm then try to cast Counterspell.
By the way, I remembered something:
I once tried to add the stack zone to this batch of code you replaced Max:
- | Open
- Code: Select all
/**
* <p>getCardsInZone.</p>
*
* @param zone a {@link java.lang.String} object.
* @param player a {@link forge.Player} object.
* @return a {@link forge.CardList} object.
*/
public static CardList getCardsInZone(final String zone, final Player player) {
CardList all = new CardList();
if (zone.contains(Constant.Zone.Graveyard)) {
if (player == null || player.isHuman()) {
all.addAll(AllZone.getHumanGraveyard().getCards());
}
if (player == null || player.isComputer()) {
all.addAll(AllZone.getComputerGraveyard().getCards());
}
}
if (zone.contains(Constant.Zone.Hand)) {
if (player == null || player.isHuman()) {
all.addAll(AllZone.getHumanHand().getCards());
}
if (player == null || player.isComputer()) {
all.addAll(AllZone.getComputerHand().getCards());
}
}
if (zone.contains(Constant.Zone.Battlefield)) {
if (player == null || player.isHuman()) {
all.addAll(AllZone.getHumanBattlefield().getCards());
}
if (player == null || player.isComputer()) {
all.addAll(AllZone.getComputerBattlefield().getCards());
}
}
if (zone.contains(Constant.Zone.Exile)) {
if (player == null || player.isHuman()) {
all.addAll(AllZone.getHumanExile().getCards());
}
if (player == null || player.isComputer()) {
all.addAll(AllZone.getComputerExile().getCards());
}
}
if (zone.contains(Constant.Zone.Library)) {
if (player == null || player.isHuman()) {
all.addAll(AllZone.getHumanLibrary().getCards());
}
if (player == null || player.isComputer()) {
all.addAll(AllZone.getComputerLibrary().getCards());
}
}
return all;
}
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Weird behavior of the Stack
by friarsol » 19 Sep 2011, 18:39
I've never seen this abbreviation before either. I guessed it might be that from the context but had to stare at it for a few minutes.Hellfish wrote:Way To Reproduce?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Weird behavior of the Stack
by Max mtg » 19 Sep 2011, 19:20
I replaced that code for good, because we might have more players in some bright future and writing a code to check each zone personally, that is specifying its name right there, is no fun.
Stack... yes, no player owns it, so it should have been included here as a special case. It was in 10557
Game does not crash, but Counterspell is not working anyway - I'm investigating
Stack... yes, no player owns it, so it should have been included here as a special case. It was in 10557
Game does not crash, but Counterspell is not working anyway - I'm investigating
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Weird behavior of the Stack
by Max mtg » 19 Sep 2011, 23:02
Counterspell fixed
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Weird behavior of the Stack
by Sloth » 20 Sep 2011, 17:53
Did you find out where this bug came from Max?Sloth wrote:- When there are two abilities on the stack, I can only see the description of the last (even when I mouse over the other). Also the first ability takes the color of the second.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Weird behavior of the Stack
by Max mtg » 20 Sep 2011, 21:28
Of course, my friend, it comes from Hellfish's change at 10450. GuiDisplay4.java:736, index is missing at peekInstanceSloth wrote:Did you find out where this bug came from Max?Sloth wrote:- When there are two abilities on the stack, I can only see the description of the last (even when I mouse over the other). Also the first ability takes the color of the second.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Weird behavior of the Stack
by Hellfish » 20 Sep 2011, 21:35
Oh, hehe.. sorry 

So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
11 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 54 guests