Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 [神器279]C-4を作成 #1129

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:artifact/0279.c-4/give/1.trigger
#
# 神器の取得処理の呼び出し時に実行されるfunction
#
# @within tag/function asset:artifact/give

execute if data storage asset:context {id:279} run function asset:artifact/0279.c-4/give/2.give
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#> asset:artifact/0279.c-4/give/2.give
#
# 神器の作成部 ここでID等を定義する
#
# @user
# @within function asset:artifact/0279.c-4/give/1.trigger

# 神器の説明や消費MPなどをここで設定する。
# 最後にasset:artifact/common/giveを実行することで入手可能。

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 279
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:carrot_on_a_stick"
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text":"C-4"}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text":"設置して遠隔で爆破できるプラスチック爆弾"}','{"text":"スニークしながら使うことで起爆する"}']
# MP以外の消費物 (TextComponentString) (オプション)
# data modify storage asset:artifact CostText set value
# 使用回数 (int) (オプション)
# data modify storage asset:artifact RemainingCount set value
# 神器を発動できるスロット (string) Wikiを参照
data modify storage asset:artifact Slot set value "auto"
# 神器のトリガー (string) Wikiを参照
data modify storage asset:artifact Trigger set value "onClick"
# 神器の発動条件 (TextComponentString) (オプション)
# data modify storage asset:artifact Condition set value
# 攻撃に関する情報 -Damage量 (literal[]/literal) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.Damage set value [0,0]
# 攻撃に関する情報 -攻撃タイプ (string[]) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.AttackType set value [Physical,Magic]
# 攻撃に関する情報 -攻撃属性 (string[]) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.ElementType set value [Fire,Water,Thunder,None]
# 攻撃に関する情報 -防御無視 (boolean) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.BypassResist set value
# 攻撃に関する情報 -範囲攻撃 (string) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.IsRangeAttack set value
# 攻撃に関する情報 -攻撃範囲 (literal) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.AttackRange set value
# MP消費量 (int)
data modify storage asset:artifact MPCost set value 20
# MP必要量 (int) (オプション)
# data modify storage asset:artifact MPRequire set value
# 神器のクールダウン (int) (オプション)
# data modify storage asset:artifact LocalCooldown set value
# グローバルクールダウン (int) (オプション)
# data modify storage asset:artifact SpecialCooldown set value
# クールダウンによる使用不可のメッセージを非表示にするか否か (boolean) (オプション)
# data modify storage asset:artifact DisableCooldownMessage set value
# MP不足による使用不可のメッセージを非表示にするか否か (boolean) (オプション)
data modify storage asset:artifact DisableMPMessage set value false
# 扱える神 (string[]) Wikiを参照
data modify storage asset:artifact CanUsedGod set value ["Flora", "Urban", "Nyaptov", "Rumor"]
# カスタムNBT (NBTCompound) 追加で指定したいNBT (オプション)
# data modify storage asset:artifact CustomNBT set value {}

# 神器の入手用function
function asset:artifact/common/give
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:artifact/0279.c-4/register
#
# 神器プールへの登録処理
#
# @within tag/function asset:artifact/register

data modify storage asset:artifact RarityRegistry[2] append value 279
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> asset:artifact/0279.c-4/trigger/0.load
#
# 神器に利用するスコアボード等の初期化処理
#
# @within tag/function asset:artifact/load

#> 定義類はここに
# @within function asset:artifact/0279.c-4/trigger/**
scoreboard objectives add 7R.UserID dummy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:artifact/0279.c-4/trigger/1.trigger
#
# 指定したイベントタイミングで実行されるfunction
#
# @within tag/function asset:artifact/**

# storage asset:idのautoに装備している神器のIDが入っているので比較し、~/2.check_condition.mcfunctionを実行する
execute if data storage asset:context id{auto:279} run function asset:artifact/0279.c-4/trigger/2.check_condition
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#> asset:artifact/0279.c-4/trigger/2.check_condition
#
# 神器の発動条件をチェックします
#
# @within function asset:artifact/0279.c-4/trigger/1.trigger

# 神器の基本的な条件の確認を行うfunction、成功している場合CanUsedタグが付く
function asset:artifact/common/check_condition/auto
# 他にアイテム等確認する場合はここに書く

