# Boss

自定义Boss配置可以在 `plugins/EcoBosses/bosses` 文件夹中找到，它的文件名称即为 **Boss的id**，其一般配置如下：

```
mob: iron_golem attack-damage:90 movement-speed:1.5 follow-range:16 health:1200
displayName: "&8钢铁傀儡 &7| &c%health%♥ &7| &e%time%"
influence: 40
customai:
  enabled: false
  target-goals: [ ] 
  ai-goals: [ ]
effects:
  - id: run_chain
    args:
      chain: blind
      self_as_victim: true
      chance: 20
    triggers:
      - static_20
conditions: [ ]
lifespan: 120
defence:
  preventMounts: true
  explosionImmune: true
  fireImmune: true
  drowningImmune: true 
  suffocationImmune: true

  meleeDamageMultiplier: 0.8
  projectileDamageMultiplier: 0.2

  teleportation:
    enabled: true
    interval: 100
    range: 20
rewards:
  xp:
    minimum: 30000
    maximum: 60000
  topDamagerCommands:
      - chance: 100 # As a percentage
        commands:
          - eco give %player% 10000
    2: [ ]
    3: [ ]
  nearbyPlayerCommands:
    radius: 10
    commands: [ ]
  drops:
    - chance: 100
      items:
        - diamond_sword unbreaking:1 name:"Example Sword"
target:
  # How the boss should choose which player to attack, choices are:
  # highest_health, lowest_health, closest, random
  mode: highest_health
  # The distance to scan for players
  range: 40
bossBar:
  # If the boss should have a boss bar
  enabled: true
  color: white # Options: blue, green, pink, purple, red, white, yellow
  style: progress # Options: progress, notched_20, notched_12, notched_10, notched_6
  radius: 120 # The distance from the boss where the boss bar is visible
spawn:
  # A list of conditions required for a player to be able to spawn a boss, useful to set
  # minimum skill levels, etc
  conditions: [ ]
  autospawn:
    # Spawn the boss automatically every x ticks. Picks a random location, but will only
    # ever spawn in a world if there are no other bosses of that type in the world.
    interval: -1 # The interval in ticks, set to -1 to disable
    locations: # Add as many locations as you want
      - world: world
        x: 100
        y: 100
        z: 100
  totem:
    enabled: false # A spawn totem is a set of 3 blocks on top of each other to spawn a boss (like a snow golem)
    top: netherite_block
    middle: iron_block
    bottom: magma_block
    notInWorlds: [ ] # If spawn totems should be disallowed in certain worlds, specify them here
  egg:
    enabled: true # If the boss should have a spawn egg
    item: evoker_spawn_egg unbreaking:1 hide_enchants
    name: "&8Steel Golem&f Spawn Egg"
    lore:
      - ""
      - "&8&oPlace on the ground to"
      - "&8&osummon a &8Steel Golem"
    craftable: true
    recipe:
      - iron_block
      - netherite_block
      - iron_block
      - air
      - ecoitems:boss_core ? nether_star
      - air
      - iron_block
      - netherite_block
      - iron_block
commands:
  # For each category, you can add as many commands as you want, which will be executed by
  # console. Supported placeholders are the same as for messages (see below)
  spawn: [ ]
  kill: [ ]
  despawn: [ ]
  injure: [ ]
messages:
  # For each category, you can add as many messages as you want, each with their own radius.
  # Radius is the distance from the boss where the player will be sent the message
  # Set to -1 to broadcast globally to all players online

  # Supported placeholders: %x%, %y%, %z% (coordinates)
  spawn:
    - message:
        - ""
        - "&fA &8&lSteel Golem&r&f has been spawned!"
        - "&fCome fight it at &8%x%&f, &8%y%&f, &8%z%&f!"
        - ""
      radius: -1

  # Supported placeholders: %damage_<x>_player%, %damage_<X>%
  # You can include as many ranks as you want - if there is no player at a certain rank,
  # it will be replaced with N/A (change in lang.yml)
  kill:
    - message:
        - ""
        - "&fThe &8&lSteel Golem&r&f has been killed!"
        - "&fMost Damage:"
        - "&f - &8%damage_1_player%&f (%damage_1% Damage)"
        - "&f - &8%damage_2_player%&f (%damage_2% Damage)"
        - "&f - &8%damage_3_player%&f (%damage_3% Damage)"
        - ""
      radius: -1
  despawn:
    - message:
        - ""
        - "&fYou ran out of time to kill the &8&lSteel Golem&r&f!"
        - ""
      radius: -1
  injure: [ ]

# All sounds will be played together at the same time
# A list of sounds can be found here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
# Volume functions as the distance at which the sound will be heard
# Pitch is any value between 0.5 and 2
# If you don't want the vanilla mob sounds, add 'silent' as an option to the mob
sounds:
  spawn:
    - sound: entity_iron_golem_death
      pitch: 0.8
      volume: 100
    - sound: entity_iron_golem_hurt
      pitch: 0.5
      volume: 100
    - sound: entity_ender_dragon_growl
      pitch: 0.5
      volume: 100
  kill:
    - sound: entity_ender_dragon_death
      pitch: 1.8
      volume: 100
    - sound: entity_wither_death
      pitch: 1.2
      volume: 100
  despawn:
    - sound: entity_ender_dragon_ambient
      pitch: 0.5
      volume: 50
    - sound: entity_enderman_death
      pitch: 0.5
      volume: 50
  injure:
    - sound: entity_iron_golem_damage
      pitch: 0.7
      volume: 10
```

