It is currently 12 May 2025, 04:49
   
Text Size

[fixed]Jayemdae Tome AI activates with no mana infinite loop

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

Re: [fixed]Jayemdae Tome AI activates with no mana infinite

Postby FastEddie » 14 Nov 2020, 10:34

Let's look at this in more detail in case someone is still interested.

generic_activated_ability() is just a wrapper for granted_generic_activated_ability():
Code: Select all
int generic_activated_ability(int player, int card, event_t event, int mode, int cless, int black, int blue, int green, int red, int white,
                       uint32_t variable_costs, target_definition_t *td, const char *prompt)
{
  return granted_generic_activated_ability(player, card, player, card, event, mode, cless, black, blue, green, red, white, variable_costs, td, prompt);
}
So let's see what this does:
Code: Select all
int granted_generic_activated_ability(int granting_player, int granting_card, int granted_to_player, int granted_to_card, event_t event, int mode,
                             int cless, int black, int blue, int green, int red, int white,
                             uint32_t variable_costs, target_definition_t *td, const char *prompt)
{
/* Removing some code that is not relevant for us */
   if(event == EVENT_ACTIVATE ){
/* Removing some more code that is not relevant for us */
         if( mode & GAA_UNTAPPED ){
            add_state(granted_to_player, granted_to_card, STATE_TAPPED);
         }
/* Removing even more code that is not relevant for us */
         return 1;
/* Yes, it doesn't end here but we are done */
}
add_state() just looks for the given card and ORs the respective state bit, nothing else. So granted_generic_activated_ability and in turn generic_activated_ability will always return 1, i.e. true. The original code then boils down to
Code: Select all
if( event == EVENT_ACTIVATE ){
    ai_modifier += (count_subtype(player, TYPE_LAND, -1) * 8);
}
and the second piece will act like this:
Code: Select all
   if( event == EVENT_ACTIVATE ){
       generic_activated_ability(player, card, event, GAA_UNTAPPED, MANACOST_X(4), 0, NULL, NULL);
/* What generic_activated_ability did was to set the STATE_TAPPED flag*/
       if( cancel != 1 ){
          ai_modifier += (count_subtype(player, TYPE_LAND, -1) * 8);
       }
   }
My 2 cents.

Edit: removed the last comment which was wrong.
---
Argivian Archaeologist in the Library of Leng studying the Spells of the Ancients
User avatar
FastEddie
 
Posts: 246
Joined: 24 Dec 2019, 10:59
Has thanked: 15 times
Been thanked: 19 times

Previous

Return to Archived Reports

Who is online

Users browsing this forum: No registered users and 9 guests


Who is online

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

Login Form