# スニークしながら使ったら発破
execute if predicate lib:is_sneaking run function asset:artifact/0279.c-4/trigger/detonate
execute if predicate lib:is_sneaking run tag @s remove CanUsed
# 個数チェック
execute if entity @s[tag=CanUsed] run function asset:artifact/0279.c-4/trigger/check/c4count
# ブロックが視点先にあるかみる
execute if entity @s[tag=CanUsed] anchored eyes positioned ~ ~1.8 ~ run function asset:artifact/0279.c-4/trigger/check/blockcheck
# なかったらおわる
tag @s[tag=!7R.Landing] remove CanUsed
tag @s remove 7R.Landing
# CanUsed消すやつ
tag @s[tag=FailRecovery] remove CanUsed
tag @s[tag=FailRecovery] remove FailRecovery
# アドベなら使えなくなる
tag @s[gamemode=adventure] remove CanUsed

# CanUsedタグをチェックして3.main.mcfunctionを実行する
execute if entity @s[tag=CanUsed] run function asset:artifact/0279.c-4/trigger/3.main
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#> asset:artifact/0279.c-4/trigger/3.main
#
# 神器のメイン処理部
#
# @within function asset:artifact/0279.c-4/trigger/2.check_condition

# 基本的な使用時の処理(MP消費や使用回数の処理など)を行う
function asset:artifact/common/use/auto

# ここから先は神器側の効果の処理を書く

# 演出
playsound minecraft:block.candle.place block @a
# 前方に壁があるまで再帰して設置
execute anchored eyes positioned ~ ~1.8 ~ run function asset:artifact/0279.c-4/trigger/4.place
# タグ削除
tag @s remove 7R.Landing

# スケジュールで1tick遅らせてノーコリジョンチームにいれたい
schedule function asset:artifact/0279.c-4/trigger/schedule_team_join 1t replace
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#> asset:artifact/0279.c-4/trigger/4.place
#
#
#
# @within function
# asset:artifact/0279.c-4/trigger/3.main
# asset:artifact/0279.c-4/trigger/4.place

# 壁があるまで進む

# 着弾検知
execute unless block ^ ^ ^0.1 #lib:no_collision run tag @s add 7R.Landing

# 着弾したらその壁が床か天井かを判定する。その後に召喚が入る
execute if entity @s[tag=7R.Landing] run function asset:artifact/0279.c-4/trigger/wall_check

# 再起
execute positioned ^ ^ ^0.1 if entity @s[tag=!7R.Landing,distance=..7] run function asset:artifact/0279.c-4/trigger/4.place
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#> asset:artifact/0279.c-4/trigger/_index.d
# @private

#> tag
# @within function asset:artifact/0279.c-4/trigger/**
#declare tag 7R.Landing
#declare tag 7R.C4
#declare tag 7R.Init
#declare tag 7R.WallCheker
#declare tag 7R.IsCeiling
#declare tag 7R.IsFloor
#declare tag 7R.IsNorth
#declare tag 7R.IsEast
#declare tag 7R.IsSouth
#declare tag 7R.IsWest
#declare tag FailRecovery
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#> asset:artifact/0279.c-4/trigger/c4_init
#
#
#
# @within function asset:artifact/0279.c-4/trigger/c4_summon

#> Private
# @private
#declare tag 7R.Ceiling
#declare tag 7R.Floor

# とりあえず上空1000に置いてあるので持ってくる
tp @s ~ ~ ~

# 天井の場合見た目変える
execute if entity @e[type=marker,tag=7R.IsCeiling,distance=..3,limit=1] positioned ~ ~1000 ~ run item replace entity @s armor.head with stick{CustomModelData:20250} 1
execute if entity @e[type=marker,tag=7R.IsCeiling,distance=..3,limit=1] positioned ~ ~1000 ~ run tag @s add 7R.Ceiling
# 床の場合見た目変える
execute if entity @e[type=marker,tag=7R.IsFloor,distance=..3,limit=1] positioned ~ ~1000 ~ run item replace entity @s armor.head with stick{CustomModelData:20251} 1
execute if entity @e[type=marker,tag=7R.IsFloor,distance=..3,limit=1] positioned ~ ~1000 ~ run tag @s add 7R.Floor

