> 函数列表
以 setLoadout 的格式返回韭葱当前的装备:武器、芯片、组件(含每件部件的改造)、总属性,以及在每项属性上投入的资本。在任何 setLoadout 之前,它是韭葱进入战斗时的装备;之后,则是 setLoadout 给它的装备。setLoadout(getCurrentLoadout()) 不会改变任何东西:它是在代码中组装装备的起点(见getInventory)。在 beforeFight() 中调用(见战斗钩子)。
// 这个函数会在第 1 回合之前自动调用
function beforeFight() {
var current = getCurrentLoadout()
// stats:总属性;capitals:在每项属性上投入的资本
debug("力量:" + current.stats.strength + ",投入的资本:" + current.capitals.strength)
// base:模型自身的属性,stats:总值,bonuses:所佩戴部件的改造带来的变化
for (var component in current.components) {
debug(component.item + ":" + jsonEncode(component.bonuses))
}
// 去掉电光芯片的同一套装备。只有减少投入的资本才会消耗洗点药水
var chips = []
for (var chip in current.chips) {
if (chip != CHIP_FLASH) push(chips, chip)
}
current.chips = chips
setLoadout(current)
}
// 这个函数会在第 1 回合之前自动调用
function beforeFight() {
const current = Fight.me.getCurrentLoadout()
// stats:总属性;capitals:在每项属性上投入的资本
Debug.log("力量:" + current.stats.strength + ",投入的资本:" + current.capitals.strength)
// base:模型自身的属性,stats:总值,bonuses:所佩戴部件的改造带来的变化
for (const component of current.components) {
Debug.log(component.item + ":" + JSON.stringify(component.bonuses))
}
// 去掉电光芯片的同一套装备。只有减少投入的资本才会消耗洗点药水
current.chips = current.chips.filter(chip => chip !== Chip.flash.id)
Fight.me.setLoadout(current)
}
// 在 TypeScript 和 JavaScript 中,只有定义了 turn() 的 AI 才会调用钩子
function turn() {
// ...
}
# 这个函数会在第 1 回合之前自动调用
def beforeFight():
current = Fight.me.getCurrentLoadout()
# stats:总属性;capitals:在每项属性上投入的资本
Debug.log("力量:" + str(current["stats"]["strength"]) + ",投入的资本:" + str(current["capitals"]["strength"]))
# base:模型自身的属性,stats:总值,bonuses:所佩戴部件的改造带来的变化
for component in current["components"]:
Debug.log(str(component["item"]) + ":" + str(component["bonuses"]))
# 去掉电光芯片的同一套装备。只有减少投入的资本才会消耗洗点药水
current["chips"] = [chip for chip in current["chips"] if chip != Chip.flash.id]
Fight.me.setLoadout(current)
# 在 Python 中,只有定义了 turn() 的 AI 才会调用钩子
def turn():
pass
name(setLoadout 最近设置的那套装备的名称,否则为空)、weapons、forgotten_weapons 和 chips(WEAPON_* 和 CHIP_* 常量的标识)、components,即 {item, base, stats, bonuses} 对象的列表(item:组件的模型,COMPONENT_* 常量;base:模型自身的属性;stats:总值;bonuses:所佩戴部件的改造带来的变化,基础件为 {})、stats,韭葱的总属性(含等级、投入的资本和组件),以及 capitals,在每项属性上投入的资本。setLoadout 先读 capitals 再读 stats:要改变分配,请修改 capitals。Impossible de charger les données du jeu.
Vérifiez votre connexion et réessayez.