Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6036e96
ArtifactとObjectの基本機能を作成
firgde Jun 14, 2026
9a24a1b
ツールチップのデザイン
firgde Jun 14, 2026
114f0e6
加工結果に登録
firgde Jun 20, 2026
2f183a6
対象が動いていないと攻撃しないように
firgde Jun 20, 2026
d0fea90
演出の位置が出現位置に合うように
firgde Jun 20, 2026
4e30e88
Objectの見た目を変更
firgde Jun 23, 2026
f36314c
攻撃情報を神器依存に
firgde Aug 2, 2026
9cccc66
足元のブロックが壊れると消えるように
firgde Aug 2, 2026
85cfff3
Loreをより正確に
firgde Sep 1, 2026
d96fd28
セレクターを修正
firgde Sep 1, 2026
055fc41
nbt取得をapiで置き換え
firgde Sep 1, 2026
6829b7d
データ取得処理を軽量化
firgde Sep 4, 2026
a01e4ae
範囲攻撃にmodifierが適用されるように
firgde Sep 16, 2026
4448e91
Merge branch 'master' into dev/firgde_1464
Lapis-LJA Oct 8, 2026
57cae4a
type指定忘れを修正
firgde Oct 8, 2026
7bbf2e0
Loreを調整
firgde Oct 8, 2026
1961f63
範囲攻撃の判定を修正
firgde Oct 8, 2026
e48dde5
ダメージをdoubleに
firgde Oct 8, 2026
41fd7ce
ダメージ処理をシングルダメージセッションに
firgde Oct 8, 2026
f207e0d
接触判定をより精密に
firgde Oct 8, 2026
d7d6542
Merge branch 'dev/firgde_1464' of https://github.com/ProjectTSB/Asset…
firgde Oct 8, 2026
e05d672
範囲攻撃のmodifier忘れを修正
firgde Oct 26, 2026
2f867fd
当たり判定の取得形式を統一
firgde Oct 26, 2026
d849e05
召喚/存在可能な判定を更新
firgde Oct 26, 2026
1fd081d
Loreをより明確に
firgde Oct 26, 2026
4354cce
ダメージ処理のリセット漏れを修正
firgde Oct 26, 2026
c17364f
各種パラメーターを神器から設定できるように
firgde Oct 28, 2026
3a95e0f
Field名が一致していない問題を修正
firgde Oct 28, 2026
179a21d
functionを改名
firgde Oct 28, 2026
daab82c
変数類に命名規則を適用
firgde Oct 31, 2026
11528bb
スコアリセット時のobjective指定を削除
firgde Oct 31, 2026
31ccb66
タグを修正
firgde Oct 31, 2026
54ec972
Objectの見た目を考慮した処理を追加
firgde Nov 8, 2026
9bf5b35
使用条件にOnGroundを追加
firgde Nov 8, 2026
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/1464.call_electric_catfish/give/1.trigger
#
# 神器の取得処理の呼び出し時に実行されるfunction
#
# @within tag/function asset:artifact/give

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

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

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 1464
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:carrot_on_a_stick"
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text": "コール:デンキナマズ", "color": "yellow"}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text": "敵に踏まれると周囲にダメージを与えるナマズを召喚する。"}' , '{"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 "mainhand"
# 神器のトリガー (string) Wikiを参照
data modify storage asset:artifact Trigger set value "onClick"
# 神器の発動条件 (TextComponentString) (オプション)
data modify storage asset:artifact Condition set value '{"text": "足元にブロックがあるとき"}'
# 攻撃に関する情報 -Damage量 (literal[]/literal) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.Damage set value [50, 100]
# 攻撃に関する情報 -攻撃タイプ (string[]) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.AttackType set value [Physical]
# 攻撃に関する情報 -攻撃属性 (string[]) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.ElementType set value [Thunder]
# 攻撃に関する情報 -防御無視 (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
# MP消費量 (int)
data modify storage asset:artifact MPCost set value 80
# 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
# 種別クールダウン ({Type: string, Duration: int}) (オプション)
data modify storage asset:artifact TypeCooldown.Type set value "summon"
data modify storage asset:artifact TypeCooldown.Duration set value 600
# グローバルクールダウン (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", "Nyaptov", "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,7 @@
#> asset:artifact/1464.call_electric_catfish/register
#
# 神器プールへの登録処理
#
# @within tag/function asset:artifact/register

data modify storage asset:artifact RarityRegistry[3] append value [1464]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:artifact/1464.call_electric_catfish/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:1464} run function asset:artifact/1464.call_electric_catfish/trigger/2.check_condition
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#> asset:artifact/1464.call_electric_catfish/trigger/2.check_condition
#
# 神器の発動条件をチェックします
#
# @within function asset:artifact/1464.call_electric_catfish/trigger/1.trigger

