Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions data/enemy/function/natural_spawn/.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#> enemy:natural_spawn/
#自然湧きのVexにスポーンタグを付与
tag @s add Spawn
tag @s add NaturalSpawn
loot replace entity @s armor.head loot settings:entity/natural_spawn
# 村人召喚時処理
execute if data entity @s ArmorItems[3].components."minecraft:custom_data"{SpawnEntities:[[{Tags:[Global,Friendly,Blow,CommonVillager],Level:1}]]} run function enemy:natural_spawn/villager
function enemy:natural_spawn/modify_level
#召喚に失敗した場合はそのまま残す
execute unless data entity @s ArmorItems[3].components."minecraft:custom_model_data" run tag @s remove Spawn
14 changes: 14 additions & 0 deletions data/enemy/function/natural_spawn/condition.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#> enemy:natural_spawn/condition
#
# 自然湧き条件を満たしているかどうか、判定する
#
# @within function entity:initialize_entity

# CreeperのNBTを変更
data merge entity @s {Silent:1b,DeathTime:19,DeathLootTable:"",NoAI:1b,Health:0.01f,attributes:[{id:"max_health",base:0.01d}]}

# プレイヤーが64m以内にいるかを判定
execute unless data storage main: difficult{world:"debug"} if entity @a[predicate=entity:player,distance=..64] run function enemy:natural_spawn/

# Spawnタグが付いてなかった場合は地面に埋めてやる
execute if entity @s[tag=!Spawn] run function enemy:natural_spawn/summon_vex
9 changes: 9 additions & 0 deletions data/enemy/function/natural_spawn/fork.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> enemy:natural_spawn/fork
#
# creeperかsilverfishで自然湧き処理の分岐をする
#
# @within function entity:initialize_entity

execute if entity @s[type=creeper] run function enemy:natural_spawn/condition
execute if entity @s[type=silverfish] run function enemy:natural_spawn/silverfish/condition
execute if entity @s[type=warden] run function enemy:natural_spawn/warden/condition
23 changes: 23 additions & 0 deletions data/enemy/function/natural_spawn/modify_level.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#> enemy:natural_spawn/modify_level
## 自然湧きレベル変更
# @s _ 占有
execute store result score @s _ run data get entity @s ArmorItems[3].tag.SpawnEntities[0][0].Level 1
scoreboard players add @s _ 1
# _ Calc 占有
execute store result score _ Calc run function calc:island/clear_count_percent
scoreboard players operation _ Calc *= _ Calc
scoreboard players add _ Calc 2000
# _ _ 占有
execute store result score _ _ run function calc:random
scoreboard players operation _ Calc *= @s _
# _ Calc 占有
scoreboard players set @s Calc 2000
scoreboard players operation _ Calc /= @s Calc
scoreboard players operation _ _ %= _ Calc
scoreboard players operation _ _ += @s _
# _ Calc 解放
scoreboard players operation _ _ >< @s _
# _ _ 解放

scoreboard players operation @s Level = @s _
# @s _ 解放
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#> enemy:natural_spawn/silverfish/condition
#
# 条件分岐
#
# @within function enemy:natural_spawn/fork

# NBT付与
data merge entity @s {Silent:1b,DeathTime:19,DeathLootTable:"",Health:0.01f,attributes:[{id:"max_health",base:0.01d}]}

# プレイヤーが64m以内にいるかを判定
execute unless data storage main: difficult{world:"debug"} if entity @a[predicate=entity:player,distance=..64] run function enemy:natural_spawn/silverfish/spawn

# Spawnタグが付いてなかった場合はKillする
kill @s[tag=!Spawn]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> enemy:natural_spawn/silverfish/spawn
# @within function enemy:natural_spawn/silverfish/condition

#自然湧きのSliverfishにスポーンタグを付与
tag @s add Spawn
loot replace entity @s armor.head loot settings:entity/silverfish_spawn
#召喚に失敗した場合はそのまま残す
execute unless data entity @s ArmorItems[3].components."minecraft:custom_model_data" run tag @s remove Spawn
8 changes: 8 additions & 0 deletions data/enemy/function/natural_spawn/summon_vex.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> enemy:natural_spawn/summon_vex
#
# Vexを召喚しておく
#
# @within function enemy:natural_spawn/condition

kill @s
summon vex ~ ~-1 ~ {Silent:1b,DeathTime:19,DeathLootTable:"",NoAI:1b,Health:0.01f,LifeTicks:200,Tags:["NaturalSpawn"],HandItems:[{},{}],attributes:[{id:"max_health",base:0.01d}],active_effects:[{id:"minecraft:invisibility",amplifier:0b,duration:-1,show_particles:0b}]}
9 changes: 9 additions & 0 deletions data/enemy/function/natural_spawn/villager.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> enemy:natural_spawn/villager
#
# 村人召喚処理
#
# @within function enemy:natural_spawn/

# 攻略率スコアを取得して
execute store result score @s Calc run function calc:island/clear_count_percent
loot replace entity @s armor.head loot settings:entity/natural_villager
14 changes: 14 additions & 0 deletions data/enemy/function/natural_spawn/warden/condition.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#> enemy:natural_spawn/warden/condition
#
# 条件分岐
#
# @within function enemy:natural_spawn/fork

# NBT付与
data merge entity @s {Silent:1b,DeathTime:19,DeathLootTable:"",Health:0.01f,attributes:[{id:"max_health",base:0.01d}]}

# プレイヤーが64m以内にいるかを判定
execute unless data storage main: difficult{world:"debug"} if entity @a[predicate=entity:player,distance=..64] run function enemy:natural_spawn/warden/spawn

# Spawnタグが付いてなかった場合はKillする
kill @s[tag=!Spawn]
9 changes: 9 additions & 0 deletions data/enemy/function/natural_spawn/warden/spawn.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> enemy:natural_spawn/warden/spawn
# @within function enemy:natural_spawn/warden/condition

#自然湧きのWardenにスポーンタグを付与
tag @s add Spawn
loot replace entity @s armor.head loot settings:entity/warden_spawn

#召喚に失敗した場合はそのまま残す
execute unless data entity @s ArmorItems[3].components."minecraft:custom_model_data" run tag @s remove Spawn
2 changes: 1 addition & 1 deletion data/entity/function/initialize_entity.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
###################################################

### 自然湧き処理
execute if entity @s[type=#entity:natural_spawn,tag=] run function enemy:natural_spawn_type
execute if entity @s[type=#entity:natural_spawn,tag=] run function enemy:natural_spawn/fork

### モブ召喚
execute if entity @s[tag=Spawn] run function entity:spawn/
Expand Down
Loading