-
Notifications
You must be signed in to change notification settings - Fork 782
Developer HOWTO Guides
Oleg Agafonov edited this page Jan 6, 2018
·
25 revisions
Before proceed read getting started guide about tools and project structure.
Below you can found howto guides or developer's checklist.
- Select card to implement (example: "Anvilwrought Raptor");
- Find out all info about card (example from scryfall);
- Make sure it's not implemented yet -- search source code for "card name";
- Find old card with the same or similar abilities (use scryfall advanced oracle search or source code search);
- Prepare empty card stub:
- Create new java class file and copy paste source code any other card to it:
- Rename java class to card name in Camel Case Notation without any special chars or spaces (example:
Angrath, the Flame-Chained
->AngrathTheFlameChained
); - Check out card type, cost and subtype of new card;
- Remove not necessary abilities or code from old card;
- Add card's abilities:
- Use copy paste code from same card;
- Change and setup that code to your cards, e.g. change filter or condition;
- Use IDE code complete to hint correct class and method access (they all have same names as they describe on card. Example for flying ability:
this.addAbility(FlyingAbility.getInstance());
);
- Add new card to set's list:
- Find set's file in
..\Mage.Sets\src\mage\sets\YOUR_SET.java
; - Card's list by alphabetically order;
- Copy paste line from any other card near and change it to your card;
- Check out
card name
,card number
,card rarity
andcard class name
;
- Find set's file in
- All done, not time to test:
- Restart test server and client from your source in test mode (see testing strategy info);
- If xmage can't find your card name (see errors log or check it in deck editor) then delete all
cards*.db
files in developer folder -- it's force to recreate new database; - Make sure your card work fine and have same text as it have on paper (hint: if card's have wrong or missing text then ability settings was incorrect -- try to fix it first);
- Run all xmage tests, they all must be green (see xmage testing tools);
- Try to download card image (use xmage download images window for card's set);
- Commit changes (new card file and changes set file) and pull request it.
TODO
- Create new set's java file in
..\Mage.Sets\src\mage\sets\
folder by copy-paste template from any other set (example:ExplorersOfIxalan.java
); - Setup official set code and release date (use scryfall for set's info);
- Add new cards to set (see above);
- Add new tokens to set (see above);
- Setup set symbols download options:
- Go to
..\Mage.Client\src\main\java\org\mage\plugins\card\dl\sources\GathererSets.java
; - Add set's code to one of the supported list (example:
symbolsBasic
); - Add replace code when source uses non standard codes (example:
codeReplacements.put("CMA", "CM1");
);
- Go to
- Setup card images download options:
- Find current supporting images sources
DownloadSources
in..\Mage.Client\src\main\java\org\mage\plugins\card\images\DownloadPictures.java
file; - For each image source that you can download go to class file and add set's code to support list;
- Add set's code to supported (example for scryfall:
supportedSets.add("OGW");
); - Add replace code when source uses non standard codes (example for scryfall:
put("DD3GVL", "gvl");
);
- Add set's code to supported (example for scryfall:
- If set's can be downloaded then remove that code from global ignore list (
ignore.urls
inC:\mage\Mage.Client\src\main\resources\image.url.properties
file);
- Find current supporting images sources
- Setup token images download options:
- Some sources can support tokens download: if so then repeat cards images setup but search source code for tokens data (start with
getTokenImages()
method from java class, example:..\Mage.Client\src\main\java\org\mage\plugins\card\dl\sources\TokensMtgImageSource.java
); - Add tokens data to
..\Mage.Client\src\main\resources\card-pictures-tok.txt
; - Find each new token class and add set's code to supported list
tokenImageSets.addAll
(example:..\Mage\src\main\java\mage\game\permanent\token\SaprolingToken.java
-- it's will help xmage to select token image on battlefield by set's priority (seeimage.url.properties
file);
- Some sources can support tokens download: if so then repeat cards images setup but search source code for tokens data (start with
If you want to test other pull request before merge:
- Go to pull request page and save it's number like #4306;
- Open git and run command to fetch new pull request to new branch:
git fetch origin pull/4306/head:test-pull-request
where:
-
origin
-- name of the xmage repository (to find out it in IntellJ IDEA go toVCS -> Git -> Remotes
); -
4306
-- pull request number; -
test-pull-request
-- temporary branch for test;
- Open new created branch by
checkout test-pull-request
;