# 神器の基本的な条件の確認を行うfunction、成功している場合CanUsedタグが付く
function asset:artifact/common/check_condition/mainhand

# 追加チェック:足元にブロックがないならCanUsed剝奪
function api:data_get/on_ground
execute if data storage api: {OnGround:0b} run tag @s remove CanUsed
execute align y if block ~ ~-1 ~ #lib:no_collision/ run tag @s remove CanUsed

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

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

# Object1160召喚
data modify storage api: Argument.ID set value 1160
# 攻撃情報
data modify storage api: Argument.FieldOverride.Damage set value 100.0d
data modify storage api: Argument.FieldOverride.AttackType set value "Physical"
data modify storage api: Argument.FieldOverride.ElementType set value "Thunder"

# 攻撃範囲: Objectを中心とした、一辺AttackRangeの正方形を攻撃する
data modify storage api: Argument.FieldOverride.AttackRange set value 7.0d

# 範囲攻撃の判定クールダウン
data modify storage api: Argument.FieldOverride.AttackCooldown set value 10

# 範囲攻撃のダメージ倍率
data modify storage api: Argument.FieldOverride.DamageMultiplier set value 0.5

# 存在時間
data modify storage api: Argument.FieldOverride.Tick set value 1200

execute store result storage api: Argument.FieldOverride.UserID int 1 run scoreboard players get @s UserID
function api:object/summon
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> asset:object/1160.electric_catfish/_index.d
# @private

#> tag
# @within function asset:object/1160.electric_catfish/**
#declare tag O1160.Inactive
#declare tag O1160.SteppedOn
#declare tag O1160.Candidate
#declare objective O1160.Cooldown
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#> asset:object/1160.electric_catfish/init/
#
# Objectのinit時の処理
#
# @within asset:object/alias/1160/init

# ブロックの中心にtp(召喚時にtpするとinitされない)
execute align xz run tp @s ~0.5 ~ ~0.5

# 存在する時間を設定
execute store result score @s General.Object.Tick run data get storage asset:context this.Tick

# 攻撃範囲のFieldを設定
execute store result storage asset:context this.AttackRadius double -0.5 run data get storage asset:context this.AttackRange
execute store result storage asset:context this.AttackHitbox int 0.9999999999 run data get storage asset:context this.AttackRange

# 演出
execute align xz run particle poof ~0.5 ~0.5 ~0.5 0.1 0.1 0.1 0.05 5
playsound entity.player.hurt neutral @a ~ ~ ~ 1 0.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> asset:object/1160.electric_catfish/load
#
# Objectに利用するスコアボード等の初期化処理
#
# @within tag/function asset:object/load

#> 定義類はここに
# @within function asset:object/1160.electric_catfish/**
scoreboard objectives add O1160.Cooldown dummy
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#> asset:object/1160.electric_catfish/register
#
# Objectのデータを指定
#
# @within function asset:object/alias/1160/register

# 継承(オプション)
# data modify storage asset:object Extends append value
# function asset:object/extends
# 他のObjectに継承されることを許可するか (boolean) (オプション)
# data modify storage asset:object ExtendsSafe set value
# 継承されることを前提とした、抽象的なObjectであるかどうか(boolean)
data modify storage asset:object IsAbstract set value false
# Tickするかどうか(boolean) (オプション)
# data modify storage asset:object IsTicking set value

# ID (int)
data modify storage asset:object ID set value 1160
# フィールド(オプション)
data modify storage asset:object Field.Damage set value -1
data modify storage asset:object Field.AttackType set value ""
data modify storage asset:object Field.ElementType set value ""

data modify storage asset:object Field.AttackRange set value -1
data modify storage asset:object Field.AttackRadius set value -1
data modify storage asset:object Field.AttackHitbox set value -1
data modify storage asset:object Field.DamageMultiplier set value -1
data modify storage asset:object Field.AttackCooldown set value -1
data modify storage asset:object Field.Tick set value -1
data modify storage asset:object Field.UserID set value -1
data modify storage asset:object Field.Motion set value []
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#> asset:object/1160.electric_catfish/summon/
#
# Object召喚処理の呼び出し時に実行されるfunction
#
# @within asset:object/alias/1160/summon

#> private
# @private
#declare score_holder $O1160.Rotation
#declare score_holder $90

