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

[神器258] 猫の夢見枕の作成 #320

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

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

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

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 258
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:carrot_on_a_stick"
data modify storage asset:artifact Item set value "minecraft:stick"
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text":"ちぇん氏の夢枕","color":"light_purple"}'
data modify storage asset:artifact Name set value '{"text":"猫の夢見枕","color":"#F8CEF5"}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text":"「あぁ~ためになる~」"}']
data modify storage asset:artifact Lore set value ['{"text":"回復対象に回復量の30%分のバリアを付与する。"}','{"text":"猫の意匠が施された枕。","color":"gray"}','{"text":"この枕で眠ると猫に囲まれる夢を見る。","color":"gray"}']
# MP以外の消費物 (TextComponentString) (オプション)
# data modify storage asset:artifact CostText set value
# 使用回数 (int) (オプション)
data modify storage asset:artifact RemainingCount set value 1
# data modify storage asset:artifact RemainingCount set value
# 神器を発動できるスロット (string) Wikiを参照
data modify storage asset:artifact Slot set value "auto"
data modify storage asset:artifact Slot set value "hotbar"
# 神器のトリガー (string) Wikiを参照
data modify storage asset:artifact Trigger set value "onClick"
data modify storage asset:artifact Trigger set value "onHeal"
# 神器の発動条件 (TextComponentString) (オプション)
# data modify storage asset:artifact Condition set value
# 攻撃に関する情報 -Damage量 (literal[]/literal) Wikiを参照 (オプション)
Expand All @@ -39,21 +39,21 @@
# 攻撃に関する情報 -攻撃範囲 (literal) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.AttackRange set value
# MP消費量 (int)
data modify storage asset:artifact MPCost set value 0
data modify storage asset:artifact MPCost set value 12
# MP必要量 (int) (オプション)
# data modify storage asset:artifact MPRequire set value
# 神器のクールダウン (int) (オプション)
# data modify storage asset:artifact LocalCooldown set value
data modify storage asset:artifact LocalCooldown set value 200
# グローバルクールダウン (int) (オプション)
# data modify storage asset:artifact SpecialCooldown set value
# クールダウンによる使用不可のメッセージを非表示にするか否か (boolean) (オプション)
# data modify storage asset:artifact DisableCooldownMessage set value
data modify storage asset:artifact DisableCooldownMessage set value true
# MP不足による使用不可のメッセージを非表示にするか否か (boolean) (オプション)
# data modify storage asset:artifact DisableMPMessage set value
data modify storage asset:artifact DisableMPMessage set value true
# 扱える神 (string[]) Wikiを参照
data modify storage asset:artifact CanUsedGod set value ["Nyaptov"]
data modify storage asset:artifact CanUsedGod set value ["Nyaptov", "Rumor"]
# カスタムNBT (NBTCompound) 追加で指定したいNBT (オプション)
# data modify storage asset:artifact CustomNBT set value {}

# 神器の入手用function
function asset:artifact/common/give
function asset:artifact/common/give
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#> asset:artifact/0258.chen_dream_pillow/register
#> asset:artifact/0258.cat_dream_pillow/register
#
# 神器プールへの登録処理
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#> asset:artifact/0258.chen_dream_pillow/trigger/1.trigger
#> asset:artifact/0258.cat_dream_pillow/trigger/1.trigger
#
# 指定したイベントタイミングで実行されるfunction
#
# @within tag/function asset:artifact/**

# storage asset:idのauto/feet/legs/chest/head/mainhand/offhandに装備している神器のIDが入っているので比較し、~/2.check_condition.mcfunctionを実行する
execute if data storage asset:context id{auto:258} run function asset:artifact/0258.chen_dream_pillow/trigger/2.check_condition
execute if data storage asset:context id{hotbar:[258]} run function asset:artifact/0258.cat_dream_pillow/trigger/2.check_condition
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#> asset:artifact/0258.cat_dream_pillow/trigger/2.check_condition
#
# 神器の発動条件をチェックします
#
# @within function asset:artifact/0258.cat_dream_pillow/trigger/1.trigger

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

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

# 基本的な使用時の処理(MP消費や使用回数の処理など)を行う auto/feet/legs/chest/head/mainhand/offhandを記載してね
function asset:artifact/common/use/hotbar

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

#> Private
# @private
#declare score_holder $Random

