Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:artifact/1361.unicorn_horn/give/1.trigger
#
# 神器の取得処理の呼び出し時に実行されるfunction
#
# @within tag/function asset:artifact/give

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

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

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 1361
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:stick"
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text":"ユニコーンのツノ","color":"#d787ff"}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text":"攻撃対象のうちランダムな1体に","color":"white"}','{"text":"属性耐性を無視するランダムな属性のダメージを与える","color":"white"}','{"text":"聖域に棲まう一角の幻獣のツノ","color":"gray"}','{"text":"満ちた神秘の魔力が、敵の守りを容易く貫く","color":"gray"}']
# 消費アイテム ({Item: TextComponent, Count: int, Extra?: TextComponent}) (オプション)
# data modify storage asset:artifact ConsumeItem.Item set value '{"translate":"item.minecraft.stick"}'
# data modify storage asset:artifact ConsumeItem.Count set value 1
# data modify storage asset:artifact ConsumeItem.Extra 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 "onAttack"
# 効果が重複可能か否か (boolean) (オプション)
# data modify storage asset:artifact EnableDuplication set value
# 神器の発動条件 (TextComponentString) (オプション)
data modify storage asset:artifact Condition set value '{"text":"1600以上のダメージを与える","color":"white"}'
# 攻撃に関する情報 -Damage量 (literal[]/literal) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.Damage set value [1000]
# 攻撃に関する情報 -攻撃タイプ (string[]) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.AttackType set value [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 true
# 攻撃に関する情報 -範囲攻撃 (string) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.IsRangeAttack set value "never"
# 攻撃に関する情報 -攻撃範囲 (literal) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.AttackRange set value
# MP消費量 (int)
data modify storage asset:artifact MPCost set value 25
# MP必要量 (int) (オプション)
# data modify storage asset:artifact MPRequire set value
# MP回復量 (int)
# data modify storage asset:artifact MPHealWhenHit set value
# 神器のクールダウン (int) (オプション)
data modify storage asset:artifact LocalCooldown set value 160
# 種別クールダウン ({Type: string, Duration: int}) (オプション)
# data modify storage asset:artifact TypeCooldown.Type set value
# data modify storage asset:artifact TypeCooldown.Duration set value
# 第二種別クールダウン ({Type: string, Duration: int}) (オプション)
# data modify storage asset:artifact SecondaryTypeCooldown.Type set value
# data modify storage asset:artifact SecondaryTypeCooldown.Duration set value
# グローバルクールダウン (int) (オプション)
# data modify storage asset:artifact SpecialCooldown set value
# クールダウンによる使用不可のメッセージを非表示にするか否か (boolean) (オプション)
data modify storage asset:artifact DisableCooldownMessage set value true
# MP不足による使用不可のメッセージを非表示にするか否か (boolean) (オプション)
data modify storage asset:artifact DisableMPMessage set value true
# 破壊時の音を鳴らさないかどうか (boolean) (オプション)
# data modify storage asset:artifact DisableBreakSound set value
# 扱える神 (string[]) Wikiを参照
data modify storage asset:artifact CanUsedGod set value ["Flora", "Nyaptov", "Wi-ki", "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,8 @@
#> asset:artifact/1361.unicorn_horn/register
#
# 神器プールへの登録処理
#
# @within tag/function asset:artifact/register

data modify storage asset:artifact RarityRegistry[4] append value [1361]
data modify storage asset:artifact RarityRegistryWithColor.Red[4] append value [1361]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:artifact/1361.unicorn_horn/trigger/1.trigger
#
# 指定したイベントタイミングで実行されるfunction
#
# @within tag/function asset:artifact/**

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

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

#> Private
# @private
#declare score_holder $MaxDamage
#declare score_holder $RequireDamage

# CanUsedじゃなければreturn
execute if entity @s[tag=!CanUsed] run return fail

# IsDoT:trueならreturn
execute if data storage asset:context Attack{IsDoT:true} run tag @s remove CanUsed
execute if entity @s[tag=!CanUsed] run return fail

# Victimがいなければreturn
execute unless entity @e[type=#lib:living_without_player,tag=Victim,distance=..64,limit=1] run tag @s remove CanUsed
execute if entity @s[tag=!CanUsed] run return fail

# 最大ダメージが要求ダメージ以上か?
scoreboard players set $RequireDamage Temporary 16000
execute store result score $MaxDamage Temporary run data get storage asset:context Attack.Amount 10
execute unless score $MaxDamage Temporary >= $RequireDamage Temporary run tag @s remove CanUsed
scoreboard players reset $RequireDamage Temporary
scoreboard players reset $MaxDamage Temporary
execute if entity @s[tag=!CanUsed] run return fail

# 3.main.mcfunctionを実行する
function asset:artifact/1361.unicorn_horn/trigger/3.main
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#> asset:artifact/1361.unicorn_horn/trigger/3.main
#
# 神器のメイン処理部
#
# @within function asset:artifact/1361.unicorn_horn/trigger/2.check_condition

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

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

# check_conditionで判定したTempTargetの中でランダムな1体を攻撃対象とする

# Victimのうちランダムな対象1体を指定して実行
execute as @e[type=#lib:living_without_player,tag=Victim,distance=..64,sort=random,limit=1] at @s run function asset:artifact/1361.unicorn_horn/trigger/as_target
Comment thread
Lapis-LJA marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#> asset:artifact/1361.unicorn_horn/trigger/as_target
#
#
#
# @within function asset:artifact/1361.unicorn_horn/trigger/3.main

#> Private
# @private
#declare score_holder $Random

# 演出
execute anchored eyes positioned ^ ^ ^ run function asset:artifact/1361.unicorn_horn/trigger/vfx

# 属性をランダムに指定する
execute store result score $Random Temporary run random value 0..3
execute if score $Random Temporary matches 0 run data modify storage api: Argument.ElementType set value "None"
execute if score $Random Temporary matches 1 run data modify storage api: Argument.ElementType set value "Fire"
execute if score $Random Temporary matches 2 run data modify storage api: Argument.ElementType set value "Water"
execute if score $Random Temporary matches 3 run data modify storage api: Argument.ElementType set value "Thunder"

# 敵の属性耐性のみを無視するダメージ
data modify storage api: Argument.Damage set value 1000f
data modify storage api: Argument.AttackType set value "Magic"
execute as @p[tag=this] run function api:damage/modifier
data modify storage api: Argument.BypassModifier set value true
function api:damage/
function api:damage/reset

# リセット
scoreboard players reset $Random Temporary
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset:artifact/1361.unicorn_horn/trigger/vfx
#
#
#
# @within function asset:artifact/1361.unicorn_horn/trigger/as_target

# 演出
particle dust 1 0.4 1 0.6 ~ ~ ~ 0 2 0 0 160 normal @a
particle dragon_breath ~ ~ ~ 0 0 0 0.4 20 normal @a
playsound minecraft:entity.allay.ambient_without_item player @a ~ ~ ~ 0.8 1.1
playsound minecraft:entity.arrow.hit_player player @a ~ ~ ~ 0.4 1.2
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/artifact/attack.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/1361.unicorn_horn/trigger/1.trigger",
"asset:artifact/1308.magnifier_of_detective_girl/trigger/1.trigger",
"asset:artifact/1109.black_lily_of_priestess/trigger/1.trigger",
"asset:artifact/1363.hydra_fang/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/1361.unicorn_horn/give/1.trigger",
"asset:artifact/1306.will_o_wisp/give/1.trigger",
"asset:artifact/1308.magnifier_of_detective_girl/give/1.trigger",
"asset:artifact/1109.black_lily_of_priestess/give/1.trigger",
Expand Down
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/artifact/register.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/1361.unicorn_horn/register",
"asset:artifact/1306.will_o_wisp/register",
"asset:artifact/1308.magnifier_of_detective_girl/register",
"asset:artifact/1109.black_lily_of_priestess/register",
Expand Down
Loading