# プレイヤーが向いている方向を90°間隔に補正
execute rotated as @s as 0-0-0-0-0 in overworld positioned as @s run tp @s ~ ~ ~ ~ ~
data modify storage asset:temp Args.Rotation set from entity 0-0-0-0-0 Rotation
data modify storage asset:temp Args.Rotation[1] set value 0.0f

execute store result score $O1160.Rotation Temporary run data get storage asset:temp Args.Rotation[0]
scoreboard players add $O1160.Rotation Temporary 45
scoreboard players operation $O1160.Rotation Temporary /= $90 Const
execute store result storage asset:temp Args.Rotation[0] float 1 run scoreboard players operation $O1160.Rotation Temporary *= $90 Const

# 元となるEntityを召喚する
function asset:object/1160.electric_catfish/summon/m with storage asset:temp Args

# リセット
scoreboard players reset $O1160.Rotation
data remove storage asset:temp Args
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#> asset:object/1160.electric_catfish/summon/debug
#
# 動作チェック用の召喚処理 使い終わったら消してもいいかも
#
# @user
# @private

# 召喚
data modify storage api: Argument.ID set value 1160
function api:object/summon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:object/1160.electric_catfish/summon/m
#
#
#
# @within function asset:object/1160.electric_catfish/summon/

$summon item_display ~ ~ ~ {Rotation: $(Rotation), Tags:["ObjectInit", "Friend"], item:{id:"minecraft:stick", Count:1b, tag:{CustomModelData:20628}},transformation:{scale:[1.0f,1.0f,1.0f], translation:[0.0f,0.5f,0.0f], left_rotation:{axis:[1.0f,1.0f,1.0f], angle:0.0f}, right_rotation:{axis:[1.0f,1.0f,1.0f], angle:0.0f}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#> asset:object/1160.electric_catfish/tick/
#
# Objectのtick時の処理
#
# @within asset:object/alias/1160/tick

# Tick減算
scoreboard players remove @s General.Object.Tick 1

# クールダウン
execute if score @s O1160.Cooldown matches 1.. run scoreboard players remove @s O1160.Cooldown 1
execute if score @s O1160.Cooldown matches 0 run tag @s remove O1160.Inactive

# 踏まれたどうかをチェック
execute unless entity @s[tag=O1160.Inactive] positioned ~-0.5 ~ ~-0.5 as @e[type=#lib:living_without_player,dx=0] positioned ~ ~-0.8 ~ if entity @s[dx=0] run function asset:object/1160.electric_catfish/tick/check
execute positioned ~-0.5 ~ ~-0.5 if entity @e[type=#lib:living_without_player,tag=O1160.Candidate,dx=0] at @s run function asset:object/1160.electric_catfish/tick/attack.m with storage asset:context this

# 足元にブロックがないなら消す
execute align y if block ~ ~-1 ~ #lib:no_collision/ run scoreboard players set @s General.Object.Tick 0

# 消滅処理
execute if score @s General.Object.Tick matches ..0 run function asset:object/1160.electric_catfish/tick/kill
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#> asset:object/1160.electric_catfish/tick/attack.m
#
# Objectのtick時の処理
#
# @within asset:object/1160.electric_catfish/tick/**

#> Private
# @private
#declare score_holder $O1160.UserID

# シングルダメージセッション開始
function api:damage/single_damage_session/open

# ダメージ設定
data modify storage api: Argument.Damage set from storage asset:context this.Damage
data modify storage api: Argument.AttackType set from storage asset:context this.AttackType
data modify storage api: Argument.ElementType set from storage asset:context this.ElementType
execute store result score $O1160.UserID Temporary run data get storage asset:context this.UserID
execute as @a if score @s UserID = $O1160.UserID Temporary run function api:damage/modifier

# CandidateタグがついたランダムなEntityが対象
tag @e[type=#lib:living_without_player,tag=O1160.Candidate,sort=random,limit=1] add O1160.SteppedOn
execute positioned ~-0.5 ~ ~-0.5 as @e[type=#lib:living_without_player,tag=O1160.SteppedOn,dx=0,sort=random,limit=1] run function api:damage/
function api:damage/reset

# 周囲のMobにもダメージ
$execute store result storage api: Argument.Damage double $(DamageMultiplier) run data get storage asset:context this.Damage

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.

c17364f で27行目と31行目に macro の行が加わりましたが、関数の名前は attack.mcfunction のままです。master で macro の行を含む関数101件のうち98件は、名前が m.mcfunction で終わります(*.m.mcfunction か m.mcfunction)。DevSpace の AGENTS.md の「共通のmcfunction規約」にも、既存の関数に macro を足すときは改名し、呼出元と IMP Doc の関数名も直すとあります。

tick/attack.m.mcfunction に改名する場合は、1行目の IMP Doc を #> asset:object/1160.electric_catfish/tick/attack.m に、tick/.mcfunction の16行目の呼び出しを tick/attack.m に直します。

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.

修正を確認しました。tick/attack の名前の件は解消されていて、この指摘への対応として問題ありません。

179a21d で tick/attack.m.mcfunction に改名され、1行目の IMP Doc と tick/.mcfunction の16行目の呼び出しも tick/attack.m になりました。PR の中に、改名前の tick/attack を呼ぶ箇所は残っていません。

検証用サーバー(Minecraft 1.20.4、このPRの head 179a21d)で、改名後の関数から範囲攻撃が動くことも確かめました。ラヴェジャーがナマズのいるブロックの角を踏むと、Hurt イベントのダメージは、踏んだラヴェジャーが200、周囲のラヴェジャーが100でした。

data modify storage api: Argument.AttackType set from storage asset:context this.AttackType
data modify storage api: Argument.ElementType set from storage asset:context this.ElementType
execute as @a if score @s UserID = $O1160.UserID Temporary run function api:damage/modifier
$execute positioned ~$(AttackRadius) ~ ~$(AttackRadius) as @e[type=#lib:living_without_player,tag=!O1160.SteppedOn,dx=$(AttackHitbox),dz=$(AttackHitbox)] positioned ~ ~-0.2 ~ if entity @s[dx=$(AttackHitbox),dz=$(AttackHitbox)] run function api:damage/
function api:damage/reset

# リセット
function api:damage/reset
Comment thread
firgde marked this conversation as resolved.
Resolved
execute positioned ~-0.5 ~ ~-0.5 run tag @e[type=#lib:living_without_player,tag=O1160.SteppedOn,dx=0,limit=1] remove O1160.SteppedOn
execute positioned ~-0.5 ~ ~-0.5 run tag @e[type=#lib:living_without_player,tag=O1160.Candidate,dx=0] remove O1160.Candidate
scoreboard players reset $O1160.UserID

# 0.5秒のクールダウン
execute store result score @s O1160.Cooldown run data get storage asset:context this.AttackCooldown
tag @s add O1160.Inactive

# 演出
particle dust 1 1 0 2 ~ ~ ~ 1.5 0.1 1.5 0 100

playsound entity.player.hurt neutral @a ~ ~ ~ 2 0.5
playsound entity.allay.hurt neutral @a ~ ~ ~ 2 2.0
playsound enchant.thorns.hit neutral @a ~ ~ ~ 2 1.0

# シングルダメージセッション終了
function api:damage/single_damage_session/close
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#> asset:object/1160.electric_catfish/tick/check
#
#
#
# @within asset:object/1160.electric_catfish/tick/**

#> private
# @private
#declare score_holder $O1160.MotionX
#declare score_holder $O1160.MotionZ

# thisにMotion保存
data modify storage asset:context this.Motion set from entity @s Motion

# 動いているなら踏んだ判定
execute store result score $O1160.MotionX Temporary run data get storage asset:context this.Motion[0] 100
execute store result score $O1160.MotionZ Temporary run data get storage asset:context this.Motion[2] 100

execute if score $O1160.MotionX Temporary matches ..-1 store result score $O1160.MotionX Temporary run data get storage asset:context this.Motion[0] -100
execute if score $O1160.MotionZ Temporary matches ..-1 store result score $O1160.MotionZ Temporary run data get storage asset:context this.Motion[2] -100

scoreboard players operation $O1160.MotionX Temporary += $O1160.MotionZ Temporary

execute if score $O1160.MotionX Temporary matches 1.. run tag @s add O1160.Candidate

# リセット
data remove storage asset:context this.Motion
scoreboard players reset $O1160.MotionX
scoreboard players reset $O1160.MotionZ
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset:object/1160.electric_catfish/tick/kill
#
# Object削除の処理
#
# @within function asset:object/1160.electric_catfish/tick/

# 演出
particle poof ~ ~0.5 ~ 0.1 0.1 0.1 0.05 5

# 消す
kill @s
8 changes: 8 additions & 0 deletions Asset/data/asset/functions/object/alias/1160/init.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/alias/1160/init
#
# Init処理のエイリアス
#
# @within asset_manager:object/init/init.m

# 元のInit処理を呼び出す
function asset:object/1160.electric_catfish/init/
Loading
Loading