Monday, September 28, 2020

Linux Generate md5 from command line

`echo` would always return with trailing new line char, therefore pass `-n` to
neglect the newline. And so md5sum would received a text from pipe with `-t`

 $ echo -n 123456 | md5sum -t

e10adc3949ba59abbe56e057f20f883e  -

Have fun ^^

Sunday, September 27, 2020

XMage, Adding MutateAbility (2)

Got the ETB triggers, by using the 

Ability abilityEquip = new EntersBattlefieldTriggeredAbility(
    new MutateEffect(Outcome.Mutate)

While the MutatesSourceTriggeredAbility failed to trigger..
or probably it is triggered but there is something in the GameImpl
that treated it different way?

Saturday, September 26, 2020

Xmage, Client does not want to Run, as the Card Repository broken or error

If you experience the Card db or repository failure, then simply
Make sure you are in the Mage.Client dir 

$ pwd 

$ rm -rf db

And then re-run the client,
$ mvn exec:java -Dexec.mainClass="mage.client.MageFrame"

Hope it helps ^^

Friday, September 25, 2020

XMage, Setting Client And Server to TestMode

Mage.Client, go to and edit

public static boolean isTestMode() {

	return true;
    //return session.isTestMode();

Mage.Server, run is with additional argument set, -testMode=true

$ mvn exec:java -Dexec.mainClass="mage.server.Main" -Dexec.args="-testMode=true"

Happy testing ^^

XMage, Adding MutateAbility (1)

 Got gp66 forked repo to work on. Trying to test Gemrazer to implement

1. target controlled permanent non-human

@@ -2,36 +2,48 @@ package;
 import mage.MageInt;
 import mage.abilities.Ability;
 import mage.abilities.common.MutatesSourceTriggeredAbility;
 import mage.abilities.effects.common.DestroyTargetEffect;
+import mage.abilities.effects.common.AttachEffect;
 import mage.constants.CardType;
+import mage.constants.Outcome;
 import mage.constants.SubType;
 import mage.constants.TargetController;
 import mage.filter.FilterPermanent;
 import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
+import mage.filter.common.FilterControlledCreaturePermanent;
+import mage.constants.SubType;
+import mage.filter.predicate.Predicates;

public final class Gemrazer extends CardImpl {
-    private static final FilterPermanent filter
+	private static final FilterPermanent filter
             = new FilterArtifactOrEnchantmentPermanent("artifact or enchantment an opponent controls");
     static {
+    private static final FilterPermanent filterCreatureNonHuman
+            = new FilterControlledCreaturePermanent("non-human creature you control");
+    static {
+    	filterCreatureNonHuman.add(Predicates.not(SubType.HUMAN.getPredicate()));
+    }

@@ -43,10 +55,15 @@ public final class Gemrazer extends CardImpl {
         // Reach
         // Trample
+        // Whenever this creature mutates, attach to a controlled non-human creature
+        Ability abilityAttach = new MutatesSourceTriggeredAbility(new AttachEffect(Outcome.Mutate));
+        abilityAttach.addTarget(new TargetPermanent(filterCreatureNonHuman));
+        this.addAbility(abilityAttach);
         // Whenever this creature mutates, destroy target artifact or enchantment an opponent controls.
         Ability ability = new MutatesSourceTriggeredAbility(new DestroyTargetEffect());
         ability.addTarget(new TargetPermanent(filter));

2. Test the ability of mutated creature

    public void testCastMutate() {
        addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
        addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
        addCard(Zone.BATTLEFIELD, playerA, "Flourishing Fox",1);
        addCard(Zone.HAND, playerA, "Gemrazer",1);

        castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gemrazer using mutate");
        // But why no addTarget to flourishing fox ??
        setStopAt(1, PhaseStep.BEGIN_COMBAT);

        assertAbility(playerA, "Gemrazer", new CyclingAbility(new ManaCostsImpl("{1}")), true);
        assertHandCount(playerA, 0);

The test result so far so good


Ask for the mutation on top or bottom of the targeted non-human creature.

Eclipse Maven build, recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0`

Error at Eclipse build, "... recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0`"


Find your .m2 repository dir, in my Linux debian 10 is at ~/.m2

$ find . -name "<>"
$ rm -f org/<> <-- usually under the name of your project

at the command line of the project, 

$ mvn clean
$ mvn install -DskipTests=true

Reopen eclipse, reference here

select Porject -> Maven -> Update

Have fun ^^