Skip to content
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/1638.tome_of_median/give/1.trigger
#
# 神器の取得処理の呼び出し時に実行されるfunction
#
# @within tag/function asset:artifact/give

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

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

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 1638
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:carrot_on_a_stick"
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text": "メディアントーム", "color": "#3dcd58"}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text": "前方の敵一体を攻撃する。"}', '{"text": "使用時のMP割合が50%に近いほど、"}', '{"text": "与えるダメージが増加する(最大500)。"}']
# 消費アイテム ({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 "mainhand"
# 神器のトリガー (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 [31]
# 攻撃に関する情報 -攻撃タイプ (string[]) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.AttackType set value [Magic]
# 攻撃に関する情報 -攻撃属性 (string[]) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.ElementType set value [None]
# 攻撃に関する情報 -防御無視 (boolean) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.BypassResist set value
# 攻撃に関する情報 -範囲攻撃 (string) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.IsRangeAttack set value "never"
# 攻撃に関する情報 -攻撃範囲 (literal) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.AttackRange set value 6
# 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 40
# 種別クールダウン ({Type: string, Duration: int}) (オプション)
data modify storage asset:artifact TypeCooldown.Type set value "shortRange"
data modify storage asset:artifact TypeCooldown.Duration set value 30
# グローバルクールダウン (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 ["Flora", "Wi-ki"]
# カスタム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/1638.tome_of_median/register
#
# 神器プールへの登録処理
#
# @within tag/function asset:artifact/register

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

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

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

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

# ダメージを消費前の時点で計算しておく
## 500 / (abs(50 - MPRatio) / 3)
#500
scoreboard players set $A1638.Damage Temporary 500

#MPRatio
function api:entity/player/get_mp_per
execute store result score $A1638.MPRatio Temporary run data get storage api: Return.MPPer 100

#MPRatioがちょうど50±2%でないならabs(50 - MPRatio) / 3を計算して500を除算
execute unless score $A1638.MPRatio Temporary matches 48..52 run function asset:artifact/1638.tome_of_median/trigger/calc

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

# ここから先は神器側の効果の処理を書く
#前方のEnemyを候補に
execute positioned ^ ^ ^3 run tag @e[type=#lib:living_without_player,tag=Enemy,tag=!Uninterferable,distance=..3] add A1638.Candidate
#Enemyがいなかったら演出のみ
execute positioned ^ ^ ^3 unless entity @e[type=#lib:living_without_player,tag=Enemy,tag=!Uninterferable,distance=..3] positioned ~ ~1.5 ~ run function asset:artifact/1638.tome_of_median/trigger/fx
#Enemyがいたら視点と距離でターゲットを決める
execute positioned ^ ^ ^1.5 as @e[type=#lib:living_without_player,tag=Enemy,tag=A1638.Candidate,tag=!Uninterferable,distance=..10,sort=nearest,limit=1] at @s run function asset:artifact/1638.tome_of_median/trigger/damage

# リセット
tag @e[type=#lib:living_without_player,tag=A1638.Candidate,distance=..10] remove A1638.Candidate
scoreboard players reset $A1638.Damage
scoreboard players reset $A1638.MPRatio
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:artifact/1638.tome_of_median/trigger/_index.d
# @private

#> Private
# @within function asset:artifact/1638.tome_of_median/trigger/**
#declare score_holder $A1638.Damage
#declare score_holder $A1638.MPRatio
#declare tag A1638.Candidate
Comment thread
firgde marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#> asset:artifact/1638.tome_of_median/trigger/calc
#
#
#
# @within function asset:artifact/1638.tome_of_median/trigger/3.main

#> Private
# @private
#declare score_holder $A1638.50
#declare score_holder $3
#declare score_holder $-3
#declare score_holder $A1638.500

# 50 - MPRatio
scoreboard players set $A1638.50 Temporary 50
scoreboard players operation $A1638.50 Temporary -= $A1638.MPRatio Temporary

# abs(50 - MPRatio) / 3
execute if score $A1638.50 Temporary matches 1.. run scoreboard players operation $A1638.50 Temporary /= $3 Const
execute if score $A1638.50 Temporary matches ..-1 run scoreboard players operation $A1638.50 Temporary /= $-3 Const

# 500を割る
scoreboard players set $A1638.500 Temporary 500
execute store result score $A1638.Damage Temporary run scoreboard players operation $A1638.500 Temporary /= $A1638.50 Temporary

# リセット
scoreboard players reset $A1638.50
scoreboard players reset $A1638.500
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#> asset:artifact/1638.tome_of_median/trigger/damage
#
#
#
# @within function asset:artifact/1638.tome_of_median/trigger/3.main

# 攻撃
execute store result storage api: Argument.Damage double 1.0 run scoreboard players get $A1638.Damage Temporary
data modify storage api: Argument.AttackType set value "Magic"
data modify storage api: Argument.ElementType set value "None"
execute as @p[tag=this] run function api:damage/modifier
function api:damage/
function api:damage/reset

# 演出
execute positioned ~ ~1.5 ~ run function asset:artifact/1638.tome_of_median/trigger/fx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#> asset:artifact/1638.tome_of_median/trigger/fx
#
#
#
# @within function asset:artifact/1638.tome_of_median/trigger/**

# vfx
particle dust 0.1 0.8 0.5 0.75 ~ ~ ~ 0.0 0.75 0.0 0 45
particle end_rod ~ ~ ~ 0.1 0.1 0.1 0.05 15

# sfx
playsound block.enchantment_table.use player @a ~ ~ ~ 1.0 1.0
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/1638.tome_of_median/trigger/1.trigger",
"asset:artifact/1661.starlight_circle/trigger/1.trigger",
"asset:artifact/1662.salmon_canon/trigger/1.trigger",
"asset:artifact/1632.photon_burst/trigger/1.trigger",
Expand Down Expand Up @@ -181,4 +182,4 @@
"asset:artifact/2001.staff_of_the_willless/trigger/1.trigger",
"asset:artifact/0019.scripture/trigger/1.trigger"
]
}
}
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/1638.tome_of_median/give/1.trigger",
"asset:artifact/1360.vintage_wine/give/1.trigger",
"asset:artifact/1661.starlight_circle/give/1.trigger",
"asset:artifact/1390.red_refraction_prism/give/1.trigger",
Expand Down Expand Up @@ -569,4 +570,4 @@
"asset:artifact/0735.collision_plate/give/1.trigger",
"asset:artifact/0745.blade_of_whirlwind/give/1.trigger"
]
}
}
3 changes: 2 additions & 1 deletion 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/1638.tome_of_median/register",
"asset:artifact/1360.vintage_wine/register",
"asset:artifact/1661.starlight_circle/register",
"asset:artifact/1662.salmon_canon/register",
Expand Down Expand Up @@ -338,4 +339,4 @@
"asset:artifact/1027.fire_of_rebirth/register",
"asset:artifact/1111.rod_o_redeem/register"
]
}
}
Loading