Page 1 of 1

Cardfactory bug hunting results

PostPosted: 23 Jun 2009, 20:07
by Sloth
I was watching the development of this game for a while now and decided to follow the example of zerker2000 to start having a look at the Cardfactory code.

Here are two bugs that I found, with my fix suggestions: Both belong to the batch of mass pump spells:

1. Shield Wall didn't work because it it didn't get it's list of targets assigned:

Code: Select all
CardList list = new CardList();

            if (cardName.equals("Chorus of Woe") || // Creatures "you" Control
                cardName.equals("Dance of Shadows") ||
                cardName.equals("Desperate Charge") ||
                cardName.equals("Kjeldoran War Cry") ||
                cardName.equals("Overrun") ||
                cardName.equals("Path of Anger's Flame") ||
                cardName.equals("Righteous Charge") ||
                cardName.equals("Scare Tactics") ||
                cardName.equals("Shield Wall") || // was missing
                cardName.equals("Solidarity") ||
                cardName.equals("Steadfastness") ||
                cardName.equals("Virtuous Charge") ||
                cardName.equals("Vitalizing Wind") ||
                cardName.equals("Warrior's Charge") ||
                cardName.equals("Warrior's Honor"))
            {
                PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
                list.addAll(play.getCards());
            }
2. Dance of Shadows gave your creatures Trample instead of Fear because the String variable kboost wasn't really used when adding keywords to your creatures:

Code: Select all
if(AllZone.GameAction.isCardInPlay(target[0]))
            {
              target[0].addTempAttackBoost(pboost);
              target[0].addTempDefenseBoost(tboost);

              if(!kboost.equals("None"))
                  target[0].addExtrinsicKeyword("Trample"); // must be kboost

              AllZone.EndOfTurn.addUntil(untilEOT);
            }//if
keep up the great work!

Re: Cardfactory bug hunting results

PostPosted: 23 Jun 2009, 20:58
by Rob Cashwalker
One of my next goals is to keyword the multi-pump spells.

Re: Cardfactory bug hunting results

PostPosted: 24 Jun 2009, 15:18
by Sloth
That would make adding Titanic Ultimatum quite easy. Most of the other mass pump spells have some special twists.

And don't forget that there are some AI rules hidden in that batch of code.

But while you're at it, you might consider keywording mass shrink effects too (like Infest and Nausea).

Re: Cardfactory bug hunting results

PostPosted: 24 Jun 2009, 15:32
by DennisBergkamp
Welcome Sloth :)
Titanic Ultimatum is actually implemented already... however, I guess it's not in the section of mass pump spells, if that's what you meant.

Re: Cardfactory bug hunting results

PostPosted: 24 Jun 2009, 15:59
by Rob Cashwalker
If I did make a multi-pump keyword, then it couldn't handle adding more than one keyword, so Titanic Ultimatum still needs its own explicit code.

The Pump keywords theoretically can handle shrink effects too. The problem is that they require a different AI, so it might as well be done separately. Plus, it's not a global effect - pretty much only black gets those effects, so it's not worth as much to the overall effort.

Re: Cardfactory bug hunting results

PostPosted: 28 Jun 2009, 15:45
by Sloth
Although not a bug in Cardfactory, but in cards.txt i noticed that Forgotten Cave and Secluded Steppe are missing a dot after 'Comes into play tapped', which causes them to malfunction.

Re: Cardfactory bug hunting results

PostPosted: 30 Jun 2009, 12:06
by Sloth
Another thing I found is, that Mawcor doesn't use the keyword 'abDamageCP T:1' in card.txt. The ability is still written in cardfactory.

Re: Cardfactory bug hunting results

PostPosted: 01 Jul 2009, 05:36
by DennisBergkamp
I think the main reason Mawcor is separate, because for the AI it's better to attack with it than to use its ability in a lot of cases. But I don't know, what do you guys think?

Re: Cardfactory bug hunting results

PostPosted: 01 Jul 2009, 11:59
by Rob Cashwalker
DennisBergkamp wrote:I think the main reason Mawcor is separate, because for the AI it's better to attack with it than to use its ability in a lot of cases. But I don't know, what do you guys think?
There's a line in the canPlayAI along the lines of if(CreatureDoesAttack) to check if the AI would rather attack with the creature instead of using the ability. If anything, I'd say that this code would need to be improved if you want the AI to not use the ability.