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

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

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

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 1677
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:carrot_on_a_stick"
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text":"金木犀のタクト","color":"#E8A33D"}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text":"金木犀の力が込められたタクト"}','{"text":"使用時、敵に当たるとはじける魔法を放ち"}','{"text":"当たった敵の内3体が1.5秒後に小さく爆発する"}','{"text":"この爆発のダメージと回復するMP量は元の50%になる"}']
# 消費アイテム ({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 40
# 攻撃に関する情報 -攻撃タイプ (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 "every"
# 攻撃に関する情報 -攻撃範囲 (literal) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.AttackRange set value 15
# MP消費量 (int)
#data modify storage asset:artifact MPCost set value
# MP必要量 (int) (オプション)
# data modify storage asset:artifact MPRequire set value
# MP回復量 (int)
data modify storage asset:artifact MPHealWhenHit set value 6
# 神器のクールダウン (int) (オプション)
# data modify storage asset:artifact LocalCooldown set value
# 種別クールダウン ({Type: string, Duration: int}) (オプション)
data modify storage asset:artifact TypeCooldown.Type set value "longRange"
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 ["Wi-ki", "Flora", "Nyaptov"]
# カスタム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/1677.osmanthus_takt/register
#
# 神器プールへの登録処理
#
# @within tag/function asset:artifact/register

data modify storage asset:artifact RarityRegistry[2] append value [1677]
data modify storage asset:artifact RarityRegistryWithColor.Red[2] append value [1677]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:artifact/1677.osmanthus_takt/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:1677} run function asset:artifact/1677.osmanthus_takt/trigger/2.check_condition
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#> asset:artifact/1677.osmanthus_takt/trigger/2.check_condition
#
# 神器の発動条件をチェックします
#
# @within function asset:artifact/1677.osmanthus_takt/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/1677.osmanthus_takt/trigger/3.main
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#> asset:artifact/1677.osmanthus_takt/trigger/3.main
#
# 神器のメイン処理部
#
# @within function asset:artifact/1677.osmanthus_takt/trigger/2.check_condition

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

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

# 演出
playsound minecraft:block.note_block.chime player @a ~ ~ ~ 1.0 2 0.0
playsound minecraft:block.note_block.chime player @a ~ ~ ~ 1.0 1.8 0.0
playsound minecraft:entity.arrow.hit_player player @a ~ ~ ~ 1.0 1.6 0.0
playsound minecraft:entity.arrow.hit_player player @a ~ ~ ~ 1.0 1.8 0.0
playsound entity.illusioner.cast_spell player @a ~ ~ ~ 0.6 1.8
particle dust 1 0.75 0.2 1 ~ ~1 ~ 0.3 0.3 0.3 0 15 normal @a

# 召喚
# 一回目の爆発のダメージ
data modify storage api: Argument.FieldOverride.Damage set value 40d
# 二回目の爆発の威力(ダメージ・MP回復量に掛ける割合 %)
data modify storage api: Argument.FieldOverride.SecondRate set value 50
# 二回目の爆発の半径(m)
data modify storage api: Argument.FieldOverride.SecondRadius set value 1.0d
# 金木犀の香りが爆発するまでの時間(tick)
data modify storage api: Argument.FieldOverride.DebuffDuration set value 30
# 金木犀の香りを付与する敵の最大数
data modify storage api: Argument.FieldOverride.MaxDebuffTargets set value 3
# 一回目の爆発によるMP回復量
data modify storage api: Argument.FieldOverride.MPHeal set from storage api: PersistentArgument.AdditionalMPHeal
execute store result storage api: Argument.FieldOverride.UserID int 1 run scoreboard players get @s UserID
data modify storage api: Argument.ID set value 1208
execute anchored eyes positioned ^ ^-0.3 ^0.3 run function api:object/summon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0421.osmanthus_scent/_/end
#
# Effectの効果の終了時に実行されるfunction
#
# @within tag/function asset:effect/end

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

execute if data storage asset:context {id:421} run function asset:effect/0421.osmanthus_scent/re-given/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0421.osmanthus_scent/_/register
#
# Effectのデータ登録時に実行されるfunction
#
# @within tag/function asset:effect/register

