Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Talk about new cards here
Moderator: CCGHQ Admins
Re: Talk about new cards here
by Yanna » 24 Aug 2010, 19:40
Your soul is minelogoliv wrote:I give my soul to the One who manages to code Grim Discovery
- Code: Select all
<!--
////////////////////////////////////////////////////////////////////////////////////////
You're not supposed to be able to play this without a valid target ! I was too lazy to
code a function like HasLandOrCreatureInGraveyard( pPlayer ) so i just put a condition
on having more than one card in graveyard :)
////////////////////////////////////////////////////////////////////////////////////////
-->
<STATIC_ABILITY zone="Hand" layer="0">
<FILTER>
return ( Subject() == Object() and CountCardsInGraveyard(Object():GetOwner()) <1 )
</FILTER>
<EFFECT>
CantBePlayed()
</EFFECT>
</STATIC_ABILITY>
<!--
////////////////////////////////////////////////////////////////////////////////////////
I wasn't sure if you were meant to choose your targets before or after this is being
cast (important for countering). Made it so you choose before, but there's a 'cast time'
before it resolves and brings your cards back to hand.
////////////////////////////////////////////////////////////////////////////////////////
-->
<SPELL_ABILITY layer="0" >
<EFFECT>
if ( Object():Register_Object_Get( 0 ) ~= nil ) then
Object():Register_Object_Get( 0 ):PutInHand()
end
if ( Object():Register_Object_Get( 1 ) ~= nil ) then
Object():Register_Object_Get( 1 ):PutInHand()
end
</EFFECT>
</SPELL_ABILITY>
<!--
////////////////////////////////////////////////////////////////////////////////////////
A forced skip trigger that fires when the spell goes from your hand on the stack.
It does :
- Set(1, 1) if you 'may' choose a creature
- Set(2, 1) if you 'may' choose a land
- Set(3, 1) because you want not to trigger both next trigger more than once (see below)
Again, a function counting lands/creatures in graveyard would ease the reading of code.
////////////////////////////////////////////////////////////////////////////////////////
-->
<TRIGGERED_ABILITY tag="CHOOSE_ONE_OR_BOTH" zone="STACK" layer="0" forced_skip="1" >
<TRIGGER value="ZONECHANGE">
return ( SelfTriggered() and (Object():GetZone() == ZONE_STACK) and (Object():GetErstwhileZone() == ZONE_HAND) )
</TRIGGER>
<EFFECT>
Object():GetFilter():Clear()
Object():GetFilter():SetZone( ZONE_GRAVEYARD )
Object():GetFilter():AddCardType( CARD_TYPE_LAND )
Object():GetFilter():SetPlayer( Object():GetPlayer() )
if ( Object():GetFilter():Count() > 0 ) then
Object():Register_Set( 3, 0 )
Object():Register_Set( 2, 1 )
end
Object():GetFilter():Clear()
Object():GetFilter():SetZone( ZONE_GRAVEYARD )
Object():GetFilter():AddCardType( CARD_TYPE_CREATURE )
Object():GetFilter():SetPlayer( Object():GetPlayer() )
if ( Object():GetFilter():Count() > 0 ) then
Object():Register_Set( 3, 1 )
Object():Register_Set( 1, 1 )
end
</EFFECT>
</TRIGGERED_ABILITY>
<!--
////////////////////////////////////////////////////////////////////////////////////////
If an ability resolves and Get(1 == 1), then you *MAY* choose a creature to bring back.
Replace "ChooseTargetCreature" with something more appropriated if you want.
////////////////////////////////////////////////////////////////////////////////////////
-->
<TRIGGERED_ABILITY tag="RETURN_TARGET_CREATURE" forced_skip="1" layer="0" zone="STACK">
<TRIGGER value="ABILITY_RESOLVED">
return ( SelfTriggered() and Object():Register_Get(1) > 0 )
</TRIGGER>
<PRE_EFFECT>
Object():Register_Set( 3, 0 )
Object():Register_Set( 1, 0 )
Object():GetFilter():Clear()
Object():GetFilter():SetZone( ZONE_GRAVEYARD )
Object():GetFilter():SetPlayer( Object():GetPlayer() )
Object():GetFilter():AddCardType ( CARD_TYPE_CREATURE )
Object():GetFilter():May()
ChooseTarget( "ChooseTargetCreature" )
</PRE_EFFECT>
<EFFECT>
if (Object():GetTargetCard() ~= nil) then
Object():Register_Object_Set( 0, Object():GetTargetCard() )
end
</EFFECT>
</TRIGGERED_ABILITY>
<!--
////////////////////////////////////////////////////////////////////////////////////////
If an ability resolves and Get(2 == 1), then you *MAY* choose a land to bring back.
Replace "ChooseLand" with something more appropriated if you want.
////////////////////////////////////////////////////////////////////////////////////////
-->
<TRIGGERED_ABILITY tag="RETURN_TARGET_LAND" forced_skip="1" layer="0" zone="STACK">
<TRIGGER value="ABILITY_RESOLVED">
return ( SelfTriggered() and Object():Register_Get(2) > 0 and Object():Register_Get(3) < 1 )
</TRIGGER>
<PRE_EFFECT>
Object():Register_Set( 2, 0 )
Object():GetFilter():Clear()
Object():GetFilter():SetZone( ZONE_GRAVEYARD )
Object():GetFilter():AddCardType ( CARD_TYPE_LAND )
Object():GetFilter():SetPlayer( Object():GetPlayer() )
Object():GetFilter():May()
ChooseTarget( "ChooseLand" )
</PRE_EFFECT>
<EFFECT>
if (Object():GetTargetCard() ~= nil) then
Object():Register_Object_Set( 1, Object():GetTargetCard() )
end
</EFFECT>
</TRIGGERED_ABILITY>
- create the missing functions that are 'hard coded' in the card
- fix the CantBePlayed() to either a land or creature in graveyard
- add fancy GuidedRevealed to show cards popping up back to hand
- fix the 'tags' i used to _RULE_1, etc
Re: Talk about new cards here
by logoliv » 24 Aug 2010, 21:11
Ok Yanna I will precautiously test the card before offering you my soul By the way, the code is as long as Natural Balance (7k) !
Zektar Shrine Expedition...
by logoliv » 25 Aug 2010, 16:30
Kev you don't need to add a charge counter on the 7/1 red elemental to destroy it... The only other card in Zendikar which produces the same token is Elemental Appeal, and the token is destroyed at the beginning of the next end step, like with Zektar Shrine Expedition
Also in the elemental code it's not :
Also in the elemental code it's not :
- Code: Select all
<TRIGGER value="END_OF_STEP">
return ( MTG():GetStep() == STEP_END_OF_TURN and Object():GetPlayer():MyTurn() ~= 0 and Object():CountCounters( MTG():ChargeCounters() ) > 0 )
</TRIGGER>
- Code: Select all
<TRIGGER value="BEGINNING_OF_STEP">
return ( MTG():GetStep() == STEP_END_OF_TURN )
</TRIGGER>
Re: Zektar Shrine Expedition...
by kevlahnota » 25 Aug 2010, 17:43
what if i trigger the zektar shrine expedition at opponents turn before his end step? the token will be detroyed at the next end step of his turn. also i've used the counter because the token has really no ability to destroy itself at the next end step. The zektar shrine expedition causes this "destroy ability at the next end step" not the token itself.
logoliv wrote:Kev you don't need to add a charge counter on the 7/1 red elemental to destroy it... The only other card in Zendikar which produces the same token is Elemental Appeal, and the token is destroyed at the beginning of the next end step, like with Zektar Shrine Expedition
Also in the elemental code it's not :but :
- Code: Select all
<TRIGGER value="END_OF_STEP">
return ( MTG():GetStep() == STEP_END_OF_TURN and Object():GetPlayer():MyTurn() ~= 0 and Object():CountCounters( MTG():ChargeCounters() ) > 0 )
</TRIGGER>
- Code: Select all
<TRIGGER value="BEGINNING_OF_STEP">
return ( MTG():GetStep() == STEP_END_OF_TURN )
</TRIGGER>
-
kevlahnota - Programmer
- Posts: 825
- Joined: 19 Jul 2010, 17:45
- Location: Philippines
- Has thanked: 14 times
- Been thanked: 264 times
Re: Talk about new cards here
by logoliv » 25 Aug 2010, 21:04
The next end step is not the end step of the next turn, but the next following end step, so if you use the activated ability of Zektar Shrine Expedition during your opponent's turn, the token will be destroyed before your turn.
When I read your code I understand "Exile it at the end of your next end step"...
To destroy the token at end of turn, use the same code as the mana tokens (since in all cases this Zendikar token is exiled from game at end of turn).
When I read your code I understand "Exile it at the end of your next end step"...
To destroy the token at end of turn, use the same code as the mana tokens (since in all cases this Zendikar token is exiled from game at end of turn).
Re: Talk about new cards here
by kevlahnota » 26 Aug 2010, 02:19
corect me if i'm wrong but,
1) the token must not be exiled from the game if you activate it in your opponents turn. because it's not "your end of turn", it will be your "opponents end of turn". Zektar says -- "Exile it at the end of your next end step"
2) the token didn't say sacrifice itself at the end of turn. the only 2 abilities of the token is trample and haste because it says in the zektar shrine expedition -- "Put a 7/1 red Elemental creature token with trample and haste onto the battlefield." and not "Put a 7/1 red Elemental creature token with trample and haste onto the battlefield with At the beginning of the next end step, sacrifice it."
3) i think my mistake was using the charge counters and removing the token at the "end" of my end step. but i couldn't think of any replacement code at that time when i made the zektar shrine.
just think of it, Ball Lightning and the Red Elemental token produced by Zektar is not the same effect.
1) the token must not be exiled from the game if you activate it in your opponents turn. because it's not "your end of turn", it will be your "opponents end of turn". Zektar says -- "Exile it at the end of your next end step"
2) the token didn't say sacrifice itself at the end of turn. the only 2 abilities of the token is trample and haste because it says in the zektar shrine expedition -- "Put a 7/1 red Elemental creature token with trample and haste onto the battlefield." and not "Put a 7/1 red Elemental creature token with trample and haste onto the battlefield with At the beginning of the next end step, sacrifice it."
3) i think my mistake was using the charge counters and removing the token at the "end" of my end step. but i couldn't think of any replacement code at that time when i made the zektar shrine.
just think of it, Ball Lightning and the Red Elemental token produced by Zektar is not the same effect.
logoliv wrote:The next end step is not the end step of the next turn, but the next following end step, so if you use the activated ability of Zektar Shrine Expedition during your opponent's turn, the token will be destroyed before your turn.
When I read your code I understand "Exile it at the end of your next end step"...
To destroy the token at end of turn, use the same code as the mana tokens (since in all cases this Zendikar token is exiled from game at end of turn).
-
kevlahnota - Programmer
- Posts: 825
- Joined: 19 Jul 2010, 17:45
- Location: Philippines
- Has thanked: 14 times
- Been thanked: 264 times
Re: Talk about new cards here
by kevlahnota » 26 Aug 2010, 07:05
please test svn r153, i modified it. the token has trample and haste ability only. as far as I understand, the tokens that produced/came from zektar shrine expedition are the only ones who will get removed from the game. if there is a spell that will copy the token or reproduced the same exact elemental token, it will not get sacrificed because it's not the tokens ability to removed itself from the game but the zektar shrine effect.
-
kevlahnota - Programmer
- Posts: 825
- Joined: 19 Jul 2010, 17:45
- Location: Philippines
- Has thanked: 14 times
- Been thanked: 264 times
Re: Talk about new cards here
by logoliv » 26 Aug 2010, 17:02
it's not your next end step but the next end step :
http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=183403
you can also see that when your mouse cursor is on the card name, in this thread
I agree that it's not clean to remove the token inside its own code, and the next end step is perhaps the end step of the next turn (considering Ball Lightning). So you will need to count the second end step in Zektar Shrine Expedition code
http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=183403
you can also see that when your mouse cursor is on the card name, in this thread
I agree that it's not clean to remove the token inside its own code, and the next end step is perhaps the end step of the next turn (considering Ball Lightning). So you will need to count the second end step in Zektar Shrine Expedition code
Re: Talk about new cards here
by Yanna » 26 Aug 2010, 19:46
I'm pretty sure that 'at the beginning of the next end step' is a rewording of 'at end of turn', like you can see on the old and modern rules of http://magiccards.info/ju/en/137.html.
For Ball Lightning, you usually can't cast it on opponent's turn (unlike using zektar's ability) so it's pretty safe to state only 'at the beginning of the end phase'.
For Ball Lightning, you usually can't cast it on opponent's turn (unlike using zektar's ability) so it's pretty safe to state only 'at the beginning of the end phase'.
Re: Talk about new cards here
by logoliv » 26 Aug 2010, 21:55
yes it's clear for the card of the link, Yanna the problem is that in the M10 edition of Ball Lightning, it is written "of the end step" and not "of the next end step" as we would have expected...
I was also pretty certain that Zektar Shrine expedition was meant to be read "at the beginning of the end step", and it would be strange that a token lives during 2 turns and be exiled after... so let's keep it like it is
I was also pretty certain that Zektar Shrine expedition was meant to be read "at the beginning of the end step", and it would be strange that a token lives during 2 turns and be exiled after... so let's keep it like it is
Re: Talk about new cards here
by Yanna » 27 Aug 2010, 17:26
Ha well no problem Logoliv, since i own your soul now i can control your posts !
Saw you posted a version of Grim discovery, and at the same time i polished code and uploaded it...
Saw you posted a version of Grim discovery, and at the same time i polished code and uploaded it...
Re: Talk about new cards here
by logoliv » 27 Aug 2010, 20:16
I returned my version since yours doesn't work... but I didn't erased your version, just renamed it
So in conclusion :
1) don't erase other modders versions if you are NOT SURE that yours works fine...
2) you should read my post about cards text (http://www.slightlymagic.net/forum/viewtopic.php?f=63&t=3069), it would have helped you for Grim Discovery text
3) and last but not least : you don't have my soul, neither can you control my posts lol
So in conclusion :
1) don't erase other modders versions if you are NOT SURE that yours works fine...
2) you should read my post about cards text (http://www.slightlymagic.net/forum/viewtopic.php?f=63&t=3069), it would have helped you for Grim Discovery text
3) and last but not least : you don't have my soul, neither can you control my posts lol
Re: Talk about new cards here
by Yanna » 27 Aug 2010, 21:13
Allright, edited this post since i found what was causing the problem (a flawed logic gate made it impossible to retrieve a land if you didn't have at least one creature in graveyard).
Works like the real card now
You can still try the challenge of coding Elixir of Immortality if you want !
Works like the real card now
You can still try the challenge of coding Elixir of Immortality if you want !
Re: Talk about new cards here
by Clark » 28 Aug 2010, 08:39
Hi folks,
When implementing one new effect 'Cascade', i met one bottleneck.
Because the new card type would not be only 'creature', so that i cannot simply move it from library into the battlefield.
Could you please give me some suggestion?
Thanks
When implementing one new effect 'Cascade', i met one bottleneck.
Here are the code:Cascade (When you play this spell, remove cards from the top of your library from the game until you remove a nonland cart that cost less. You may play it without paying its mana cost. Put the removed cards on the bottom in a random order).
- Code: Select all
<TRIGGERED_ABILITY tag="BLOODBRAID_ELF_RULE_1" forced_skip="1" layer="0">
<TRIGGER value="COMES_INTO_PLAY">
return SelfTriggered()
</TRIGGER>
<EFFECT>
local LNC_CARD_COST = 4
local LNC_FLAG_SUCCESS = 1
local LNC_OBJ_SELF = Object():GetOwner()
while (LNC_FLAG_SUCCESS > 0) do
if (LNC_OBJ_SELF:Library_GetTop() ~= nil) then
local LNC_OBJ_SELF_TOPCARD = LNC_OBJ_SELF:Library_GetTop()
local LNG_TOPCARD_CONVERTEDMANACOST = LNC_OBJ_SELF_TOPCARD:GetConvertedManaCost()
if ( ( LNC_OBJ_SELF_TOPCARD:GetCardType():Test( CARD_TYPE_LAND ) == 0 ) and ( LNG_TOPCARD_CONVERTEDMANACOST < LNC_CARD_COST ) ) then
Subject():DecreaseCost( 16 )
Subject():DecreaseColouredCost( COLOUR_BLACK, 7 )
Subject():DecreaseColouredCost( COLOUR_RED, 7 )
Subject():DecreaseColouredCost( COLOUR_GREEN, 7 )
Subject():DecreaseColouredCost( COLOUR_BLUE, 7 )
Subject():DecreaseColouredCost( COLOUR_WHITE, 7 )
Subject():DecreaseColouredCost( COLOUR_X, 1 )
LNC_OBJ_SELF_TOPCARD:PutInHand()
LNC_OBJ_SELF_TOPCARD:GuidedReveal( ZONE_LIBRARY, ZONE_HAND )
LNC_FLAG_SUCCESS = 0
end
end
end
LNC_OBJ_SELF:ShuffleLibrary()
</EFFECT>
Because the new card type would not be only 'creature', so that i cannot simply move it from library into the battlefield.
Could you please give me some suggestion?
Thanks
- Clark
- Posts: 64
- Joined: 21 Aug 2010, 16:07
- Has thanked: 0 time
- Been thanked: 0 time
Re: Talk about new cards here
by kevlahnota » 28 Aug 2010, 09:37
i was thinking of that also, did you try to set the object stackable?
i'm still wondering how to use these constants:
------------------------------------
STACK OBJECT TYPES -----------------
------------------------------------
STACK_OBJECT_UNDEFINED
STACK_OBJECT_CARD
STACK_OBJECT_ABILITY
STACK_OBJECT_COMBAT_DAMAGE
if we can utilize those and set the zone in ZONE_STACK we can make a new card ability like cascade,suspend,storm...etc(AD Nauseum )
i'm still wondering how to use these constants:
------------------------------------
STACK OBJECT TYPES -----------------
------------------------------------
STACK_OBJECT_UNDEFINED
STACK_OBJECT_CARD
STACK_OBJECT_ABILITY
STACK_OBJECT_COMBAT_DAMAGE
if we can utilize those and set the zone in ZONE_STACK we can make a new card ability like cascade,suspend,storm...etc(AD Nauseum )
Clark wrote:Hi folks,
When implementing one new effect 'Cascade', i met one bottleneck.Here are the code:Cascade (When you play this spell, remove cards from the top of your library from the game until you remove a nonland cart that cost less. You may play it without paying its mana cost. Put the removed cards on the bottom in a random order).I tried every way to decrease the cost of new card but failed
- Code: Select all
<TRIGGERED_ABILITY tag="BLOODBRAID_ELF_RULE_1" forced_skip="1" layer="0">
<TRIGGER value="COMES_INTO_PLAY">
return SelfTriggered()
</TRIGGER>
<EFFECT>
local LNC_CARD_COST = 4
local LNC_FLAG_SUCCESS = 1
local LNC_OBJ_SELF = Object():GetOwner()
while (LNC_FLAG_SUCCESS > 0) do
if (LNC_OBJ_SELF:Library_GetTop() ~= nil) then
local LNC_OBJ_SELF_TOPCARD = LNC_OBJ_SELF:Library_GetTop()
local LNG_TOPCARD_CONVERTEDMANACOST = LNC_OBJ_SELF_TOPCARD:GetConvertedManaCost()
if ( ( LNC_OBJ_SELF_TOPCARD:GetCardType():Test( CARD_TYPE_LAND ) == 0 ) and ( LNG_TOPCARD_CONVERTEDMANACOST < LNC_CARD_COST ) ) then
Subject():DecreaseCost( 16 )
Subject():DecreaseColouredCost( COLOUR_BLACK, 7 )
Subject():DecreaseColouredCost( COLOUR_RED, 7 )
Subject():DecreaseColouredCost( COLOUR_GREEN, 7 )
Subject():DecreaseColouredCost( COLOUR_BLUE, 7 )
Subject():DecreaseColouredCost( COLOUR_WHITE, 7 )
Subject():DecreaseColouredCost( COLOUR_X, 1 )
LNC_OBJ_SELF_TOPCARD:PutInHand()
LNC_OBJ_SELF_TOPCARD:GuidedReveal( ZONE_LIBRARY, ZONE_HAND )
LNC_FLAG_SUCCESS = 0
end
end
end
LNC_OBJ_SELF:ShuffleLibrary()
</EFFECT>
Because the new card type would not be only 'creature', so that i cannot simply move it from library into the battlefield.
Could you please give me some suggestion?
Thanks
-
kevlahnota - Programmer
- Posts: 825
- Joined: 19 Jul 2010, 17:45
- Location: Philippines
- Has thanked: 14 times
- Been thanked: 264 times
Who is online
Users browsing this forum: No registered users and 10 guests