Rise of the Eldrazi
Discuss Upcoming Releases, Coding New Cards, Etc.
PLEASE DO NOT REPORT BUGS HERE!
PLEASE DO NOT REPORT BUGS HERE!
Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins
Rise of the Eldrazi
by purplepixie » 23 Apr 2010, 06:50
I'm seeing what I can do as to making this happen in Manalink and it's looking pretty funky
In case anyone cares, here's what's working:
Rebound seems to be working fine, Level up also.
I've kind of hacked together the Eldrazi's "if was played from your hand" to trigger correctly, but I'm not convinced it's perfect.
Uncounterable and protection from coloured spells kind of elude me at the moment, but I'm thinking.
Within the context of RoE cards, Tajaru Preserver works too, but I can't really get it to work outside of that ...
And Totem Armour is what I'm about to look at.
On a vaguely technical note - rebound is basically done just by casting the card and not killing it on resolution, is this likely to do anything unexpected while it kicks around effectively in play?
EDIT: Totem Armour works just fine.
Granting it I'm not convinced about yet, but straight up having totem armour is fine.
In case anyone cares, here's what's working:
Rebound seems to be working fine, Level up also.
I've kind of hacked together the Eldrazi's "if was played from your hand" to trigger correctly, but I'm not convinced it's perfect.
Uncounterable and protection from coloured spells kind of elude me at the moment, but I'm thinking.
Within the context of RoE cards, Tajaru Preserver works too, but I can't really get it to work outside of that ...
And Totem Armour is what I'm about to look at.
On a vaguely technical note - rebound is basically done just by casting the card and not killing it on resolution, is this likely to do anything unexpected while it kicks around effectively in play?
EDIT: Totem Armour works just fine.
Granting it I'm not convinced about yet, but straight up having totem armour is fine.
Phyrexian Arena, Necropotence, Dark Confidant: "Life is more important than cards."
This is, of course, evidenced by your average Magic player: lots of cards and no life
This is, of course, evidenced by your average Magic player: lots of cards and no life
- purplepixie
- Posts: 12
- Joined: 20 Apr 2010, 15:41
- Has thanked: 0 time
- Been thanked: 0 time
Re: Rise of the Eldrazi
by jatill » 23 Apr 2010, 12:07
Nice work. Very good idea for Rebound. I think that'll work just fine, as long as there are valid targets when the spell goes to resolve the 2nd time. On the other hand, it is possible to code the cards to work exactly right using legacy effects.
Look at Terra Stomper for uncounterable.
Would you mind pasting your code for Kozilek?
Look at Terra Stomper for uncounterable.
Would you mind pasting your code for Kozilek?
Apps by jatill: http://www.slightlymagic.net/wiki/Other_Apps_by_jatill
Re: Rise of the Eldrazi
by purplepixie » 23 Apr 2010, 18:54
It really is a hack
But sure ...
The rules engine had this added to it:
and on EVENT_RESOLVE_SPELL you just ask was_spell_cast(player, card)
So when a card is drawn it gets effectively flagged as "legit."
Then when you cast it, it stops being so.
So it triggers the first time but not after for any specific card id.
I don't know quite how tutoring is done (i.e whether it puts it on top then fakes a draw) so that may or may not work, but otherwise it seems to go alright for my purposes.
But sure ...
The rules engine had this added to it:
- Code: Select all
int cards_seen[2][500];
int was_card_cast(int player, int card)
{
int x = cards_seen[player][card];
cards_seen[player][card] = 0;
return x;
}
void eldrazi_rules_engine(int player, int card, event_t event)
{
if (comes_into_play(player, card, event))
{
int i;
for (i = 0 ; i < active_cards_count[player]; i ++ )
{
cards_seen[player][i] = 1;
}
}
if (trigger_condition == TRIGGER_REPLACE_CARD_DRAW && affect_me(player, card) && reason_for_trigger_controller == player)
{
if (event == EVENT_TRIGGER)
{
event_result |= 2;
}
else if (event == EVENT_RESOLVE_TRIGGER)
{
int card_added = active_cards_count[player] ;
cards_seen[player][card_added] = 1 ;
}
}
}
int card_rules_engine(int player, int card, event_t event ){
eldrazi_rules_engine(player, card, event);
and on EVENT_RESOLVE_SPELL you just ask was_spell_cast(player, card)
So when a card is drawn it gets effectively flagged as "legit."
Then when you cast it, it stops being so.
So it triggers the first time but not after for any specific card id.
I don't know quite how tutoring is done (i.e whether it puts it on top then fakes a draw) so that may or may not work, but otherwise it seems to go alright for my purposes.
Phyrexian Arena, Necropotence, Dark Confidant: "Life is more important than cards."
This is, of course, evidenced by your average Magic player: lots of cards and no life
This is, of course, evidenced by your average Magic player: lots of cards and no life
- purplepixie
- Posts: 12
- Joined: 20 Apr 2010, 15:41
- Has thanked: 0 time
- Been thanked: 0 time
Re: Rise of the Eldrazi
by jatill » 23 Apr 2010, 20:09
Interesting way of doing that. I always wanted to code cards like these but haven't been able to crack the "was this cast from hand" problem. I tried something similar to what you did, but failed (I can't remember the exact reason... maybe the game slowed down too much).
Here are a few ways that your code will break down (not really criticizing, just an FYI):
1) As you mentioned, tutors and other cards that put cards directly into hand
2) Using arrays for game state is buggy (as Ive learned the hard way more than once). When the program goes to figure out what to do for its next move, it simulates a bunch of plays, and then rolls back the game state. Things like instance->blah get reset, but anything in arrays do not. That's why I have to use instance->blah for the Zendikar traps, instead of an array.
In any case, it seems like you're really digging in and have a solid grasp of what's going on with the code. Keep up the good work!
Here are a few ways that your code will break down (not really criticizing, just an FYI):
1) As you mentioned, tutors and other cards that put cards directly into hand
2) Using arrays for game state is buggy (as Ive learned the hard way more than once). When the program goes to figure out what to do for its next move, it simulates a bunch of plays, and then rolls back the game state. Things like instance->blah get reset, but anything in arrays do not. That's why I have to use instance->blah for the Zendikar traps, instead of an array.
In any case, it seems like you're really digging in and have a solid grasp of what's going on with the code. Keep up the good work!
Apps by jatill: http://www.slightlymagic.net/wiki/Other_Apps_by_jatill
Re: Rise of the Eldrazi
by purplepixie » 24 Apr 2010, 21:18
Yeah, I knew it would fail in some ways but I did notice you'd tried something similar and commented it out, so I didn't have massively high hopes.
Still, I'll poke around further into zendikar.c and see what I can't find out from the traps system.
Also, any idea why attack_if_able() wouldn't work?
I'm having a play around with reserved info at the moment, so if it's that then I should find out for myself
And yeah, it all makes a lot of sense - it's tidily and smartly coded enough that it's pretty easy to pick up.
Thanks for the help.
EDIT: [s]Just a thought in re the "is played from hand" idea ... couldn't we give the rules engine an interrupt-speed trigger like Daring Apprentice and just have it set a flag on the card then?
Or even call the cards function with an EVENT_CAST_FROM_HAND or something?
Putting stuff into play (even spells) doesn't seem to give you the interrupt option because it's not using the stack properly. Just a thought.[/s]
Didn't seem to gel.
However ... what's wrong with basically taking the keep_storm_count() code and changing the action from increment_storm_count to calling this function on the cast card?:
It seems to work from my (very limited) testing.
However, affect_me() will invariably return 0 for the EVENT_CAST_FROM_HAND, since the currently affected card must be the rules engine, so make sure to actively not check it
Unless you can fake that for a call, but I haven't seen it.
Still, I'll poke around further into zendikar.c and see what I can't find out from the traps system.
Also, any idea why attack_if_able() wouldn't work?
I'm having a play around with reserved info at the moment, so if it's that then I should find out for myself
And yeah, it all makes a lot of sense - it's tidily and smartly coded enough that it's pretty easy to pick up.
Thanks for the help.
EDIT: [s]Just a thought in re the "is played from hand" idea ... couldn't we give the rules engine an interrupt-speed trigger like Daring Apprentice and just have it set a flag on the card then?
Or even call the cards function with an EVENT_CAST_FROM_HAND or something?
Putting stuff into play (even spells) doesn't seem to give you the interrupt option because it's not using the stack properly. Just a thought.[/s]
Didn't seem to gel.
However ... what's wrong with basically taking the keep_storm_count() code and changing the action from increment_storm_count to calling this function on the cast card?:
- Code: Select all
if(trigger_condition == TRIGGER_SPELL_CAST && affect_me(player, card)
&& player == reason_for_trigger_controller && player == HUMAN)
{
card_instance_t *played= get_card_instance(trigger_cause_controller, trigger_cause);
if( ! ( cards_data[ played->internal_card_id].type & TYPE_LAND ) )
{
if(event == EVENT_TRIGGER)
{
event_result |= RESOLVE_TRIGGER_MANDATORY;
}
else if(event == EVENT_RESOLVE_TRIGGER)
{
int (*ptFunction)(int, int, event_t) = (void*)cards_data[ played->internal_card_id].code_pointer;
ptFunction(trigger_cause_controller, trigger_cause, EVENT_CAST_FROM_HAND);
}
}
}
It seems to work from my (very limited) testing.
However, affect_me() will invariably return 0 for the EVENT_CAST_FROM_HAND, since the currently affected card must be the rules engine, so make sure to actively not check it
Unless you can fake that for a call, but I haven't seen it.
Phyrexian Arena, Necropotence, Dark Confidant: "Life is more important than cards."
This is, of course, evidenced by your average Magic player: lots of cards and no life
This is, of course, evidenced by your average Magic player: lots of cards and no life
- purplepixie
- Posts: 12
- Joined: 20 Apr 2010, 15:41
- Has thanked: 0 time
- Been thanked: 0 time
Re: Rise of the Eldrazi
by jatill » 27 Apr 2010, 11:58
I think this will work pretty well. Does it interact correctly with counterspells, though?
Instead, can you just add the Eldrazi triggers to EVENT_CAST_SPELL? (I haven't tried this)
Instead, can you just add the Eldrazi triggers to EVENT_CAST_SPELL? (I haven't tried this)
Apps by jatill: http://www.slightlymagic.net/wiki/Other_Apps_by_jatill
Re: Rise of the Eldrazi
by purplepixie » 28 Apr 2010, 11:36
Actually it doesn't seem to be working as well as I thought.
Counterspells do cause a problem, and I think EVENT_CAST_SPELL happens whether it was cast or faked.
Sad faces all around.
Though I am also wondering about Ulamog's Crusher's attack if able ability - this does seem broken.
Even if I play a good old fashioned Juggernaut it seems quite happy not to attack, any idea why?
However, it all seems to be coming along fine apart from one tiny hiccup ...
Which was me discovering Challenge Mode and losing half of my Magic time to it
On which note, would you consider it cheating to create cards because the challenge deck you want to build need them?
E.g. I've been playing March of the Machines, and I just don't think my deck is good enough without Scourglass, so I created it - totally fair, right?
Counterspells do cause a problem, and I think EVENT_CAST_SPELL happens whether it was cast or faked.
Sad faces all around.
Though I am also wondering about Ulamog's Crusher's attack if able ability - this does seem broken.
Even if I play a good old fashioned Juggernaut it seems quite happy not to attack, any idea why?
However, it all seems to be coming along fine apart from one tiny hiccup ...
Which was me discovering Challenge Mode and losing half of my Magic time to it
On which note, would you consider it cheating to create cards because the challenge deck you want to build need them?
E.g. I've been playing March of the Machines, and I just don't think my deck is good enough without Scourglass, so I created it - totally fair, right?
Phyrexian Arena, Necropotence, Dark Confidant: "Life is more important than cards."
This is, of course, evidenced by your average Magic player: lots of cards and no life
This is, of course, evidenced by your average Magic player: lots of cards and no life
- purplepixie
- Posts: 12
- Joined: 20 Apr 2010, 15:41
- Has thanked: 0 time
- Been thanked: 0 time
Re: Rise of the Eldrazi
by jatill » 28 Apr 2010, 11:59
Yes, totally fair
The must attack function has always been a little quirky; I'm not sure why.
The must attack function has always been a little quirky; I'm not sure why.
Apps by jatill: http://www.slightlymagic.net/wiki/Other_Apps_by_jatill
Re: Rise of the Eldrazi
by purplepixie » 28 Apr 2010, 13:20
I can't seem to get event_modify_cost to work either
I'm working on the Hand of Emrakul, and I've got it perfect except for one thing - it never reduces the cost.
If you have 4 tokens and 18 mana, you can cast it for 9 and then choose to pay 9 more or sac 4 spawn.
Or you can cast it for 9 if you don't have 4 spawn, otherwise it's 9 mana and 4 spawn.
Is there an obvious reason (mainly me being a douche) that would cause this?
The code is:
(count_eldrazi_spawn definitely works - I've even removed that line and it still costs 9)
I'm working on the Hand of Emrakul, and I've got it perfect except for one thing - it never reduces the cost.
If you have 4 tokens and 18 mana, you can cast it for 9 and then choose to pay 9 more or sac 4 spawn.
Or you can cast it for 9 if you don't have 4 spawn, otherwise it's 9 mana and 4 spawn.
Is there an obvious reason (mainly me being a douche) that would cause this?
The code is:
- Code: Select all
int card_hand_of_emrakul(int player, int card, event_t event)
{
if ( event == EVENT_MODIFY_COST )
{
if ( count_eldrazi_spawn(player) >= 4)
COST_COLORLESS -= 9 ;
}
if ( event == EVENT_CAST_SPELL && affect_me(player, card))
{
int options = 0 ;
int choice = -1 ;
if ( has_mana( player, COLOR_ANY, 9 ) )
{
options |= 1;
choice = 1;
}
if ( ( count_eldrazi_spawn(player) >= 4) )
{
options |= 2;
choice = 0;
}
if ( options == 3)
{
choice = do_dialog(player, player, card, -1, -1, " Sacrifice 4 spawn\nPay 9", 0);
}
if (choice == 0)
{
card_instance_t *instance = get_card_instance(player, card);
target_definition_t td;
default_target_definition(player, card, &td, TYPE_CREATURE);
td.allowed_controller = player;
td.preferred_controller = player;
td.who_chooses = player;
td.illegal_abilities = 0;
int i=0;
while (i < 4)
{
pick_target(&td, "LORD_OF_THE_PIT");
int target = instance->targets[0].card;
if ( has_creature_type(player, target, SUBTYPE_ELDRAZI) && has_creature_type(player, target, SUBTYPE_SPAWN) )
{
kill_card(player, target, KILL_SACRIFICE);
i ++ ;
}
}
}
if (choice == 1)
{
charge_mana(player, COLOR_COLORLESS, 9);
}
}
annihilator(player, card, event, 1);
return 0;
}
(count_eldrazi_spawn definitely works - I've even removed that line and it still costs 9)
Phyrexian Arena, Necropotence, Dark Confidant: "Life is more important than cards."
This is, of course, evidenced by your average Magic player: lots of cards and no life
This is, of course, evidenced by your average Magic player: lots of cards and no life
- purplepixie
- Posts: 12
- Joined: 20 Apr 2010, 15:41
- Has thanked: 0 time
- Been thanked: 0 time
Re: Rise of the Eldrazi
by jatill » 28 Apr 2010, 15:53
For the modify cost code to trigger, you need to have the proper reserved information. Copy that from any hybrid card.
Apps by jatill: http://www.slightlymagic.net/wiki/Other_Apps_by_jatill
Re: Rise of the Eldrazi
by purplepixie » 28 Apr 2010, 16:52
Awesomes - I knew it would be something like that.
I guess that's just the standard "this card isn't working" test, right?
Find something that it *does* work for and rip its reserved info.
I guess that's just the standard "this card isn't working" test, right?
Find something that it *does* work for and rip its reserved info.
Phyrexian Arena, Necropotence, Dark Confidant: "Life is more important than cards."
This is, of course, evidenced by your average Magic player: lots of cards and no life
This is, of course, evidenced by your average Magic player: lots of cards and no life
- purplepixie
- Posts: 12
- Joined: 20 Apr 2010, 15:41
- Has thanked: 0 time
- Been thanked: 0 time
Re: Rise of the Eldrazi
by jatill » 11 May 2010, 11:58
Making any progress? Are you planning on doing a release any time soon?
Apps by jatill: http://www.slightlymagic.net/wiki/Other_Apps_by_jatill
Re: Rise of the Eldrazi
by purplepixie » 11 May 2010, 16:54
Definitely making progress
But mostly it's struggling through the nasty ones first - not much point in releasing until I at least sit down and blaze through the commons.
But yeah, when I give up on some of these nasties and get into just adding cards there should be something for people to test for me
Also, totally unrelatedly, Undead Warchief is broken - his ability never checks that he is in play, so you can't respond to him by Lightning Bolt ing the other Warchief - it's already 5/4
Just a first line
But mostly it's struggling through the nasty ones first - not much point in releasing until I at least sit down and blaze through the commons.
But yeah, when I give up on some of these nasties and get into just adding cards there should be something for people to test for me
Also, totally unrelatedly, Undead Warchief is broken - his ability never checks that he is in play, so you can't respond to him by Lightning Bolt ing the other Warchief - it's already 5/4
Just a first line
- Code: Select all
if !in_play(player, card)
return 0
Phyrexian Arena, Necropotence, Dark Confidant: "Life is more important than cards."
This is, of course, evidenced by your average Magic player: lots of cards and no life
This is, of course, evidenced by your average Magic player: lots of cards and no life
- purplepixie
- Posts: 12
- Joined: 20 Apr 2010, 15:41
- Has thanked: 0 time
- Been thanked: 0 time
Re: Rise of the Eldrazi
by enigma73 » 11 May 2010, 19:04
yeah alot of the +pow/+tough enchancers are like that, its not supposed to be that way until card hits the playfield. I find myself bolting,etc.. on my turn before the next enchaners pops up otherwise your screwed.
-
enigma73 - Posts: 29
- Joined: 31 Mar 2010, 17:27
- Location: USA
- Has thanked: 0 time
- Been thanked: 0 time
Re: Rise of the Eldrazi
by jatill » 23 Jun 2010, 12:23
Are you still with us? I'm going to start adding Rise cards myself soon, so I'd like to take whatever code you already have written. In particular, have you worked on Gideon at all?
Apps by jatill: http://www.slightlymagic.net/wiki/Other_Apps_by_jatill
15 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 32 guests