Progress towards v0.7.1c
by Incantus
Moderator: CCGHQ Admins
Re: Progress towards v0.7.1c
by Ricochet » 19 Jul 2011, 20:25
actualy with mat's solution i got the errorMageKing17 wrote:Actually, Mat's solution was an elegant implementation that was merely missing four letters ("Card", BTW). But good for you to notice it wasn't working; at least somebody's testing cards.
Technically, I suppose, Mat's solution is incorrect because it's not actually paying a cost, which could theoretically come back to bite us in the ass, but I can't think of anything that could care about a cost paid in the middle of a triggered ability's activation. Usually, abilities just care about costs paid to cast spells or activate abilities.
Actually, that doesn't quite work. If you choose to discard a card but have no cards in your hand, under your implementation, Balduvian Horde would live, despite the fact that it needs to be sacrificed in that case. Also, your use of list comprehension and random.sample is redundant when you're only picking one card. Here is how the card should look.
But thank you for testing cards and coming up with code; if you want access to the web editor, PM me your email address.
- Code: Select all
NameError: global name 'DisardCost' is not defined
Also, you misstyped in "discard a card and random", and it wont work in "B" version without the "import random". Adding the line it works perfectly... thx MK
- Ricochet
- Posts: 12
- Joined: 21 Jun 2011, 20:23
- Has thanked: 0 time
- Been thanked: 0 time
Re: Progress towards v0.7.1c
by MageKing17 » 20 Jul 2011, 03:58
That... makes no sense. Either DiscardCost works, or it doesn't. Where you use it is irrelevant, in terms of whether or not the variable is defined or not.Ricochet wrote:actualy with mat's solution i got the errorMageKing17 wrote:Actually, Mat's solution was an elegant implementation that was merely missing four letters ("Card", BTW). But good for you to notice it wasn't working; at least somebody's testing cards.
Technically, I suppose, Mat's solution is incorrect because it's not actually paying a cost, which could theoretically come back to bite us in the ass, but I can't think of anything that could care about a cost paid in the middle of a triggered ability's activation. Usually, abilities just care about costs paid to cast spells or activate abilities.
Actually, that doesn't quite work. If you choose to discard a card but have no cards in your hand, under your implementation, Balduvian Horde would live, despite the fact that it needs to be sacrificed in that case. Also, your use of list comprehension and random.sample is redundant when you're only picking one card. Here is how the card should look.
But thank you for testing cards and coming up with code; if you want access to the web editor, PM me your email address.so i gess the game wouldnt understand DiscardCost in the middle of a triggered ability.
- Code: Select all
NameError: global name 'DisardCost' is not defined
...Ah. That error you pasted says "DisardCost", not "DiscardCost". A simple typo. Easily fixed.
Whoops. Fixed.Ricochet wrote:Also, you misstyped in "discard a card and random", and it wont work in "B" version without the "import random". Adding the line it works perfectly... thx MK
-
MageKing17 - Programmer
- Posts: 473
- Joined: 12 Jun 2008, 20:40
- Has thanked: 5 times
- Been thanked: 9 times
Re: Progress towards v0.7.1c
by coruja » 21 Aug 2011, 18:11
Hi MageKing! Thanks for the source code in your last release. I would like to ask you if you will make the source code available on Bitbucket or Github, for example. Because I am willing to help you find and fix bugs in Python for the next releases.
- coruja
- Posts: 3
- Joined: 21 Aug 2011, 14:03
- Has thanked: 0 time
- Been thanked: 0 time
Re: Progress towards v0.7.1c
by MageKing17 » 27 Aug 2011, 19:53
That would require effort and free time. Sadly, I am short on either, these days. As soon as I do have a chunk of time I can devote to Incantus, I'll be releasing v0.7.1c so that everyone can have the latest source code. If you want to then take that code and merge it with Incantus's UI improvements on his bitbucket page, feel free; then you'd have the absolutely latest code out of anybody.coruja wrote:Hi MageKing! Thanks for the source code in your last release. I would like to ask you if you will make the source code available on Bitbucket or Github, for example. Because I am willing to help you find and fix bugs in Python for the next releases.
-
MageKing17 - Programmer
- Posts: 473
- Joined: 12 Jun 2008, 20:40
- Has thanked: 5 times
- Been thanked: 9 times
Re: Progress towards v0.7.1c
by drekonja » 01 Sep 2011, 15:04
Hey, could you update your site, so also the New Phyrexia and M12 cards are shown in database?
- drekonja
- Posts: 41
- Joined: 05 Jun 2009, 19:53
- Has thanked: 0 time
- Been thanked: 0 time
Re: Progress towards v0.7.1c
by MageKing17 » 02 Sep 2011, 18:01
Sadly, magiccards.info changed their site layout, so I need to also find some time to fix the expansion-adding function.drekonja wrote:Hey, could you update your site, so also the New Phyrexia and M12 cards are shown in database?
-
MageKing17 - Programmer
- Posts: 473
- Joined: 12 Jun 2008, 20:40
- Has thanked: 5 times
- Been thanked: 9 times
Re: Progress towards v0.7.1c
by coruja » 02 Oct 2011, 22:08
Hi!
In 0.7.1b 'untapped' is not defined but 'not tapped' is and it seems to work, I have fixed (and tested) the code of one of my favorite card 'Well of Life':
In 0.7.1b 'untapped' is not defined but 'not tapped' is and it seems to work, I have fixed (and tested) the code of one of my favorite card 'Well of Life':
- Code: Select all
name = 'Well of Life'
cost = '4'
types = Artifact
text = ['At the beginning of your end step, if you control no untapped lands, you gain 2 life.']
#################################
@triggered(txt=text[0])
def ability():
def condition(source, player):
res = len(source.controller.battlefield.get(isLand.with_condition(lambda l: not l.tapped)))
return (player == source.controller and res == 0)
def effects(controller, source):
target = yield NoTarget()
res = len(controller.battlefield.get(isLand.with_condition(lambda l: not l.tapped)))
if res == 0:
controller.life +=2
yield
return PhaseTrigger(EndTurnStepEvent(), condition), effects
abilities.add(ability)
- coruja
- Posts: 3
- Joined: 21 Aug 2011, 14:03
- Has thanked: 0 time
- Been thanked: 0 time
Re: Progress towards v0.7.1c
by MageKing17 » 03 Oct 2011, 06:19
There's generally not much point in defining antonyms in the code, but if it would make people's lives easier, it would be entirely possible to define "untapped" as a property that merely returns "not self.tapped". Assuming I ever have time to work on Incantus.coruja wrote:Hi!
In 0.7.1b 'untapped' is not defined but 'not tapped' is and it seems to work
That's certainly a card, all right. I have to wonder why you bother with this "res = " fluff, though; it seems the expression could just be put into the return/if statement directly instead of wastefully stored into a variable that only gets referred to once. Also, if you want an invitation to the card editor, just send me a PM with the email address you want it sent to.coruja wrote:I have fixed (and tested) the code of one of my favorite card 'Well of Life':
- Code: Select all
name = 'Well of Life'
cost = '4'
types = Artifact
text = ['At the beginning of your end step, if you control no untapped lands, you gain 2 life.']
#################################
@triggered(txt=text[0])
def ability():
def condition(source, player):
res = len(source.controller.battlefield.get(isLand.with_condition(lambda l: not l.tapped)))
return (player == source.controller and res == 0)
def effects(controller, source):
target = yield NoTarget()
res = len(controller.battlefield.get(isLand.with_condition(lambda l: not l.tapped)))
if res == 0:
controller.life +=2
yield
return PhaseTrigger(EndTurnStepEvent(), condition), effects
abilities.add(ability)
I really wish I had time to work on Incantus, but my job seems to eat up all of my time. Perhaps I shall simply make some time for coding some time soon, because if nothing else, I need to set up an environment for building Incantus executables in case someone finds a major bug, and my new computer doesn't have the required libraries to run Incantus yet.coruja wrote:Almost one month without news... how many people are still hacking this code?
-
MageKing17 - Programmer
- Posts: 473
- Joined: 12 Jun 2008, 20:40
- Has thanked: 5 times
- Been thanked: 9 times
Re: Progress towards v0.7.1c
by coruja » 03 Oct 2011, 19:42
Yes, I suppose you're right, I used to have a print statement just before the return or the if statement for debugging purpose. I'll change that in a new version.MageKing17 wrote:I have to wonder why you bother with this "res = " fluff, though; it seems the expression could just be put into the return/if statement directly instead of wastefully stored into a variable that only gets referred to once.
OK. I'll do that!MageKing17 wrote:Also, if you want an invitation to the card editor, just send me a PM with the email address you want it sent to.
Yes, do that , and I hope you keep a backup of this code too. I know there is something on bitbucket already but I have noticed that the source code you posted for 0.7.1b is more recent than what is on bitbucket.MageKing17 wrote:I really wish I had time to work on Incantus, but my job seems to eat up all of my time. Perhaps I shall simply make some time for coding some time soon, because if nothing else, I need to set up an environment for building Incantus executables in case someone finds a major bug, and my new computer doesn't have the required libraries to run Incantus yet.
- coruja
- Posts: 3
- Joined: 21 Aug 2011, 14:03
- Has thanked: 0 time
- Been thanked: 0 time
Re: Progress towards v0.7.1c
by MageKing17 » 04 Oct 2011, 03:52
And the v0.7.1c source is more recent still, although I have not included the advanced UI features from the source on bitbucket due to their not handling planeswalkers, levellers, and other advanced cards. I have that code on three seperate harddrives, although I'm not 100% sure they're all the same version. Perhaps I should upload it before I forget...coruja wrote:Yes, do that , and I hope you keep a backup of this code too. I know there is something on bitbucket already but I have noticed that the source code you posted for 0.7.1b is more recent than what is on bitbucket.MageKing17 wrote:I really wish I had time to work on Incantus, but my job seems to eat up all of my time. Perhaps I shall simply make some time for coding some time soon, because if nothing else, I need to set up an environment for building Incantus executables in case someone finds a major bug, and my new computer doesn't have the required libraries to run Incantus yet.
-
MageKing17 - Programmer
- Posts: 473
- Joined: 12 Jun 2008, 20:40
- Has thanked: 5 times
- Been thanked: 9 times
Re: Progress towards v0.7.1c
by Huggybaby » 07 Oct 2011, 15:53
Indeed!MageKing17 wrote:Perhaps I should upload it before I forget...
-
Huggybaby - Administrator
- Posts: 3209
- Joined: 15 Jan 2006, 19:44
- Location: Finally out of Atlanta
- Has thanked: 704 times
- Been thanked: 595 times
Re: Progress towards v0.7.1c
by MageKing17 » 13 Oct 2011, 04:23
Turns out it was just a different URL (the old "beta.magiccards.info" subdomain stopped working, which... makes perfect since, since it hasn't been in beta for years). I even disabled the non-beta fetching, although I haven't gotten rid of the "use beta" checkbox for... debug purposes.MageKing17 wrote:Sadly, magiccards.info changed their site layout, so I need to also find some time to fix the expansion-adding function.drekonja wrote:Hey, could you update your site, so also the New Phyrexia and M12 cards are shown in database?
In other news, New Phyrexia, Magic 2012, and Innistrad have been added to the web editor, I implemented a bunch of Magic 2011 cards, hexproof has been added to the source code, and subtype symbols have been updated. Look out for v0.7.1c to be released soon.
-
MageKing17 - Programmer
- Posts: 473
- Joined: 12 Jun 2008, 20:40
- Has thanked: 5 times
- Been thanked: 9 times
42 posts
• Page 3 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 1 guest