# 演出
particle dust 1000000000 -0.3 -0.2 1 ~ ~1.2 ~ 0.8 0.4 0.8 0 50

# 乱数生成
execute store result score $Random Temporary run function lib:random/
scoreboard players operation $Random Temporary %= $3 Const

# playsound
execute if score $Random Temporary matches 0 run playsound entity.cat.ambient player @a ~ ~ ~ 1 1 0
execute if score $Random Temporary matches 1 run playsound entity.cat.purreow player @a ~ ~ ~ 1 1 0
execute if score $Random Temporary matches 2 run playsound entity.cat.stray_ambient player @a ~ ~ ~ 1 1 0

# ToとAmountsをコピー
data modify storage asset:temp Temp.To set from storage asset:context Heal.To
data modify storage asset:temp Temp.Amounts set from storage asset:context Heal.Amounts

# 回復対象へそれぞれの回復量の30%分のバリアを付与
function asset:artifact/0258.cat_dream_pillow/trigger/give_barrier

# リセット
scoreboard players reset $TempUserID Temporary
scoreboard players reset $Random Temporary
scoreboard players reset $BarrierAmount Temporary
scoreboard players reset $CurrentBarrier Temporary
scoreboard players reset $MaxHP30Per Temporary
data remove storage asset:temp Temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> asset:artifact/0258.cat_dream_pillow/trigger/_index.d
# @private

#> tag
# @within function asset:artifact/0258.cat_dream_pillow/trigger/**
#declare score_holder $TempUserID
#declare score_holder $BarrierAmount
#declare score_holder $CurrentBarrier
#declare tag BarrierTarget
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#> asset:artifact/0258.cat_dream_pillow/trigger/give_barrier
#
# バリアをプレイヤーに再帰で付与していく
#
# @within function
# asset:artifact/0258.cat_dream_pillow/trigger/3.main
# asset:artifact/0258.cat_dream_pillow/trigger/give_barrier

# このmcf実行前にHeal.To[]とHeal.Amounts[]をコピーする
# Temp.To[]の最後尾のUserIDのプレイヤーに、Temp.Amounts[]の最後尾の値の30%のバリアを付与する
# ↑が終わったらTemp.To[]とTemp.Amountsの最後尾の要素を削除し、要素が残っていれば再帰する

# UserIDを取得
execute store result score $TempUserID Temporary run data get storage asset:temp Temp.To[-1]

# Amountsの30%の10倍を取得 代入する際に0.1倍にする
execute store result score $BarrierAmount Temporary run data get storage asset:temp Temp.Amounts[-1] 3

# 該当プレイヤーにTagをつけておく
execute at @a if score $TempUserID Temporary = @p UserID run tag @p add BarrierTarget

# 演出 使用者には演出を出さない
execute at @p[tag=BarrierTarget,tag=!this] run particle dust 1000000000 -0.3 -0.2 1 ~ ~1.2 ~ 0.8 0.4 0.8 0 50

# 現在のバリアの数値を取得
data modify storage api: Argument.UUID set value [I;1,3,267,0]
function api:entity/player/absorption/get
execute store result score $CurrentBarrier Temporary run data get storage api: Return.Absorption.Amount 10

# 付与するバリア数値 < 現在バリア数値ならTagを削除
execute if score $BarrierAmount Temporary < $CurrentBarrier Temporary run tag @p[tag=BarrierTarget] remove BarrierTarget

# バリア数値をフィールドへ代入
execute store result storage api: Argument.FieldOverride.Barrier double 0.1 run scoreboard players get $BarrierAmount Temporary

# バリア用エフェクトを付与
data modify storage api: Argument.ID set value 267
execute as @p[tag=BarrierTarget] run function api:entity/mob/effect/give

# Tagを削除
tag @p[tag=BarrierTarget] remove BarrierTarget

# 配列の最後尾の要素を削除
data remove storage asset:temp Temp.To[-1]
data remove storage asset:temp Temp.Amounts[-1]

# 要素がまだあれば再帰
execute if data storage asset:temp Temp.To[-1] run function asset:artifact/0258.cat_dream_pillow/trigger/give_barrier

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0267.dreaming_veil/_/end
#
# Effectの効果の終了時に実行されるfunction
#
# @within tag/function asset:effect/end

