It is currently 25 Apr 2024, 04:43
   
Text Size

Forge version 1.4.3

Post MTG Forge Related Programming Questions Here

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

Re: Forge version 1.4.3

Postby Max mtg » 12 Jul 2013, 05:26

I wonder why it would not work
Code: Select all
        final List<Card> a = CardLists.getType(p.getCardsIn(ZoneType.Battlefield), "Legendary");
        if (a.isEmpty() || game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLegendRule)) {
            return false;
        }
        boolean recheck = false;
        final List<Card> yamazaki = CardLists.filter(a, CardPredicates.nameEquals("Brothers Yamazaki"));
        if (yamazaki.size() == 2) {
            a.removeAll(yamazaki);
        }       
It considers only brothers under a single player's control
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: Forge version 1.4.3

Postby swordshine » 12 Jul 2013, 05:35

Max mtg wrote:It considers only brothers under a single player's control
Since the oracle of this card didn't change, the legend rule won't apply to them if only 2 Brothers Yamazaki ON THE BATTLEFIELD (not controlled by a player). So if each player controls two Brothers Yamazaki, the total number is 4 and the legend rule will apply, each player has to choose one Brothers Yamazaki to survive and destroy the other.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Forge version 1.4.3

Postby swordshine » 12 Jul 2013, 05:51

How about this?
Code: Select all
### Eclipse Workspace Patch 1.0
#P trunk
Index: src/main/java/forge/game/GameAction.java
===================================================================
--- src/main/java/forge/game/GameAction.java   (revision 22547)
+++ src/main/java/forge/game/GameAction.java   (working copy)
@@ -904,9 +904,9 @@
                 // Place triggers on stack
                 game.getStack().chooseOrderOfSimultaneousStackEntryAll();
             }