# 少しずれる共有
execute at @s if predicate lib:random_pass_per/20 run tp ^0.2 ^ ^
execute at @s if predicate lib:random_pass_per/20 run tp ^-0.2 ^ ^
execute at @s if predicate lib:random_pass_per/20 run tp ^0.1 ^ ^
execute at @s if predicate lib:random_pass_per/20 run tp ^-0.1 ^ ^
# すこしずれる(壁バージョン)
execute at @s if entity @s[tag=!7R.Ceiling,tag=!7R.Floor] if predicate lib:random_pass_per/20 run tp ~ ~0.2 ~
execute at @s if entity @s[tag=!7R.Ceiling,tag=!7R.Floor] if predicate lib:random_pass_per/20 run tp ~ ~-0.2 ~
execute at @s if entity @s[tag=!7R.Ceiling,tag=!7R.Floor] if predicate lib:random_pass_per/20 run tp ~ ~0.1 ~
execute at @s if entity @s[tag=!7R.Ceiling,tag=!7R.Floor] if predicate lib:random_pass_per/20 run tp ~ ~-0.1 ~
# 少しずれる(床or天井バージョン)
execute at @s unless entity @s[tag=!7R.Ceiling,tag=!7R.Floor] if predicate lib:random_pass_per/20 run tp ^ ^ ^0.2
execute at @s unless entity @s[tag=!7R.Ceiling,tag=!7R.Floor] if predicate lib:random_pass_per/20 run tp ^ ^ ^-0.2
execute at @s unless entity @s[tag=!7R.Ceiling,tag=!7R.Floor] if predicate lib:random_pass_per/20 run tp ^ ^ ^0.1
execute at @s unless entity @s[tag=!7R.Ceiling,tag=!7R.Floor] if predicate lib:random_pass_per/20 run tp ^ ^ ^-0.1

# 設置したC4に自身のスコアを入れる
scoreboard players operation @s 7R.UserID = @p[tag=this] UserID

# initタグの削除
tag @s remove 7R.Init
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#> asset:artifact/0279.c-4/trigger/c4_summon
#
#
#
# @within function asset:artifact/0279.c-4/trigger/wall_check

# 設置(床、天井ではない者がいない場合。つまり床or天井の場合、プレイヤーの向きに従う)
execute unless entity @s[tag=!7R.IsCeiling,tag=!7R.IsFloor] if entity @p[tag=this,y_rotation=-22.5..67.4] rotated ~ 0 run summon zombie ~ ~1000 ~ {Rotation:[0F,0F],NoAI:1b,Silent:1b,DeathLootTable:"minecraft:empty",DeathTime:19s,NoGravity:1b,IsBaby:1b,Team:"NoCollision",Tags:["7R.Init","7R.C4","Object","AllowProcessingCommonTag","AlwaysInvisible"],ArmorItems:[{},{},{},{id:"minecraft:stick",Count:1b,tag:{CustomModelData:20249}}]}
execute unless entity @s[tag=!7R.IsCeiling,tag=!7R.IsFloor] if entity @p[tag=this,y_rotation=67.5..157.4] rotated ~ 0 run summon zombie ~ ~1000 ~ {Rotation:[90F,0F],NoAI:1b,Silent:1b,DeathLootTable:"minecraft:empty",DeathTime:19s,NoGravity:1b,IsBaby:1b,Team:"NoCollision",Tags:["7R.Init","7R.C4","Object","AllowProcessingCommonTag","AlwaysInvisible"],ArmorItems:[{},{},{},{id:"minecraft:stick",Count:1b,tag:{CustomModelData:20249}}]}
execute unless entity @s[tag=!7R.IsCeiling,tag=!7R.IsFloor] if entity @p[tag=this,y_rotation=157.5..-114.9] rotated ~ 0 run summon zombie ~ ~1000 ~ {Rotation:[180F,0F],NoAI:1b,Silent:1b,DeathLootTable:"minecraft:empty",DeathTime:19s,NoGravity:1b,IsBaby:1b,Team:"NoCollision",Tags:["7R.Init","7R.C4","Object","AllowProcessingCommonTag","AlwaysInvisible"],ArmorItems:[{},{},{},{id:"minecraft:stick",Count:1b,tag:{CustomModelData:20249}}]}
execute unless entity @s[tag=!7R.IsCeiling,tag=!7R.IsFloor] if entity @p[tag=this,y_rotation=-115..-22.4] rotated ~ 0 run summon zombie ~ ~1000 ~ {Rotation:[-90F,0F],NoAI:1b,Silent:1b,DeathLootTable:"minecraft:empty",DeathTime:19s,NoGravity:1b,IsBaby:1b,Team:"NoCollision",Tags:["7R.Init","7R.C4","Object","AllowProcessingCommonTag","AlwaysInvisible"],ArmorItems:[{},{},{},{id:"minecraft:stick",Count:1b,tag:{CustomModelData:20249}}]}