execute if data storage asset:context {id:267} run function asset:effect/0267.dreaming_veil/end/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0267.dreaming_veil/_/given
#
# Effectが付与された時に実行されるfunction
#
# @within tag/function asset:effect/given

execute if data storage asset:context {id:267} run function asset:effect/0267.dreaming_veil/given/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0267.dreaming_veil/_/re-given
#
# Effectが上書きされた時に実行されるfunction
#
# @within tag/function asset:effect/re-given

execute if data storage asset:context {id:267} run function asset:effect/0267.dreaming_veil/re-given/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0267.dreaming_veil/_/register
#
#
#
# @within tag/function asset:effect/register

execute if data storage asset:context {id:267} run function asset:effect/0267.dreaming_veil/register
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0267.dreaming_veil/_/remove
#
# Effectが神器や牛乳によって削除された時に実行されるfunction
#
# @within tag/function asset:effect/remove

execute if data storage asset:context {id:267} run function asset:effect/0267.dreaming_veil/remove/
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#> asset:effect/0267.dreaming_veil/_index.d
# @private

#> 0267.dreaming_veil
# @within function asset:effect/0267.dreaming_veil/**
#declare
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#> asset:effect/0267.dreaming_veil/barrier/add
#
# バリアを付与する
#
# @within function
# asset:effect/0267.dreaming_veil/given/
# asset:effect/0267.dreaming_veil/re-given/

# フィールドからバリア量を取得
data modify storage api: Argument.Amount set from storage asset:context this.Barrier

# バリア設定
data modify storage api: Argument.UUID set value [I;1,3,267,0]
data modify storage api: Argument.Priority set value 1
data modify storage api: Argument.WipedCallback set value "asset:effect/0267.dreaming_veil/remove/"
function api:entity/player/absorption/add
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset:effect/0267.dreaming_veil/barrier/remove
#
# バリアを削除する
#
# @within function
# asset:effect/0267.dreaming_veil/end/
# asset:effect/0267.dreaming_veil/remove/

# バリアを削除する
data modify storage api: Argument.UUID set value [I;1,3,267,0]
function api:entity/player/absorption/remove
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:effect/0267.dreaming_veil/end/
#
# Effectの効果が切れた時の処理
#
# @within function asset:effect/0267.dreaming_veil/_/end

# バリアを削除する
function asset:effect/0267.dreaming_veil/barrier/remove
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:effect/0267.dreaming_veil/given/
#
# Effectが付与された時の処理
#
# @within function asset:effect/0267.dreaming_veil/_/given

# バリアを付与する
function asset:effect/0267.dreaming_veil/barrier/add
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:effect/0267.dreaming_veil/re-given/
#
# Effectが上書きされた時の処理
#
# @within function asset:effect/0267.dreaming_veil/_/re-given

# バリアを付与する
function asset:effect/0267.dreaming_veil/barrier/add
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#> asset:effect/0267.dreaming_veil/register
#
# Effectのデータを指定
#
# @within function asset:effect/0267.dreaming_veil/_/register

# ExtendsSafe (boolean) (default = false)
# data modify storage asset:effect ExtendsSafe set value true
# ID (int)
data modify storage asset:effect ID set value 267
# 名前 (TextComponentString)
data modify storage asset:effect Name set value '{"text":"夢見の護り","color":"light_purple"}'
# 説明文 (TextComponentString[])
data modify storage asset:effect Description set value ['{"text":"ダメージを吸収する","color":"white"}']
# 効果時間 (int) (default = API || error)
data modify storage asset:effect Duration set value 600
# スタック (int) (default = API || 1)
# data modify storage asset:effect Stack set value
# 効果時間の操作方法 (default = API || "replace")
# data modify storage asset:effect DurationOperation set value
# スタックの操作方法 (default = API || "replace")
# data modify storage asset:effect StackOperation set value
# 最大効果時間 (int) (default = 2147483647)
# data modify storage asset:effect MaxDuration set value
# 最大スタック (int) (default = 2147483647)
data modify storage asset:effect MaxStack set value 1
# 悪い効果か否か (boolean)
data modify storage asset:effect IsBadEffect set value false
# 死亡時のエフェクトの処理 (default = "remove")
# data modify storage asset:effect ProcessOnDied set value
# 消すのに必要なレベル (int) (default = 1)
data modify storage asset:effect RequireClearLv set value 3

# フィールド
# data modify storage asset:effect Field set value {}
Loading
Loading