Skip to content

PacketBankConfig

卡牌选择配置,控制玩家可使用的卡牌机制。

结构定义

typescript
interface PacketBankConfig {
  Method: "Preset" | "Choose" | "Conveyor";                     // 卡牌使用方法
  Type: "GeneralPlant" | "GeneralZombie" | "TotalZombie" | "Total";  // 套卡类型
  Value: any[];                                                  // 配置数组
}

字段说明

Method

"Preset" | "Choose" | "Conveyor"

卡牌使用方法,决定玩家如何获得和使用卡牌。

可选值:

  • Preset - 预设:直接以指定卡牌进入关卡
  • Choose - 选卡:将指定卡牌固定在卡牌中,不可放回
  • Conveyor - 传送带:动态提供卡牌

Type

"GeneralPlant" | "GeneralZombie" | "TotalZombie" | "Total"

套卡类型,指定可选择的卡牌范围。

可选值:

  • GeneralPlant - 主植物
  • GeneralZombie - 主僵尸
  • TotalZombie - 全部僵尸
  • Total - 全部

Value

any[]

根据Method设置的数组配置,具体格式依赖于选择的方法:

Preset方法的Value

json
[
  "卡牌名1",
  "卡牌名2", 
  "卡牌名3"
]

表示该关卡直接以这几个卡牌进入关卡。

Choose方法的Value

json
[
  "卡牌名1",
  "卡牌名2",
  "卡牌名3"
]

表示该关卡将这几个卡牌固定在卡牌中,不可放回。

Conveyor方法的Value

json
[
  {
    "Interval": 5.0,
    "IntervalIncreaseEvery": 3.0,
    "IntervalMagnification": 1.2,
    "WaveEvent": [],
    "Packet": []
  }
]

传送带配置详解

当Method为Conveyor时,Value数组包含一个配置字典:

Interval

number 每张卡牌出现的间隔时间。

IntervalIncreaseEvery

number 每几张卡牌出现后将增加卡牌出现间隔。

IntervalMagnification

number 间隔增长倍数,按此配置增加间隔时间。

WaveEvent

ConveyorEventItem[] 每大波传送带事件数组。第一波入侵开始也为一波,比如一共两大波就需要三个数组,数组可以为空,但是必须要有。

Packet

PacketItem[] 传送带卡牌配置数组。

使用示例

Preset示例

json
{
  "Method": "Preset",
  "Type": "GeneralPlant", 
  "Value": ["Peashooter", "Sunflower", "WallNut"]
}

Choose示例

json
{
  "Method": "Choose",
  "Type": "Total",
  "Value": ["Peashooter", "Sunflower", "WallNut", "PotatoMine"]
}

Conveyor示例

json
{
  "Method": "Conveyor",
  "Type": "GeneralPlant",
  "Value": [
    {
      "Interval": 5.0,
      "IntervalIncreaseEvery": 3.0, 
      "IntervalMagnification": 1.2,
      "WaveEvent": [[], [], []],
      "Packet": [
        {
          "Name": "Peashooter",
          "Weight": 1.0
        },
        {
          "Name": "Sunflower", 
          "Weight": 0.8
        }
      ]
    }
  ]
}