It is currently 09 Sep 2025, 04:44
   
Text Size

Enchant land auras

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Enchant land auras

Postby Chris H. » 23 Apr 2010, 14:51

I noticed something with the auras that enchant a land. The AI code will enchant the first land that came into play. As such, it had 3 Squirrel Nest auras in play but they all appeared on the same land. :!: 8)

I changed the AI code to only add non-enchanted lands to the list of lands and this resulted in the auras being attached to different lands. But in the various tests that I ran the stacking of lands into piles became out of sync. I seem to remember seeing this in one game. Not sure.

So what do people think? Does Dennis (MV) have any input … seeing that he is the one who designed the original aura system. There may be something that I am missing or this could be another case of us being human and we run out of steam. And then at a later time someone notices something strange and we scratch our heads as we ponder the greater meaning? :-D

There currently are several aura cards and they all appear to enchant the same land rather than placing them on different lands.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Enchant land auras

Postby DennisBergkamp » 23 Apr 2010, 23:18

Hmm, yeah it's true I implemented this awhile back... I really can't remember the details of this though. Changing the AI for this to only consider lands that are not currently enchanted is a good enough solution, I think.
But why the stacking gets screwed up, I'm not sure? I'll see if I can reproduce this...
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Enchant land auras

Postby Chris H. » 23 Apr 2010, 23:30

This is what I have at the moment for a new canPlayAI() method for Squirrel Nest and it works really well from what I can tell with my testing. I will go ahead and commit it.

Code: Select all
public boolean canPlayAI() {

    CardList list = new CardList(AllZone.Computer_Play.getCards());
    list = list.filter(new CardListFilter() {
        public boolean addCard(Card c) {
            return c.isLand() && !c.isEnchanted() && CardFactoryUtil.canTarget(card, c);
        }
    });

    if (list.isEmpty()) return false;
    else {
        list.shuffle();
        setTargetCard(list.get(0));
        return true;
    }
}//canPlayAI()
`
I almost added additional tests into this but at some point I tend to lose sight of what my code is trying to do. Old saying, keep it simple stupid. :mrgreen:
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 41 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 41 users online :: 0 registered, 0 hidden and 41 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 41 guests

Login Form