execute if data storage asset:context {id:421} run function asset:effect/0421.osmanthus_scent/register
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0421.osmanthus_scent/_/tick
#
# Effectが発動している間毎tick実行されるfunction
#
# @within tag/function asset:effect/tick

execute if data storage asset:context {id:421} run function asset:effect/0421.osmanthus_scent/tick/
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#> asset:effect/0421.osmanthus_scent/detonate/
#
# 付与先の位置で演出を行い、攻撃者のプレイヤーを実行者にしてSecondRadiusの範囲の敵を攻撃する
#
# @within function
# asset:effect/0421.osmanthus_scent/end/
# asset:effect/0421.osmanthus_scent/re-given/

#> Private
# @private
#declare score_holder $UserID

# 演出
particle dust 1 0.75 0.2 1.2 ~ ~0.8 ~ 0.6 0.5 0.6 0 25 normal @a
particle minecraft:wax_on ~ ~0.8 ~ 0 0 0 15 40 normal @a
particle composter ~ ~0.8 ~ 0.6 0.5 0.6 0 20 normal @a
playsound block.amethyst_block.break player @a ~ ~ ~ 0.8 1.6

# 攻撃者のプレイヤーを実行者にして爆発させる
execute store result score $UserID Temporary run data get storage asset:temp 421.Field.UserID
execute as @a if score @s UserID = $UserID Temporary run function asset:effect/0421.osmanthus_scent/detonate/explode.m with storage asset:temp 421.Field

# リセット
scoreboard players reset $UserID Temporary
data remove storage asset:temp 421
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#> asset:effect/0421.osmanthus_scent/detonate/explode.m
#
# 付与先の半径SecondRadiusの敵へ、元のダメージとMP回復量にSecondRate%を掛けた値で攻撃する
#
# @input args:
# SecondRadius : double
# @within function asset:effect/0421.osmanthus_scent/detonate/

#> Private
# @private
#declare score_holder $Rate
#declare score_holder $Damage
#declare score_holder $MPHeal

