It is currently 16 Apr 2024, 14:02
   
Text Size

Progress towards v0.7.1c

by Incantus

Moderator: CCGHQ Admins

Re: Progress towards v0.7.1c

Postby Ricochet » 19 Jul 2011, 20:25

MageKing17 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.
actualy with mat's solution i got the error
Code: Select all
NameError: global name 'DisardCost' is not defined
so i gess the game wouldnt understand DiscardCost in the middle of a triggered ability.
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

Postby MageKing17 » 20 Jul 2011, 03:58

Ricochet wrote:
MageKing17 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.
actualy with mat's solution i got the error
Code: Select all
NameError: global name 'DisardCost' is not defined
so i gess the game wouldnt understand DiscardCost in the middle of a triggered ability.
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.

...Ah. That error you pasted says "DisardCost", not "DiscardCost". A simple typo. Easily 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
Whoops. Fixed.
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: Progress towards v0.7.1c

Postby 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

Postby MageKing17 » 27 Aug 2011, 19:53

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.
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.
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: Progress towards v0.7.1c

Postby 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

Postby MageKing17 » 02 Sep 2011, 18:01

drekonja wrote:Hey, could you update your site, so also the New Phyrexia and M12 cards are shown in database?
Sadly, magiccards.info changed their site layout, so I need to also find some time to fix the expansion-adding function. :P
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: Progress towards v0.7.1c

Postby 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':

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)
Almost one month without news... how many people are still hacking this code?
coruja
 
Posts: 3
Joined: 21 Aug 2011, 14:03
Has thanked: 0 time
Been thanked: 0 time

Re: Progress towards v0.7.1c

Postby MageKing17 » 03 Oct 2011, 06:19

coruja wrote:Hi!

In 0.7.1b 'untapped' is not defined but 'not tapped' is and it seems to work
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: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)
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:Almost one month without news... how many people are still hacking this code?
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.
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: Progress towards v0.7.1c

Postby coruja » 03 Oct 2011, 19:42

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.
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:Also, if you want an invitation to the card editor, just send me a PM with the email address you want it sent to.
OK. I'll do that!

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.
Yes, do that :D, 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.
coruja
 
Posts: 3
Joined: 21 Aug 2011, 14:03
Has thanked: 0 time
Been thanked: 0 time

Re: Progress towards v0.7.1c

Postby MageKing17 » 04 Oct 2011, 03:52

coruja wrote:
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.
Yes, do that :D, 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.
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...
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: Progress towards v0.7.1c

Postby Huggybaby » 07 Oct 2011, 15:53

MageKing17 wrote:Perhaps I should upload it before I forget...
Indeed!
User avatar
Huggybaby
Administrator
 
Posts: 3205
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 696 times
Been thanked: 594 times

Re: Progress towards v0.7.1c

Postby MageKing17 » 13 Oct 2011, 04:23

MageKing17 wrote:
drekonja wrote:Hey, could you update your site, so also the New Phyrexia and M12 cards are shown in database?
Sadly, magiccards.info changed their site layout, so I need to also find some time to fix the expansion-adding function. :P
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.

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.
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Previous

Return to Incantus

Who is online

Users browsing this forum: No registered users and 12 guests


Who is online

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

Login Form