-
Notifications
You must be signed in to change notification settings - Fork 4
Value manipulation
(mechanic from Cryptlib)
Value manipulation refers to the change of all values on a card's ability table and a playing card's base table. To manipulate the values on a card card, use Spectrallib.manipulate(card, args).
By default, there are four ways to incorporate some value into each of a card's values (referred here as tbl_value). Given a table args where it defines the fields value a number (unless otherwise specified), and type a string, the manipulation types are as follows:
- "+" -
args.valueis added onto eachtbl_value - "X" -
args.valueis multiplied with eachtbl_value - "^" -
tbl_valueis raised to the power ofargs.value - "hyper" -
tbl_valueis raised to the hyperpower ofargs.value, which should now be a table of the form{arrows = number, height = number}.
Alternatively, in args, the field func can be defined to override the manipulation types, allowing for the introduction of a unique method of value manipulation. func must be of the form function(tbl_value, args, is_big, num_key), and return a number.
By default, manipulation will be repeatedly applied onto tbl_value without consideration to its original value. args.dont_stack can be defined as true to temporarily reset tbl_value to its original value.
If args.value is not provided, a pseudorandom value will be chosen from a logarithmically distributed set of numbers. The range of this set is [args.min, args.max], but defaults to [G.GAME.modifiers.cry_misprint_min, G.GAME.modifiers.cry_misprint_max]; both variables default to 1 if undefined.
args.seed can be provided to seed the pseudorandom selection.
Selects a random number from a logarithmically distributed range. It is recommended that seed be the output of pseudoseed.
Manipulates card's ability table and base table (where applicable). args is a table that takes the following fields:
-
value- Optional: A number, with some exceptions. If it is not provided, a random value will be generated from a logarithmically distributed range. -
type- Optional: Determines howvalueis incorporated into each of a card's values (referred here asoriginal_value). Can be one of the following strings:- "+" -
valueis added onto eachoriginal_value - "X" -
valueis multiplied with eachoriginal_value - "^" -
original_valueis raised to the power ofvalue - "hyper" -
original_valueis raised to the hyperpower ofvalue, which should now be a table of the form{arrows = number, height = number}.
- "+" -
-
min- Optional: Ifvalueis undefined, this is the minimum number for the random value. -
max- Optional: If value is undefined, this is the maximum number for the random value. -
seed- Optional: The seed for selecting the aforementioned random value. -
func- Optional: Overridestypeas its own way of incorporatingvalueinto each of a card's values. -
dont_stack- Optional: If true, each of a card's values are temporarily reset before manipulation. -
no_deck_effects- Optional: (todo figure out what deck_effects are for) -
bypass_checks- Optional: (todo figure out what deck_effects are for)
Manipulates the value ref_table[ref_value].
-
ref_tableis a table in the Cardcard. -
argsis the same asSpectrallib.manipulate's args.
Perform a manipulation on some value tbl_value.
-
argsis the same asSpectrallib.manipulate's args. -
is_bigis true if the manipulatedtbl_valueis allowed to be a BigNumber. -
value_keywould be the key mapped totbl_valuein their original table, if this function was called from the aforementionedSpectrallib.manipulate_table.