# 設置(床、天井じゃない場合、方角に従う)
execute if entity @s[tag=7R.IsSouth,tag=!7R.IsCeiling,tag=!7R.IsFloor] rotated ~ 0 run summon zombie ~ ~1000 ~ {Rotation:[0F,0F],NoAI:1b,Silent:1b,DeathLootTable:"minecraft:empty",DeathTime:19s,NoGravity:1b,IsBaby:1b,Team:"NoCollision",Tags:["7R.Init","7R.C4","Object","AllowProcessingCommonTag","AlwaysInvisible"],ArmorItems:[{},{},{},{id:"minecraft:stick",Count:1b,tag:{CustomModelData:20249}}]}
execute if entity @s[tag=7R.IsWest,tag=!7R.IsCeiling,tag=!7R.IsFloor] rotated ~ 0 run summon zombie ~ ~1000 ~ {Rotation:[90F,0F],NoAI:1b,Silent:1b,DeathLootTable:"minecraft:empty",DeathTime:19s,NoGravity:1b,IsBaby:1b,Team:"NoCollision",Tags:["7R.Init","7R.C4","Object","AllowProcessingCommonTag","AlwaysInvisible"],ArmorItems:[{},{},{},{id:"minecraft:stick",Count:1b,tag:{CustomModelData:20249}}]}
execute if entity @s[tag=7R.IsNorth,tag=!7R.IsCeiling,tag=!7R.IsFloor] rotated ~ 0 run summon zombie ~ ~1000 ~ {Rotation:[180F,0F],NoAI:1b,Silent:1b,DeathLootTable:"minecraft:empty",DeathTime:19s,NoGravity:1b,IsBaby:1b,Team:"NoCollision",Tags:["7R.Init","7R.C4","Object","AllowProcessingCommonTag","AlwaysInvisible"],ArmorItems:[{},{},{},{id:"minecraft:stick",Count:1b,tag:{CustomModelData:20249}}]}
execute if entity @s[tag=7R.IsEast,tag=!7R.IsCeiling,tag=!7R.IsFloor] rotated ~ 0 run summon zombie ~ ~1000 ~ {Rotation:[-90F,0F],NoAI:1b,Silent:1b,DeathLootTable:"minecraft:empty",DeathTime:19s,NoGravity:1b,IsBaby:1b,Team:"NoCollision",Tags:["7R.Init","7R.C4","Object","AllowProcessingCommonTag","AlwaysInvisible"],ArmorItems:[{},{},{},{id:"minecraft:stick",Count:1b,tag:{CustomModelData:20249}}]}

# Init処理
execute positioned ~ ~1000 ~ as @e[type=zombie,tag=7R.Init,distance=..10] at @s positioned ~ ~-1000 ~ run function asset:artifact/0279.c-4/trigger/c4_init
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#> asset:artifact/0279.c-4/trigger/check/blockcheck
#
# 前方に壁があるかみる
#
# @within function
# asset:artifact/0279.c-4/trigger/2.check_condition
# asset:artifact/0279.c-4/trigger/check/blockcheck

# 着弾検知
execute unless block ^ ^ ^0.25 #lib:no_collision run tag @s add 7R.Landing

# 着弾しても斜めな場合
#execute if entity @s[tag=7R.Landing] align xyz positioned ~0.5 ~0.5 ~0.5 if block ~ ~1 ~ #lib:no_collision if block ~ ~-1 ~ #lib:no_collision if block ~ ~ ~1 #lib:no_collision if block ~ ~ ~-1 #lib:no_collision if block ~1 ~ ~ #lib:no_collision if block ~-1 ~ ~ #lib:no_collision run tag @s add FailRecovery

# 再起
execute positioned ^ ^ ^0.25 if entity @s[tag=!7R.Landing,distance=..5] run function asset:artifact/0279.c-4/trigger/check/blockcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#> asset:artifact/0279.c-4/trigger/check/c4count
#
#
#
# @within function asset:artifact/0279.c-4/trigger/2.check_condition

#> Private
# @private
#declare score_holder $Count

# 数みる
# 数のカウント
execute store result score $Count Temporary if entity @e[type=zombie,tag=7R.C4,distance=..100]
# もしいたらテレポ
execute if score $Count Temporary matches 15.. run tag @s add FailRecovery
# リセット
scoreboard players reset $Count Temporary
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset:artifact/0279.c-4/trigger/detonate
#
#
#
# @within function asset:artifact/0279.c-4/trigger/2.check_condition

