It is currently 05 Sep 2025, 16:31
   
Text Size

Developing Bugs

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: Developing Bugs

Postby goonjamin » 10 Nov 2012, 22:57

r17975 - The following 3 pictures will not download.

Code: Select all
AEthertow [SHM - Shadowmoor]
Circle of Protection: Black [9ED - Core Set - Ninth Edition]
Circle of Protection: Red [9ED - Core Set - Ninth Edition]
goonjamin
 
Posts: 133
Joined: 19 Aug 2010, 19:51
Has thanked: 39 times
Been thanked: 5 times

Re: Developing Bugs

Postby goonjamin » 11 Nov 2012, 02:17

r17977 - Received the attached crash when clicking on Skyshroud Cutter and then my Drudge Skeletons to block.

Code: Select all
This is a Crash Report. An error has occurred. Please save this message to a file.
Please follow the instructions at this address to submit this Crash Report, plus what you were doing at the time:
   http://tinyurl.com/3zzrnyb
Reporting bugs in Forge is very important. We thank you for your time.

null


Version:
Forge version 1.3.1-SNAPSHOT-r0000

OS: Windows 7 Version: 6.1 Architecture: x86

Java Version: 1.6.0_35 Vendor: Sun Microsystems Inc.

Detailed error trace:
java.lang.NullPointerException
   at forge.gui.framework.SDisplayUtil$1$1.run(SDisplayUtil.java:62)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$400(Unknown Source)
   at java.awt.EventQueue$2.run(Unknown Source)
   at java.awt.EventQueue$2.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.Dialog$1.run(Unknown Source)
   at java.awt.Dialog$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.awt.Dialog.show(Unknown Source)
   at java.awt.Component.show(Unknown Source)
   at java.awt.Component.setVisible(Unknown Source)
   at java.awt.Window.setVisible(Unknown Source)
   at java.awt.Dialog.setVisible(Unknown Source)
   at forge.error.ErrorViewer.showDialog(ErrorViewer.java:192)
   at forge.error.ErrorViewer.showError(ErrorViewer.java:117)
   at forge.error.ErrorViewer.showError(ErrorViewer.java:79)
   at forge.error.ExceptionHandler.handle(ExceptionHandler.java:62)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at java.awt.EventDispatchThread.handleException(Unknown Source)
   at java.awt.EventDispatchThread.processException(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
Attachments
crash.jpg
goonjamin
 
Posts: 133
Joined: 19 Aug 2010, 19:51
Has thanked: 39 times
Been thanked: 5 times

Re: Developing Bugs

Postby Agetian » 11 Nov 2012, 09:53

Not a developing "bug" per se, but a request for code review: with the recent (r17985) addition of visual highlighting of cards on the playfield when choosing sources, declaring the order of blockers, etc., two static methods had to be added to set and clear the highlighting; they were added to GuiUtils since that seemed logical, but I don't know if that was the correct place. Please review and move if necessary so that they are in the right place.

- Agetian
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: Developing Bugs

Postby ArsenalNut » 30 Nov 2012, 04:28

When looking at the use of the getParentTargetingCard method in Forge, I came across this in the
calculateAmount method

Targeted amount snippet | Open
Code: Select all
 } else if (calcX[0].startsWith("Targeted")) {
                    final Target t = ability.getTarget();
                    if (null != t) {
                        final ArrayList<Object> all = t.getTargets();
                        list = new ArrayList<Card>();
                        if (!all.isEmpty() && (all.get(0) instanceof SpellAbility)) {
                            final SpellAbility saTargeting = ability.getParentTargetingSA();
                            // possible NPE on next line
                            final ArrayList<SpellAbility> sas = saTargeting.getTarget().getTargetSAs();
                            for (final SpellAbility sa : sas) {
                                list.add(sa.getSourceCard());
                            }
                        } else {
                            final SpellAbility saTargeting = ability.getParentTargetingCard();
                            if (null != saTargeting.getTarget()) {
                                list.addAll(saTargeting.getTarget().getTargetCards());
                            }
                        }
                    } else {
                        final SpellAbility parent = ability.getParentTargetingCard();
                        if (parent.getTarget() != null) {
                            final ArrayList<Object> all = parent.getTarget().getTargets();
                            if (!all.isEmpty() && (all.get(0) instanceof SpellAbility)) {
                                list = new ArrayList<Card>();
                                final ArrayList<SpellAbility> sas = parent.getTarget().getTargetSAs();
                                for (final SpellAbility sa : sas) {
                                    list.add(sa.getSourceCard());
                                }
                            } else {
                                list = new ArrayList<Card>(parent.getTarget().getTargetCards());
                            }
                        }
                    }
This code is searching for a card target through a couple different lists but it seems to be doing it in a confusing way that counts on the fact the getParentTargetingCard checks the current ability despite the fact that the targets of current ability could be directly checked.

Here's what I think the search priority is supposed to be :
1) cards targeted by the current ability
2) cards targeted by a parent of the current ability
3) source cards for SA targeted by the current ability
4) source cards for SA targeted by a parent of the current ability

