It is currently 19 Apr 2024, 20:43
   
Text Size

Implementing cards

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

Implementing cards

Postby eljinete7 » 11 Aug 2014, 14:45

Hello. I send you one card I'd like to play in XMage. This is Cruel Bargain. I'm not familiar with Java or GitHub, so this is a card already implemented with other name (Infernal Contract) but with the same mechanic. I hope it is helpful.

Thanks for all your hard work in XMage.

(Sorry for my English).
Attachments
Portal-CruelBargain.java.txt
(3.54 KiB) Downloaded 453 times
VintageMasters-CruelBargain.java.txt
(2.12 KiB) Downloaded 229 times
User avatar
eljinete7
 
Posts: 66
Joined: 15 Nov 2009, 22:42
Has thanked: 5 times
Been thanked: 0 time

Re: Implementing cards

Postby eljinete7 » 11 Aug 2014, 16:21

Another one. Restless Dead from Mirage set.
Attachments
Mirage-RestlessDead.java.txt
(2.72 KiB) Downloaded 217 times
User avatar
eljinete7
 
Posts: 66
Joined: 15 Nov 2009, 22:42
Has thanked: 5 times
Been thanked: 0 time

Re: Implementing cards

Postby LevelX » 14 Aug 2014, 14:38

Hello eljinete7,

cards are added.
But normally we only need the specific adding ability/affects part, because the complete card frame is generated automically by a script.

So if you want to contribute further look at https://github.com/magefree/mage/wiki/Developer-Getting-Started.
There are some steps to use java + netbeans + XMage. Then you are perfectly equipped to contribute.
Manually create cards and copy code parts is always a pain.

If you try and have any questions feel free to ask here for help.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: Implementing cards

Postby eljinete7 » 29 Aug 2014, 17:46

This is my try for Culling the Weak from Exdous set, a card needed for some good Legacy decks. Correct it if necessary.

Sorry if don't use GitHub yet, but it's too difficult for me to use it just now.
Attachments
Exodus-CullingTheWeak.java.txt
(1.24 KiB) Downloaded 246 times
User avatar
eljinete7
 
Posts: 66
Joined: 15 Nov 2009, 22:42
Has thanked: 5 times
Been thanked: 0 time

Re: Implementing cards

Postby jeffwadsworth » 05 Nov 2014, 15:46

Working on .Mana Reflection. This is a replacement effect, but apparently "Tapped_For_Mana" is not implemented for it. Is this the case?
jeffwadsworth
Super Tester Elite
 
Posts: 1171
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 69 times

Re: Implementing cards

Postby LevelX » 05 Nov 2014, 16:12

jeffwadsworth wrote:Working on .Mana Reflection. This is a replacement effect, but apparently "Tapped_For_Mana" is not implemented for it. Is this the case?
I guess you have to replace "ADD_MANA" (because here you get the Mana object and can manipulate it) and check if the producing source was tapped before by using a watcher that checks and remembers the "Tapped_For_Mana" event.
Ony a rough plan.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: Implementing cards

Postby jeffwadsworth » 10 Nov 2014, 15:57

Is there a way to get the cost information from a "ADD_MANA" event? I have tried a few techniques with no success. The watcher technique does not appear to cover every case, unfortunately.
jeffwadsworth
Super Tester Elite
 
Posts: 1171
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 69 times

Re: Implementing cards

Postby LevelX » 10 Nov 2014, 16:42

jeffwadsworth wrote:Is there a way to get the cost information from a "ADD_MANA" event? I have tried a few techniques with no success. The watcher technique does not appear to cover every case, unfortunately.
Why did the watcher technique not work?
Can you give an example?
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: Implementing cards

Postby jeffwadsworth » 10 Nov 2014, 17:20

I erased the watcher code last week during testing of multiple variations, etc. Anyway, here is an example of a missed case:

Mana Reflection is played. A permanent is tapped for mana. The same permanent adds mana to the pool via counter removal, etc. The watcher will check and see that the permanent was tapped for mana that turn and double the second case.
jeffwadsworth
Super Tester Elite
 
Posts: 1171
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 69 times

Re: Implementing cards

Postby LevelX » 10 Nov 2014, 17:40

