It is currently 28 Apr 2024, 19:12
   
Text Size

Wormwood Treefolk menu/ai choice no honor Magical Hack

Report wrong Card behavior to get it fixed.
PLEASE ADD SAVEGAMES TO YOUR TOPIC !

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

Wormwood Treefolk menu/ai choice no honor Magical Hack

Postby travolter » 24 Jun 2019, 20:24

Describe the Bug:
You cannot activate the ability that requires GG. Only the BB one.

Which card did behave improperly?
Wormwood Treefolk

Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
Manalink dev version 250c78bd updated 11-5-19
Attachments
Wormwood Treefolk.rar
(2.35 KiB) Downloaded 130 times
Last edited by Aswan jaguar on 27 Jun 2019, 14:51, edited 4 times in total.
Reason: strikethrough fixed-rename to current bug
travolter
 
Posts: 250
Joined: 26 Mar 2012, 17:56
Has thanked: 4 times
Been thanked: 8 times

Re: Wormwood Treefolk

Postby Aswan jaguar » 26 Jun 2019, 12:38

Fixed in commit 51c47843. As I try to keep the card's code as close as to how it was coded it has a minor bug that in menu to choose ability from both abilities will highlight as activate-able. Also in this form I can't figure out how to make it use alternate_legacy_text.
code | Open
Code: Select all
int card_wormwood_treefolk(int player, int card, event_t event){
   /*
     Wormwood Treefolk English |3|G|G
     Creature - Treefolk 4/4
     {G}{G}: Wormwood Treefolk gains forestwalk until end of turn and deals 2 damage to you.
     {B}{B}: Wormwood Treefolk gains swampwalk until end of turn and deals 2 damage to you.
   */


   if( event == EVENT_CAN_ACTIVATE ){
      if( generic_activated_ability(player, card, event, 0, MANACOST0, 0, NULL, NULL) ){
         return has_mana_for_activated_ability(player, card, MANACOST_B(2)) || has_mana_for_activated_ability(player, card, MANACOST_G(2)) ;
      }
   }

   if( event == EVENT_ACTIVATE ){
      card_instance_t *instance = get_card_instance(player, card);
      int choice = 0;
      if(has_mana_for_activated_ability(player, card, MANACOST_B(2)) || has_mana_for_activated_ability(player, card, MANACOST_G(2)) ){
         choice = do_dialog(player, player, card, -1, -1, " Give Forestwalk\n Give Swampwalk\n Cancel",
                                                       check_battlefield_for_subtype(1-player, TYPE_LAND, SUBTYPE_SWAMP || SUBTYPE_FOREST));
      }
      else{
         choice = 1;
      }
      if( choice == 2 ){
         spell_fizzled = 1;
         return 0;
      }
      if( charge_mana_for_activated_ability(player, card, 0, (choice == 1 ? 2 : 0), 0, (choice == 0 ? 2 : 0), 0, 0) ){
         instance->info_slot = 66+choice;
      }
   }

   if( event == EVENT_RESOLVE_ACTIVATION ){
      card_instance_t *instance = get_card_instance(player, card);
      int kw = instance->info_slot == 66 ? get_hacked_walk(instance->parent_controller, instance->parent_card, KEYWORD_FORESTWALK) :
                                 get_hacked_walk(instance->parent_controller, instance->parent_card, KEYWORD_SWAMPWALK);
      pump_ability_until_eot(instance->parent_controller, instance->parent_card, instance->parent_controller, instance->parent_card, 0, 0, kw, 0);
      damage_player(instance->parent_controller, 2, instance->parent_controller, instance->parent_card);
   }

   return 0;
}
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8078
Joined: 13 May 2010, 12:17
Has thanked: 730 times
Been thanked: 458 times

Re: Wormwood Treefolk doesn't use different legacy cards/abi

Postby Korath » 26 Jun 2019, 16:34

Neither the menu nor the AI's choice honor Magical Hack, either (though the created effect should), and that "SUBTYPE_SWAMP || SUBTYPE_FOREST" doesn't do anything at all like what you're intending - it looks for a land with SUBTYPE_ALLY. Setting that aside, you'd want something similar to
Code: Select all
int choice = 0;
int has_BB = has_mana_for_activated_ability(player, card, MANACOST_B(2));
int has_GG = has_mana_for_activated_ability(player, card, MANACOST_G(2));
if (has_BB && has_GG)
  choice = do_dialog(player, player,card, -1,-1, " Forestwalk\n Swampwalk\n Cancel",
                     check_battlefield_for_subtype(1-player, TYPE_LAND, SUBTYPE_SWAMP));
else if (has_BB)
  choice = 0;
else if (has_GG)
  choice = 1;
else
  choice = 2;
Always displaying both options even if only one is pickable (and disabling the other) is a better interface, of course, and DIALOG()'s the most convenient way to do that.

pump_ability_until_eot() returns the card index of the effect card it creates, just like most other effect-creating functions in Manalink.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: Wormwood Treefolk doesn't use different legacy cards/abi

Postby Aswan jaguar » 27 Jun 2019, 14:49

I gave it alternate effect for abilities and used above code to fix the other bug in commit 5360d68e.
I tried but seems impossible for me to make menu honor Magical Hack without changing the whole card using DIALOG() which is a nice touch. I left untouched also AI's choice which doesn't honor Magical Hack which seems easy but I don't know what it does and how it will affect AI's choice.
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8078
Joined: 13 May 2010, 12:17
Has thanked: 730 times
Been thanked: 458 times


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 40 guests


Who is online

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

Login Form