Card Development - talk about cards code here
Posted: 08 Aug 2020, 15:45
Below code will fail if cards in deck are less than 8, as it will exile only cards above the last 4 and never the last 4,3,2,1.
So, I really need your help to finish this.
- Code: Select all
int card_orcish_librarian(int player, int card, event_t event){
/* Orcish Librarian |1|R 0x000000
* Creature - Orc 1/1
* |R, |T: Look at the top eight cards of your library. Exile four of them at random, then put the rest on top of your library in any order. */
if( event == EVENT_RESOLVE_ACTIVATION ){
if( count_deck(player) ){
int amount = MIN(8, count_deck(player));
show_deck( player, deck_ptr[player], amount, "Here's the top eight cards of your deck.", 0, 0x7375B0 );
int count_g = amount;
int cards = 0;
int rnd_ex = MIN(4, amount);
while( cards < 4 && count_g > 0){
int rnd = count_g - (rnd_ex +1);
if( rnd > cards ){
rnd = internal_rand(count_g);
}
rfg_card_in_deck(player, rnd);
cards++;
count_g--;
}
rearrange_top_x(player, player, amount-rnd_ex);
}
}
return generic_activated_ability(player, card, event, GAA_UNTAPPED, MANACOST_R(1), 0, NULL, NULL);
}