-
+            boolean yamazaki = CardLists.filter(game.getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Brothers Yamazaki")).size() ==  2;
             for(Player p : game.getPlayers() ) {
-                if (this.handleLegendRule(p)) {
+                if (this.handleLegendRule(p, yamazaki)) {
                     checkAgain = true;
                 }
     
@@ -1189,14 +1189,14 @@
      * destroyLegendaryCreatures.
      * </p>
      */
-    private boolean handleLegendRule(Player p) {
+    private boolean handleLegendRule(Player p, boolean yama) {
         final List<Card> a = CardLists.getType(p.getCardsIn(ZoneType.Battlefield), "Legendary");
         if (a.isEmpty() || game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLegendRule)) {
             return false;
         }
         boolean recheck = false;
-        final List<Card> yamazaki = CardLists.filter(a, CardPredicates.nameEquals("Brothers Yamazaki"));
-        if (yamazaki.size() == 2) {
+        if (yama) {
+            List<Card> yamazaki = CardLists.filter(a, CardPredicates.nameEquals("Brothers Yamazaki"));
             a.removeAll(yamazaki);
         }
         

swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Forge version 1.4.3

Postby Max mtg » 12 Jul 2013, 08:58

I'm thinking of a multiplayer game with 3+ players, each controlling a Brothers Yamazaki. How will they agree whose creatures will go to the grave?
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: Forge version 1.4.3

Postby swordshine » 12 Jul 2013, 09:04

Max mtg wrote:I'm thinking of a multiplayer game with 3+ players, each controlling a Brothers Yamazaki. How will they agree whose creatures will go to the grave?
Each player will keep one after the state-based action, so no Brothers Yamazaki will go to the graveyard.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Forge version 1.4.3

Postby Max mtg » 12 Jul 2013, 09:38

Then your patch solves all problems!
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: Forge version 1.4.3

Postby friarsol » 12 Jul 2013, 12:28

This should work except for when Brothers are affected by Humility, which would cause them not to be granting this static ability, and then use the normal rules.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Forge version 1.4.3

Postby Max mtg » 12 Jul 2013, 13:03

there was something like GlobalRuleChanges for these cases
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: Forge version 1.4.3

Postby Chris H. » 12 Jul 2013, 13:14

While trying to build and deploy today's 1.4.3 beta there was a build error. This error appears to happen fairly early in the process in the tests stage.
 
Code: Select all
[INFO] [INFO] --- maven-surefire-plugin:2.14.1:test (default-test) @ forge ---
[INFO] [INFO] Surefire report directory: /Users/chrish/Workspace_SVN/ForgeSVN/target/surefire-reports
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
[INFO] Configuring TestNG with: TestNG652Configurator
[INFO]
[INFO] Results :
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 40.175s
[INFO] [INFO] Finished at: Fri Jul 12 09:01:18 EDT 2013
[INFO] [INFO] Final Memory: 24M/469M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.14.1:test (default-test) on project forge: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.14.1:test failed: There was an error in the forked process
[INFO] [ERROR] org.testng.TestNGException:
[INFO] [ERROR] Cannot instantiate class forge.PanelTest
[INFO] [ERROR] at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:38)
[INFO] [ERROR] at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:387)
[INFO] [ERROR] at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:299)
[INFO] [ERROR] at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:110)
[INFO] [ERROR] at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:186)
[INFO] [ERROR] at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:120)
[INFO] [ERROR] at org.testng.TestRunner.initMethods(TestRunner.java:409)
[INFO] [ERROR] at org.testng.TestRunner.init(TestRunner.java:235)
[INFO] [ERROR] at org.testng.TestRunner.init(TestRunner.java:205)
[INFO] [ERROR] at org.testng.TestRunner.<init>(TestRunner.java:153)
[INFO] [ERROR] at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:522)
[INFO] [ERROR] at org.testng.SuiteRunner.init(SuiteRunner.java:157)
[INFO] [ERROR] at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
[INFO] [ERROR] at org.testng.TestNG.createSuiteRunner(TestNG.java:1299)
[INFO] [ERROR] at org.testng.TestNG.createSuiteRunners(TestNG.java:1286)
[INFO] [ERROR] at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
[INFO] [ERROR] at org.testng.TestNG.run(TestNG.java:1057)
[INFO] [ERROR] at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:77)
[INFO] [ERROR] at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:189)
[INFO] [ERROR] at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:105)
[INFO] [ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:117)
[INFO] [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[INFO] [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] [ERROR] at java.lang.reflect.Method.invoke(Method.java:601)
[INFO] [ERROR] at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
[INFO] [ERROR] at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:159)
[INFO] [ERROR] at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:87)
[INFO] [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
[INFO] [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)
[INFO] [ERROR] Caused by: java.lang.reflect.InvocationTargetException
[INFO] [ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[INFO] [ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
[INFO] [ERROR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[INFO] [ERROR] at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
[INFO] [ERROR] at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
[INFO] [ERROR] ... 29 more
[INFO] [ERROR] Caused by: java.lang.NullPointerException
[INFO] [ERROR] at java.awt.Window.initGC(Window.java:467)
[INFO] [ERROR] at java.awt.Window.init(Window.java:487)
[INFO] [ERROR] at java.awt.Window.<init>(Window.java:536)
[INFO] [ERROR] at java.awt.Frame.<init>(Frame.java:420)
[INFO] [ERROR] at java.awt.Frame.<init>(Frame.java:385)
[INFO] [ERROR] at javax.swing.JFrame.<init>(JFrame.java:180)
[INFO] [ERROR] at forge.PanelTest.<init>(PanelTest.java:46)
[INFO] [ERROR] ... 34 more
 
Attachments
complete log.txt
(174.42 KiB) Downloaded 280 times
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Forge version 1.4.3

Postby spr » 12 Jul 2013, 14:56

Hi Chris,

I am no maven expert but I ran just the "Maven test" configuration against r22554 and it appears to have worked. This was on Windows 7 64, running Eclipse 64, using jdk1.7.0_21 (32bit).

Code: Select all
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Forge 1.4.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:released-version (released-version) @ forge ---
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:parse-version (parse-version) @ forge ---
[INFO]
[INFO] --- svn-revision-number-maven-plugin:1.13:revision (default) @ forge ---
[INFO] inspecting directory D:\_DATA\Java\eclipse\mtg-forge\trunk
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ forge ---
[INFO] Using 'ISO-8859-1' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (build-version-string) @ forge ---
[INFO] Executing tasks

main:
[INFO] Executed tasks
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ forge ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ forge ---
[INFO] Using 'ISO-8859-1' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\_DATA\Java\eclipse\mtg-forge\trunk\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ forge ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.14.1:test (default-test) @ forge ---
[INFO] Surefire report directory: D:\_DATA\Java\eclipse\mtg-forge\trunk\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: TestNG652Configurator
failed : 41.0
failed : 42.0
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.721 sec

Results :

Tests run: 8, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.143s
[INFO] Finished at: Fri Jul 12 15:49:44 BST 2013
[INFO] Final Memory: 8M/23M
[INFO] ------------------------------------------------------------------------
Cheers,
Steve.
User avatar
spr
 
Posts: 213
Joined: 06 Jul 2013, 19:31
Has thanked: 28 times
Been thanked: 60 times

Re: Forge version 1.4.3

Postby Chris H. » 12 Jul 2013, 15:31

spr wrote:Hi Chris,

I am no maven expert but I ran just the "Maven test" configuration against r22554 and it appears to have worked. This was on Windows 7 64, running Eclipse 64, using jdk1.7.0_21 (32bit).

Code: Select all
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Forge 1.4.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:released-version (released-version) @ forge ---
[INFO]
[INFO] --- build-helper-maven-plugin:1.7:parse-version (parse-version) @ forge ---
[INFO]
[INFO] --- svn-revision-number-maven-plugin:1.13:revision (default) @ forge ---
[INFO] inspecting directory D:\_DATA\Java\eclipse\mtg-forge\trunk
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ forge ---
[INFO] Using 'ISO-8859-1' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (build-version-string) @ forge ---
[INFO] Executing tasks

main:
[INFO] Executed tasks
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ forge ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ forge ---
[INFO] Using 'ISO-8859-1' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\_DATA\Java\eclipse\mtg-forge\trunk\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ forge ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.14.1:test (default-test) @ forge ---
[INFO] Surefire report directory: D:\_DATA\Java\eclipse\mtg-forge\trunk\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: TestNG652Configurator
failed : 41.0
failed : 42.0
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.721 sec

Results :

Tests run: 8, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.143s
[INFO] Finished at: Fri Jul 12 15:49:44 BST 2013
[INFO] Final Memory: 8M/23M
[INFO] ------------------------------------------------------------------------
Cheers,
Steve.
 
Thank you Steve. :D

I decided to retry the beta build and release Maven command and it now appears to be working OK. My terminal window now shows that the reports are being uploaded to cardforge and this is the last step so we should be OK. :D
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 91 guests


Who is online

In total there are 91 users online :: 0 registered, 0 hidden and 91 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 91 guests

Login Form