# 演出
playsound minecraft:ui.button.click player @a ~ ~ ~ 1 1.3

# 自分の持っているC4を起爆する
execute as @e[type=zombie,tag=7R.C4,distance=..100] at @s if score @s 7R.UserID = @p[tag=this] UserID run function asset:artifact/0279.c-4/trigger/explode
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#> asset:artifact/0279.c-4/trigger/explode
#
#
#
# @within function
# asset:artifact/0279.c-4/trigger/detonate
# asset:artifact/0279.c-4/trigger/explode

# 自殺する
kill @s

# おまけでダメージを与える
# 与えるダメージ = 80
data modify storage lib: Argument.Damage set value 80f
# 第一属性
data modify storage lib: Argument.AttackType set value "Physical"
data modify storage lib: Argument.ElementType set value "Fire"
# ダメージ
function lib:damage/modifier
execute as @e[type=#lib:living,type=!player,tag=!Uninterferable,tag=!7R.C4,distance=..5] run function lib:damage/
function lib:damage/reset

# クリーパー召喚
summon creeper ~ ~ ~ {DeathTime:19s,Invulnerable:1b,DeathLootTable:"minecraft:empty",ExplosionRadius:3b,Fuse:0s,Tags:["Uninterferable"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:artifact/0279.c-4/trigger/schedule_team_join
#
#
#
# @within function asset:artifact/0279.c-4/trigger/3.main

# 1tick遅らせてノーコリジョンチームにいれたい
team join NoCollision @e[type=zombie,tag=7R.C4]
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#> asset:artifact/0279.c-4/trigger/wall_check
#
#
#
# @within function asset:artifact/0279.c-4/trigger/4.place

# 着弾したら前方のブロックの中心で6方向にマーカー出す
execute positioned ^ ^ ^0.1 align xyz positioned ~0.5 ~0.5 ~0.5 run summon marker ~ ~ ~1 {Tags:["7R.WallCheker","7R.IsNorth"]}
execute positioned ^ ^ ^0.1 align xyz positioned ~0.5 ~0.5 ~0.5 run summon marker ~1 ~ ~ {Tags:["7R.WallCheker","7R.IsWest"]}

execute positioned ^ ^ ^0.1 align xyz positioned ~0.5 ~0.5 ~0.5 run summon marker ~ ~ ~-1 {Tags:["7R.WallCheker","7R.IsSouth"]}
execute positioned ^ ^ ^0.1 align xyz positioned ~0.5 ~0.5 ~0.5 run summon marker ~-1 ~ ~ {Tags:["7R.WallCheker","7R.IsEast"]}

execute positioned ^ ^ ^0.1 align xyz positioned ~0.5 ~0.5 ~0.5 run summon marker ~ ~1 ~ {Tags:["7R.WallCheker","7R.IsFloor"]}
execute positioned ^ ^ ^0.1 align xyz positioned ~0.5 ~0.5 ~0.5 run summon marker ~ ~-1 ~ {Tags:["7R.WallCheker","7R.IsCeiling"]}
# 一番近いマーカーだけ残して後は殺す。そうすれば現在位置がわかる
kill @e[type=marker,tag=7R.WallCheker,distance=..3,sort=furthest,limit=5]
# C4召喚
execute as @e[type=marker,tag=7R.WallCheker,distance=..3,sort=nearest,limit=1] at @s positioned ~ ~-0.5 ~ run function asset:artifact/0279.c-4/trigger/c4_summon

# もうマーカーはいらないので殺す
kill @e[type=marker,tag=7R.WallCheker,distance=..3]
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/0279.c-4/trigger/1.trigger",
"asset:artifact/0958.whetstone_of_the_gods/trigger/1.trigger",
"asset:artifact/0985.ark_of_the_sanctuary/trigger/1.trigger",
"asset:artifact/0976.brave_sword/trigger/1.trigger",
Expand Down
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/artifact/give.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/0279.c-4/give/1.trigger",
"asset:artifact/0736.sailor_hat/give/1.trigger",
"asset:artifact/0741.abyss_insurance_card/give/1.trigger",
"asset:artifact/1016.sharpened_netherite_sword/give/1.trigger",
Expand Down
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/artifact/load.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/0279.c-4/trigger/0.load",
"asset:artifact/0985.ark_of_the_sanctuary/trigger/0.load",
"asset:artifact/0192.falcios_wand/trigger/0.load",
"asset:artifact/0191.horus_wand/trigger/0.load",
Expand Down