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

[神器1122]守護者の鉄塊を作成 #327

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

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

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

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 1122
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:stick"
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text":"守護者の鉄塊"}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text":"守護者が遺した鎧の一部","color":"gray"}','{"text":"揺るぎ無き守護の意志が感じられる","color":"gray"}','{"text":"防御力+3 ノックバック耐性+99 全属性耐性+5%","color":"green"}']
# 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 "hotbar"
# 神器のトリガー (string) Wikiを参照
data modify storage asset:artifact Trigger set value "equipping"
# 効果が重複可能か否か (boolean) (オプション)
# data modify storage asset:artifact EnableDuplication set value
# 神器の発動条件 (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 0
# 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
# 破壊時の音を鳴らさないかどうか (boolean) (オプション)
# data modify storage asset:artifact DisableBreakSound set value
# 扱える神 (string[]) Wikiを参照
data modify storage asset:artifact CanUsedGod set value "ALL"
# カスタム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,8 @@
#> asset:artifact/1122.guardian_ironlump/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{hotbar:[1122]} run function asset:artifact/1122.guardian_ironlump/trigger/2.check_condition
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#> asset:artifact/1122.guardian_ironlump/trigger/2.check_condition
#
# 神器の発動条件をチェックします
#
# @within function asset:artifact/1122.guardian_ironlump/trigger/1.trigger

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

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

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

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

# リセット処理
function asset:artifact/1122.guardian_ironlump/trigger/removal

attribute @s minecraft:generic.armor modifier add 1-0-1-0-46200000007 "1122" 3 add
attribute @s minecraft:generic.knockback_resistance modifier add 1-0-1-0-46200000007 "1122" 99 add

# 防御力+5%
data modify storage api: Argument.UUID set value [I;1,1,1122,7]
data modify storage api: Argument.Amount set value 0.05
data modify storage api: Argument.Operation set value "multiply_base"
function api:modifier/defense/base/add

# 演出
particle block iron_block ~ ~1 ~ 0.3 0.3 0.3 0 20
playsound entity.iron_golem.death player @a ~ ~ ~ 1 2
playsound minecraft:entity.skeleton.converted_to_stray player @a ~ ~ ~ 1 0
playsound ogg:block.smithing_table.smithing_table2 player @a ~ ~ ~ 1 1
playsound minecraft:item.armor.equip_iron player @a ~ ~ ~ 1 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:artifact/1122.guardian_ironlump/trigger/dis_equip/
#
# 装備を外した時に外した部位にのみのidが入った状態でトリガーされる
#
# @within tag/function asset:artifact/dis_equip

execute if data storage asset:context id{hotbar:[1122]} run function asset:artifact/1122.guardian_ironlump/trigger/dis_equip/main
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#> asset:artifact/1122.guardian_ironlump/trigger/dis_equip/main
#
# 装備を外した時のメイン処理
#
# @within function asset:artifact/1122.guardian_ironlump/trigger/dis_equip/

#> private
# @private
#declare score_holder $ItemCount

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

# 神器ID930がホットバー内にあるか確認する。
execute store result score $ItemCount Temporary if data storage asset:context New.Items.hotbar[{tag:{TSB:{ID:1122}}}]

# ホットバー内に残ってない場合、削除する。
execute if score $ItemCount Temporary matches ..0 run function asset:artifact/1122.guardian_ironlump/trigger/removal

# リセット
scoreboard players reset $ItemCount Temporary
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#> asset:artifact/1122.guardian_ironlump/trigger/removal
#
#
#
# @within function
# asset:artifact/1122.guardian_ironlump/trigger/3.main
# asset:artifact/1122.guardian_ironlump/trigger/dis_equip/main

# attribute削除
attribute @s minecraft:generic.armor modifier remove 1-0-1-0-46200000007
attribute @s minecraft:generic.attack_knockback modifier remove 1-0-1-0-46200000007

# 防御力+5%
data modify storage api: Argument.UUID set value [I;1,1,1122,6]
function api:modifier/defense/base/remove
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/artifact/dis_equip.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/1122.guardian_ironlump/trigger/dis_equip/",
"asset:artifact/1032.life_charm/trigger/dis_equip/",
"asset:artifact/0667.soul_fire_armor/trigger/dis_equip/",
"asset:artifact/0666.soul_fire_armor/trigger/dis_equip/",
Expand Down
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/artifact/equip.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/1122.guardian_ironlump/trigger/1.trigger",
"asset:artifact/1032.life_charm/trigger/1.trigger",
"asset:artifact/0667.soul_fire_armor/trigger/1.trigger",
"asset:artifact/0666.soul_fire_armor/trigger/1.trigger",
Expand Down
3 changes: 2 additions & 1 deletion 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/1122.guardian_ironlump/give/1.trigger",
"asset:artifact/0002.blessing/give/1.trigger",
"asset:artifact/1108.white_lily_of_priestess/give/1.trigger",
"asset:artifact/1106.rainbow_candy/give/1.trigger",
Expand Down Expand Up @@ -381,4 +382,4 @@
"asset:artifact/0735.collision_plate/give/1.trigger",
"asset:artifact/0745.blade_of_whirlwind/give/1.trigger"
]
}
}
Loading