Spreading Seas
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
4 posts
• Page 1 of 1
Spreading Seas
by Beached As » 04 Jun 2010, 17:22
Hey again people,
When i was coding Spreading Seas, i noticed something strange with Dark Depths. In order to get Spreading Seas to work correctly, i had to save the abilities of the enchanted land onto Spreading Seas and then disable Spreading Seas from using any abilities. Then give the abilities back when Spreading Seas disenchants. However, with Dark Depths, i could use the abilities even when i disabled it on Ability.java, Ability_Hand.java, Ability_Activated.java and Ability_Triggered.java. When i say disabled i mean returning false in canPlay() in those java files. It's probably something obvious but could anyone explain why Dark Depths seems to bypass the canPlay check? I've made a dodgy fix by not allowing the player to activate Dark Depths abilities if it is enchanted by Spreading Seas but i would like to find a better fix.
P.S. If it helps, all lands tested had their abilities disabled when only Ability.java returned false
When i was coding Spreading Seas, i noticed something strange with Dark Depths. In order to get Spreading Seas to work correctly, i had to save the abilities of the enchanted land onto Spreading Seas and then disable Spreading Seas from using any abilities. Then give the abilities back when Spreading Seas disenchants. However, with Dark Depths, i could use the abilities even when i disabled it on Ability.java, Ability_Hand.java, Ability_Activated.java and Ability_Triggered.java. When i say disabled i mean returning false in canPlay() in those java files. It's probably something obvious but could anyone explain why Dark Depths seems to bypass the canPlay check? I've made a dodgy fix by not allowing the player to activate Dark Depths abilities if it is enchanted by Spreading Seas but i would like to find a better fix.
P.S. If it helps, all lands tested had their abilities disabled when only Ability.java returned false
- Beached As
- Programmer
- Posts: 110
- Joined: 23 Feb 2010, 07:48
- Has thanked: 0 time
- Been thanked: 0 time
Re: Spreading Seas
by DennisBergkamp » 04 Jun 2010, 17:43
Hm, I think with Dark Depths something like this happened, to be honest I'm not sure if it relates to your question (but I know this is the only "funky" thing going on with Dark Depths right now, so I'm guessing it does) :
First, when I coded Dark Depths, using its ability would just remove the counter, and a check was made if that was the last Ice counter to be removed. If so, it would get sacced and the token would be put onto the battlefield.
Then, slapshot coded Vampire Hexmage, and when testing the combo with Dark Depths, it became apparent that Dark Depths' token ability would only trigger when manually using its "remove counter" ability. So he kind of hacked in a second ability which can be played if there's currently no Ice counters on it, to allow the player to "force" the token ability to trigger. Of course, we should add this as a state based effect...
First, when I coded Dark Depths, using its ability would just remove the counter, and a check was made if that was the last Ice counter to be removed. If so, it would get sacced and the token would be put onto the battlefield.
Then, slapshot coded Vampire Hexmage, and when testing the combo with Dark Depths, it became apparent that Dark Depths' token ability would only trigger when manually using its "remove counter" ability. So he kind of hacked in a second ability which can be played if there's currently no Ice counters on it, to allow the player to "force" the token ability to trigger. Of course, we should add this as a state based effect...
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Spreading Seas
by Beached As » 05 Jun 2010, 08:11
I figured it out. It seems that a spell or ability that has a canPlay() command in the spell code needs a super.canPlay() to call the canPlay() conditions in head java files (Ability.java, Ability_Activated.java , etc). I've fixed this for Dark Depths and committed it.
This also means that Linvala, Keeper of Silence is possible, and i currently have a working version of it on my version of forge. But i think i'll need to do more testing before i commit it because it requires a lot of changes all over the place (mainly adding super.canPlay() to lots of spells and keywords).
This also means that Linvala, Keeper of Silence is possible, and i currently have a working version of it on my version of forge. But i think i'll need to do more testing before i commit it because it requires a lot of changes all over the place (mainly adding super.canPlay() to lots of spells and keywords).
- Beached As
- Programmer
- Posts: 110
- Joined: 23 Feb 2010, 07:48
- Has thanked: 0 time
- Been thanked: 0 time
Re: Spreading Seas
by mtgrares » 07 Jun 2010, 21:43
Yeah calling super.canPlay() in canPlay() is always a good idea because it checks on stupid things like is the card in play (versus in your hand).
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: Google [Bot] and 46 guests