Skip to content

Commit

Permalink
虚空の魔導書 実装
Browse files Browse the repository at this point in the history
  • Loading branch information
EllaCoat committed Aug 26, 2024
1 parent 4231654 commit 58c8f58
Show file tree
Hide file tree
Showing 27 changed files with 331 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:mob/0399.void_spellbook/_/death
#
# Mobの死亡時に実行されるfunction
#
# @within tag/function asset:mob/death

execute if data storage asset:context {id:399} run function asset:mob/0399.void_spellbook/death/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:mob/0399.void_spellbook/_/init
#
# Mobの召喚時に実行されるfunction
#
# @within tag/function asset:mob/initialize

execute if data storage asset:context {id:399} run function asset:mob/0399.void_spellbook/init/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:mob/0399.void_spellbook/_/register
#
#
#
# @within tag/function asset:mob/register

execute if data storage asset:context {id:399} run function asset:mob/0399.void_spellbook/register
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:mob/0399.void_spellbook/_/summon
#
#
#
# @within tag/function asset:mob/summon

execute if data storage asset:context {id:399} run function asset:mob/0399.void_spellbook/summon/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:mob/0399.void_spellbook/_/tick
#
# Mobが生きている間毎tick実行されるfunction
#
# @within tag/function asset:mob/tick

execute if data storage asset:context {id:399} run function asset:mob/0399.void_spellbook/tick/
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#> asset:mob/0399.void_spellbook/_index.d
# @private

#> tag
# @within function asset:mob/0399.void_spellbook/**
#declare tag B3.Temp
#declare tag B3.Bullet
#declare tag B3.Landing
#declare tag B3.Marker

#> score
# @within function asset:mob/0399.void_spellbook/**
#declare score_holder $B3.Temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#> asset:mob/0399.void_spellbook/ai/bullet/0.summon
#
# 弾幕 召喚
#
# @within function asset:mob/0399.void_spellbook/ai/bullet/4.fire

# UUIDスコア移し
scoreboard players operation $B3.Temp B3.UUID = @s MobUUID

# 元となるMobを召喚する
summon item_display ~ ~ ~ {Tags:["B3.Temp","B3.Bullet","AllowProcessingCommonTag","AutoKillWhenDiePassenger"],billboard:"center",teleport_duration:1,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[0f,0f,0f]},item:{id:"leather_horse_armor",Count:1b,tag:{display:{color:3604544},CustomModelData:20370}},Passengers:[{id:"area_effect_cloud",Particle:"block air",Radius:0f,Duration:2}]}

# 初期化処理
tp @e[type=item_display,tag=B3.Temp,distance=..2] ^ ^ ^ ~ ~
execute as @e[type=item_display,tag=B3.Temp,distance=..2] at @s run function asset:mob/0399.void_spellbook/ai/bullet/1.init

# リセット
scoreboard players reset $B3.Temp B3.UUID
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#> asset:mob/0401.darkness_spellbook/ai/bullet/1.init
#
# 初期化処理
#
# @within function asset:mob/0401.darkness_spellbook/ai/bullet/0.summon

# スコア初期化
scoreboard players set @s B3.Tick 0

# UUIDスコア紐づけ
scoreboard players operation @s B3.UUID = $B3.Temp B3.UUID

# 発射音
playsound ogg:block.amethyst.step6 hostile @a[distance=..32] ~ ~ ~ 1 2 0
playsound ogg:block.amethyst.step6 hostile @a[distance=..32] ~ ~ ~ 1 1.95 0
playsound ogg:block.amethyst.step6 hostile @a[distance=..32] ~ ~ ~ 1 1.9 0
playsound block.respawn_anchor.deplete hostile @a[distance=..32] ~ ~ ~ 1 2 0

# リセット
tag @s remove B3.Temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#> asset:mob/0399.void_spellbook/ai/bullet/2.tick
#
# 弾幕 Tick処理
#
# @within function asset:mob/0399.void_spellbook/tick/

