It is currently 25 Apr 2024, 04:04
   
Text Size

Named Counters?

Discuss Upcoming Releases, Coding New Cards, Etc.
PLEASE DO NOT REPORT BUGS HERE!

Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins

Named Counters?

Postby Jaye » 03 Nov 2009, 04:02

I've been adding some cards to my copy of manalink so that I can build my thallid/saproling deck. Something I am wondering about is it possible to name the counters on the card, such as have "Spore" counters instead of the default "+1/+1" counter text show up?

This is problematic because actual +1/+1 counters stack with the unnamed counters on the card (so +1/+1 counters could be removed as if they were spore counters...)
Jaye
 
Posts: 5
Joined: 23 Jun 2009, 19:22
Has thanked: 0 time
Been thanked: 0 time

Re: Named Counters?

Postby jatill » 03 Nov 2009, 13:28

I've never figured this out. What cards in this game already use non power/toughness counters? Mana Batteries, I think. If there are other, simple example cards, I might be able to figure out how they are done.
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: Named Counters?

Postby aww1979 » 03 Nov 2009, 15:50

Clockwork Avian and Clockwork Beast use counters that are +1/+0 instead of +1/+1 like most cards have. Also, Unstable Mutation has -1/-1 counters. Maybe if you can find what makes those different from Sengir Vampire, etc, you can find out how to rename them?
aww1979
Tester
 
Posts: 1717
Joined: 03 Mar 2009, 19:36
Has thanked: 0 time
Been thanked: 2 times

Re: Named Counters?

Postby jatill » 03 Nov 2009, 16:07

aww1979 wrote:Clockwork Avian and Clockwork Beast use counters that are +1/+0 instead of +1/+1 like most cards have. Also, Unstable Mutation has -1/-1 counters. Maybe if you can find what makes those different from Sengir Vampire, etc, you can find out how to rename them?
Ok, I figured this out. So complicated! I can now choose what image to use for counters from about 20 choices, and I can distinguish +1/+1 counters from other counters. I cannot add new counter types, though, since that is hard-coded into the game. When the new version is released, you can look at the code for Dark Depths to see what I did. Also, you'll need to peek into functions.c -> get_counter_type_by_id
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: Named Counters?

Postby Jaye » 03 Nov 2009, 23:22

Cool. :)

I added Elvish Farmer, Thallid, & Pyschotorpe Thallid to my copy of the game, and if I can use like, carrion counters--or something-- then they won't get confused with +1/+1 counters in game...
Jaye
 
Posts: 5
Joined: 23 Jun 2009, 19:22
Has thanked: 0 time
Been thanked: 0 time

Re: Named Counters?

Postby jatill » 05 Nov 2009, 13:22

Jaye wrote:Cool. :)

I added Elvish Farmer, Thallid, & Pyschotorpe Thallid to my copy of the game, and if I can use like, carrion counters--or something-- then they won't get confused with +1/+1 counters in game...
You should be able to look at yesterday's release to see how to do counters. Are you coding in C? Can I see your code for Elvish Farmer? Good job if you got that guy working; he's definitely nontrivial.
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: Named Counters?

Postby Jaye » 05 Nov 2009, 19:50

yes... I did it in C. I am not that good at C but I know enough to make stuff work by patching code together from cards and writing some small conditionals and stuff myself. I really like how my elvish farmer works, it doesn't prompt for choices unless both conditions are met. Same with my psychotrope (which is slightly more advanced cause of the 1 colorless cost to the sac)

Code: Select all
int card_elvish_farmer(int player, int card, event_t event){
    if( player == current_turn && trigger_condition == TRIGGER_UPKEEP && affect_me(player, card) ){
        if(event == EVENT_TRIGGER){
            event_result |= RESOLVE_TRIGGER_MANDATORY;
        }
        else if(event == EVENT_RESOLVE_TRIGGER){
            add_counter(player, card);
        }
    }
    target_definition_t td;
    default_target_definition(player, card, &td, TYPE_CREATURE);
    td.required_subtype = SUBTYPE_SAPROLING;
   
    if(event == EVENT_ACTIVATE ){
        if (count_counters(player, card) >= 3 && target_available(player, card, &td)) {
            char buffer[50];
            sprintf(buffer, " Create a Saproling\n Sacrifice a Saproling\n Cancel" );
            int choice = do_dialog(player, player, card, -1, -1, buffer, 0);
            if( choice == 0 ){
                remove_counter(player, card);
                remove_counter(player, card);
                remove_counter(player, card);
                generate_token(player, 1516);
            }
            if( choice == 1 ){
                if( select_target(player, card, &td, "Choose saproling to sacrifice", NULL)) {
                    card_instance_t *this_instance = get_card_instance(player, card);
                    kill_card(this_instance->targets[0].player, this_instance->targets[0].card, KILL_SACRIFICE);
                    gain_life(player, 2 );
                }
                else {
                    spell_fizzled = 1;
                }
            }
        }
        else if(count_counters(player, card) >= 3) {
            remove_counter(player, card);
            remove_counter(player, card);
            remove_counter(player, card);
            generate_token(player, 1516);
        }
        else if(target_available(player, card, &td)) {
            if( select_target(player, card, &td, "Choose saproling to sacrifice", NULL)) {
                card_instance_t *this_instance = get_card_instance(player, card);
                kill_card(this_instance->targets[0].player, this_instance->targets[0].card, KILL_SACRIFICE);
                gain_life(player, 2 );
            }
            else {
                spell_fizzled = 1;
            }
        }
    }
    if( event == EVENT_CAN_ACTIVATE && count_counters(player, card) >= 3) {
        return 1;
    }
    if( event == EVENT_CAN_ACTIVATE && target_available(player, card, &td)) {
        return 1;
    }
    return 0;
}
Jaye
 
Posts: 5
Joined: 23 Jun 2009, 19:22
Has thanked: 0 time
Been thanked: 0 time

Re: Named Counters?

Postby jatill » 05 Nov 2009, 20:03

Nice to know that someone else has been able to get everything compiled, etc. I won't make a lot of comments on your code, since you didn't ask, but I like how you don't offer a choice when there isn't one. I wish every card in the game worked that way. Watch out, though, you can sacrifice your opponent's Saprolings as written. I love bugs like that where you might not even notice until the AI starts eating your team and gaining life :)
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: Named Counters?

Postby Jaye » 05 Nov 2009, 20:29

yeahh that was an oversight on my part. I think I know how to fix it though, with td required = player or whatev.
Jaye
 
Posts: 5
Joined: 23 Jun 2009, 19:22
Has thanked: 0 time
Been thanked: 0 time


Return to Development

Who is online

Users browsing this forum: No registered users and 18 guests


Who is online

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

Login Form