Bugs SVN

Do not post feature requests here, please.
Before posting bugs report check the Image Bug reporting help & guidelines
Forum rules
Do not post Features/Improvments request here (i.e : AI being stupid is not a bug, not being able to do a mulligan is not a bug, etc..etc..)
Before posting, please read the Bugs reporting guideline
Locked
dopple
Posts: 26
Joined: Sat Nov 05, 2011 2:20 pm

Re: Bugs SVN

Post by dopple »

mtg.txt

Tribute to Hunger
When I cast Tribute to Hunger, opponent sacrifice all creatures in battlefield. I change some codes simliary Cruel Edict

Code: Select all

[card]
name=Tribute to Hunger
target=opponent
auto=ability$!name(sacrifice) notatarget(creature|mybattlefield) dynamicability<!mytgt toughnesslifegain targetopponent!> sacrifice!$ targetedplayer
text=Target opponent sacrifices a creature. You gain life equal to that creature's toughness.
mana={2}{B}
type=Instant
sandman423
Posts: 806
Joined: Thu Sep 10, 2009 8:59 pm

Re: Bugs SVN

Post by sandman423 »

Latest SVN */* and texts are all Yellow how do I change it to White.
dopple
Posts: 26
Joined: Sat Nov 05, 2011 2:20 pm

Re: Bugs SVN

Post by dopple »

thx, punkeduard. i found some more.

1. (AVR) Restoration Angel : "may" needed

2. (M13) Healer of the Pride : "may" need to be deleted. "Whenever another creature enters the battlefield under your control, you gain 2 Life."

3. (M13) Wild Guess : Game crashed when select itself to pay for additional cost. maybe "other" keyword needed.

4. (AVR) Druid's Repository : I change it like below. It's seems to work.
before : auto={C(0/0,-1,Charge)}:chooseacolor Add{chosencolor} chooseend
after : auto={C(0/0,-1,Charge)}:activatechooseacolor Add{chosencolor} activatechooseend

but, how about this codes? I know Its not looking good. but, this is a mana ability, so I think it should can't interrupted.
auto={C(0/0,-1,Charge)}: Add{G}
auto={C(0/0,-1,Charge)}: Add{W}
auto={C(0/0,-1,Charge)}: Add{R}
auto={C(0/0,-1,Charge)}: Add{B}
auto={C(0/0,-1,Charge)}: Add{U}

5. (AVR) Spectral Prison : sorry, prev post was typo.

6. (mtg.txt) Tribute to Hunger : missing "target=opponent" in latest svn

7. (mtg.txt) Planeswalker's emblem doesn't work. ( Sorin, Lord of Innistrad / Koth of the Hammer / Elspeth, Knight-Errant )

Code: Select all

[card]
name=Restoration Angel
abilities=flash,flying
auto=may (blink) target(creature[-angel]|mybattlefield)
text=Flash -- Flying -- When Restoration Angel enters the battlefield, you may exile target non-Angel creature you control, then return that creature to the battlefield under your control.
mana={3}{W}
type=Creature
subtype=Angel
power=3
toughness=4
[/card]

[card]
name=Healer of the Pride
auto=@movedTo(other creature|mybattlefield):life:2 controller
text=Whenever another creature enters the battlefield under your control, you gain 2 life. 
mana={3}{W}
type=Creature
subtype=Cat Cleric
power=2
toughness=3
[/card]

[card]
name=Wild Guess
auto=Draw:2
text=As an additional cost to cast Wild Guess, discard a card. -- Draw two cards.
mana={R}{R}{discard(other *|myhand)}
type=Sorcery
[/card]

[card]
name=Druids' Repository
auto=@combat(attacking) source(creature|mybattlefield):all(this) counter(0/0,1,Charge)
#auto={C(0/0,-1,Charge)}:activatechooseacolor Add{chosencolor} activatechooseend
auto={C(0/0,-1,Charge)}: Add{G}
auto={C(0/0,-1,Charge)}: Add{W}
auto={C(0/0,-1,Charge)}: Add{R}
auto={C(0/0,-1,Charge)}: Add{B}
auto={C(0/0,-1,Charge)}: Add{U}
text=Whenever a creature you control attacks, put a charge counter on Druids' Repository. -- Remove a charge counter from Druids' Repository : Add one mana of any color to your mana pool.
mana={1}{G}{G}
type=Enchantment
[/card]

[card]
name=Spectral Prison
target=creature
auto=doesnotuntap
auto=@targeted(mytgt) from(*|opponenthand):sacrifice all(this)
auto=@targeted(mytgt) from(*|myhand):sacrifice all(this)
text=Enchant creature -- Enchanted creature doesn't untap during its controller's untap step. -- Whenever enchanted creature becomes the target of a spell, sacrifice Spectral Prison.
mana={1}{U}
type=Enchantment
subtype=Aura
[/card]

[card]
name=Tribute to Hunger
target=opponent
auto=ability$!name(sacrifice) notatarget(creature|mybattlefield) dynamicability<!mytgt toughnesslifegain targetopponent!> sacrifice!$ targetedplayer
text=Target opponent sacrifices a creature. You gain life equal to that creature's toughness.
mana={2}{B}
type=Instant
[/card]

[card]
name=Elspeth, Knight-Errant
auto=counter(0/0,4,loyalty)
auto={C(0/0,1,Loyalty)}:token(Soldier,Creature Soldier,1/1,white)
auto={C(0/0,1,Loyalty)}:3/3 && flying target(creature)
auto={C(0/0,-8,Loyalty)}:name(Emblem) emblem transforms((,newability[lord(*[-planeswalker]|mybattlefield) indestructible])) dontremove
text=+1: Put a 1/1 white Soldier creature token onto the battlefield. -- +1: Target creature gets +3/+3 and gains flying until end of turn. -- -8: For the rest of the game, artifacts, creatures, enchantments, and lands you control are indestructible.
mana={2}{W}{W}
type=Planeswalker
subtype=Elspeth
[/card]

[card]
name=Koth of the Hammer
auto=counter(0/0,3,loyalty)
auto={C(0/0,1,Loyalty)}:untap target(mountain) && becomes(Elemental Creature,4/4,red) ueot
auto={C(0/0,-2,Loyalty)}:foreach(mountain|myBattlefield) add:{R}
auto={C(0/0,-5,Loyalty)}:name(Emblem) emblem transforms((,newability[lord(mountain|mybattlefield) {T}:damage:1 target(creature)], newability[lord(mountain|mybattlefield) {T}:damage:1 target(player)])) dontremove
text=+1: Untap target Mountain. It becomes a 4/4 red Elemental creature until end of turn. It's still a land. -- -2: Add {R} to your mana pool for each Mountain you control. -- -5: You get an emblem with "Mountains you control have {T}: This land deals 1 damage to target creature or player.'"
mana={2}{R}{R}
type=Planeswalker
subtype=Koth
[/card]

[card]
name=Sorin, Lord of Innistrad
auto=counter(0/0,3,loyalty)
auto={C(0/0,1,Loyalty)}:token(Vampire,Creature Vampire,1/1,black,lifelink)
auto={C(0/0,-2,Loyalty)}:name(Emblem) emblem transforms((,newability[lord(creature|mybattlefield) 1/0])) dontremove
auto={C(0/0,-6,Loyalty)}:target(<upto:3>other creature,planeswalker) destroy and!(moveto(mybattlefield))!
text=+1: Put a 1/1 black Vampire creature token with lifelink onto the battlefield. -- -2: You get an emblem with "Creatures you control get +1/+0." -- -6: Destroy up to three target creatures and/or other planeswalkers. Return each card put into a graveyard this way to the battlefield under your control.
mana={2}{W}{B}
type=Planeswalker
subtype=Sorin
[/card]
Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

Re: Bugs SVN

Post by Zethfox »

emblem has been fixed, please make sure if you report a SVN based bug that you are actually on most current SVN version...
dopple
Posts: 26
Joined: Sat Nov 05, 2011 2:20 pm

Re: Bugs SVN

Post by dopple »

I test r4491 on ubuntu and androids.

I cleaned-up all my test work and compile again, but still have problem with emblem.
Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

Re: Bugs SVN

Post by Zethfox »

you made sure all your files are up to date? mainly rules folder...
dopple
Posts: 26
Joined: Sat Nov 05, 2011 2:20 pm

Re: Bugs SVN

Post by dopple »

I checked out svn repository entirely and built again.
I don't know what happens, but I'll test on other environments and let you know.
dopple
Posts: 26
Joined: Sat Nov 05, 2011 2:20 pm

Re: Bugs SVN

Post by dopple »

On windows platform same happens.

By the way, I found another bug.

Blasphemous act :
Blasphemous Act costs less to cast for each creature on the battlefield. Blasphemous Act deals 13 damage to each creature.

4 Crimson Acolytes and 3 creatures in battlefield, I was trying to cast Blasphemous Act with {1}{R}. But, I it requires {5}{R} to cast.
I think if a creature that has protection from red in battlefield, Blasphemous Act doesn't count that creature.

So I changed GameObserver.cpp

Line number 955 : after call createTargetChooser()

if( tcn != NULL )
{
tcn->targetter = NULL;
}

Is this correct fix?

Code: Select all

void GameObserver::Affinity()
{
    for (int i = 0; i < 2; i++)
    {
        MTGGameZone * zone = players[i]->game->hand;
        for (int k = zone->nb_cards - 1; k >= 0; k--)
        {
            MTGCardInstance * card = zone->cards[k];
            if (!card)
                continue;

            int color = 0;
            string type = "";
            //only do any of the following if a card with the stated ability is in your hand.
            ManaCost * original = NEW ManaCost();
            original->copy(card->model->data->getManaCost());
            //have to run alter cost before affinity or the 2 cancel each other out.
            if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost())
            {
                if(card->getIncreasedManaCost()->getConvertedCost())
                    original->add(card->getIncreasedManaCost());
                if(card->getReducedManaCost()->getConvertedCost())
                    original->remove(card->getReducedManaCost());
                card->getManaCost()->copy(original);
                if(card->getManaCost()->extraCosts)
                {
                    for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
                    {
                        card->getManaCost()->extraCosts->costs[i]->setSource(card);
                    }
                }
            }
            int reducem = 0;
            bool resetCost = false;
            for(unsigned int na = 0; na < card->cardsAbilities.size();na++)
            {
                ANewAffinity * newAff = dynamic_cast<ANewAffinity*>(card->cardsAbilities[na]);
                if(newAff)
                {
                    if(!resetCost)
                    {
                        resetCost = true;
                        card->getManaCost()->copy(original);
                        if(card->getManaCost()->extraCosts)
                        {
                            for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
                            {
                                card->getManaCost()->extraCosts->costs[i]->setSource(card);
                            }
                        }
                    }
                    TargetChooserFactory tf(this);
                    TargetChooser * tcn = tf.createTargetChooser(newAff->tcString,card,NULL);

                     // Added Code
                     if ( tcn != NULL )
                     {
                         tcn->targetter = NULL;
                     }
                     // Added Code

                    for (int w = 0; w < 2; ++w)
                    {
                        Player *p = this->players[w];
                        MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile };
                        for (int k = 0; k < 6; k++)
                        {
                            MTGGameZone * z = zones[k];
                            if (tcn->targetsZone(z))
                            {
                                reducem += z->countByCanTarget(tcn);
                            }
                        }
                    }
                    SAFE_DELETE(tcn);
                    ManaCost * removingCost = ManaCost::parseManaCost(newAff->manaString);
                    for(int j = 0; j < reducem; j++)
                        card->getManaCost()->remove(removingCost);
                    SAFE_DELETE(removingCost);
                }
            }
            if(card->has(Constants::AFFINITYARTIFACTS)||
                card->has(Constants::AFFINITYFOREST)||
                card->has(Constants::AFFINITYGREENCREATURES)||
                card->has(Constants::AFFINITYISLAND)||
                card->has(Constants::AFFINITYMOUNTAIN)||
                card->has(Constants::AFFINITYPLAINS)||
                card->has(Constants::AFFINITYSWAMP)){
                    if (card->has(Constants::AFFINITYARTIFACTS))
                    {
                        type = "artifact";
                    }
                    else if (card->has(Constants::AFFINITYSWAMP))
                    {
                        type = "swamp";
                    }
                    else if (card->has(Constants::AFFINITYMOUNTAIN))
                    {
                        type = "mountain";
                    }
                    else if (card->has(Constants::AFFINITYPLAINS))
                    {
                        type = "plains";
                    }
                    else if (card->has(Constants::AFFINITYISLAND))
                    {
                        type = "island";
                    }
                    else if (card->has(Constants::AFFINITYFOREST))
                    {
                        type = "forest";
                    }
                    else if (card->has(Constants::AFFINITYGREENCREATURES))
                    {
                        color = 1;
                        type = "creature";
                    }
                    card->getManaCost()->copy(original);
                    if(card->getManaCost()->extraCosts)
                    {
                        for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
                        {
                            card->getManaCost()->extraCosts->costs[i]->setSource(card);
                        }
                    }
                    int reduce = 0;
                    if(card->has(Constants::AFFINITYGREENCREATURES))
                    {
                        TargetChooserFactory tf(this);
                        TargetChooser * tc = tf.createTargetChooser("creature[green]",NULL);
                        reduce = card->controller()->game->battlefield->countByCanTarget(tc);
                        SAFE_DELETE(tc);
                    }
                    else
                    {
                        reduce = card->controller()->game->battlefield->countByType(type.c_str());
                    }
                    for(int i = 0; i < reduce;i++)
                    {
                        if(card->getManaCost()->getCost(color) > 0)
                            card->getManaCost()->remove(color,1);
                    }

            }
            SAFE_DELETE(original);
        }
    }
}
Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

Re: Bugs SVN

Post by Zethfox »

close but not quite, the fix has to go deeper, the function countbycantarget is actually where you should look.
while setting tc->targetter to is the right idea. I'll look at other places where this could cause issues. I think When I coded countbycantarget() I ended up using that function for pretty much every instance where we needed a number of targetible objects counted.

good find btw :)
dopple
Posts: 26
Joined: Sat Nov 05, 2011 2:20 pm

Re: Bugs SVN

Post by dopple »

Thx, Zeth :D, for helping me understand codes.
and I found something else.

I was control Xathrid Gorgon, and opponent controls Llanowar elves.

Xathrid Gorgon : {5}{B}
Creature - Gorgon
Deathtouch
{2}{1}, {T} : Put a petrification counter on target creature. It gains defender and becomes a colorless artifact creature in addition to its other types. Its activated abilities can't be activated.
3/ 6

I cast "Prey Upon" targets those two creatures to kill LIanowar elves. And I was expect Xathrid Gorgon will survive.
But both creatures died.

Prey Upon : {G}
Sorcery
Target creature you control fights target creature you don't control. (Each deals damage equal to its power to the other.)

I check another situation.
I control Primodial Hydra ( 32 1/1 counters on it ), and opponent controls Vampire Nighthawk ( 2/3 , flying , Lifelink, Death touch ).
When I cast "Prey Upon" targets those two creatures, only Vampire Nighthawk are died.

If i undestand code correctly, it explains these situation.
Xathrid Gorgon deals 3 damages to LIanowar elves with death touch, and Xathrid Gorgon deals 1 damages to self with death touch. So both creatures are died.

I was trying to fix like below. How about this?

Code: Select all

AllAbility.cpp / Linenumber:1938
        case DYNAMIC_ABILITY_EFFECT_STRIKE://deal damage
            {
                mainAbility = NEW AADamager(game, this->GetId(), source,tosrc == true?(Targetable*)OriginalSrc:(Targetable*)_target,sourceamountstring);
                activateMainAbility(mainAbility,source,tosrc == true?OriginalSrc:(MTGCardInstance*)_target);
                if(eachother)
                {
                    // << prev
                    // mainAbility = NEW AADamager(game, this->GetId(), source,(Targetable*)OriginalSrc,targetamountstring);
                    // >> fix 
                    mainAbility = NEW AADamager(game, this->GetId(), dynamic_cast<MTGCardInstance*>(_target),(Targetable*)OriginalSrc,targetamountstring);

                    activateMainAbility(mainAbility,source,OriginalSrc);
                }
                return 1;
                break;
            }
Locked