It is currently 25 Apr 2024, 19:24
   
Text Size

too much lag

by BetaSteward

Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins

too much lag

Postby BiasedDice » 15 Nov 2014, 04:56

too much lag
Last edited by BiasedDice on 28 Feb 2015, 23:07, edited 1 time in total.
BiasedDice
 
Posts: 17
Joined: 15 Nov 2014, 04:45
Has thanked: 0 time
Been thanked: 0 time

Re: About how cards are implemented

Postby LevelX » 15 Nov 2014, 11:35

I added AEther Rift to Xmage (just for you).

Each card is a java class. The Java program (XMage in this case) itself runs already in a sand box.
So every card is a java object and uses the classes and methods from the XMage framework to make it work by the rules.
Therefore you have to write java code to implement cards.

Here as example the AEther Rift class
Code: Select all
public class AEtherRift extends CardImpl {

    public AEtherRift(UUID ownerId) {
        super(ownerId, 227, "AEther Rift", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{G}");
        this.expansionSetCode = "INV";

        this.color.setRed(true);
        this.color.setGreen(true);

        // At the beginning of your upkeep, discard a card at random. If you discard a creature card this way, return it from your graveyard to the battlefield unless any player pays 5 life.
        this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AEtherRiftEffect(), TargetController.YOU, false));

    }

    public AEtherRift(final AEtherRift card) {
        super(card);
    }

    @Override
    public AEtherRift copy() {
        return new AEtherRift(this);
    }
}

class AEtherRiftEffect extends OneShotEffect {

    public AEtherRiftEffect() {
        super(Outcome.Benefit);
        this.staticText = "discard a card at random. If you discard a creature card this way, return it from your graveyard to the battlefield unless any player pays 5 life";
    }

    public AEtherRiftEffect(final AEtherRiftEffect effect) {
        super(effect);
    }

    @Override
    public AEtherRiftEffect copy() {
        return new AEtherRiftEffect(this);
    }

    @Override
    public boolean apply(Game game, Ability source) {
        Player controller = game.getPlayer(source.getControllerId());
        if (controller != null) {
            Card card = controller.discardOne(true, source, game);
            if (card != null && card.getCardType().contains(CardType.CREATURE)) {
                Effect returnEffect = new ReturnFromGraveyardToBattlefieldTargetEffect();
                returnEffect.setTargetPointer(new FixedTarget(card.getId()));
                Effect doEffect = new DoUnlessAnyPlayerPaysEffect(returnEffect, new PayLifeCost(5),
                        "Pay 5 life to prevent " + card.getLogName() + " to return from graveyard to battlefield?");
                return doEffect.apply(game, source);
            }
            return true;
        }
        return false;
    }
}
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: About how cards are implemented

Postby kleedrac » 26 Nov 2014, 06:39

Has it ever been considered to allow users to implement cards and submit our classes to you for inclusion?
kleedrac
 
Posts: 23
Joined: 10 Oct 2014, 04:14
Has thanked: 0 time
Been thanked: 0 time

Re: About how cards are implemented

Postby emerald000 » 26 Nov 2014, 07:38

We are gladly accepting any help for the development. You might want to check https://github.com/magefree/mage/wiki/D ... ng-Started to get started.

If you have any questions, you can post on the developers subforum and we'll be glad to help.
User avatar
emerald000
 
Posts: 92
Joined: 07 Jul 2014, 16:55
Has thanked: 1 time
Been thanked: 9 times

Re: About how cards are implemented

Postby kleedrac » 27 Nov 2014, 06:11

One more quick question - can existing cards be revised? I've got a Marrow-Gnawer commander deck I can't use because it contains several Relentless Rats (which is legal) but would I have to put that in the card or the rules for commander?
kleedrac
 
Posts: 23
Joined: 10 Oct 2014, 04:14
Has thanked: 0 time
Been thanked: 0 time

Re: About how cards are implemented

Postby LevelX » 27 Nov 2014, 13:29

kleedrac wrote:One more quick question - can existing cards be revised? I've got a Marrow-Gnawer commander deck I can't use because it contains several Relentless Rats (which is legal) but would I have to put that in the card or the rules for commander?
I'm not sure if I got your problem correctly.

The legality of a deck is checked with classes in the package mage.deck of the project "Mage Deck Constructed".
There is a class Commander.java and a class "Commander Duel.java" that do the format check for the Commander formats.
E.g. the check that a commander deck can have multiple Relentless Rats or Shadowborn Apostle is already implemented there.
So I don't understand why you can't use your deck.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

too much lag

Postby BiasedDice » 27 Nov 2014, 23:38

too much lag
Last edited by BiasedDice on 28 Feb 2015, 23:07, edited 1 time in total.
BiasedDice
 
Posts: 17
Joined: 15 Nov 2014, 04:45
Has thanked: 0 time
Been thanked: 0 time

Re: About how cards are implemented

Postby kleedrac » 30 Nov 2014, 00:30

LevelX wrote:
kleedrac wrote:One more quick question - can existing cards be revised? I've got a Marrow-Gnawer commander deck I can't use because it contains several Relentless Rats (which is legal) but would I have to put that in the card or the rules for commander?
I'm not sure if I got your problem correctly.

The legality of a deck is checked with classes in the package mage.deck of the project "Mage Deck Constructed".
There is a class Commander.java and a class "Commander Duel.java" that do the format check for the Commander formats.
E.g. the check that a commander deck can have multiple Relentless Rats or Shadowborn Apostle is already implemented there.
So I don't understand why you can't use your deck.
The specific error I get is as follows;

You(Kleedrac) have an invalid deck for the selected Commander format.
Commander: Commander invalide (Marrow-Gnawer)
Select a deck that is appropriate for the selected format and try again!

I always assumed it was an error stemming from the number of Relentless Rats but evidently it doesn't think I'm allowed to use Marrow-Gnawer as a commander! What would cause this?

-update-
To answer my own question it would appear that xmage is incorrectly thinking Marrow-Gnawer isn't legendary - he's being bounced as my commander! If I have time in the coming week I'll make that my first git fix (unless you guys get to it first) :)
kleedrac
 
Posts: 23
Joined: 10 Oct 2014, 04:14
Has thanked: 0 time
Been thanked: 0 time

Re: About how cards are implemented

Postby fireshoes » 01 Dec 2014, 03:52

Correct, it does not list Marrow-Gnawer as Legendary in the tooltips.
User avatar
fireshoes
 
Posts: 536
Joined: 20 Aug 2014, 03:51
Has thanked: 201 times
Been thanked: 49 times


Return to XMage

Who is online

Users browsing this forum: No registered users and 174 guests


Who is online

In total there are 174 users online :: 0 registered, 0 hidden and 174 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 174 guests

Login Form