# ダメージ
# SecondRate%攻撃力を下げて攻撃
execute store result score $Rate Temporary run data get storage asset:temp 421.Field.SecondRate
execute store result score $Damage Temporary run data get storage asset:temp 421.Field.Damage 100
scoreboard players operation $Damage Temporary *= $Rate Temporary
execute store result storage api: Argument.Damage double 0.0001 run scoreboard players get $Damage Temporary
data modify storage api: Argument.AttackType set value "Magic"
data modify storage api: Argument.ElementType set value "None"
execute store result score $MPHeal Temporary run data get storage asset:temp 421.Field.MPHeal 100
scoreboard players operation $MPHeal Temporary *= $Rate Temporary
execute store result storage api: Argument.AdditionalMPHeal double 0.0001 run scoreboard players get $MPHeal Temporary
#reset
scoreboard players reset $Rate Temporary
scoreboard players reset $Damage Temporary
scoreboard players reset $MPHeal Temporary
function api:damage/modifier
function api:damage/single_damage_session/open
$execute as @e[type=#lib:living_without_player,tag=Enemy,tag=!Uninterferable,distance=..$(SecondRadius)] run function api:damage/
function api:damage/single_damage_session/close
function api:damage/reset
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> asset:effect/0421.osmanthus_scent/end/
#
# Effectの効果が切れた時の処理
#
# @within function asset:effect/0421.osmanthus_scent/_/end

# 爆発
data modify storage asset:temp 421.Field set from storage asset:context this
function asset:effect/0421.osmanthus_scent/detonate/
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#> asset:effect/0421.osmanthus_scent/re-given/
#
# Effectが上書きされた時の処理
#
# @within function asset:effect/0421.osmanthus_scent/_/re-given

# 爆発
# 先に香りを付けたプレイヤーの攻撃として扱うため、上書き前のFieldで爆発させる
data modify storage asset:temp 421.Field set from storage asset:context PreviousField
function asset:effect/0421.osmanthus_scent/detonate/

@tatuharu tatuharu Oct 26, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

再付与のときの爆発は再付与した側のプレイヤーの攻撃として処理されます。

re-given の実行中、asset:context this は今回の FieldOverride を反映した新しいFieldで、それまでのFieldは PreviousField に入ります(本体の asset_manager:effect/give/make_effect_data と asset_manager:effect/process.m)。detonate/ は this.UserID・this.Damage・this.MPHeal を読むので、次のようになります。

  • プレイヤーAの弾で香りが付いた敵に、1.5秒以内にプレイヤーBの弾が当たると、そのtickにBの攻撃として爆発します。この爆発の攻撃補正とMP回復はBに適用されます
  • DurationOperationの既定値 replace は長いほうの残り時間を採るので、再付与では効果は消えず、残り時間は30tickに戻ります。その30tick後に、もう一度Bの攻撃として爆発します。Aの攻撃としての爆発は起きません

先に香りを付けたプレイヤーの爆発として扱うなら、re-given では PreviousField の値で爆発させる必要があります。

検証用サーバー(Minecraft 1.20.4、このPRの head c42c26d)で確かめました。プレイヤーA(UserID 1)の弾が当たった敵に、10tick後にプレイヤーB(UserID 2)の弾を当てると、そのtickに再付与の爆発が起き、Effectの Field.UserID は2、残り時間は30tickになりました。この爆発と30tick後の爆発は、どちらも敵の MobEvents.Hurt の From が2で、MP回復と ArtifactEvents.Attack もBに入り、Aだけに付けた攻撃補正(2倍)はダメージに掛かりませんでした。Aの弾だけを当てた対照では30tick後にAの攻撃として爆発しましたが、Bの弾も当てたときはAの攻撃としての爆発は起きませんでした。弾は神器の右クリックを通さず、3.main と同じFieldOverrideでプレイヤーの目の位置から api:object/summon で召喚し、MPの自然回復は止めています。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

未解消です。

7f08d7f5bで、re-givenの爆発のダメージ・MP回復量・範囲はasset:temp 421.Field(re-givenではPreviousFieldをコピーしたもの)から読むようになりました。ただ、爆発の実行者を決めるdetonate/.mcfunctionの20行目はasset:context this.UserIDを読んだままです。re-givenの実行中のthisは再付与したプレイヤーのFieldなので、爆発は今も再付与したプレイヤーの攻撃として処理されます。

検証用サーバー(Minecraft 1.20.4、このPRのhead e6fda5f)で、前回と同じ手順を流しました。プレイヤーA(UserID 1)の弾が当たった敵に、10tick後にプレイヤーB(UserID 2)の弾を当てると、再付与の爆発はMobEvents.HurtのFromが2で、MP回復とArtifactEvents.AttackもBに入り、Aだけに付けた攻撃補正(2倍)は掛かりませんでした(ダメージ19.68。Aの弾だけを当てた対照の爆発は39.36)。

20行目をexecute store result score $UserID Temporary run data get storage asset:temp 421.Field.UserIDに変えた作業コピーで同じ手順を流すと、再付与の爆発はFromが1でダメージ39.36になり、MP回復とArtifactEvents.AttackもAに入りました。その30tick後の効果終了の爆発は、Bの攻撃(Fromが2、ダメージ19.68)でした。


Generated by Claude Code

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正を確認しました。

21963d613で、detonate/.mcfunctionの20行目がasset:temp 421.Field.UserIDを読むようになりました。end/もre-given/もdetonate/を呼ぶ前にasset:temp 421.FieldへFieldをコピーしているので、再付与では上書き前のFieldのUserIDが使われます。

検証用サーバー(Minecraft 1.20.4、このPRのhead 21963d6)で、前回と同じ手順を流しました。プレイヤーA(UserID 1)の弾が当たった敵に、10tick後にプレイヤーB(UserID 2)の弾を当てると、再付与の爆発はMobEvents.HurtのFromが1で、Aだけに付けた攻撃補正(2倍)が掛かったダメージ39.36になり、MP回復とArtifactEvents.AttackもAに入りました。そのあと効果が切れたときの爆発は、Bの攻撃(Fromが2、ダメージ19.68)でした。


Generated by Claude Code

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#> asset:effect/0421.osmanthus_scent/register
#
# Effectのデータを指定
#
# @within function asset:effect/0421.osmanthus_scent/_/register

# ExtendsSafe (boolean) (default = false)
# data modify storage asset:effect ExtendsSafe set value true
# ID (int)
data modify storage asset:effect ID set value 421
# 名前 (TextComponentString)
data modify storage asset:effect Name set value '{"text":"金木犀の香り","color":"#E8A33D"}'
# 説明文 (TextComponentString[])
data modify storage asset:effect Description set value ['{"text":"効果終了時に周囲の敵に魔法ダメージを与える"}']
# 効果時間 (int) (default = API || error)
# data modify storage asset:effect Duration set value
# スタック (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 true
# 死亡時のエフェクトの処理 (default = "remove")
# data modify storage asset:effect ProcessOnDied set value
# 消すのに必要なレベル (int) (default = 1)
data modify storage asset:effect RequireClearLv set value 3
# エフェクトをUIに表示するか (boolean) (default = true)
data modify storage asset:effect Visible set value false
# エフェクトのスタックををUIに表示するか (boolean) (default = true)
data modify storage asset:effect StackVisible set value false

# フィールド
data modify storage asset:effect Field.Damage set value 1
data modify storage asset:effect Field.MPHeal set value 1
data modify storage asset:effect Field.UserID set value -1
data modify storage asset:effect Field.SecondRate set value 50
data modify storage asset:effect Field.SecondRadius set value 1.0d
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:effect/0421.osmanthus_scent/tick/
#
# Effectのtick処理
#
# @within function asset:effect/0421.osmanthus_scent/_/tick

# 演出
particle dust 1 0.75 0.2 1 ~ ~0.8 ~ 0.3 0.5 0.3 0 1 normal @a
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#> asset:object/1208.osmanthus_scent/_index.d
# @private

#> score_holder
# @within function asset:object/1208.osmanthus_scent/kill/**
#declare score_holder $BodyID

#> tag
# @within function asset:object/1208.osmanthus_scent/kill/**
#declare tag 1208.DebuffTarget
#declare tag 1208.Grouped
#declare tag 1208.SameBody
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/1208.osmanthus_scent/detect_hit_block/
#
# 進行方向のブロックとの接触を判定する
#
# @within asset:object/alias/1208/detect_hit_block

# 判定
execute unless block ^ ^ ^0.5 #lib:no_collision/ run data modify storage asset:context IsHitBlock set value true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/1208.osmanthus_scent/detect_hit_entity/
#
# 敵との接触を判定する
#
# @within asset:object/alias/1208/detect_hit_entity

# 判定
execute positioned ~-0.5 ~-0.5 ~-0.5 if entity @e[type=#lib:living_without_player,tag=Enemy,tag=!Uninterferable,dx=0] run data modify storage asset:context IsHitEntity set value true
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#> asset:object/1208.osmanthus_scent/kill/
#
# 現在位置で攻撃判定を発生させて消滅する
# 敵・ブロックへの接触と射程限界の各経路から呼ばれる
#
# @within asset:object/alias/1208/kill

#> Private
# @private
#declare score_holder $UserID

# 演出
particle dust 1 0.75 0.2 1.5 ~ ~ ~ 0.8 0.8 0.8 0 40 normal @a
particle minecraft:wax_on ~ ~ ~ 0.8 0.8 0.8 5 50 normal @a
particle end_rod ~ ~ ~ 0 0 0 0.2 15 normal @a
particle minecraft:dripping_lava ~ ~ ~ 0.9 0.8 0.9 0 40 normal @a
playsound block.amethyst_block.break player @a ~ ~ ~ 1 1.4
playsound block.amethyst_block.break player @a ~ ~ ~ 1 1.2

# 攻撃者のプレイヤーを実行者にして攻撃する
execute store result score $UserID Temporary run data get storage asset:context this.UserID
execute as @a if score @s UserID = $UserID Temporary run function asset:object/1208.osmanthus_scent/kill/attack.m with storage asset:context this
scoreboard players reset $UserID Temporary

# 消滅
kill @s
Loading
Loading