Log in

API for Magic Coding in C

Args in all caps should use special constants as the arguments (see manalink.h for a list of constants)

Please leave subs in alphabetical order for easier scanning.

Card Status Functions


Game State Functions

  • int can_be_played_as_sorcery(int player)
  • count_graveyard(player)
  • has_mana(player, COLOR, amount)
  • has_mana_multi(player, colorless, black, blue, green, red, white)
  • has_threshold(player)
  • is_artifact_in_play() [unimplemented]


Cost Paying Functions

  • charge_mana(player, COLOR, amount)
  • charge_mana_multi(player, colorless, black, blue, green, red, white)
  • tap_card(player, card)


Targeting Functions It is recommended you use the targeting system instead of this sub.

  • target_player(player, card, event)


Abilities

  • void boost_creature_type(int player, int card, event_t event, creature_type_t type, int power, int toughness, int abilities, int flags);
  • check_legend_rule(player, card, event) [I think this should be renamed legendary, since the sub actually kills the legend]
  • void echo(int player, int card, event_t event, int colorless, int black, int blue, int green, int red, int white)
  • void fading(int player, int card, event_t event, int fading_number)
  • int basic_equipment(int player, int card, event_t event, int equip_cost)
  • void haste(int, int);
  • int hybrid_XX(int player, int card, event_t event, int hybrid, int colorless)
  • void indestructible(int player, int card, event_t event)
  • islandhome(player, card, event)
  • int lifelink(int, int, event_t);
  • int mana_producer(int player, int card, event_t event)
  • void vigilance(int player, int card);


Actions

  • add_one_mana_any_color(player)
  • int damage_creature(int target_controller, int target_card, int amount, int source_controller, int source_card)
  • int damage_creature_or_player(int player, int card, event_t event, int damage_amount, int ??? [use 3]);
  • void draw_a_card(int player)
  • void draw_cards(int player, int amount)
  • void discard(int player, int is_random, int unknown) [The last param appears to be unused]
  • gain_life(player, amount)
  • generate_token***(player, manalink.csv card id);
  • kill_card(player, card, KILL_METHOD)
  • produce_mana(player, COLOR, amount)

Random Stuff

  • affect_me(player, card)
  • int do_dialog(int player, int player2, int card, int unknown1, int unknown2, char *text, int AI_choice)

int get_attack_power(int player, int card)
Returns the actual attack power of a single creature. It's used to implement Doran, the Siege Tower power/toughness switching.

int get_counter_type_by_id(int id)
You need to define the appearance of the "special counters" that can be added on a specific card via the "add_ccounter" function in this function. Each single card is identified by its CSV ID. Available values range from 0 to 23

int get_id_by_name(const char * name)
A really useful functions that return the CSV ID of a specific card from his name.