It is currently 19 Apr 2024, 16:26
   
Text Size

[confirmed]Amulet of Vigor and 2 mana lands

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

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

[confirmed]Amulet of Vigor and 2 mana lands

Postby Gargaroz » 05 Mar 2014, 00:39

As per ruling, you should be able to draw mana from 2 mana bouncelands from Ravnica if you've the Amulet of Vigor in play, as the ability to bounce a land goes on the stack.
It's possible to implement this ? Maybe we could add a check in the "comes_into_play" function to avoid the addendum of "STATE_TAPPED" if Amulet of Vigor is in play.

Edit : in order to work as it's needed, Amulet of Vigor must be recoded (AKA given a proper code). I'll do it.
Last edited by Aswan jaguar on 29 Apr 2016, 17:49, edited 2 times in total.
Reason: reconfirmed bug
----
- Current / medium term task: adjusting the code for making Misdirection and such usable
- Long term task: inserting all the good stuff I left out from the "Golden Years" mod
Gargaroz
Programmer
 
Posts: 7097
Joined: 06 Nov 2009, 11:11
Has thanked: 82 times
Been thanked: 595 times

Re: [confirmed]Amulet of Vigor and 2 mana lands

Postby Korath » 05 Mar 2014, 02:35

.Amulet of Vigor already works properly; there's just no opportunity to respond.

Part of the problem is that the lands are bouncing the land as part of resolution instead of as a trigger, so the amulet never even gets a chance to untap them.
This comes closer | Open
Code: Select all
static int karoo(int player, int card, event_t event, int color1, int color2, int ai_card){

   card_instance_t *instance = get_card_instance(player, card);
   if(player == AI ){
      int id = get_internal_card_id_from_csv_id(ai_card);
      instance->internal_card_id = id;
      return 0;
   }

   comes_into_play_tapped(player, card, event);

   if (comes_into_play(player, card, event)){
      target_definition_t td;
      base_target_definition(player, card, &td, TYPE_LAND);
      td.allowed_controller = player;
      td.preferred_controller = player;
      td.allow_cancel = 0;

      select_target(player, card, &td, "Choose a land to bounce", NULL);
      bounce_permanent(instance->targets[0].player, instance->targets[0].card);
   }

   return two_mana_land(player, card, event, color1, color2);
}
That still doesn't allow a response, though.

Maybe hack a chance to respond into Amulet of Vigor's EVENT_RESOLVE_TRIGGER handler. 0x436A20 is the function that gives players a chance to respond; the trick is to always stop even if the player doesn't have an instant to cast. Last time I was experimenting with this, the version I had closest to working was
Code: Select all
int card_turntimber_ranger(int player, int card, event_t event)
{
    if (ally_trigger(player, card, event))
      {
        int choice = do_dialog(player, player, card, -1, -1,
                               " Make a wolf\n Don't make a wolf", 0);
        if (choice == 0)
          {
            put_card_or_activation_onto_stack(player, card,
                                              EVENT_RESOLVE_ACTIVATION,
                                              player, 0);

            //TENTATIVE_raw_put_card_on_stack(not_a_mana_source)
            EXE_FN(int, 0x436450, int)(1);

            if (ai_is_speculating != 1)
              EXE_FN(void, 0x436700, void)();   //set_stack_damage_targets()

            //allow_response()
            EXE_FN(int, 0x436a20, int, int, const char*, int)(-player-1, current_phase, "Resolving trigger", EVENT_ACTIVATE);

            EXE_FN(void, 0x436740, void)();     //resolve_top_card_on_stack()
          }
      }

    if (event == EVENT_RESOLVE_ACTIVATION)
      {
        card_instance_t* instance = get_card_instance(player, card);
        add_1_1_counter(instance->parent_controller, instance->parent_card);
        generate_token_by_id(player, CARD_ID_WOLF);
    }
    return 0;
}
There's an outline of how some of those functions work (at least as well as is known) in the comments inside event_activate_then_duplicate_into_stack() in functions/events.c.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [confirmed]Amulet of Vigor and 2 mana lands

Postby Korath » 05 Mar 2014, 03:41

This works, but is fairly annoying:
Code: Select all
static int effect_dummy_activateable(int player, int card, event_t event)
{
  if (event == EVENT_CAN_ACTIVATE)
    return 1;
  if (event == EVENT_ACTIVATE)
    cancel = 1;
  return 0;
}

int card_amulet_of_vigor(int player, int card, event_t event)
{
  test_definition_t this_test;
  default_test_definition(&this_test, TYPE_PERMANENT);
  this_test.state = STATE_TAPPED;
  if (new_specific_cip(player, card, event, player, RESOLVE_TRIGGER_MANDATORY, &this_test))
    {
      card_instance_t* instance = get_card_instance(player, card);
      untap_card(instance->targets[1].player, instance->targets[1].card);

      /* Create an invisible activateable effect so the player always has a chance to respond to this trigger, even if he can't do anything else at instant
       * speed except tap lands. */
      int leg = create_legacy_activate(0, card, effect_dummy_activateable);
      get_card_instance(player, leg)->token_status |= STATUS_INVISIBLE_FX;

      EXE_FN(int, 0x436a20, int, int, const char*, int)(-2, current_phase, "Resolving trigger", EVENT_RESOLVE_TRIGGER);

      kill_card(0, leg, KILL_REMOVE);
    }
  return 0;
}
Annoying in that it asks you to respond whenever an Amulet of Vigor triggers, and if you tap a land or do anything else, you have to click "Done" twice (just like to advance to the next phase if you have a stop on the current one, which is also annoying). On the other hand, if you're playing decks with Amulets of Vigor, you probably mostly want to respond here anyway.

I can't imagine wanting to do this every time any trigger activated, though.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 56 guests


Who is online

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

Login Form