It is currently 30 Apr 2025, 15:02
   
Text Size

spDestroyTgt keyword

Post MTG Forge Related Programming Questions Here

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

Re: spDestroyTgt keyword

Postby Chris H. » 05 Jan 2010, 17:57

Rob Cashwalker wrote:BTW, even though I wrote it, I currently have no clue how my targeting restriction function works.... Seriously... I was looking at it the other day because I wanted to see if I could easily integrate a targeting restirction clause in the other keywords. The short-answer, is yeah, probably... but WTF was I thinking?

The long answer involves a bunch of divine inspiration while drooling over the various elements of nantuko's elegant approach....

Anyway.. glad that it worked out.
`
Yeah, there are times when I seem to have some insight and inspiration ... great when it happens. Several days later and I look at what I did and I no longer understand. :)

I have recently managed to repair two newish cards that needed a choose dialog that would display text since they have Cycling. I got it working.

I just noticed today that Dennis' new "Counter target spell unless its controller pays " {x} spells has the same problem. And today I can't figure out how to get the spell description in place. :(
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: spDestroyTgt keyword

Postby DennisBergkamp » 23 Feb 2010, 16:44

There was an interesting bug in getTargets():

Code: Select all
CardList getTargets() {
                    CardList tmpList = new CardList();
                    tmpList.addAll(AllZone.Human_Play.getCards());
                    tmpList.filter(new CardListFilter() {
                        public boolean addCard(Card c) {
                            return (CardFactoryUtil.canTarget(card, c));
                        }
                    });
                   
                    return tmpList.getValidCards(Tgts);
                }
tmpList.filter(new CardListFilter() doesn't do anything, it should be tmpList = tmpList.filter(new CardListFilter()...
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: spDestroyTgt keyword

Postby zerker2000 » 24 Feb 2010, 03:27

Ah, I remember this being a common bug for String.concat :).
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: spDestroyTgt keyword

Postby Rob Cashwalker » 18 Aug 2010, 03:02

I just made some changes to the spDestroyTgt code to allow for Drawback. Then I made some changes to doDrawback to enable some of these drawbacks.

new cards that should work with these changes:
Code: Select all

Despoil
3 B
Sorcery
Destroy target land. Its controller loses 2 life.
spDestroyTgt:Land:Drawback$LoseLifeTgtCtrlr/2

Devour in Shadow
B B
Instant
Destroy target creature. It can't be regenerated. You lose life equal to that creature's toughness.
spDestroyTgt:Creature:NoRegen:Drawback$YouLoseLife/dX
SVar:dX:Count$TgtCardToughness

Hideous End
1 B B
Instant
Destroy target nonblack creature. Its controller loses 2 life.
spDestroyTgt:Creature.Nonblack:Drawback$LoseLifeTgtCtrlr/2

Vendetta
B
Instant
Destroy target nonblack creature. It can't be regenerated. You lose life equal to that creature's toughness.
spDestroyTgt:Creature.nonblack:NoRegen:Drawback$YouLoseLife/dX
SVar:dX:Count$TgtCardToughness

Crumble
G
Instant
Destroy target artifact. It can't be regenerated. That artifact's controller gains life equal to its converted mana cost.
spDestroyTgt:Artifact:NoRegen:Drawback$GainLifeTgtCtrlr/dX
SVar:dX:Count$TgtCardManaCost

Dark Offering
4 B B
Sorcery
Destroy target nonblack creature. You gain 3 life.
spDestroyTgt:Creature.Nonblack:Drawback$YouGainLife/3

Divine Offering
1 W
Instant
Destroy target artifact. You gain life equal to its converted mana cost.
spDestroyTgt:Artifact:Drawback$YouGainLife/dX
SVar:dX:Count$TgtCardManaCost

Drain the Well
2 BG BG
Sorcery
Destroy target land. You gain 2 life.
spDestroyTgt:Land:Drawback$YouGainLife/2

Poison the Well
2 BR BR
Sorcery
Destroy target land. Poison the well deals 2 damage to that land's controller.
spDestroyTgt:Land:Drawback$DamgeTgtCtrlr/2

Misfortune's Gain
3 W
Sorcery
Destroy target creature. Its owner gains 4 life.
spDestroyTgt:Creature:Drawback$TgtOwnerGainLife/4

Nature's Claim
G
Instant
Destroy target artifact or enchantment. Its controller gains 4 life.
spDestroyTgt:Artifact,Enchantment:Drawback$TgtCtrlrGainLife/4

Path of Peace
3 W
Sorcery
Destroy target creature. Its owner gains 4 life.
spDestroyTgt:Creature:Drawback$GainLifeTgtOwner/4

Poison Arrow
4 B B
Sorcery
Destroy target nonblack creature. You gain 3 life.
spDestroyTgt:Creature.nonblack:Drawback$YouGainLife/3

Serene Offering
1 W
Instant
Destroy target enchantment. You gain life equal to its converted mana cost.
spDestroyTgt:Enchantment:Drawback$YouGainLife/dX
SVar:dX:Count$TgtCardManaCost

Sever Soul
3 B B
Sorcery
Destroy target nonblack creature. It can't be regenerated. You gain life equal to its toughness.
spDestroyTgt:Creature.nonblack:NoRegen:Drawback$YouGainLife/dX
SVar:dX:Count$TgtCardToughness

Solemn Offering
2 W
Sorcery
Destroy target artifact or enchantment. You gain 4 life.
spDestroyTgt:Artifact,Enchantment:Drawback$YouGainLife/4

Terashi's Grasp
2 W
Sorcery Arcane
Destroy target artifact or enchantment. You gain life equal to its converted mana cost.
spDestroyTgt:Artifact,Enchantment:Drawback$YouGainLife/dX
SVar:dX:Count$TgtCardManaCost

Desecrated Earth
4 B
Sorcery
Destroy target land. Its controller discards a card.
spDestryTgt:Land:Drawback$DiscardTgtCtrlr/1
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: spDestroyTgt keyword

Postby Rob Cashwalker » 28 Aug 2010, 14:17

Last night I sent in some code for Card.isValidCard(). The major addition is that power, toughness and converted mana cost are now supported.

For example:
Code: Select all
Smother
1 B
Instant
Destroy target creature with converted mana cost 3 or less. It can't be regenerated.
spDestroyTgt:Creature.cmcLE3:NoRegen
I will start a new thread to define all the possible restrictions.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: spDestroyTgt keyword

Postby Chris H. » 29 Aug 2010, 20:24

We had a small problem with the keyword used by Desecrated Earth.

Desecrated Earth
4 B
Sorcery
Destroy target land. Its controller discards a card.
spDestroyTgt:Land:Drawback$DiscardTgtCtrlr/1
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/desecrated_earth.jpg

I fixed the keyword miss-spelling and I could then destroy a target land, but the computer did not discard. :D
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: spDestroyTgt keyword

Postby Rob Cashwalker » 30 Aug 2010, 03:21

Fixed the bug.

It helps if I check for and specify the right number of elements in a string array....
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: spDestroyTgt keyword

Postby Chris H. » 30 Aug 2010, 11:34

Thank you. I merged the fixed keyword miss-spelling into the SVN and tested the card and it now works. One less bug. :D
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: spDestroyTgt keyword

Postby Rob Cashwalker » 30 Aug 2010, 14:02

Actually... ALL of the cards using drawback or noregen were broken until this fix....
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 20 guests


Who is online

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

Login Form