# スコア上昇
scoreboard players add @s B3.Tick 1

# TP
tp @s ^ ^ ^0.75 ~ ~

# パーティクル
particle fishing ~ ~ ~ 0.2 0.2 0.2 0.05 1 force @a[distance=..32]
particle minecraft:dust 0.35 0.07 0.55 1 ~ ~ ~ 0.2 0.2 0.2 0 1 force @a[distance=..32]

# 暗闇を与える
execute at @s positioned ~-0.5 ~-0.5 ~-0.5 as @a[tag=!PlayerShouldInvulnerable,dx=0] run tag @s add B3.Landing
execute if entity @a[tag=B3.Landing,distance=..3] run function asset:mob/0399.void_spellbook/ai/bullet/3.cast
execute as @a[tag=B3.Landing,distance=..3] at @s run function lib:damage/

# リセット
function lib:damage/reset
tag @a[tag=B3.Landing,distance=..3] remove B3.Landing

# Age弄り
execute on passengers run data modify entity @s Age set value 0

# 表示
execute if score @s B3.Tick matches 3 run data modify entity @s transformation.scale set value [0.5f,0.5f,0.5f]

# キル
execute if score @s B3.Tick matches 121 run kill @s
execute at @s unless block ^ ^ ^ #lib:no_collision run kill @s
execute if entity @s[tag=B3.Landing] run kill @s
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#> asset:mob/0399.void_spellbook/ai/bullet/3.cast
#
# 着弾処理
#
# @within function asset:mob/0399.void_spellbook/ai/bullet/2.tick

# 引数の設定
# 与えるダメージ
data modify storage lib: Argument.Damage set value 28.0f
# 第一属性
data modify storage lib: Argument.AttackType set value "Magic"
# 第二属性
data modify storage lib: Argument.ElementType set value "Water"
# デスログ
data modify storage lib: Argument.DeathMessage append value '[{"translate": "%1$sの身体は%2$sの弾幕に貫かれてしまった","with":[{"selector":"@s"},{"nbt":"Return.AttackerName","storage":"lib:","interpret":true}]}]'
# 補正functionを実行
execute as @e[tag=this,distance=..100] run function lib:damage/modifier

# タグ付け
tag @s add B3.Landing
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#> asset:mob/0399.void_spellbook/ai/bullet/4.fire
#
# 発射
#
# @within function asset:mob/0399.void_spellbook/tick/

# Markerを召喚
execute positioned ~ ~1 ~ run summon marker ~ ~ ~ {Tags:["B3.Marker"]}

# 前方拡散設定
data modify storage lib: Argument.Distance set value 8.0
data modify storage lib: Argument.Spread set value 3

# 前方拡散を実行する
execute as @e[type=marker,tag=B3.Marker,distance=..3] at @s facing entity @a[tag=!PlayerShouldInvulnerable,nbt={OnGround:0b},distance=..100,sort=random,limit=1] eyes run function lib:forward_spreader/circle

# 発射
execute positioned ~ ~1 ~ facing entity @e[type=marker,tag=B3.Marker,distance=..15,limit=1] feet run function asset:mob/0399.void_spellbook/ai/bullet/0.summon

# Makerを戻してあげる
kill @e[type=marker,tag=B3.Marker,distance=..15,limit=1]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:mob/0399.void_spellbook/death/
#
# Mobの死亡時の処理
#
# @within function asset:mob/0399.void_spellbook/_/death

# 死ぬ音
playsound minecraft:entity.zombie.break_wooden_door hostile @a ~ ~ ~ 0.6 0.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#> asset:mob/0399.void_spellbook/init/
#
# Mob召喚時のInit処理
#
# @within function asset:mob/0399.void_spellbook/_/init
10 changes: 10 additions & 0 deletions Asset/data/asset/functions/mob/0399.void_spellbook/load.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#> asset:mob/0399.void_spellbook/load
#
# MOBに利用するスコアボード等の初期化処理
#
# @within tag/function asset:mob/load