suggest code replacement | Open
Code: Select all
} else if (calcX[0].startsWith("Targeted")) {
                    // First Check for an SA in the tree that has a list of card targets
                    SpellAbility saTargeting = ability.getSATargetingCard();
                    if (null != saTargeting.getTarget() && !saTargeting.getTarget().getTargetCards().isEmpty()) {
                        list.addAll(saTargeting.getTarget().getTargetCards());
                    }
                    else {
                        // Now check for source cards of targeted SA
                        saTargeting = ability.getSATargetingSA();
                        if (null != saTargeting.getTarget()) {
                            list = new ArrayList<Card>();
                            final ArrayList<SpellAbility> sas = saTargeting.getTarget().getTargetSAs();
                            for (final SpellAbility sa : sas) {
                                list.add(sa.getSourceCard());
                            }
                        }
                    }   
The getSATargetingCard and getSATargetingSA methods would look for non-null targeting starting the current SA. Is there anything I overlooked in the original code?

Is search order really correct? Should the search order really be:
1) cards targeted by the current ability
2) source cards for SA targeted by the current ability
3) cards targeted by a parent of the current ability
4) source cards for SA targeted by a parent of the current ability

Edit:
filterListByType(List<Card>, String, SpellAbility) sort of does the search like above but it doesn't really check for a parent that targets SA's. It would be good to get a consensus on which of the search orders I've proposed is the desired order so I can implement it in filterListByType.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Developing Bugs

Postby Sloth » 30 Nov 2012, 17:18

ArsenalNut wrote:filterListByType(List<Card>, String, SpellAbility) sort of does the search like above but it doesn't really check for a parent that targets SA's. It would be good to get a consensus on which of the search orders I've proposed is the desired order so I can implement it in filterListByType.
Your second order sounds more natural, but i guess it doesn't really matter for any card currently scripted.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Developing Bugs

Postby Agetian » 29 Dec 2012, 13:45

Hmm, for some reason I once again get a failure during the tests when building Forge. The last time I've had an issue like that, I remember I had to use "Clean and Build" to rebuild the application, but this time it doesn't help, I still get a test failure... is there anything else I need to do to get rid of it? Here's what it shows me:

Code: Select all
 T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNGMapConfigurator@1dbb27d
[white, red, blue]
failed : 0.9
failed : 0.91
failed : 38.0
failed : 41.0
failed : 42.0
failed : 43.0
ManaCost : addMana() error, mana not needed - 1
failed : 45.1
3
Tests run: 9, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 2.551 sec <<< FAILURE!

Results :

Failed tests:   testPayManaCost(forge.card.mana.ManaPartTest)
  test(forge.ReadDraftRankingsTest)

Tests run: 9, Failures: 2, Errors: 0, Skipped: 0

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 42.548s
Finished at: Sat Dec 29 17:42:51 MSK 2012
Final Memory: 10M/62M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project forge: There are test failures.

Please refer to C:\Users\Agetian\Documents\NetBeansProjects\trunk\target\surefire-reports for the individual test results.
-> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Thanks in advance.

