It is currently 11 Apr 2021, 13:57
   
Text Size

Card Development - talk about cards code here

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

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

Re: How to make "target creature other than enchanted creatu

Postby Aswan jaguar » 25 Feb 2021, 17:04

I can't make the "target creature other than enchanted" for Kjeldoran Pride.

Code: Select all
static const char* not_the_enchanted(int who_chooses, int player, int card, int targeting_player, int targeting_card)
{
  if (  )          // what?
   return NULL;
  else
   return "can't be this enchanted creature.";
}

int card_kjeldoran_pride(int player, int card, event_t event){
   /* CARD_ID_KJELDORAN_PRIDE   2306
   Kjeldoran Pride   |1|W
   Enchantment - Aura
   Enchant creature
   Enchanted creature gets +1/+2.
   |2|U: Attach ~ to target creature other than enchanted creature. */

   if( get_card_instance(player, card)->damage_target_player > -1 ){
      card_instance_t *instance = get_card_instance(player, card);

      target_definition_t td;
      default_target_definition(player, card, &td, TYPE_CREATURE);
      td.preferred_controller = player;
      td.special = TARGET_SPECIAL_EXTRA_FUNCTION;
      td.extra = (int32_t)not_the_enchanted;
      //td.special = TARGET_SPECIAL_NOT_ME; // not working as the aura is targeting.

      if( event == EVENT_CAN_ACTIVATE || event == EVENT_ACTIVATE ){
          return generic_activated_ability(player, card, event, GAA_CAN_TARGET | GAA_LITERAL_PROMPT, MANACOST_XU(2, 1), 0,
                                           &td, "Select another target creature to attach this.");
      }

       if( event == EVENT_RESOLVE_ACTIVATION ){
          if( valid_target(&td) ){
             attach_aura_to_target(player, instance->parent_card, event, instance->targets[0].player, instance->targets[0].card);
          }
       }
   }

   if (event == EVENT_CHECK_PUMP)   // will only be sent to this card if it has flash, e.g. for Mageta's Boon
      return vanilla_instant_pump(player, card, event, ANYBODY, player, 1, 2, 0, 0);

   if( ! IS_AURA_EVENT(player, card, event) ){
      return 0;
   }

   return generic_aura(player, card, event, player, 1, 2, 0, 0, 0, 0, 0);
}
Also we don't have anything new for Hipparion, right?
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 7424
Joined: 13 May 2010, 12:17
Has thanked: 636 times
Been thanked: 343 times

Re: Card Development - talk about cards code here

Postby drool66 » 26 Feb 2021, 03:08

I don't quite have the time to do it right now, but take a look at the targeting function in Godsend from Journey into Nyx - not 100% sure, but I think your solution would be similar, just work in instance->damage_target_player/card for is_blocking(). I'll update later if you're still having trouble.
EDIT: Here's my guess:
Code: Select all
static const char* not_the_enchanted(int who_chooses, int player, int card, int targeting_player, int targeting_card)
{
  card_instance_t* kp = get_card_instance(targeting_player, targeting_card);
  if ( !(kp->damage_target_player == player && kp->damage_target_card == card) )          // what?
   return NULL;
  else
   return "can't be this enchanted creature.";
}
User avatar
drool66
 
Posts: 602
Joined: 25 Nov 2010, 22:38
Has thanked: 147 times
Been thanked: 132 times

Re: Card Development - talk about cards code here

Postby Aswan jaguar » 26 Feb 2021, 19:01

It crashes like most of my tries did. A dizzy persons mistake :rolleyes: it is not crashing but not working either you can still target enchanted creature.
Last edited by Aswan jaguar on 27 Feb 2021, 09:37, edited 1 time in total.
Reason: edited my dizzy result
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 7424
Joined: 13 May 2010, 12:17
Has thanked: 636 times
Been thanked: 343 times

Re: Card Development - talk about cards code here

Postby drool66 » 27 Feb 2021, 12:11

It needs a general return value rather than one behind an "else". I tested and confirmed this working for me:
Code: Select all
static const char* not_the_enchanted(int who_chooses, int player, int card, int targeting_player, int targeting_card)
{
  card_instance_t* kp = get_card_instance(targeting_player, targeting_card);
  if ( !(kp->damage_target_player == player && kp->damage_target_card == card) ){
   return NULL;
  }

   return "can't be this enchanted creature.";
}
To go back to your previous post - no, I haven't worked on Hipparion. I'm amazed how subtly complex that card function is.
User avatar
drool66
 
Posts: 602
Joined: 25 Nov 2010, 22:38
Has thanked: 147 times
Been thanked: 132 times

Re: Card Development - talk about cards code here

Postby drool66 » 02 Mar 2021, 03:07

Not strictly on topic, but does anyone know why devoid cards are not tagged "Color Colorless" in ct_all? (at least the ones I checked aren't) I'm trying to get them to work with Mystic Forge without special casing "get_color_by_internal_id() == 0" for them. This wouldn't be terrible, but I feel it breaks or bends something else. I also had to modify get_color_by_internal_id() to be able to return COLOR_TEST_COLORLESS for non-artifact, non-land cards, while still stripping it out for colored cards that produce colorless mana.
User avatar
drool66
 
Posts: 602
Joined: 25 Nov 2010, 22:38
Has thanked: 147 times
Been thanked: 132 times

Previous

Return to Development

Who is online

Users browsing this forum: No registered users and 8 guests


Who is online

In total there are 8 users online :: 0 registered, 0 hidden and 8 guests (based on users active over the past 10 minutes)
Most users ever online was 1371 on 09 Feb 2020, 16:22

Users browsing this forum: No registered users and 8 guests

Login Form