Scripting Library: Duel. methods - ProjectIgnis/CardScripts GitHub Wiki

return type function description
Card Debug.AddCard(int code, int owner, int player, int location, int seq, int pos[, bool proc=false]) Adds a card of (int code), owned by (int owner) and under (int player)'s control, to (int seq) of (int location) in (int pos) position. If (bool proc) is true, it will be treated as properly summoned for the purposes of revive limits.
void Debug.Message(any msg) Sends (any msg) as a script error to the logs
void Debug.PreAddCounter(Card c, int counter_type, int count) Adds (int count) counters of (int counter_type) to (Card c)
bool Debug.PreEquip(Card equip_card, Card target) Equips (Card equip_card) to (Card target)
void Debug.PreSetTarget(Card c, Card target) Sets (Card c)'s target card to (Card target) (e.g. Call of the Haunted)
void Debug.PreSummon(Card c, int sum_type[, int sum_location=0, int summon_sequence=0, bool summon_pzone=false]) Treats (Card c) as if it was summoned by (int sum_type). If (int sum_location) is provided, treats it as summoned from that location. If (int sum_sequence) is provided, treats it as summoned in that sequence. I(bool summon_pzone) is required to be true if the card is to be considered to be summoned from the Pendulum Zone.
void Debug.ReloadFieldBegin(int flag, int rule[, bool ignore_rule=false]) Begins loading the field for a puzzle, with DUEL_ constants in (int flag) under Master Rule (int rule). If (bool ignore_rule) is set to true, then the master rules from (int flag) are ignored and the field is constructed only from the duel flags provided
void Debug.ReloadFieldEnd() Stops loading the field for a puzzle.
void Debug.SetAIName(string name) Sets the name of the AI to (string name)
void Debug.SetPlayerInfo(int playerid, int lp, int startcount, int drawcount) Sets (int playerid) to have (int lp) LP, start with a (in startct) card hand, and draw (int drawcount) during the Draw Phase.
void Debug.ShowHint(string msg) Displays a message (string msg) on the screen.
void Duel.Activate(Effect e) Activates an effect in a new chain link. If the effect is the activate effect of a spell/trap, that card is also activated.
bool Duel.ActivateFieldSpell(Card c, e, tp, eg, ep, ev, re, r, rp, target_p) Activates a field spell Card "c". Already handles interactions with Field Spells that are already face up, rules for only 1 Field Spell at time, checks for costs and activated effects of the field spell and als the interaction with Ancient Pixie Dragon.
void Duel.AddCustomActivityCounter(int counter_id, int activity_type, function f) Registers an activity with type (int activity_type), with id (int counter_id), that matches (function f)
void Duel.AddNoTributeCheck()
void Duel.AdjustInstantly([Card c]) Adjusts the game state checking self destroy effects, continuous negation effects being applied, etc. If a card is passed, it also adjust immediately the properties of that card and cards related to it.
int Duel.AnnounceAnotherAttribute(group g, int player) Makes (int player) announce an attribute different from the one(s) already among the members of (group g)
int Duel.AnnounceAnotherRace(group g, int player) Makes (int player) announce a monster type (Race) different from the one(s) already among the members of (group g)
int Duel.AnnounceAttribute(int player, int count, int available) Asks (int player) to announce (int count) number of Attributes, amongst those specified in (int available).
int Duel.AnnounceCard(int player[, ...]) Makes the player declare a card name. With no extra parameters, the function allows declaring any monster, spell and trap card names. If a single int parameter is passed as second parameter, that parameter will be used to limit the types that are declarable (for example passing TYPE_MONSTER to only declare monster cards). If 3 or more parameters are passed, the function will use the OPCODE_ constants to build a filter based on the reverse polish notation to allow declaring cards with more specific restrictions (for example declaring cards of a specific archetype only). The opcode parameters can also be passed all in a table as the second parameter.
int Duel.AnnounceCoin(int player[, bool confirm_dialog=true]) Asks (int player) to call heads or tails. Returns COIN_HEADS or COIN_TAILS. If confirm_dialog is false, the announce will be performed, but the no selection hint will be shown to the opponent
int|nil,int|nil Duel.AnnounceLevel(int player[, int min = 1, int max=12, int exception=nil, ...]) Asks (int player) to announce a number between (int min) and (int max), except any (int exception)s. Returns the chosen number, and the index of that number amongst the choices.
int,int Duel.AnnounceNumber(int player, int number, ...) Asks (int player) to announce a number found amongst (int number)s. Returns the chosen number and its index amongst the options
int|nil,int|nil Duel.AnnounceNumberRange(int player[, int min = 1, int max=12, ...]) Asks (int player) to announce a number between (int min) and (int max). Extra integers can be passed as the exceptions. Returns the chosen number, and the index of that number amongst the choices.
int Duel.AnnounceRace(int player, int count, int available) Asks (int player) to announce (int count) number of Races, amongst those specified in (int available).
int Duel.AnnounceType(int player) Makes int player declare a type
int Duel.AskAny(stringid)
int Duel.AskEveryone(stringid)
void Duel.AssumeReset() Manually resets assume effects. Usually used in synchro summon. (eg: it resets the applied effect of "Influence Dragon (Anime)" on the other materials in the Synchro Summon.)
void Duel.AttackCostPaid([int paid=1]) Register the status of payment of attack cost. A value of 2 means that the attack cost was not paid, 1 means the attack cost was paid.
void Duel.BreakEffect() Separates an effect for the purposes of timing (Reflects the effects of the conjunctives "then" and "also after that")
void Duel.CalculateDamage(Card c1, Card c2|nil) Conduct damage calculation between (Card c1) as attacker and (Card c2) or opponent player (nil)
bool Duel.CallCoin(int player) Tosses a coin and returns true if the player guessed right, false if he didn't
bool Duel.CanPlayerSetMonster(int player[, Card sumcard, int sumtype]) Returns if player can set a monster, if sumcard and sumtype are passed, those parameters are also passed to the EFFECT_CANNOT_MSET effects.
bool Duel.CanPlayerSetSpellTrap(int player[, Card setcard]) Returns if player can set a spell/trap card, if setcard is passed, that parameter is also passed to the EFFECT_CANNOT_SSET effects.
void Duel.ChainAttack([Card c]) Makes the currently attacking card attacks able to declare a consecutive attack after the current one. If a card is passed, the next attack will have to be against that specific card.
void Duel.ChangeAttacker(Card c[, int ign = false]) Changes the current monster attacking to another card (Card c), if ignore counts is set to true (int ign) it will ignore if the card can still attack.
bool Duel.ChangeAttackTarget(Card c|nil) Changes the current monster being attacker to another card (or makes the attack a direct attack in case of no card being passed)
void Duel.ChangeBattleDamage(int player, int value[, bool check=true]) Changes the battle damage (int player) would take to (int value). If (bool check) == false, you are able change the battle damage that originally is 0.
void Duel.ChangeChainOperation(int chain_idx, function f) Replaces the operation executed by the effect at the specific chain index with the passed function.
int Duel.ChangePosition(Card|Group targets, int au[, int ad=au, int du=au, int dd=au, bool noflip=false]) Changes the battle position of (Card|Group targets). (int au), (int ad), int (du) and (int dd) are the positions cards in face-up attack, face-down attack, face-up defense, and face-down defense positions will be changed to, respectively. If (bool noflip) is true, FLIP effects will not be activated by this change. Returns the number of cards successfully affected.
void Duel.ChangeTargetCard(int chainc, Group g) Change the target cards for the specific chain link (0 is the currently resolving one). This alters the value that that chain link set with Duel.SetTargetCards
void Duel.ChangeTargetParam(int chainc, int param) Change the target parameter for the specific chain link (0 is the currently resolving one). This alters the value that that chain link set with Duel.SetTargetParam
void Duel.ChangeTargetPlayer(int chainc, int player) Change the target player for the specific chain link (0 is the currently resolving one). This alters the value that that chain link set with Duel.SetTargetPlayer
bool Duel.CheckChainTarget(int chainc, Card c) Checks if a card (Card c) can be a target for a chain's (int chainc) effect (via calling target(chkc) function of the effect)
bool Duel.CheckChainUniqueness() Checks if there is no card with the same name in the current chain
bool[,Group,int,int,Effect,int,int] Duel.CheckEvent(int event[, bool get_info]) Returns if, at the activation timing, the (int event) passed is available. If (bool get_info) is set to true, all the even info are returned as extra return values
bool Duel.CheckLocation(int player, int location, int seq) Checks if there is an position (int seq) available for the player (int player) in the location (int location). (The sequence (int seq) is used to indicate the specific position of the location, for example in the location of monsters the sequence would go from 0 to 7., etc.)
bool Duel.CheckLPCost(int player, int cost) Checks if a player (int player) can pay an amount (int cost) of LP
bool Duel.CheckPendulumZones(int player) Returns if (int player) has at least one Pendulum zone free, using Duel.CheckLocation.
bool Duel.CheckPhaseActivity() Checks if the an "activity" was not performed yet which means that the player is at "the start" of the current phase. Used for effects like Pot of Extravagance, Soundproofed and Mimir of the Nordic Ascendant.
bool Duel.CheckReleaseGroup(int player, function f, int count[, bool use_hand=false, int max=min, bool check_field=false, Card card_to_check=nil, int to_player=player, int zone=0xff, bool use_oppo=false], Group|Card ex|nil, ...) Check if there is a monster that can be used as tribute from the int player, that satisfies function, having a min and a max of the count specified with the exception of some card/group if specified, ... are extra arguments. If use_hand is true, then cards in the hand are considered for the tribute. If use_oppo is true, opponent's cards are also considered for the tribute. If check_field is true and card_to_check is passed, the function will also take in account to check if there are free zones (int zone) left on to_player's field to summon that card after tributing the cards. Also effects of cards like "Lair of Darkness" are taken into account when performing those checks.
bool Duel.CheckReleaseGroupCost(int player, function f, int minc[, int maxc=minc], bool use_hand, function spcheck, Card|Group|nil ex, ...) Check if the player can tribute cards on the field, excluding "ex" to activate the effect of a monster while also checking for applied effects of cards like "Lair of Darkness" (behaviour now also implemented in the normal CheckReleaseGroup). If function f is passed, the cards returned by Duel.GetReleaseGroup are filtered based on that function. The function spcheck is a callback function that gets passed the current checked group (sg) as first parameter, the checking player (tp) as second parameter, a group containing opponent's cards affected by EFFECT_EXTRA_RELEASE_NONSUM or EFFECT_EXTRA_RELEASE (exg) and the extra parameters passed to the function (...). The spcheck function has to return 1 or 2 boolean values indicating if the passed group (sg) satisfy the requirements as first return value and as optional second parameter to indicate if no matter how many new cards are added to (sg), the condition will never return true.
bool Duel.CheckReleaseGroupEx(int player, function f, int count[, bool use_hand=true, int max=min, bool check_field=false, Card card_to_check=nil, int to_player=player, int zone=0xff, bool use_oppo=false], Group|Card ex|nil, ...) Same as Duel.CheckReleaseGroup, except that the hand is included by default.
bool Duel.CheckReleaseGroupSummon(card c, int player, effect e, function fil, int min, int max, function last, ...)
bool Duel.CheckRemoveOverlayCard(int player, int s, int o, int count, int reason[, Group ocard]) Returns if (int player) can remove a total of (int count) cards attached, for reason (int reason) from your field (int s == 1) and/or opponent's (int o == 1). If group (ocard) is provided, only checks if cards can be detached from monsters that match said group.
bool Duel.CheckSummonedCount([Card c]) Check if the current reason player can still normal summon other monsters or has used that turn's summons, or if a card is passed and that card is affected by an EFFECT_EXTRA_SUMMON_COUNT effect allowing it to be summoned.
bool Duel.CheckTiming(int timing) Returns true if the current activation hint timing is one of the passed timings.
bool Duel.CheckTribute(Card c, int min[, int max=min, Group|nil mg, int tp=c:GetControler(), int zone=0x1f]) Check if there are valid tributes on the field to summon Card c to tp's field in the zones specified by zone using the rules of a normal tribute summon.
void Duel.ClearOperationInfo(int chainc) Clear all the informations that were set by Duel.SetOperationInfo for the passed chain.
void Duel.ClearTargetCard() Remove all the targeted cards corresponding to the current resolving/building chain.
void Duel.ConfirmCards(int player, Card|Group targets) Reveals the passed cards to the passed player if they are in a private knowledge state.
void Duel.ConfirmDecktop(int player, int count) Reveals a number (int count) of cards from the top of a player's (int player) Deck to both players
void Duel.ConfirmExtratop(int tp, int count) Reveals a number (int count) of facedown cards from the top of a player's (int player) Extra Deck to both players. (faceup pendulum monsters are ignored)
int Duel.CountHeads(results, ...)
int Duel.CountTails(results, ...)
Card Duel.CreateToken(int player, int code) Creates a new instance of a card owned by player (int player) with card code (int code).
return type function description
int Duel.Damage(int player, int value, int reason[, bool is_step=false, in rp=reason_player]) Damages/Decreases player's (int player) Life Points by an amount (int value) for a reason (int reason). The damage is considered to be dealt by (int rp). Setting (bool is_step) to true will make so the damage is considered dealt at the call of Duel.RDComplete().
int Duel.Destroy(Card|Group targets, int reason[ , int dest = LOCATION_GRAVE, int rp = reason_player]) Destroys a card or group (Card|Group targets) with (int reason) as reason, and sends the card in the location specified by (int dest). If (int rp) is passed, sets the reason player to be that player. Returns the number of cards successfully destroyed.
void Duel.DisableSelfDestroyCheck([disable=true]) If disable is true, prevents the core from performing the checks for cards that self destroy themselves (like "Burning Abyss" monsters). This behaviour persists until it's manually enabled again by passing false.
void Duel.DisableShuffleCheck([disable=true]) If disable is true, makes an action that adds/removes a card(s) from/to Deck/hand not trigger the shuffle check at the end of the the current routine execution. Putting false would revert to normal behavior.
int Duel.DiscardDeck(int player, int count, int reason) A player (int player) sends the top n cards (int count) to the Graveyard (discard mechanic) with a reason (int reason)
int Duel.DiscardHand(int player, function f|nil, int min, int max, int reason, Group|Card ex|nil, ...) Makes (int player) Discard between (int min) and (int max) cards from their hand for which (function f) returns true, except (Group|Card ex), for (int reason)
int Duel.Draw(int player, int count, int reason) Player (int player) draws a specific amount (int count) of Cards for a reason (REASON_x)
void Duel.EnableGlobalFlag(int global_flag) Enables the specified global flags (int global_flag) for the rest of the Duel (GLOBALFLAG_x).
bool Duel.Equip(int player, Card c1, Card c2[, bool up=true, bool is_step=false]) A Player (int player) equips a Card (Card c1) to another Card (Card c2). When up==false, the equip card will not have its position changed face-up. Is_step is for using with Duel.EquipComplete. Returns true if the equip is successful.
void Duel.EquipComplete() Concludes a series of Equips (Always used with 'is_step = true' in Duel.Equip())
void Duel.ForceAttack(Card c1, Card c2) Last Turn's specific effect: after the chain resolves, switches to a standalone Battle Phase and makes card (card c1) attack (card c2). After that, returns to the previous phase.
int,... Duel.GetActivityCount(int player, int activity_type, ...) Gets the number of times (int player) has performed activities of (int activity_type). (See ACTIVITY_XXX constants, )
Card Duel.GetAttacker() Gets the attacking card (or nil if there is no attacker)
Card|nil Duel.GetAttackTarget() Gets the attack target card (or nil if there's no attack target/the attack is a direct attack)
int Duel.GetBattleDamage(int player) Gets the battle damage (int player) would take
int Duel.GetBattledCount(int player) Gets the number of battles (int player) has been involved in this turn
Card|nil,Card|nil Duel.GetBattleMonster(int tp) Returns as first value the monster that is currently battling from the perspective of tp (nil if tp has no currently battling monsters), as second value returns the battling monster from the perspective of 1-tp.
int Duel.GetCardAliasFromCode(int code) Gets a card's alias from its card id (the value returned is the same as the one returned with Card.Alias on a card object corresponding to a card with such id)
int Duel.GetCardAttackFromCode(int code) Gets a card's attack from its card id (the value returned is the same as the one returned with Card.Attack on a card object corresponding to a card with such id)
int Duel.GetCardAttributeFromCode(int code) Gets a card's attribute from its card id (the value returned is the same as the one returned with Card.Attribute on a card object corresponding to a card with such id)
int Duel.GetCardDefenseFromCode(int code) Gets a card's defense from its card id (the value returned is the same as the one returned with Card.Defense on a card object corresponding to a card with such id)
Card Duel.GetCardFromCardID(int cardid) Returns the card whose internal id matches cardid, if no card matches, nil is returned.
int Duel.GetCardLevelFromCode(int code) Gets a card's level/rank/link rating from its card id (the value returned is the same as the one returned with Card.Level on a card object corresponding to a card with such id)
int Duel.GetCardLinkMarkerFromCode(int code) Gets a card's link marker from its card id (the value returned is the same as the one returned with Card.LinkMarker on a card object corresponding to a card with such id)
int Duel.GetCardLscaleFromCode(int code) Gets a card's left pendulum scale from its card id (the value returned is the same as the one returned with Card.Lscale on a card object corresponding to a card with such id)
int Duel.GetCardRaceFromCode(int code) Gets a card's race from its card id (the value returned is the same as the one returned with Card.Race on a card object corresponding to a card with such id)
int Duel.GetCardRscaleFromCode(int code) Gets a card's right pendulum scale from its card id (the value returned is the same as the one returned with Card.Rscale on a card object corresponding to a card with such id)
int,int,... Duel.GetCardSetcodeFromCode(int code) Gets a card's setcodes from its card id (the value returned is the same as the one returned with Card.Setcode on a card object corresponding to a card with such id)
int Duel.GetCardTypeFromCode(int code) Gets a card's type from its card id (the value returned is the same as the one returned with Card.Type on a card object corresponding to a card with such id)
Group|nil,int,int,Effect,int,int Duel.GetChainEvent(int chain) Returns the elements associated with the event that caused the current chain link to form, in order: The group containing the cards that were associated with that event The player associated with that event The value associated with that event The reason Effect associated with that event The reason associated with that event The reason player associated with that event
... Duel.GetChainInfo(int chainc, ...) Returns the chain link properties (aka, chain Info, described by constant group CHAININFO_) of the passed chain link (int chainc), or current chain if it's 0.
Effect Duel.GetChainMaterial(int player) Gets the EFFECT_CHAIN_MATERIAL field effect that is applied to a player (int player). Returns only the first effect found
... Duel.GetCoinResult() Returns the values corresponding to the results of the last coins tosses.
bool Duel.GetControl(Card|Group targets, int player[, int reset_phase=0, int reset_count=0, int zone = 0xff, int chose_player = reason_player]) Give control of a card/group (Card|Group targets) to a player (int player). If reset_phase and reset_count is specified, will behave like other effects with those resets (and so, the control will be returned when the effect has expired). Works only for monsters in Monster Zone, if zone is specified, if moves monster to that zones only or destroy if they are full. If chose_player is provided, the player selecting the zone is the passed value, if PLAYER_NONE is passed, the player performing the selection is player (int player), otherwise the selecting player will be the current reason player.
int Duel.GetCounter(int player, int s, int o, int countertype) Gets the number of counter (int countertype) on the field, from a player's (int player) perspective. The variables int s and int o are the player's and the opponent's field, respectively, 0 to exclude and 1 (or higher) to include.
int Duel.GetCurrentChain([bool real_chain=false]) Returns the number of the current chain link. If real chain is true, then it will return the number of ACTUAL chains that have already formed, so in a target or cost function, it will not include the current chain in this count, while with that parameter as false the current chain will be included as well. Set this when you need to check for the current chain in an effect condition.
int Duel.GetCurrentPhase() Gets the current Phase of the game (corresponds to PHASE_x in constants.lua)
int Duel.GetCustomActivityCount(int counter_id, int player, int activity_type) Same behaviour as Duel.GetActivityCount with the difference that returns the count of the activities that were registered with the specific counter_id as Duel.AddCustomActivityCounter.
Group Duel.GetDeckbottomGroup(int player, int count) Returns a group with the (int count) cards on the bottom of (int player)'s Deck
Group Duel.GetDecktopGroup(int player, int count) Gets a group of a player's (int player) top n (int count) cards of their Deck
... Duel.GetDiceResult() Returns the values corresponding to the results of the last dice rolls.
int Duel.GetDrawCount(int player) Gets the draw count for normal draw for a player (int player)
int Duel.GetDuelType() Returns all of the Duel flags used in the current duel
int,int Duel.GetEnvironment() Gets the environment code for the applied field card (the same as the Field Spell's code, usually). Returns the code, then the controlling player. Prioritizes the first player. deprecated and should be avoided
Group Duel.GetExtraTopGroup(int player, int count) Gets a group of a player's (int player) top n (int count) facedown cards of their Extra Deck
Card Duel.GetFieldCard(int player, int location, int seq) Gets a card in certain location at a certain sequence
Group Duel.GetFieldGroup(int player, int s, int o) Gets a group containing cards from a specified location of a player (int player), s denotes the player's side of the field, o denotes opposing player's side of the field
int Duel.GetFieldGroupCount(int player, int s, int o) Counts the number of cards from a specified location of a player (int player), s denotes the player's side of the field, o denotes opposing player's side of the field
int Duel.GetFieldGroupCountRush(int player, int s, int o) Same as Duel.GetFieldGroupCount but exclude the left and right pieces of a summoned maximum monster
Card Duel.GetFirstMatchingCard(function f, int player, int s, int o, Group|Card ex|nil, ...) Get the first card in locations (int s) (on (int player)'s side of the field) and (int o) (on their opponent's) for which (function f) returns true, except (Card ex)
Card,... Duel.GetFirstTarget() Returns all the cards that got targeted in the current chain link as separate return values, Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS) is an equivalent alternative that directly returns a group. Duel.GetTargetCards() is a better alternative that returns a group and of target cards that are filtered depending on their relation to the effect.
int Duel.GetFlagEffect(int player, int code) Gets the flag effect with (int code) as the effect code that is registered to a player (int player), returns 0 if no effect, a positive integer otherwise
void Duel.GetFlagEffectLabel(int player, int code) Gets the integer labels to the flag effect registered to the player (int player) with (int code) as the effect code, returns nil if there is no integer label.
int Duel.GetFreeLinkedZone(int player) Gets all the unoccupied zones that (int player) has that Link Monsters points to
Group Duel.GetFusionMaterial(int player) Returns a group of cards that are usable as fusion materials by the players, those cards consist of cards in the player's monster zone and also in the player's hand, GY and spell/trap zone that are affected by an EFFECT_EXTRA_FUSION_MATERIAL effect.
Group Duel.GetLinkedGroup(int player, int location1, int location2) Returns the group of cards in the specified locations that are pointed by a link card.
int Duel.GetLinkedGroupCount(int player, int location1, int location2) Returns the number of cards that would be returned by Duel.GetLinkedGroup
int Duel.GetLinkedZone(int player) Gets all the zones that (int player) has that Link Monsters points to
int, int flag Duel.GetLocationCount(int player, int location[, int use_player = reason player, int reason = LOCATION_REASON_TOFIELD, int zone = 0xff]) Returns 2 values. First the number of zones that a player (target_player) has available in a location of the field (int location)[, that can be used by the player (use_player), with intention of (reason), among certain zones (zone)]. Second return is a flag with the available zones.
int, int flag Duel.GetLocationCountFromEx(int player, [int rplayer = reason_player, Group|Card sg=nil, Card|int lc=nil, int zone=0xff]) Gets the number of available zones that (int player) has to perform a Special Summon from the Extra Deck. Optional Parameters: int rplayer is the player performing the summon , by default comes from the player that activates the effect itself; sg are material(s) or tribute(s) for the special summon, it's included when the effect requires the cost of one or more cards; lc is the card that will be special summoned, it's included when it's a specific card which will be special summon). If lc is group, it cannot be passed directly. Instead, pass the type of the monsters in that group (e.g. TYPE_FUSION, see "Construct Element"), which is limited to a single type and will not work properly if the group has different types. The zone parameter is used to limit the check to only some specific zones of the field. The second return is a flag with the available zones.
int Duel.GetLP(int player) Gets a specified player's (int player) current Life Point
Group Duel.GetMatchingGroup(function f, int player, int s, int o, Group|Card ex|nil, ...) Gets all cards in locations (int s) (on (int player)'s side of the field) and (int o) (on their opponent's) for which (function f) returns true, except (Card ex)
int Duel.GetMatchingGroupCount(function f, int player, int s, int o, Group|Card ex|nil, ...) Returns the number of cards that would be returned by Duel.GetMatchingGroup
int Duel.GetMatchingGroupCountRush(function f, int player, int s, int o, Group|Card ex|nil, ...) Same as Duel.GetMatchingGroupCount but exclude the left and right pieces of a summoned maximum monster
int Duel.GetMatchingGroupRush(function f, int player, int s, int o, Group|Card ex|nil, ...) Equivalent to Duel.GetMatchingGroup, but the cards are also filtered to match Auxiliary.FilterMaximumSideFunctionEx
table Duel.GetMetatable(int code) Equivalent of calling _G["c" .. code], returns the global metatable associated with that card's code (the "s" returned by GetID)
int, int flag Duel.GetMZoneCount(int target_player[, card|group ex = nil, int use_player = target_player, int reason = LOCATION_REASON_TOFIELD, int zone = 0xff]) Gets the number of available Main Monster Zones of a player (target_player)[, excluding card|group (ex), that can be used by the player (use_player), with intention of (reason), among certain zones (zone)] {note: Basically it is Duel.GetLocationCount that excludes}. The second return is a flag with the available zones.
Group Duel.GetOperatedGroup() Gets the last group of operated cards (from last call of some functions, ex. calling this after Duel.Draw would return a group of the drawn cards)
int Duel.GetOperationCount(int chainc) Get the amount of operation info set by previous calls to Duel.SetOperationInfo for the corresponding chain.
bool,Card|Group,int,int,int Duel.GetOperationInfo(int chainc, int category) Returns the corresponding values that were set by a previous call to Duel.SetOperationInfo for the corresponding category. If the first return value is true that means that operation info was set and then there will be 4 extra return values corresponding to the parameters of SetOperationInfo, otherwise only a single false value is returned.
int Duel.GetOverlayCount(int player, int s, int o) Returns the number of cards that would be returned by Duel.GetOverlayGroup
Group Duel.GetOverlayGroup(int player, int s, int o) Returns the group of cards that are currently attached to monsters. (int player) is the reference player, and (int s) and (int o) check, respectively for your cards and your opponent's cards.
Effect, ... Duel.GetPlayerEffect (int player[, int effect_type]) Returns all the effect with that code (int effect_type) applied on the player. With no effect_type or effect_type=0 it will return all the effects applied on the player. [effect_type refer to "EFFECT_" constants, eg: EFFECT_REVERSE_DAMAGE, EFFECT_CANNOT_MSET]
int Duel.GetPlayersCount(int team) Get the amount of player for that specific team. (Can be used to deduce if the duel is an "n vs m" duel and also in conjunction with Duel.TagSwap to "iterate" all the players in the duel.)
bool,Card|Group,int,int,int Duel.GetPossibleOperationInfo(int chainc, int category) Behaviour similar to Duel.GetOperationInfo, but returns the value set by Duel.SetPossibleOperationInfo instead
int Duel.GetRandomNumber([int min = 0, ]int max) Gets a random number between min (default is 0) and max.
Group Duel.GetReleaseGroup(int player[, bool use_hand=false, bool use_oppo=false]) Returns the group of cards that can be used as tribute NOT for a Tribute Summon
int Duel.GetReleaseGroupCount(int player[, bool use_hand=false, bool use_oppo=false]) Returns the number of cards that would be returned by Duel.GetReleaseGroup
Group Duel.GetRitualMaterial(int player, bool checklevel = true) Returns cards that are usable by (int player) as ritual materials. if (bool checklevel) is true, only cards with level greater than 0 will be returned
int Duel.GetStartingHand(int player) Gets a specified player's (int player) starting hand
Group Duel.GetTargetCards(Effect e) Returns a group containing the targeted cards of (Effect e)'s activation and that are still related to that specific effect
int Duel.GetTargetCount(function f, int player, int s, int o, Group|Card ex|nil, ...) Returns the number of targets, except (Group/Card ex), that match (function f), taking (int player) as the referential player, in locations defined in (int s) for your cards and (int o) for opponent's.
int Duel.GetTributeCount(Card c[, Group mg=nil, bool ex=false]) Returns the number of cards that are usable for a tribute summon by c's controller. By default it only check the controller's field and opponent's cards with an extra release effecta applied to them. If ex is true then all the cards on the opposing side of the field are considered regardless. If mg is passed, the cards are picked only among that group. deprecated and should not be used
Group Duel.GetTributeGroup(Card c) Returns the cards that are usable for a tribute summon of c.
int Duel.GetTurnCount([int tp]) Gets the turn count, if tp is passed, it returns the turn count for that specific player (so if the current turn count is 5, a player's turn count would be 2 or 3)
int Duel.GetTurnPlayer() Returns the turn player (0 for the player who went first, 1 for the other)
int Duel.GetUsableMZoneCount(int target_player[, int using_player=reason_player]) Gets the number of Monster Zones that are usabled by (int using_player) on (int target_player)'s field.
int Duel.GetZoneWithLinkedCount(int count, int tp) Returns a zone flag including the tp's zones that are pointed by at least "count" Link Monsters.
void Duel.GoatConfirm(int tp, int loc) Used for goat versions of cards, handle the "fail to find" scenario. It confirms tp's LOCATION_DECK or LOCATION_HAND (passed in loc), the hand is revealed to the opposing player, the deck is revealed to tp.
Group Duel.GrabSelectedCard () Returns the group of cards that was set by a previous Duel.SetSelectedCard call. The group of selected cards is cleared in the core.
return type function description
bool Duel.HasFlagEffect(int tp, int id[, int ct]) Returns if (int tp) has a flag with id equal to (int id) register to it. If (int ct) is provided checks if it the flags was registered at least that many times.
void Duel.Hint(int hint_type, int player, int desc) Creates a message for the "player" which has "type" as key and "desc" as value. It is entirely up to the client to interpret say data, the most common case is setting the selection message with, "type" being "HINT_SELECTMSG" and "desc" being a stringId. It is also used to implement Skill Cards visually. Check the "HINT_XXX" constants for their behaviour.
void Duel.HintSelection(Card|Group selection[, bool log_as_selection=false]) If log_as_selection is true, that selection will be logged by the client as "card(s) selected" rather than "card(s) targeted"
void Duel.IncreaseSummonedCount([Card c]) Increases the number of normal summons/sets performed by the turn player. If a card is passed and that card has an EFFECT_EXTRA_SUMMON_COUNT applied to it, that effect is used instead of increasing the count of the turn player.
bool Duel.IsAbleToEnterBP() Checks if the player can enter BP this turn. This function returns true when: - it is not the first turn of the duel, OR - the duel mode flag DUEL_ATTACK_FIRST_TURN is set, OR - the turn player is affected by EFFECT_BP_FIRST_TURN and that player is not affected by EFFECT_CANNOT_BP and the current phase is lower than PHASE_BATTLE_START.
int Duel.IsAttackCostPaid() Return the status of payment of attack cost for a card (e.g. Mist Valley Falcon). A return value of 0 means that the attack cost hasn't been paid yet, so it can be canceled by the current effect, 1 means the attack cost has been paid by at least 1 previous card, so it HAS TO be paid and cannot be canceled, 2 means that the attack cost has been canceled by a previous effect and thus HAS TO NOT be paid nor canceled, just ignored.
bool Duel.IsBattlePhase() Returns if the current phase is the Battle Phase (between PHASE_BATTLE_START and PHASE_BATTLE)
bool Duel.IsCanAddCounter(int player[, int countertype, int count, Card c]) If only (int player) is passed, it checks if that player is not affected by "EFFECT_CANNOT_PLACE_COUNTER" that doesn't have a specific target (and thus no extra checks). If all the other 3 parameters are provided, it checks if that player is affected by "EFFECT_CANNOT_PLACE_COUNTER" effects with those parameters as arguments.
bool Duel.IsCanRemoveCounter(int player, int s, int o, int countertype, int count, int reason) Checks if a player (int player) can remove counter(s) (int countertype) (int count) from the field with a reason (int reason). The variables int s and int o are the player's and the opponent's field, respectively, 0 to exclude and nonzero to include.
bool Duel.IsChainDisablable(int chainc) Checks if a chain's (int chainc) effect can be disabled (Negate Effect)
bool Duel.IsChainNegatable(int chainc) Checks if a chain's (int chainc) effect activation can be negated (Negate Activation)
bool Duel.IsChainSolving() Checks if there is a chain currently resolving. (retrieves the processor's chain_solving data member, without calling any function)
bool Duel.IsDamageCalculated() Returns true if damage has been calculated during the current (or previous) damage calculation, otherwise returns false
bool Duel.IsDuelType(int flag) Check if the current duel flags match the passed ones. (Check the "DUEL_XXX" constants for the available flags)
bool Duel.IsEnvironment(int code[, int player=PLAYER_ALL, int location=LOCATION_ONFIELD|LOCATION_FZONE]) Depending on the location and player passed check if there's: a field spell with its effects applied in the field zone. a card with its effects applied that correspond to the code. If there are no field spells in play and LOCATION_FZONE or LOCATION_SZONE are passed, effects that treats as if a field spell is in play (e.g. "Maiden of the Aqua") are also checked.
bool Duel.IsExistingMatchingCard(function f, int player, int s, int o, int count, Group|Card ex|nil, ...) Checks if (int count) cards exist in locations (int s) (on (int player)'s side of the field) and (int o) (on their opponent's) for which (function f) returns true, except (Card ex)
bool Duel.IsExistingTarget(function f, int player, int s, int o, int count, Group|Card ex|nil, ...) This function's behaviour is equivalent of calling Duel.IsExistingMatchingCard with the same arguments and filtering cards with Card.IsCanBeEffectTarget with the current reason effect as parameter (internal to the core, but most of the time corresponds to the effect itself)
bool Duel.IsMainPhase() Returns if the current phase is either Main Phase 1 or Main Phase 2.
Effect|nil Duel.IsPlayerAffectedByEffect(int player, int code) Returns the first instance of an effect affecting the player corresponding to the passed code, nil if there's none. The return can be used as boolean check with an Effect being returned as true and nil being returned as false.
bool Duel.IsPlayerCanAdditionalSummon(int player) Returns if the player can perform an additional normal summon via a EFFECT_EXTRA_SUMMON_COUNT (e.g. "Fire Formation - Tensu")
bool Duel.IsPlayerCanDiscardDeck(int player, int count) Checks if a player (int player) can mill a number of cards (int count) from their Deck
bool Duel.IsPlayerCanDiscardDeckAsCost(int player, int count) Checks if a player (int player) can mill a number of cards (int count) from their Deck as cost
bool Duel.IsPlayerCanDraw(int player[, int count=0]) Checks if (int player) can draw (int count) cards from their deck
bool Duel.IsPlayerCanFlipSummon(int player, Card c) Checks if (int player) can Flip Summon (Card c)
bool Duel.IsPlayerCanPendulumSummon(int player) Returns if the player can perform a pendulum summon. (equivalent of calling Duel.IsPlayerCanProcedureSummonGroup(player, SUMMON_TYPE_PENDULUM))
bool Duel.IsPlayerCanProcedureSummonGroup(int player, int sumtype) Checks if the player is affected by a EFFECT_SPSUMMON_PROC_G effect whose summon type value is sumtype.
bool Duel.IsPlayerCanRelease(int player[, Card c]) If c is not passed, only checks if the player can is not affected by EFFECT_CANNOT_RELEASE, otherwise checks if the player can Tribute the passed card.
bool Duel.IsPlayerCanRemove(int player[, Card c]) If c is not passed, only checks if the player can is not affected by EFFECT_CANNOT_REMOVE, otherwise checks if the player can banish the passed card.
bool Duel.IsPlayerCanSendtoDeck(int player[, Card c]) If c is not passed, only checks if the player can is not affected by EFFECT_CANNOT_TO_DECK, otherwise checks if the player can return the passed card to the deck.
bool Duel.IsPlayerCanSendtoGrave(int player[, Card c]) If c is not passed, only checks if the player can is not affected by EFFECT_CANNOT_TO_GRAVE, otherwise checks if the player can send the passed card to the GY.
bool Duel.IsPlayerCanSendtoHand(int player[, Card c]) If c is not passed, only checks if the player can is not affected by EFFECT_CANNOT_TO_HAND, otherwise checks if the player can send the passed card to the Hand.
bool Duel.IsPlayerCanSpecialSummon(int player[, int sumtype, int sumpos, int target_player, Card c]) If only the player is passed as parameter, it checks if the player is affected by any effect that would prevent him to special summon a monster, otherwise checks if the player can Special Summon "c" as "sumtype", to "target_player"'s field in the passed position.
bool Duel.IsPlayerCanSpecialSummonCount(int player, int count) Checks if the player can Special Summon "count" times.
bool Duel.IsPlayerCanSpecialSummonMonster(int player, int code[, int|table setcode, int type, int atk, int def, int level, int race, int attribute, int pos=POS_FACEUP, int target_player=player, int sumtype=0]) Checks if the player can special summon a monster as "sumtype", with the specified stats, in "pos" on "target_player"'s field. The stats are read as "code"'s default stats, if the stat parameters are not passed are passed as nil, they are not overwritten from the base stats, otherwise the new passed value will be used as stat for the card. "setcode" can be both an int with multiple setcodes encoded in a single value (by bit shifting them, but with a max of 4 setcodes) or as a table, with each entry representing a separate setcode.
bool Duel.IsPlayerCanSummon(int player[, int sumtype, Card c]) If only the player is passed, checks if the player is not affected by EFFECT_CANNOT_SUMMON, otherwise checks if the player can Normal Summon the passed card as the passed summon type.
bool Duel.IsSummonCancelable() Returns if the current summon procedure is cancelable, as in it's a summon done outside a chain in an open game state and it's not being performed during a chain or as a part of a separate effect.
bool Duel.IsTurnPlayer(int player) Checks if the current turn is (int player)'s turn.
void Duel.LinkSummon(int player, Card c[, Group|Card|nil must_use, Group|Card|nil mg, int minc=0, int maxc=0]) A player (int player) Link Summons a card (Card c) using "must_use" as part of its materials, choosing among "mg", with "min" and "max" materials to be used for the Summon.
void Duel.LoadCardScript(string|int code) Loads into the current environment (duel/puzzle) the script from card which id is int code. If a string is used, it must be "c'code'.lua"
bool,object/nil Duel.LoadScript (string file_name[, bool forced=false]) Loads into the current environment (duel/puzzle) (file_name)'s script, and return true or false depending on the script loading success. If "forced" is false, the file name is loaded only if it hasn't been loaded before. If "forced" is true, other than loading the script regardless if it has been loaded previously, the 2nd returned value will be whatever was set as the global variable "edopro_export" from the loaded script.
void Duel.LoadCardScriptAlias(int code) Loads the target's card metatable in the duel, and makes so that the current loaded one gets replaced by it. This will basically make the script that called this function behave like script loading for alternate artworks.
void Duel.MajesticCopy(Card c1, Card c2[, int reset_value, int reset_count=1) Copies c1's effect to c2 allowing c2 to use c1's activated effects. If reset_value and reset_count are provided, use those parameter as reset parameters for the copied effects (reset_value default value is RESET_EVENT|0x1fe0000|RESET_PHASE|PHASE_END
void Duel.MoveSequence(Card c, int seq[, int location=current location]) Moves a card (Card c) to a different sequence (int seq). If (int location) is not provided, only the current location is considered
void Duel.MoveToDeckBottom(int|Card|Group targets[, int player]) Places the passed cards in the deck to the bottom of player's deck. If the argument is an integer then it moves the top n cards from player's deck.
void Duel.MoveToDeckTop(Card|Group targets) Places the passed cards to the top of the deck.
bool Duel.MoveToField(Card c, int move_player, int target_player, int dest, int pos, bool enabled[, int zone = 0xff]) A player (int move_player) moves a card (Card c) to the target player's field. The destination must be either LOCATION_MZONE or LOCATION_SZONE (maybe LOCATION_ONFIELD too). It will be sent with the given position (int pos). Its effects will either be enabled or disabled according to the last parameter (bool enabled), if zone is specified, it can only place the card in these zones.
void Duel.MSet(int player, Card c, bool ignore_count, Effect e|nil[, int min=0, int zone=0x1f]) A player Sets a card (Card c) to the provided zone, using Normal Summon proc that the card has. if ignore_count is true, the Set would not count towards the standard limit of Normal Summon/Set. If an effect (Effect e) is provided, the Normal Set is counted as a Set by that effect. if min>0 then the Set proc must need that amount or more tributes. If zone is provided, the card will be settable only to the specific zones.
bool Duel.NegateActivation(int chainc) Negates the activation of an effect in a chain corresponding to that specific chain link.
bool Duel.NegateAttack() Negates the current attack. Has no effect if the game has confirmed battle (about to enter Damage Step)
bool Duel.NegateEffect(int chainc) Negates the effect in a chain corresponding to that specific chain link.
void Duel.NegateRelatedChain(Card c, int reset) Negates all effects activation in a chain related to a card. This effect negation is reset based on the reset flag passed. (e.g. with RESET_TURN_SET the activations would not be disabled if the card were to be set facedown in that chain.)
void Duel.NegateSummon(Card|Group targets) Negates the summon of a card or a group of cards
void Duel.Overlay(Card c, Card|Group of_card, [bool send_to_grave=false]) Attachs (Card|Group of_card) to (Card c). By default, if any card in the 2nd parameter has materials attached to it as well, they'll also be attached to (Card c) automatically. If send_to_grave is true, they will instead be sent to the graveyard with REASON_RULE, if you want to do something else with those cards, you have to move them before calling this function.
void Duel.PayLPCost(int player, int cost) Makes a player (int player) pay an amount (int cost) of LP
void Duel.PendulumSummon(int player) Makes the player perform a Pendulum Summon. (equivalent to calling Duel.ProcedureSummon(player, SUMMON_TYPE_PENDULUM)
bool Duel.PlayFieldSpell(Card c, e, tp, eg, ep, ev, re, r, rp, target_p) Function deprecated since version 40.0.0. Use "Duel.ActivateFieldSpell" instead
void Duel.ProcedureSummon(int player, int sumtype, Card c[, Group|Card|nil must_use, Group|Card|nil mg, int minc=0, int maxc=0]) A player (int player) "Procedure Summons" (the summon type performed is determined by the corresponding parameter) a card (Card c) using "must_use" as part of its materials, choosing among "mg", with "min" and "max" materials to be used for the Summon.
void Duel.ProcedureSummonGroup(int player, int sumtype) Makes the player perform a summon using a field effect EFFECT_SPSUMMON_PROC_G
void Duel.RaiseEvent(Group|Card eg, int code, Effect re, int r, int rp, int ep, int ev) Raises a specific event that will raise effects of type EFFECT_TYPE_FIELD, by relying re,r,rp,ep,ev as the arguments of that event with eg being the cards that were the reason of that event.
void Duel.RaiseSingleEvent(Card ec, int code, Effect re, int r, int rp, int ep, int ev) Raises a specific event that will raise effects of type EFFECT_TYPE_SINGLE on the specific ec, by relying re,r,rp,ep,ev as the arguments of that event.
void Duel.RDComplete() Complete Damage/Recover step (for simultaneous damage/recovery)
void Duel.Readjust() Makes the game do the adjustments ( win, disable, control, self destroy, equip, position, trap monster). Calling this while adjusting (most likely, in EVENT_ADJUST) four times with the same card (calling this will raise EVENT_ADJUST at the end, so it is possible to loop) will make the card instantly destroyed.
int Duel.Recover(int player, int value, int reason[, bool is_step=false, int rp=reason_player]) Increases player's (int player) Life Points by an amount (int value) for a reason (int reason). The LP increase is considered to be done by (int rp). Setting (bool is_step) to true makes so the recovery is considered being done at the call of Duel.RDComplete().
void Duel.RegisterEffect(Effect e, int player) Registers an effect (Effect e) to a player (int player)
Effect Duel.RegisterFlagEffect(int player, int code, int reset_flag, int property, int reset_count[, int label = 0]) Registers a flag effect to a player (int player) with (int code) as the effect code
int Duel.Release(Card|Group targets, int reason[, int rp = reason_player]) Tribute a card(s) (Card|Group targets) with listed reason (int reason). If (int rp) is provided, sets the reason player to be that player. Returns the number of cards successfully Tributed.
void Duel.ReleaseRitualMaterial(Group g) Tributes monsters from group g for a Ritual Summon
int Duel.Remove(Card|Group targets, int|nil pos, int reason[, int player=PLAYER_NONE, int rp=reason_player]) Banishes a card or group (Card|Group targets) in position as supplied by (int pos) (nil means their current position), with (int reason) as reason, if (int player) is supplied, the destination would be that player's zone. If (int rp) is provided, sets the reason player to be that player. Returns the number of cards successfully banished.
void Duel.RemoveCards(Card|Group cards) Removes the passed cards from the duel.
bool Duel.RemoveCounter(int player, int s, int o, int countertype, int count, int reason) Makes a player (int player) remove counter(s) (int countertype) (int count) from the field with a reason (int reason). The variables int s and int o are the player's and the opponent's field, respectively, 0 to exclude and 1 (or higher) to include.
bool Duel.RemoveOverlayCard(int player, int s, int o, int min, int max, int reason[, Group rg]) Player (int player) removes cards attached, from your field (int s) and/or opponent's (int o), with a minimum of (int min), and a maximum of (int max), with reason (int reason). If Group rg is provided, then the player removes only from monsters in that group.
void Duel.ResetFlagEffect(int player, int code) Resets a flag with (int code) as the effect code from a player (int player)
bool Duel.ReturnToField(Card c[, int pos, int zone = 0xff]) Return a card (Card c) to the field (only valid for cards that leaves the field with REASON_TEMPORARY, pos denotes the return position (if not specified, uses the card's previous position on field)
int Duel.RockPaperScissors([bool repeat=true]) Has players play a game of Rock Paper Scissors. Return player (winner or PLAYER_NONE). If repeat == true, RPS continues until there is a winner, otherwise RPS is only played once.
table[int,int],...|int,... Duel.SelectCardsFromCodes(int sel_player, int min, int max, bool cancelable, bool return_index, int code1, ...) Make (int sel_player) select between (int min) and (int max) cards among the passed card codes. If cancelable is true and the selection is canceled nil will be returned. If return_index is true a number of tables equal to the number of selected cards will be returned, each table will have the selected code index (starting by 1) as the first element and the code itself as second element. Otherwise the selected codes will be returned as multiple return values.
return type function description
int Duel.SelectDisableField(int player, int count, int location_player, int location_oppo[, int filter=0xe0e0e0e0, bool all_field=false]) Asks (int player) to select zones to be disabled, a number of zones up to (int count), in locations (location_player) for the player and (location_oppo) for their opponent, that are bitmasked by (int filter) <in another word, zones that are not filter>. If all_field is true the player can select any zones, including Pendulum and Extra Monster Zone which are normally not allowed.
int/nil Duel.SelectEffect(int player, ..) Makes player (int player) select 1 option among possible effects. The ellipsis (...) allows tables in the form {bool condition, int stringid}. The function then makes the player select an effect, displaying the strings whose conditions are true, returning the index of the chosen element or nil.
bool Duel.SelectEffectYesNo(int player, Card c[, int description=3]) Asks (int player) Yes or No, with the question being specified by (int desc) highlighting the passed card (Card c). The default string ask the player if they want to use the effect of "card x"
int Duel.SelectFieldZone(int player, int count, int s, int o[, int filter=0xe0e0e0e0]) Asks (int player) to choose a number of Zones up to (int count), in locations (int s) for the player and (int o) for their opponent, that are bitmasked by (int filter) <in another word, zones that are not filter>. This function allows the player to select ANY field zone, even those that are currently occupied by other cards.
Group Duel.SelectFusionMaterial(int player, Card c, Group materials[, Card|Group|nil must_use, int chkf=PLAYER_NONE]) Makes the player select the fusion materials among the passed group for the fusion summon of the passed card and returns such group (this function filters the various EFFECT_FUSION_MATERIAL effects registered on the card). If must_use is provided, those cards should be materials forced for that fusion summon, chkf is a value keeping the player whose field is to check, with optional FUSPROC_XX flags or'ed to it.
Group Duel.SelectMatchingCard(int sel_player, function f, int player, int s, int o, int min, int max[, cancelable=false], Group|Card ex|nil, ...) Makes (int sel_player) select between (int min) and (int max) cards in locations (int s) (on (int player)'s side of the field) and (int o) (on their opponent's) for which (function f) returns true, except (Card ex). If cancelable is true and the selection is canceled nil will be returned. If both cancelable and a minimum of 0 are passed, the result is unspecified.
int Duel.SelectOption(int player[, bool confirm_dialog=true], int desc1, ...) Allows (int player) to choose between any number of options, starting with (int desc1). Returns the index of the chosen option, e.g. desc1 returns 0, the second option returns 1, etc. If confirm_dialog is false, the announce will be performed, but the no selection hint will be shown to the opponent
int Duel.SelectPosition(int player, Card c, int pos) Makes int player select a position int pos for card c
Group Duel.SelectReleaseGroup(int sel_player, function f, int min, int max[, bool use_hand=false, bool cancelable=false, bool check_field=false, Card card_to_check=nil, int to_player=player, int zone=0xff, bool use_oppo=false], Group|Card ex|nil, ...) Selects monsters to be tributed by int sel_player, applying the same filtering rules as Duel.CheckReleaseGroup. If cancelable is true and the selection is canceled nil will be returned.
Group Duel.SelectReleaseGroupCost(int player, function f, int min, int max, bool use_hand, function specialchk, card|group ex|nil, ...) Selects monsters to be tributed by int sel_player, applying the same filtering rules as Duel.CheckReleaseGroupCost.
Group Duel.SelectReleaseGroupEx(int player, function f, int min, int max[, bool use_hand=false, bool cancelable=false, bool check_field=false, Card card_to_check=nil, int to_player=player, int zone=0xff, bool use_oppo=false], Group|Card ex|nil, ...) Selects monsters to be tributed by int sel_player, applying the same filtering rules as Duel.CheckReleaseGroupEx. If cancelable is true and the selection is canceled nil will be returned.
bool Duel.SelectReleaseGroupSummon(card c, int player, effect e, function fil, int min, int max, function last, ...)
Group Duel.SelectTarget(int sel_player, function f, int player, int s, int o, int min, int max[, bool cancelable=false], Group|Card ex|nil, ...) This function's behaviour is equivalent of calling Duel.SelectMatchingCard with the same arguments and filtering cards with Card.IsCanBeEffectTarget with the current reason effect as parameter (internal to the core, but most of the time corresponds to the effect itself)
Group Duel.SelectTribute(int player, Card c, int min, int max[, Group mg, int to_player=player, int zone=0x1f, bool cancelable=false]) Makes (int player) select a (int min) and (int max) number of tributes to be used for (Card c) to be summoned in the passed zones to to_player's field by also forcefully selecting the cards from mg. If cancelable is true and the selection is canceled, nil will be returned.
bool Duel.SelectYesNo(int player, int desc) Asks (int player) Yes or No, with the question being specified by (int desc)
int Duel.Sendto(Card|Group, int location, int reason, [int pos=POS_FACEUP, int player=PLAYER_NONE, int sequence=0, int rp = reason_player]) Sends a card or group (Card|Group targets) to the location (int location) with (int reason) as reason in (ins pos) position (only applies in Extra Deck and Banish). If (int player) is supplied, the destination would be that player's location. A seq value of 0 means it's put on the top, 1 means it's put on the bottom, other values means it's put on the top, and then if it is in the Deck, it will be shuffled after the function resolution, except if Duel.DisableShuffleCheck() is set to true beforehand. If (int rp) is provided, sets the reason player to be that player. Returns the number of cards successfully sent.
int Duel.SendtoDeck(Card|Group targets, int player|nil=PLAYER_NONE, int seq, int reason [, int rp = reason_player]) Sends a card or group (Card|Group targets) to the Deck with (int reason) as reason, if (int player) is supplied, the destination would be that player's Deck. If (int rp) is provided, sets the reason player to be that player. Available sequence values (SEQ_DECKTOP, SEQ_DECKBOTTOM and SEQ_DECKSHUFFLE). If SEQ_DECKSHUFFLE or other values are used for the sequence, the card is put on the top, and the Deck will be shuffled after the function resolution, except if Duel.DisableShuffleCheck() is set to true beforehand. Returns the number of cards successfully sent to the Deck.
int Duel.SendtoExtraP(Card|Group targets, int player|nil=PLAYER_NONE, int reason[, int rp = reason player]) Sends a card or group (Card|Group targets) to the Extra Deck face-up with (int reason) as reason, if (int player) is supplied, the destination would be that player's Extra Deck (for Pendulum monsters only). If (int rp) is provided, sets the reason player to be that player. Returns the number of cards successfully sent.
int Duel.SendtoGrave(Card|Group targets, int reason[, int player=PLAYER_NONE, int rp = reason_player]) Sends a card or group (Card|Group targets) to the Graveyard with (int reason) as reason, if (int player) is supplied, the destination would be that player's Graveyard. If (int rp) is provided, sets the reason player to be that player. Returns the number of cards successfully sent.
int Duel.SendtoHand(Card|Group targets, int player|nil=PLAYER_NONE, int reason[, int rp = reason_player]) Sends a card or group (Card|Group targets) to the Hand with (int reason) as reason, if (int player) is supplied, the destination would be that player's hand. If (int rp) is provided, sets the reason player to be that player. Returns the number of cards successfully sent.
void Duel.SetChainLimit(function f) Sets a function for limiting effects that could chain from this point in the chain, removed when an effect is chained to the current chain. Function f accepts at most 3 parameters [f(e, tp, p)] in which e is the effect that would be chained, tp is the same tp from the effect function where this function is called, and p is the player who would activate the would-be chaining effect.
void Duel.SetChainLimitTillChainEnd(function f) Sets a function for limiting effects that could chain from this point for the chain until the end of the chain. Function f accepts at most 3 parameters [f(e, tp, p)] in which e is the effect that would be chained, tp is the same tp from the effect function where this function is called, and p is the player who would activate the would-be chaining effect.
void Duel.SetCoinResult(int res, ...) Changes the results of the latest executed coin tosses to the provided values.
void Duel.SetDiceResult(int res, ...) Changes the result of the latest executed dice rolls to the provided values.
bool Duel.SetFlagEffectLabel(int player, int code, int label) Assigns an integer (int label) number to the flag effect registered to the player (int player) with (int code) as the effect code. Returns true if a flag effect with such code existed and the label was set.
void Duel.SetFusionMaterial(Group g) Sets the internal group of selected fusion materials, this function is to be used in EFFECT_SUMMON_MATERIAL after the materials are selected, as this group is what will then be returned from Duel.SetFusionMaterial
void Duel.SetLP(int player, int lp) Sets a specified player's (int player) current Life Point to (int lp). (Used by effects that "make the LP become X")
void Duel.SetOperationInfo(int chainc, int category, Card|Group targets, int count, int target_player, int target_param) Sets informations about the operation being performed in the current (int chainc = 0) chain, belonging to (int category), with a total of (int count) of card(s) from (Card|Group targets) being affected. These are used with GetOperationInfo. Also, the parameter passed here are checked if any of the summon related activities are checked like ACTIVITY_SUMMON, ACTIVITY_NORMALSUMMON, ACTIVITY_SPSUMMON and ACTIVITY_FLIPSUMMON.
void Duel.SetPossibleOperationInfo(int chainc, int category, Card|Group targets, int count, int target_player, int target_param) Behavior similar to Duel.SetOperationInfo, but those properties are stored separately and are meant to be set for cards that "could" perform such action (for example for cards that include an effect that can be negated by Ghost Belle)
void Duel.SetSelectedCard(Card|Group cards) Sets the current selected cards that are to be used by Group.Select/CheckWithSumGreater and Group.Select/CheckWithSumEqual, also by Duel.CheckReleaseGroup and Duel.CheckReleaseGroupEx
void Duel.SetTargetCard(Card|Group targets) Sets the cards targeted by the current effect and creates a relation to them.
void Duel.SetTargetParam(int value) Stores an arbitrary integer as the "target parameter" for the currently resolving chain, its uses vary depending on the type of effect, but for example with cards that damage/recover LP this value corresponds to the amount to gain/lose, so that other effects that change those amounts can access and change this value
void Duel.SetTargetPlayer(int player) Used to set the "target player" for the currently resolving chain, its uses vary depending on the type of effect, but it's mostly used to indicate which player will be affected by such effect (see "Mystical Refpanel")
void Duel.ShuffleDeck(int player) Shuffles the deck of (int player). Handled automatically if a card is sent to deck sequence -2.
void Duel.ShuffleExtra(int player) Shuffles the Extra Deck of (int player). Must be used after confirming cards in the Extra Deck.
void Duel.ShuffleHand(int player) Shuffles the hand of (int player). Handled automatically after Duel.ConfirmCards().
void Duel.ShuffleSetCard(Group g) Shuffles the set cards in (Group g). (Shifting Shadows). All the cards must be from the same location. The only supported locations are the Main Monster Zone and the Spell & Trap Zone.
void Duel.SkipPhase(int player, int phase, int reset_flag, int reset_count[, int value=0]) Makes the specified player (int player) skips the encountered phase (int phase), the effect is reset when reset_flag is met reset_count times. (int value) sets the skip effect's value (don't know what it's used for though...)
void Duel.SortDeckbottom(int sort_player, int target_player, int count) Player (int sort_player) sorts an amount of cards (int count) of a player's (int target_player) deck bottom
void Duel.SortDecktop(int sort_player, int target_player, int count) Player (int sort_player) sorts an amount of cards (int count) of a player's (int target_player) deck top
int Duel.SpecialSummon(Card|Group targets, int sumtype, int sumplayer, int target_player, bool nocheck, bool nolimit, int pos[, int zone=0xff]) A player (int sumplayer) Special Summons a card/group of cards (Card|Group targets) with summon type described with SUMMON_TYPE_x (int sumtype) to a player's (int target_player) field in the specific zone (here zone 0xff, means the default zones). If (bool nocheck) is true, it will summon ignoring conditions. If (bool nolimit) is true, it will summon ignoring the revive limit. Returns the number of cards successfully summoned.
void|int Duel.SpecialSummonComplete() Completes Special Summons conducted with Duel.SpecialSummonStep. This has to be called even if all the Duel.SpecialSummonStep fails.
void Duel.SpecialSummonRule(int player, Card c[, int sumtype=0]) A player (int player) Special Summons a card (Card c) using Special Summon proc that the card has that matches the provided summon type (0 means any).
bool Duel.SpecialSummonStep(Card c, int sumtype, int sumplayer, int target_player, bool nocheck, bool nolimit, int pos[, int zone=0xff]) A player (int sumplayer) Special Summons a card (Card c) with summon type described with SUMMON_TYPE_x (int sumtype) to a player's (int target_player) field in the specific zone (here zone 0xff, means the default zones). If (bool nocheck) is true, it will summon ignoring conditions. If (bool nolimit) is true, it will summon ignoring the revive limit. When a card is summoned this way, its summon is not considered complete until a call to Duel.SpecialSummonComplete is performed, this is useful when effects are to be applied to the card after it is "summoned" but before it "reaches the field".
void|int Duel.SSet(int player, Card|Group targets[, int target_player = player, bool confirm=true]) A player Sets a cards(s) (Card|Group target) to the Spell/Trap Card Zone on target_player's field, if confirm is true, the card(s) set are revealed - for confirmation - to the opponent.
void Duel.Summon(int player, Card c, bool ignore_count, Effect e|nil[, min=0, int zone=0x1f]) Makes a player (int player) Normal Summons a card (Card c) using the Normal Summon procedure that the card has. If (ignore_count) is set to true, the Summon would not count towards the standard limit of Normal Summon/Set. If an effect (Effect e) is provided, the Normal Summon is counted as a Summon by that effect. If (min) is greater than 0, the Summon proc must need that amount or more tributes. If zone is provided, the card will be summonable only to the specific zones.
void Duel.SummonOrSet(int tp, Card c, bool ignore_count, Effect e|nil[, int min=0]) Makes player (int tp) Normal Summon or Set (Card c) by calling simultaneously Duel.Summon and Duel.MSet. If (Effect e) is not nil, checks if the summon can be done by that effect. If (bool ignore_count) is true, it ignores the standard once per turn summon limit. (int min) is the minimum number of tributes that are required.
bool Duel.SwapControl(Card|Group c1, Card|Group c2[, int reset_phase=0, int reset_count=0]) Swaps control of 2 cards or 2 groups. If groups are provided they must contain the same number of cards and each group must contains cards on the same side of the field. If reset_phase and reset_count is specified, will behave like other effects with those resets (and so, the control will be returned when the effect has expired). Works only for monsters in Monster Zone.
void Duel.SwapDeckAndGrave(int player) Swaps the cards from (int player)'s GY with the cards from his deck. This is an ad hoc function for Exchange of the Spirit.
void Duel.SwapSequence(Card c1, Card c2) Exchanges the positions of two cards in the same location on the same side of the field.
void Duel.SynchroSummon(int player, Card c[, Group|Card|nil must_use, Group|Card|nil mg, int minc=0, int maxc=0]) A player (int player) Synchro Summons a card (Card c) using "must_use" as part of its materials, choosing among "mg", with "min" and "max" materials to be used for the Summon
void Duel.TagSwap(int team) If the current team has more than 1 player, switches to the next player of that team.
... Duel.TossCoin(int player, int count) Tosses (int count) coins on behalf of (int player). Returns all the results of the tosses.
... Duel.TossDice(int player, int count1[, int count2 = 0]) Rolls (int count1) dice on behalf of (int player) and (int count1) dice on behalf of the opponent of (int player). Returns all the results of the rolls.
void Duel.Win(int player, int win_reason) Player (int player) wins the Duel for a reason (REASON_x). If the player is affected by EFFECT_CANNOT_LOSE_EFFECT the duel keeps going on.
void Duel.XyzSummon(int player, Card c[, Group|Card|nil must_use, Group|Card|nil mg, int minc=0, int maxc=0]) A player (int player) Xyz Summons a card (Card c) using "must_use" as part of its materials, choosing among "mg", with "min" and "max" materials to be used for the Summon