#> 定義類はここに
# @within function asset:mob/0399.void_spellbook/**
scoreboard objectives add B3.Tick dummy
scoreboard objectives add B3.UUID dummy
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#> asset:mob/0399.void_spellbook/register
#
# Mobのデータを指定
#
# @within function asset:mob/0399.void_spellbook/_/register

# 継承 (int) (オプション)
# data modify storage asset:mob Extends append value
# function asset:mob/extends

# 他のモブに継承されることを許可するか (boolean) (オプション)
# data modify storage asset:mob ExtendsSafe set value true
# ID (int)
data modify storage asset:mob ID set value 399
# Type (string) Wikiを参照
data modify storage asset:mob Type set value "Enemy"
# 干渉可能か否か (boolean)
data modify storage asset:mob Interferable set value true
# 名前 (TextComponentString) (オプション)
data modify storage asset:mob Name set value '{"text":"爆発の魔導書","color":"#370040"}'
# Mobの説明文 (TextComponentString[]) (オプション)
# data modify storage asset:mob Lore set value
# 武器
# メインハンド (Compound(Item)) (オプション)
# data modify storage asset:mob Weapon.Mainhand set value
# オフハンド (Compound(Item)) (オプション)
# data modify storage asset:mob Weapon.Offhand set value
# 武器ドロップ率 ([float, float]) (オプション)
# data modify storage asset:mob WeaponDropChances set value
# 防具
# 頭 (Compound(Item)) (オプション)
data modify storage asset:mob Armor.Head set value {id:"leather_horse_armor",Count:1b,tag:{CustomModelData:20138,display:{color:3604544}}}
# 胴 (Compound(Item)) (オプション)
# data modify storage asset:mob Armor.Chest set value
# 脚 (Compound(Item)) (オプション)
# data modify storage asset:mob Armor.Legs set value
# 足 (Compound(Item)) (オプション)
# data modify storage asset:mob Armor.Feet set value
# 防具ドロップ率 ([float, float]) (オプション)
# data modify storage asset:mob ArmorDropChances set value
# 体力 (double) (オプション)
data modify storage asset:mob Health set value 800
# 攻撃力 (double) (オプション)
# data modify storage asset:mob AttackDamage set value
# 防御力 (double) (オプション) // 被ダメージがある程度大きい場合1ptにつき0.8%カット、小さい場合1ptにつき約4%カット 20pt以上は頭打ち
data modify storage asset:mob Defense set value 0
# 特殊防御力 (double) (オプション) // 4pointにつきダメージを大きく減らす
# data modify storage asset:mob SpecialDefense set value
# 移動速度 (double) (オプション)
# data modify storage asset:mob Speed set value
# 索敵範囲 (double) (オプション)
# data modify storage asset:mob FollowRange set value
# ノックバック耐性 (double) (オプション)
# data modify storage asset:mob KnockBackResist set value
# 属性倍率 // 1.0fで100% 最低でも25%は軽減されずに入る
# 物理倍率 (float) (オプション)
data modify storage asset:mob Resist.Physical set value 1
# 魔法倍率 (float) (オプション)
data modify storage asset:mob Resist.Magic set value 0
# 火倍率 (float) (オプション)
data modify storage asset:mob Resist.Fire set value 1
# 水倍率 (float) (オプション)
data modify storage asset:mob Resist.Water set value 1
# 雷倍率 (float) (オプション)
data modify storage asset:mob Resist.Thunder set value 1

# フィールド
# data modify storage asset:mob Field set value {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:mob/0399.void_spellbook/summon/
#
# Mob召喚処理の呼び出し時に実行されるfunction
#
# @within asset:mob/0399.void_spellbook/_/summon

