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

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

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

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 1643
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:carrot_on_a_stick"
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text": "ジェットブースター", "color": "blue"}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text": "使用してから5秒後、爆発をして向いている方向に吹っ飛ぶ。"}', '{"text": "MPが使用時と比べて低いほど攻撃範囲、威力、推進力が上昇する。"}', '{"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 "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 [200,1000]
# 攻撃に関する情報 -攻撃タイプ (string[]) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.AttackType set value [Physical]
# 攻撃に関する情報 -攻撃属性 (string[]) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.ElementType set value [Fire]
# 攻撃に関する情報 -防御無視 (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 100
# 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 600
# 種別クールダウン ({Type: string, Duration: int}) (オプション)
# data modify storage asset:artifact TypeCooldown.Type set value
# data modify storage asset:artifact TypeCooldown.Duration 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 ["Urban", "Rumor", "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/1643.jet_booster/register
#
# 神器プールへの登録処理
#
# @within tag/function asset:artifact/register

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

# 神器の基本的な条件の確認を行うfunction、成功している場合CanUsedタグが付く
function asset:artifact/common/check_condition/mainhand
# 他にアイテム等確認する場合はここに書く
# Effect 408が既にあるならキャンセル
data modify storage api: Argument.ID set value 408
function api:entity/mob/effect/get/from_id
execute if data storage api: Return.Effect run tag @s remove CanUsed

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

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

# ここから先は神器側の効果の処理を書く
# Effect 408を付与、MP計測開始
data modify storage api: Argument.ID set value 408

# 効果時間
data modify storage api: Argument.Duration set value 100

## 攻撃情報
# 最低ベクトル / 最低ダメージ(倍率2)
data modify storage api: Argument.FieldOverride.MinMagnitude set value 100
# 最大ベクトル / 最大ダメージ(倍率2)
data modify storage api: Argument.FieldOverride.MaxMagnitude set value 500

# MP差1ごとのダメージ(倍率0.01)
data modify storage api: Argument.FieldOverride.Multiplier set value 200

# 攻撃範囲とMP消費の基準値
data modify storage api: Argument.FieldOverride.Range set value {0:3,1:6,2:8}
data modify storage api: Argument.FieldOverride.Border set value {1:100,2:150}

function api:entity/mob/effect/give
function api:entity/mob/effect/reset

# 演出
playsound entity.tnt.primed player @a ~ ~ ~ 1.0 0.5
playsound ogg:block.vault.eject3 player @a ~ ~ ~ 1.0 1.0
particle campfire_signal_smoke ~ ~1 ~ 0.1 0.5 0.1 0.05 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0408.fueling/_/end
#
# Effectの効果の終了時に実行されるfunction
#
# @within tag/function asset:effect/end

execute if data storage asset:context {id:408} run function asset:effect/0408.fueling/end/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0408.fueling/_/given
#
# Effectが付与された時に実行されるfunction
#
# @within tag/function asset:effect/given

execute if data storage asset:context {id:408} run function asset:effect/0408.fueling/given/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0408.fueling/_/register
#
#
#
# @within tag/function asset:effect/register

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

execute if data storage asset:context {id:408} run function asset:effect/0408.fueling/tick/
66 changes: 66 additions & 0 deletions Asset/data/asset/functions/effect/0408.fueling/end/.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#> asset:effect/0408.fueling/end/
#
# Effectの効果が切れた時の処理
#
# @within function asset:effect/0408.fueling/_/end

#> Private
# @private
#declare score_holder $E0408.Multiplier
#declare score_holder $E0408.Magnitude
#declare score_holder $E0408.MinMagnitude
#declare score_holder $E0408.MaxMagnitude
#declare score_holder $E0408.MP
#declare score_holder $E0408.Border1
#declare score_holder $E0408.Border2

# 使用時とのMP差に応じた強さのPlayerMotionを適用
function api:mp/get_current
execute store result score $E0408.MP Temporary run data get storage api: Return.CurrentMP
execute store result score $E0408.Magnitude Temporary run data get storage asset:context this.InitialMP
scoreboard players operation $E0408.Magnitude Temporary -= $E0408.MP Temporary

#最低MinMagnitudeは飛ぶ
execute store result score $E0408.MinMagnitude Temporary run data get storage asset:context this.MinMagnitude
execute if score $E0408.Magnitude Temporary matches 1.. run scoreboard players operation $E0408.Magnitude Temporary += $E0408.MinMagnitude Temporary
execute if score $E0408.Magnitude Temporary matches ..0 run scoreboard players operation $E0408.Magnitude Temporary = $E0408.MinMagnitude Temporary

execute store result storage lib: Argument.VectorMagnitude double 0.01 run scoreboard players get $E0408.Magnitude Temporary
function lib:motion/looking


# 攻撃情報(最低でMinMagnitude * Multiplier)
execute store result score $E0408.MaxMagnitude Temporary run data get storage asset:context this.MaxMagnitude
scoreboard players operation $E0408.Magnitude Temporary < $E0408.MaxMagnitude Temporary

execute store result score $E0408.Multiplier Temporary run data get storage asset:context this.Multiplier
execute store result storage api: Argument.Damage double 0.01 run scoreboard players operation $E0408.Multiplier Temporary *= $E0408.Magnitude Temporary
data modify storage api: Argument.AttackType set value "Physical"
data modify storage api: Argument.ElementType set value "Fire"
function api:damage/modifier

function api:damage/single_damage_session/open

# 攻撃範囲も可変
execute store result score $E0408.Border1 Temporary run data get storage asset:context this.Border.1 2
execute store result score $E0408.Border2 Temporary run data get storage asset:context this.Border.2 2

execute if score $E0408.Magnitude Temporary < $E0408.Border1 Temporary positioned ^ ^ ^-2 run function asset:effect/0408.fueling/end/attack/1.m with storage asset:context this.Range
execute if score $E0408.Magnitude Temporary >= $E0408.Border1 Temporary if score $E0408.Magnitude Temporary < $E0408.Border2 Temporary positioned ^ ^ ^-2 run function asset:effect/0408.fueling/end/attack/2.m with storage asset:context this.Range
execute if score $E0408.Magnitude Temporary >= $E0408.Border2 Temporary positioned ^ ^ ^-2 run function asset:effect/0408.fueling/end/attack/3.m with storage asset:context this.Range
Comment on lines +48 to +50

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.

3ab754e で、攻撃範囲の中心が3段階とも positioned ^ ^ ^-2 になりました。0bc93e0 では段階ごとに ^ ^ ^-2・^ ^ ^-4・^ ^ ^-6 で、範囲が後ろへ広がっていました。いまの中心では、2段階目(半径6)はプレイヤーの前方4ブロック、3段階目(半径8)は前方6ブロックまで届き、後ろは8・10ブロックまでになります。このコミットは各種パラメーターを神器から設定する変更なので、意図した変更かを確認させてください。

1件目の指摘の suggestion を当てて、MP を450減らしたプレイヤーで試しました(検証用サーバー、Minecraft 1.20.4、head 3ab754e)。3段階目の範囲が選ばれ、前5ブロックのハスクに当たり、後ろ11ブロックのハスクには当たりませんでした。0bc93e0 では同じ条件で後ろ11ブロックに当たり、前5ブロックには当たりませんでした。MP の差が150のときは2段階目の範囲が選ばれ、後ろ2・7ブロックに当たって前5ブロックには当たりませんでした。前4ブロック以内のハスクでは試していません。

元の範囲に戻すなら、48〜50行目の positioned を段階ごとに ^ ^ ^-2・^ ^ ^-4・^ ^ ^-6 にします。

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.

未解消です。270a742 では48〜50行目は変わっておらず、攻撃範囲の中心は3段階とも positioned ^ ^ ^-2 のままです。

検証用サーバー(Minecraft 1.20.4、head 270a742)で前回と同じ手順を流すと、MP を450減らしたプレイヤーでは3段階目の範囲が選ばれ、前5ブロックのハスクに当たり、後ろ11ブロックのハスクには当たりませんでした。0bc93e0 では同じ条件で後ろ11ブロックに当たり、前5ブロックには当たりませんでした。意図した変更なら、その旨の返信だけで十分です。


function api:damage/reset
function api:damage/single_damage_session/close

# 共通演出
playsound entity.firework_rocket.launch player @a ~ ~ ~ 2.0 0.5
playsound block.note_block.bit player @s ~ ~ ~ 1.0 2.0

# リセット
scoreboard players reset $E0408.Multiplier
scoreboard players reset $E0408.Magnitude
scoreboard players reset $E0408.MinMagnitude
scoreboard players reset $E0408.MaxMagnitude
scoreboard players reset $E0408.MP
scoreboard players reset $E0408.Border1
scoreboard players reset $E0408.Border2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset:effect/0408.fueling/end/attack/1.m
#
#
#
# @within function asset:effect/0408.fueling/end/

$execute as @e[type=#lib:living_without_player,tag=Enemy,distance=..$(0)] run function api:damage/

# 演出
playsound ogg:random.explode4 player @a ~ ~ ~ 1 2
particle flame ~ ~ ~ 1 0.0 1 0.01 50
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#> asset:effect/0408.fueling/end/attack/2.m
#
#
#
# @within function asset:effect/0408.fueling/end/


$execute as @e[type=#lib:living_without_player,tag=Enemy,distance=..$(1)] run function api:damage/

# 演出
playsound ogg:random.explode4 player @a ~ ~ ~ 1 1.5
particle flame ~ ~ ~ 2 0.0 2 0.01 100
particle explosion ^ ^ ^4 0 0 0 1 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#> asset:effect/0408.fueling/end/attack/3.m
#
#
#
# @within function asset:effect/0408.fueling/end/

$execute as @e[type=#lib:living_without_player,tag=Enemy,distance=..$(2)] run function api:damage/

# 演出
playsound ogg:random.explode4 player @a ~ ~ ~ 1 1.5
particle flame ~ ~ ~ 4 0.0 4 0.01 150
particle explosion_emitter ^ ^ ^6 0 0 0 1 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> asset:effect/0408.fueling/given/
#
# Effectが付与された時の処理
#
# @within function asset:effect/0408.fueling/_/given

# 現在MPを記憶
function api:mp/get_current
data modify storage asset:context this.InitialMP set from storage api: Return.CurrentMP
40 changes: 40 additions & 0 deletions Asset/data/asset/functions/effect/0408.fueling/register.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#> asset:effect/0408.fueling/register
#
# Effectのデータを指定
#
# @within function asset:effect/0408.fueling/_/register

# ExtendsSafe (boolean) (default = false)
# data modify storage asset:effect ExtendsSafe set value true
# ID (int)
data modify storage asset:effect ID set value 408
# 名前 (TextComponentString)
data modify storage asset:effect Name set value '{"text": "発射用意", "color": "#fa9514"}'
# 説明文 (TextComponentString[])
data modify storage asset:effect Description set value ['{"text": "効果開始時と終了時のMP差を推進力に変える"}']
# 効果時間 (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
# 悪い効果か否か (boolean)
data modify storage asset:effect IsBadEffect set value false
# 死亡時のエフェクトの処理 (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
# エフェクトのスタックををUIに表示するか (boolean) (default = true)
data modify storage asset:effect StackVisible set value false

# フィールド
data modify storage asset:effect Field.InitialMP set value -1
data modify storage asset:effect Field.Interval set value 20
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> asset:effect/0408.fueling/tick/
#
# Effectのtick処理
#
# @within function asset:effect/0408.fueling/_/tick

# Interval減算
execute store result storage asset:context this.Interval int 0.9999999999 run data get storage asset:context this.Interval
execute if data storage asset:context this{Interval:0} run function asset:effect/0408.fueling/tick/countdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset:effect/0408.fueling/tick/countdown
#
#
#
# @within function asset:effect/0408.fueling/tick/

# Intervalを20にリセット
data modify storage asset:context this.Interval set value 20

# 演出
playsound block.note_block.bit player @s ~ ~ ~ 1.0 1.0
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/1643.jet_booster/trigger/1.trigger",
"asset:artifact/1555.shift_change/trigger/1.trigger",
"asset:artifact/1636.mana_controller/trigger/1.trigger",
"asset:artifact/1606.dimension_knife/click/1.trigger",
Expand Down Expand Up @@ -180,4 +181,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/1643.jet_booster/give/1.trigger",
"asset:artifact/1392.yellow_refraction_prism/give/1.trigger",
"asset:artifact/1421.toaster/give/1.trigger",
"asset:artifact/1555.shift_change/give/1.trigger",
Expand Down Expand Up @@ -559,4 +560,4 @@
"asset:artifact/0735.collision_plate/give/1.trigger",
"asset:artifact/0745.blade_of_whirlwind/give/1.trigger"
]
}
}
Loading
Loading