我们可以看出它由以下部分组成：

* **mob**：实体语法。
* **displayName**：显示名称。支持变量符 `%health%` 显示怪物的当前血量，`%time%` 显示怪物剩余生命时间，按照 `分钟:秒` 格式显示。
* **influence**：怪物释放的距离最多影响到距离其多少格的玩家。
* **customai**：自定义 AI。

其中：

* customai.enabled：是否启用自定义 AI。
* customai.target-goals：怪物自定义 AI 的攻击目标部分。
* customai.ai-goals：怪物自定义 AI 的自身部分。

继续：

* **effects/conditions**：The Effect System（自定义技能系统）的内容，将在后文介绍。这里的技能仍然是以玩家作用的，如果你是想怪物释放技能给玩家，请在参量中使用 `self_as_victim` 选项，就像所给示例那样。`conditions` 选项可以用作技能不使用于低等级玩家等情况。
* **lifespan**：怪物的生命时长，超过自动死亡，以秒为单位。如果想禁用，只需要将这个数字设置的很大即可。
* **defense**：有关怪物的防御设置。

其中：

* defense.preventMounts：怪物是否会坐船、矿车等。
* defense.explosionImmune：怪物是否免疫爆炸伤害。
* defense.fireImmune：怪物是否免疫火焰伤害。
* defense.drowningImmune：怪物是否免疫溺水伤害。
* defense.meleeDamageMultiplier：近战伤害加倍值。
* defense.projectileDamageMultiplier：远程伤害加倍值。
* defense.teleportation.enabled：是否开启怪物自动传送，以避免被卡在方块里。
* defense.teleportaion.interval：自动传送的尝试间隔时长。
* defense.teleportaion.range：自动传送的尝试半径。

继续：

* **rewards**：击杀怪物的奖励。

其中：

* rewards.xp：奖励的经验值范围，在 `rewards.xp.minimum` 和 `rewards.xp.maxiumum` 之间取值。
* rewards.topDamagerCommands：根据玩家造成伤害排行榜执行的不同命令，底下的 `1、2、3` 子选项即代表第一名、第二名和第三名的指令奖励，你还可以以此顺序添加第四名、第五名等等。每名奖励下是 List 选项，这意味着你可以设置多个指令，其中 `chance` 选项代表百分比，`commands` 代表指令列表。可以使用 `%player%` 变量符指代玩家。
* rewards.nearbyPlayerCommands：给怪物周围玩家执行的命令。其中 `radius` 为半径，`commands` 为指令列表。
* rewards.drops：掉落物奖励，也是 List 选项，这意味着可以添加无数多的掉落物。每个掉落物下还有选项 `chance` 为几率，`items` 为物品语法。

继续：

* target.mode：怪物最先尝试攻击哪个玩家。分别有 `highest_health` 为最高血量玩家，`lowest_health` 为最低血量玩家，`closest` 为距离最近玩家，`random` 为随机玩家。
* target.range：怪物尝试攻击玩家的距离。
* bossbar.enabled：是否开启Boss血量条显示。
* bossbar.color：Boss血量条的颜色。可以填写：blue, green, pink, purple, red, white, yellow。
* bossbar.sytle：Boss血量条的风格。可以填写：progress, notched\_20, notched\_12, notched\_10, notched\_6。
* bossbar.radius：Boss血量条显示的距离。
* spawn.conditions：怪物生成的条件。
* spawn.autospawn.interial：怪物自动生成的间隔时长。
* spawn.autospawn.locations：怪物自动生成的位置。是 List 选项，你可以以此添加无数多的位置。
* totem.enabled：是否开启怪物的召唤图腾。
* totem.top：怪物的召唤图腾的最上方方块。
* totem.middle：怪物的召唤图腾的中间方块。
* totem.bottom：怪物的召唤图腾的最下方方块。
* totem.notInWorld：怪物的召唤图腾不能使用的世界。
* totem.egg：怪物的召唤蛋，见 **盔甲和护身符** 查看对应选项的功能。
* commands/messages/sounds：分别是指令、消息、音效的设置，这三个选项下都有 `spawn` 选项设置怪物生成，`kill` 选项设置怪物击杀，`despawn` 设置怪物生命结束，`injure` 设置怪物受到伤害。