- Agetian
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: Developing Bugs

Postby bbbbbbbbba » 29 Dec 2012, 18:56

UnlessSwitched$ didn't work if human is not eligible for paying. It swaped paidCommand with unpaidCommand, but later when executing the command, neither is used.
bbbbbbbbba
 
Posts: 18
Joined: 25 Dec 2012, 13:54
Has thanked: 0 time
Been thanked: 1 time

Re: Developing Bugs

Postby Sloth » 19 Mar 2013, 09:24

When i download LQ set pics, the downloader hangs on the first pic that is not available and spams hundreds of these lines in the console:
"File not found, no image created: TSP/Yavimaya Dryad.full"
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Developing Bugs

Postby Max mtg » 19 Mar 2013, 09:45

@Sloth, See if r20476 stops spamming
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: Developing Bugs

Postby Agetian » 06 Apr 2013, 03:02

r20833 does not compile (missing CardFactoryArtifacts.java - seems like there's still at least one reference to this class that got removed).

- Agetian
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: Developing Bugs

Postby friarsol » 06 Apr 2013, 03:34

Agetian wrote:r20833 does not compile (missing CardFactoryArtifacts.java - seems like there's still at least one reference to this class that got removed).

- Agetian
Stupid changelists hiding it. Sorry bout that.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Developing Bugs

Postby swordshine » 06 Apr 2013, 14:36

Some codes need to be updated for "landwalk of the chosen type", I'll fix them tomorrow.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Developing Bugs

Postby moomarc » 08 Apr 2013, 11:47

I'm trying to fix Undying Flame (bug reported here) and simplifying the script while I'm at it. Can anyone tell me why this snippet from Barrel Down Sokenzan will allow you to select a target for the DealDamage subability, while the following snippet from my version of Undying Flames doesn't allow you to select targets?
Code: Select all
A:SP$ ChangeZone | Cost$ 2 R | Origin$ Battlefield | Destination$ Hand | ChangeType$ Mountain.YouCtrl | ChangeNum$ X | Hidden$ True | RememberChanged$ True | SubAbility$ DBDamage | References$ X | SpellDescription$ Sweep - Return any number of Mountains you control to their owner's hand. CARDNAME deals damage to target creature equal to twice the number of Mountains returned this way.
SVar:DBDamage:DB$ DealDamage | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumDmg$ Y | References$ Y
Code: Select all
A:SP$ DigUntil | Cost$ 4 R R | Valid$ Card.nonLand | ValidDescription$ nonland | FoundDestination$ Exile | RevealedDestination$ Exile | RememberFound$ True | SubAbility$ UndyingDamage | SpellDescription$ Exile cards from the top of your library until you exile a nonland card. Undying Flames deals damage to target creature or player equal to that card's converted mana cost.
SVar:UndyingDamage:DB$ DealDamage | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ X | References$ X | SubAbility$ DBCleanup
Edit: Nevermind that part. I see it's because Epic just grabs targets from the base ability.

So onto fixing Undying Flames: I've traced the problem to the Target returning empty (not null) when called by getParentTargetingPlayer/Card from AbilityUtils:getDefinedPlayer/Card:"Targeted". It might be fixed by making the Epic ability correctly consider targets of subabilities so that the pump used for targeting is unnecessary, but I'm not sure and don't know how to apply the fix anyway. Hopefully it will at least help someone else fix it.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: Developing Bugs

Postby Sloth » 08 Apr 2013, 17:56

moomarc wrote:I'm trying to fix Undying Flame (bug reported here) and simplifying the script while I'm at it.
I will try to fix Undying Flames.

EDIT: Fixed.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Developing Bugs

Postby Sloth » 14 Apr 2013, 07:23

@Max: Your changes to CostRemoveCounter broke the AI part of this cost. The doPayment function now requires the cntRemoved variable to be set, but it looks like you forgot to tell that to the AI.

EDIT: Fixed.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 33 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 33 users online :: 0 registered, 0 hidden and 33 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 33 guests

Login Form