jeffwadsworth wrote:I erased the watcher code last week during testing of multiple variations, etc. Anyway, here is an example of a missed case:

Mana Reflection is played. A permanent is tapped for mana. The same permanent adds mana to the pool via counter removal, etc. The watcher will check and see that the permanent was tapped for mana that turn and double the second case.
But because mana effects don't go to the stack you can get always the last info (tapped_for_mana or not) from the watcher and clear the saved data of the watcher as you retrieve the info from watcher. So you can't get a wrong old information from the watcher.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: Implementing cards

Postby emerald000 » 10 Nov 2014, 19:00

I have a question about implementing Nahiri, the Lithomancer. How can I check that the Kor Soldier can be equipped by the chosen Equipment? In some weird cases, the Equipment might not be equipable (it turned into a creature for example). The only way I could find in the code was related to Auras and don't apply (checking the spell targets). So anything already exists?

EDIT: After some more looking around, I guess it doesn't exist. O-Naginata and Konda's Banner equipping restriction are implemented as EmptyEffect and checked only on its own Equip ability.
User avatar
emerald000
 
Posts: 92
Joined: 07 Jul 2014, 16:55
Has thanked: 1 time
Been thanked: 9 times

Re: Implementing cards

Postby LevelX » 10 Nov 2014, 20:46

emerald000 wrote:I have a question about implementing Nahiri, the Lithomancer. How can I check that the Kor Soldier can be equipped by the chosen Equipment? In some weird cases, the Equipment might not be equipable (it turned into a creature for example). The only way I could find in the code was related to Auras and don't apply (checking the spell targets). So anything already exists?

EDIT: After some more looking around, I guess it doesn't exist. O-Naginata and Konda's Banner equipping restriction are implemented as EmptyEffect and checked only on its own Equip ability.
It should be possible to get the target from the equip ability of the equipment and check if it canTarget() the creature it should be attached to.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: Implementing cards

Postby emerald000 » 10 Nov 2014, 22:05

LevelX wrote:
emerald000 wrote:I have a question about implementing Nahiri, the Lithomancer. How can I check that the Kor Soldier can be equipped by the chosen Equipment? In some weird cases, the Equipment might not be equipable (it turned into a creature for example). The only way I could find in the code was related to Auras and don't apply (checking the spell targets). So anything already exists?

EDIT: After some more looking around, I guess it doesn't exist. O-Naginata and Konda's Banner equipping restriction are implemented as EmptyEffect and checked only on its own Equip ability.
It should be possible to get the target from the equip ability of the equipment and check if it canTarget() the creature it should be attached to.
What if it lost its Equip ability? Gained another one? Also you should be able to attach through Shroud.
User avatar
emerald000
 
Posts: 92
Joined: 07 Jul 2014, 16:55
Has thanked: 1 time
Been thanked: 9 times

Re: Implementing cards

Postby LevelX » 11 Nov 2014, 00:09

emerald000 wrote:What if it lost its Equip ability?
Than you can get the target from the card if you need it to check if the Equipment can be attached to the created token.

emerald000 wrote:Gained another one?
You mean another EquipAbility?
Which card does such a thing?
Than the Equipment probably copies all abilites from another Equipment, so it would be correct.

emerald000 wrote:Also you should be able to attach through Shroud.
Copy the target and set notTarget = true before you check.

This will probably work in 99,9 % of all cases. So if we get aware of the 0,1 % case we can think how to solve it.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: Implementing cards

Postby emerald000 » 11 Nov 2014, 02:09

Puresteel Paladin lets you gain a second EquipAbility.

Also, the main problem I see with the current setup is that the equip restrictions aren't checked (as far as I know) on SBAs. I don't know how Auras are working, but it should be possible to use something quite similar, as they are extremely similar once on the battlefield. There is no rule distinction of enchant vs equip. (If you manage to get an Enchantment Artifact - Equipment Aura, the attached permanent will get both bonuses and can be moved around with the Equip ability.)
User avatar
emerald000
 
Posts: 92
Joined: 07 Jul 2014, 16:55
Has thanked: 1 time
Been thanked: 9 times

Next

Return to Developers Talk

Who is online

Users browsing this forum: No registered users and 9 guests


Who is online

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

Login Form