-
Notifications
You must be signed in to change notification settings - Fork 75
Utility Functions
Returns the type of the sticker applied on card, or false if card has no type sticker.
Applies a sticker of type type to card, changing its type.
Returns a table of all Jokers matching type, excluding exclude if given.
Returns the count of all Jokers and Energies matching type, excluding card if count_self is not true.
Returns if the card is of the type or not.
Returns the card's type, or nil if it doesn't have any.
Evolves card into the Joker of key to_key and energizes it by energize_amount.
Calls poke_backend_evolve(card, to_key, energize_amount)
-
immediate: if true, doesn't wrap the call in an event -
evolve_message: status text displayed on the card after evolving, defaults to"poke_evolve_success" -
transformation:trueif this function was called by Transformation, should not be referenced otherwise
Call these functions at the end of a Joker's calculate function.
-
self,cardandcontext: the same as thecalculatefunction's arguments -
forced_key: the key of the Joker to evolve into
Levels up a card that evolves after some rounds. If it reaches the last rounds, evolves it into forced_key. card.ability.extra.rounds must be defined, and is after how many rounds the Pokémon will evolve.
The Joker must define item_req. Evolves if the item was used. Set forced_key to nil if the Joker defines evo_list because it has multiple item_req.
Evolves if current >= target. evo_message is passed to poke_evolve.
Evolves if the Joker is of type type_req.
Evolves if percentage (number between 0 and 1) or more cards in deck are of suit suit.
Evolves if percentage (number between 0 and 1) or more cards in deck are of enhancement enhancement.
If percentage is not defined, evolves if flat or more cards in deck have the enhancement.
Evolves if percentage (number between 0 and 1) or more cards in deck are of seal seal.
If percentage is not defined, evolves if flat or more cards in deck have the seal.
Add a new custom stage to the stages list, set between prev_stage and next_stage
Respectively return the stage preceding or following stage, or nil if the stage doesn't exist or if the previous/next stage doesn't exist.
Returns the name of the lowest or highest stage of card's family (in the case of highest, a random one if multiple highest exist).
Returns the name of card's mega. If card has 2 mega, returns the first one if it's the leftmost Joker, the second one if it's the rightmost, or a random one. Returns nil if card doesn't have a mega.
Given the name of a Mega, and the Joker's mod prefix prefix, returns the name of the non-Mega form, or the full key if full_key = true
Returns the name of center's pre-evolution, or the full key if full_key = true. get_previous_evo can be called to use a card instead of a center, as it calls get_previous_evo_from_center(card.config.center,full_key).
Returns name's family.
center as in card.config.center for a Joker. Returns if a member of center's family is possessed or not. If the player has Showman or Pokédex, returns false.
Sets card as the item created by Twisted Spoon. Must be called at the start of the use function of any non-reusable Item.
evo_item_use(self, card, area, copier), highlighted_evo_item(self, card, area, copier) and evo_item_use_total(self, card, area, copier)
-
self, card, area, copier: the same as the item'suse's function arguments The first one tries to evolve the first Joker it finds from left to right, using the item. The second one tries to evolve the highlighted Joker. The third wraps both, callinghighlightedif 1 Joker is highlited, and the other one if not.
Returns if the self item can be used to evolve card.
Returns if a possessed Joker can evolve using self.
Returns if the Joker has energizable values or not. Energizable values are defined in the global energy_values table.
Returns if an energy of type etype can energize card, without going over the energy limit.
Returns if card's type matches etype's type. If include_colorless = true, return true if card has any type and etype is "Colorless".
Wrap for energy_matches(card, etype, true) and is_energizable(card) and can_increase_energy(card, etype): returns if an energy of etype can be used on the highlighted Joker, or leftmost compatible Joker, and if it can increase its energy
Used by Energy cards in their can_use function, returns if the energy can currently be used or not.
Used by Energy cards in their use function. Uses the energy on the highlighted or leftmost compatible Joker. If exclude_spoon ~= true, calls set_spoon_item(card).
Energize card by amount if it wouldn't bypass the energy limit. If amount is nil, sets it to 1. amount can be negative. Calls increment_energy(card, etype, amount, silent).
Energize card by amount, regardless of the energy limit. Increases card's energy count. Increases the colorless count instead if etype = "Colorless", card isn't Colorless and G.GAME.modifiers.disable_colorless_penalty is false or nil (it's true if playing on the Amped Deck with the Amped Sleeve). If amount is nil, sets it to 1. amount can be negative. Calls energize(card, etype, nil, silent, amount, nil)
Energize card by amount, regardless of the energy limit. Does not increase the energy count. Increases values by half as much if etype = "Colorless", card isn't Colorless and G.GAME.modifiers.disable_colorless_penalty is false or nil. If amount is nil, sets it to 1. amount can be negative. If silent ~= true, displays a status text on card. If center is nil, sets it to card.config.center.
Returns the amount of energies used on card. If get_counts = true, returns 2 values: the regular energy count and the colorless count.
Returns the key of the energy matching card's type. If card is Bird-type, allow_bird must be true to return the Bird energy, otherwise it returns nil. Also returns nil if card has no type.
Returns if card's Volatile effect should be active or not. card is a Joker.
Debuffs card depending on context and its position among Jokers, following Baby rules. Does not actually check if card is a Baby.
Removes $amount of sell value from target. card called this function. If one_way ~= true, adds the sell value removed to card.
Should be given to the generate_ui value of a Joker if this Joker uses the "Ancient" mechanic
If there's room, creates the Item with key key and edition edition (or nil). If has_evolved = true, prevents creation.
Returns the count of cards of id id in hand. If card is given, also sets card.ability.extra.ancient_count to the count.
Cycles G.GAME.poke_poli_suit to the next suit, in "Spades", "Hearts", "Clubs", "Diamonds" order. Used to determine Poliwag's family's current suit.
Returns the key of a random Pickup item, using seed for the randomization. Used by Zigzagoon and Linoon.
Creates a treasure using seed for randomization. Used by Drilbur and Excadrill. If megastone = true, can generate a Mega Stone.
The following 3 functions are called by Pokermon's SMODS.current_mod.reset_game_globals function
Picks a random rank in deck, gives its rank to G.GAME.current_round[name].rank and its id to G.GAME.current_round[name].id. Used by Bulbasaur's, Sneasel's and Bramblin's families to determine their target rank.
Picks a random target card for Espeon, among cards in the deck.
Similar to how Ancient Joker works, picks a random suit among "Spades", "Hearts", "Clubs", "Diamonds" for Gligar and Gliscor to use. Cannot pick the same suit twice in a row.
Unhighlights all selected cards in hand.
Args: array(table), amt(num), seed(string), add_con(function), mod_func(function)
Returns amt random elements from array satisfying add_con, using seed if not nil. mod_func will be called with each returned element if not nil.
Usually used by Items affecting ranks or suits (ex: Fire Stone, Leaf Stone, Prism Scale...). The functions are to be called with second = true when flipping the cards back, aka the 2nd time they're called.
Juice the given card and respectively flip selected or all cards in hand.
Does the same except flips the limit first cards in the targets table.
Juices and flips the given card. index is its index in its area, used to modify the sound played.
Adds add_card to area. card is the card calling this function. Used by Metal Coat.
Calls SMODS.add_card(t), then if no_joker_effect = true calculates Jokers with the {playing_card_added = true, cards = t} context. Returns the card added.
Adds add_card to shop cards, then calculates status text with card.
Destroys card. If check_shiny = true, reduces the booster pack limit if the card was shiny. self and context are unused.
Destroys target and juices card with trigger as the event's trigger. If trigger = nil, after is used by default.
If ratio is defined, adds an amount of "Hazard" cards in the deck equal to floor((cards that are not Hazard in deck)/ratio). Otherwise, adds flat "Hazard" cards to the deck.
-
card: the card to change the rank of -
decrease: iftrue, decrease the rank ; iffalse, increases it ; ifnil, picks any random rank -
seed: seed used to randomly pick a rank. Ifnil, a default one is used. Is used even ifdecrease ~= nil, as a rank can have multiple next or previous ranks defined and one of them is picked at random. -
immediate: iftrue, applies the new rank immediately. Otherwise, delays it in an event.
-
cards: the card or a table of cards to convert -
t: table of args:{seal, mod_conv, edition, suit_conv, random, up, down, bonus_chips}-
seal: seal's key -
mod_conv: enhancement's key -
edition: edition's key -
suit_conv: suit's key -
random,upanddown: +1, -1 or randomly change the rank -
bonus_chips: permanent chips to add to the card
-
-
noflip: iftrue, don't flip the card -
immediate: iftrue, applies the changes immediately.
Enhance amount unenhanced cards in deck to "Hazard".
Returns a table of the value of all energizable values of the Joker card.
Returns the total chips of the playing card card, including its base value, permanent bonus (such as Hiker buff), and its edition's chips (Foil).
key_or_function is either a Joker's key, or a function taking a Joker card as an argument and returning a boolean.
Finds the first Joker matching key_or_function, then returns it (or nil if you don't have any). If use_highlighted = true, only checks the highlighted Joker.
If a Joker is selected, returns it if it matches key_or_function. Otherwise, returns the leftmost Joker matching it.
Returns the Jokers to the left and right of the given one.
Looks for the next rank above rank present in the deck, using "Strength" logic, and returns its id and rank. If it eventually loops to the given rank, it returns it.
Returns the lowest id and rank in the deck. If the deck has no card with a rank, returns the given id and rank instead.
Returns true if the card currently is in the collection (as in, if the collection is opened and this card is currently on screen)
Returns if all cards in the table are of the same suit or not.
Returns the card's rank.
Respectively return if the given card is even or odd.
Returns if the table contains num or more cards of different suits.
Returns the key of a random Pokémon matching the arguments
-
pseed: the seed for the randomization -
stage:nil, a stage or a table of stages -
pokerarity:nil, a rarity or a table of rarities -
_area: unused, set it tonil -
poketype:nilor a type -
exclude_keys:nilor a set of Joker keys to exclude
Wrapper for get_random_poke_key. The arguments are as follow:
-
pseed:options.seedoroptions.pseedoroptions.key_append -
stage:options.stageoroptions.pokestage -
pokerarity:options.rarityoroptions.pokerarity -
poketype:options.typeoroptions.poketype -
exclude_keys:options.exclude_keys
Returns a table containing num card ranks, using seed as the randomization seed. If no table can be generated, returns default instead. If use_deck = true, picks from ranks in the deck.
Returns a table containing 1 suit, using seed as the randomization seed. If no table can be generated, returns default instead, or {suit = "Spades"} if not defined. If use_deck = true, picks from suits in the deck. If limit_suits is defined, restricts possible suits to the suits in limit_suits.
Adds targets to vars. Only properly works for Rank natures.
If precise_energy is disabled and card has money values, has a probability (displayed on screen) to add up to $3 to the amount, using seed for randomization. If calc_only ~= true, earns the player the new amount. Returns the new amount. Should be called every time you manipulate money.
Helper function to wrap a function in an event
-
func: the function to call in the event -
delay: the event's delay. Defaults to 0.1 -
immediate: iftrue, callsfuncright away instead of in an event
Returns the dex number of the given Pokémon.
Returns a set of all the values in the given list, or a set of 1 element. Returns nil instead of an empty set if element_or_list is nil.
Draws 1 card from deck to hand. Functions similarly to G.FUNCS.draw_from_deck_to_hand.
Returns if table contains element or not.
Adds all elements of t2 in t1. Neither table must be using keys.
Returns str with its first character capitalized