# 元となるMobを召喚する
summon zombie ~ ~ ~ {NoAI:1b,Silent:1b,Tags:["MobInit","AlwaysInvisible"],DeathLootTable:"asset:mob/death/0399.void_spellbook"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#> asset:mob/0399.void_spellbook/summon/debug
#
# モブの動作チェック用の召喚処理 使い終わったら消してもいいかも
#
# @user
# @private

# モブを召喚
data modify storage api: Argument.ID set value 399
function api:mob/summon
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#> asset:mob/0399.void_spellbook/tick/
#
# Mobのtick時の処理
#
# @within function asset:mob/0399.void_spellbook/_/tick

# パーティクル
particle enchant ~ ~1.68 ~ 0.25 0.25 0.25 0 2 force @a[distance=..40]

# 接地で上を向く
execute unless block ~ ~-0.1 ~ #lib:no_collision at @s run tp @s ~ ~ ~ ~ ~-35
execute unless block ~ ~1 ~ #lib:no_collision at @s run tp @s ~ ~ ~ ~ ~80

# カベにぶつかった際の処理
execute at @s unless block ^ ^ ^0.5 #lib:no_collision at @s run tp @s ~ ~ ~ ~45 ~-45
execute at @s unless block ^ ^ ^0.2 #lib:no_collision at @s run tp @s ~ ~ ~ ~45 ~-45

# 範囲内ならホーミングじみた移動
execute facing entity @p feet positioned ^ ^ ^-100 rotated as @s positioned ^ ^ ^-800 facing entity @s feet positioned as @s run tp @s ^ ^ ^0.2 ~ ~

# Timeを取る
execute store result score $B3.Temp Temporary run time query gametime
scoreboard players operation $B3.Temp Temporary %= $2 Const

# 地面に足を付けていないプレイヤを見つけろ!
execute if score $B3.Temp Temporary matches 0 if entity @p[tag=!PlayerShouldInvulnerable,nbt={OnGround:0b},distance=..100] at @s run function asset:mob/0399.void_spellbook/ai/bullet/4.fire

# 弾幕Tick処理
scoreboard players operation $B3.Temp B3.UUID = @s MobUUID
execute as @e[type=item_display,tag=B3.Bullet,distance=..100] if score @s B3.UUID = $B3.Temp B3.UUID at @s run function asset:mob/0399.void_spellbook/ai/bullet/2.tick

# リセット
scoreboard players reset $B3.Temp Temporary
scoreboard players reset $B3.Temp B3.UUID
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#declare tag B5.Temp
#declare tag B5.Bullet
#declare tag B5.Landing
#declare tag B5.Marker

#> score
# @within function asset:mob/0401.darkness_spellbook/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#declare tag B6.Temp
#declare tag B6.Bullet
#declare tag B6.Landing
#declare tag B6.Marker

#> score
# @within function asset:mob/0402.drown_spellbook/**
Expand Down
20 changes: 20 additions & 0 deletions Asset/data/asset/loot_tables/mob/death/0399.void_spellbook.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "entity",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "loot_table",
"name": "asset:mob/death/abstract_detect_item",
"functions": [
{
"function": "set_nbt",
"tag": "{TSB:{ID:402}}"
}
]
}
]
}
]
}
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/mob/death.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:mob/0399.void_spellbook/_/death",
"asset:mob/0402.drown_spellbook/_/death",
"asset:mob/0401.darkness_spellbook/_/death",
"asset:mob/0400.explosion_spellbook/_/death",
Expand Down
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/mob/initialize.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:mob/0399.void_spellbook/_/init",
"asset:mob/0402.drown_spellbook/_/init",
"asset:mob/0401.darkness_spellbook/_/init",
"asset:mob/0400.explosion_spellbook/_/init",
Expand Down
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/mob/load.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:mob/0399.void_spellbook/load",
"asset:mob/0402.drown_spellbook/load",
"asset:mob/0401.darkness_spellbook/load",
"asset:mob/0400.explosion_spellbook/load",
Expand Down
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/mob/register.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:mob/0399.void_spellbook/_/register",
"asset:mob/0402.drown_spellbook/_/register",
"asset:mob/0401.darkness_spellbook/_/register",
"asset:mob/0400.explosion_spellbook/_/register",
Expand Down
Loading

0 comments on commit 58c8f58

Please sign in to comment.