getCurrentLoadout

getCurrentLoadout() → any loadout

Returns the loadout your leek is currently wearing, in the setLoadout format: its weapons, its chips, its components with the alteration of each piece, its total characteristics and the capital invested in each. Before any setLoadout, it is the loadout it entered the fight with; afterwards, the one setLoadout gave it. setLoadout(getCurrentLoadout()) changes nothing: it is a starting point for building a loadout in code (see getInventory). Call it in beforeFight() (see Fight hooks).

// This function is called automatically before turn 1
function beforeFight() {
	var current = getCurrentLoadout()

	// stats: total characteristics; capitals: capital invested in each
	debug("Strength: " + current.stats.strength + ", invested capital: " + current.capitals.strength)

	// base: template's stats, stats: total, bonuses: what the alteration of the worn piece changes
	for (var component in current.components) {
		debug(component.item + ": " + jsonEncode(component.bonuses))
	}

	// The same loadout without the Flash chip. Only lowering the invested capital costs a restat potion
	var chips = []
	for (var chip in current.chips) {
		if (chip != CHIP_FLASH) push(chips, chip)
	}
	current.chips = chips
	setLoadout(current)
}
// This function is called automatically before turn 1
function beforeFight() {
	const current = Fight.me.getCurrentLoadout()

	// stats: total characteristics; capitals: capital invested in each
	Debug.log("Strength: " + current.stats.strength + ", invested capital: " + current.capitals.strength)

	// base: template's stats, stats: total, bonuses: what the alteration of the worn piece changes
	for (const component of current.components) {
		Debug.log(component.item + ": " + JSON.stringify(component.bonuses))
	}

	// The same loadout without the Flash chip. Only lowering the invested capital costs a restat potion
	current.chips = current.chips.filter(chip => chip !== Chip.flash.id)
	Fight.me.setLoadout(current)
}

// In TypeScript and JavaScript, hooks are only called if the AI defines turn()
function turn() {
	// ...
}
# This function is called automatically before turn 1
def beforeFight():
	current = Fight.me.getCurrentLoadout()

	# stats: total characteristics; capitals: capital invested in each
	Debug.log("Strength: " + str(current["stats"]["strength"]) + ", invested capital: " + str(current["capitals"]["strength"]))

	# base: template's stats, stats: total, bonuses: what the alteration of the worn piece changes
	for component in current["components"]:
		Debug.log(str(component["item"]) + ": " + str(component["bonuses"]))

	# The same loadout without the Flash chip. Only lowering the invested capital costs a restat potion
	current["chips"] = [chip for chip in current["chips"] if chip != Chip.flash.id]
	Fight.me.setLoadout(current)

# In Python, hooks are only called if the AI defines turn()
def turn():
	pass
Return