Skip to content

Commit

Permalink
✨ [Artifact 294] タレットを作成 (#1004)
Browse files Browse the repository at this point in the history
Co-authored-by: Lapis-LJA <[email protected]>
  • Loading branch information
quikku and Lapis-LJA authored Mar 5, 2025
1 parent 501e50d commit 0e64a9d
Show file tree
Hide file tree
Showing 24 changed files with 336 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:artifact/0294.turret/give/1.trigger
#
# 神器の取得処理の呼び出し時に実行されるfunction
#
# @within tag/function asset:artifact/give

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

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

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 294
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:carrot_on_a_stick"
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text":"タレット","color":"gray"}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text":"配置すると自動的に周囲の敵を感知し攻撃する"}','{"text":"Hello?","color":"dark_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 "auto"
# 神器のトリガー (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 ["5.5"]
# 攻撃に関する情報 -攻撃タイプ (string[]) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.AttackType set value [Physical]
# 攻撃に関する情報 -攻撃属性 (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 5
# 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
# 種別クールダウン ({Type: string, Duration: int}) (オプション)
data modify storage asset:artifact TypeCooldown.Type set value "summon"
data modify storage asset:artifact TypeCooldown.Duration set value 150
# グローバルクールダウン (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 "ALL"
# カスタム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/0294.turret/register
#
# 神器プールへの登録処理
#
# @within tag/function asset:artifact/register

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

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

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

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

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

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

# 召喚
data modify storage api: Argument.ID set value 1102
execute store result storage api: Argument.FieldOverride.UserID int 1 run scoreboard players get @s UserID
data modify storage api: Argument.FieldOverride.Damage set value 5.5
execute positioned ~ ~0.5 ~ rotated ~ 0 positioned ^ ^ ^1 run function api:object/summon
10 changes: 10 additions & 0 deletions Asset/data/asset/functions/object/1102.turret/init/.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#> asset:object/1102.turret/init/
#
# Objectのinit時の処理
#
# @within asset:object/alias/1102/init

# 演出
playsound entity.iron_golem.death neutral @a ~ ~ ~ 1 1.5

# イースター的な要素で見た目ランダムにしたかったけどやる気なかった。保留で
9 changes: 9 additions & 0 deletions Asset/data/asset/functions/object/1102.turret/load.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> asset:object/1102.turret/load
#
# Objectに利用するスコアボード等の初期化処理
#
# @within tag/function asset:object/load

#> 定義類はここに
# @within function asset:object/1102.turret/**
scoreboard objectives add 1102.Shot dummy
20 changes: 20 additions & 0 deletions Asset/data/asset/functions/object/1102.turret/register.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#> asset:object/1102.turret/register
#
# Objectのデータを指定
#
# @within function asset:object/alias/1102/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 1102
# フィールド(オプション)
# data modify storage asset:object Field.myValue set value
11 changes: 11 additions & 0 deletions Asset/data/asset/functions/object/1102.turret/summon/.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset:object/1102.turret/summon/
#
# Object召喚処理の呼び出し時に実行されるfunction
#
# @within asset:object/alias/1102/summon

# 元となるEntityを召喚する
execute as 0-0-0-0-0 in minecraft:overworld positioned as @s rotated ~ 0 run tp @s ~ ~ ~ ~ ~
data modify storage asset:temp Args.Rotation set from entity 0-0-0-0-0 Rotation
function asset:object/1102.turret/summon/macro.m with storage asset:temp Args
data remove storage asset:temp Args
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#> asset:object/1102.turret/summon/debug
#
# 動作チェック用の召喚処理 使い終わったら消してもいいかも
#
# @user
# @private

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

$summon item_display ~ ~ ~ {Rotation:$(Rotation),Tags:["ObjectInit","Friend"],item:{id:"minecraft:stick",Count:1b,tag:{CustomModelData:20387}},teleport_duration:1}
39 changes: 39 additions & 0 deletions Asset/data/asset/functions/object/1102.turret/tick/.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#> asset:object/1102.turret/tick/
#
# Objectのtick時の処理
#
# @within asset:object/alias/1102/tick

#> tag
# @private
#declare tag 1102.Target
#declare tag 1102.Even
#declare score_holder $1102.ShotCount

# Tick加算
scoreboard players add @s General.Object.Tick 1

# 奇数偶数チェック
execute store result score $1102.ShotCount Temporary run scoreboard players get @s 1102.Shot
scoreboard players operation $1102.ShotCount Temporary %= $2 Const
execute if score $1102.ShotCount Temporary matches 0 run tag @s add 1102.Even
scoreboard players reset $1102.ShotCount

# 敵がいたらそっち向く
execute if entity @e[type=#lib:living,tag=Enemy,tag=!Uninterferable,distance=..10] positioned ~-5 ~ ~-5 as @e[type=#lib:living,tag=Enemy,tag=!Uninterferable,distance=..20,dx=9,dy=0,dz=9] run tag @s add 1102.Target
execute if entity @e[type=#lib:living,tag=Enemy,tag=!Uninterferable,distance=..10] facing entity @e[type=#lib:living,tag=Enemy,tag=1102.Target,tag=!Uninterferable,distance=..10,sort=nearest,limit=1] eyes rotated ~ 0 run tp @s ~ ~ ~ ~ ~

# 4tickおきに実行するやつ
# 実行時間を移す
scoreboard players operation $Interval Temporary = @s General.Object.Tick
# 4tickおきに実行
scoreboard players operation $Interval Temporary %= $2 Const
execute if entity @e[type=#lib:living,tag=Enemy,tag=1102.Target,distance=..10] if score $Interval Temporary matches 0 if entity @s[tag=1102.Even] positioned ~ ~0.3 ~ positioned ^-0.4 ^ ^ run function asset:object/1102.turret/tick/shot/shot
execute if entity @e[type=#lib:living,tag=Enemy,tag=1102.Target,distance=..10] if score $Interval Temporary matches 0 unless entity @s[tag=1102.Even] positioned ~ ~0.3 ~ positioned ^0.4 ^ ^ run function asset:object/1102.turret/tick/shot/shot
# リセット
scoreboard players reset $Interval
tag @s remove 1102.Even
# ターゲットのタグを消す
tag @e[type=#lib:living,tag=Enemy,tag=1102.Target,tag=!Uninterferable,distance=..40] remove 1102.Target
# 消滅処理
kill @s[scores={General.Object.Tick=120..}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#> asset:object/1102.turret/tick/shot/bullet_rec
#
#
#
# @within function
# asset:object/1102.turret/tick/shot/shot
# asset:object/1102.turret/tick/shot/bullet_rec

# 着弾検知
execute positioned ~-0.5 ~-0.5 ~-0.5 if entity @e[type=#lib:living,type=!player,tag=!Uninterferable,dx=0] run tag @s add Landing
execute unless block ^ ^ ^0.5 #lib:no_collision run tag @s add Landing

# 演出
particle dust 0.345 0.345 0.345 0.4 ~ ~ ~ 0 0 0 0 6

# 着弾
execute if entity @s[tag=Landing] positioned ~-0.5 ~-0.5 ~-0.5 as @e[type=#lib:living,type=!player,tag=!Uninterferable,dx=0,limit=1] at @s run function asset:object/1102.turret/tick/shot/deal_damage

# 再帰
execute positioned ^ ^ ^0.5 if entity @s[tag=!Landing,distance=..30] run function asset:object/1102.turret/tick/shot/bullet_rec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#> asset:object/1102.turret/tick/shot/deal_damage
#
#
#
# @within function asset:object/1102.turret/tick/shot/bullet_rec

#> Private
# @private
#declare score_holder $UserID

# UserID 取得
execute store result score $UserID Temporary run data get storage asset:context this.UserID

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

# リセット
function api:damage/reset
scoreboard players reset $UserID Temporary
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#> asset:object/1102.turret/tick/shot/shot
#
#
#
# @within function asset:object/1102.turret/tick/

#> tag
# @private
#declare tag SpreadMarker


# 前方拡散設定
summon marker ~ ~ ~ {Tags:["SpreadMarker"]}
data modify storage lib: Argument.Distance set value 2.0
data modify storage lib: Argument.Spread set value 0.3

# 前方拡散を実行する
execute as @e[type=marker,tag=SpreadMarker,distance=..0.5,limit=1] run function lib:forward_spreader/circle

# 発砲
execute facing entity @e[type=marker,tag=SpreadMarker,distance=..10,limit=1] eyes positioned ^ ^ ^0.4 run function asset:object/1102.turret/tick/shot/bullet_rec

# 演出
playsound entity.wither.shoot neutral @a ~ ~ ~ 0.3 1.6 0
playsound entity.firework_rocket.blast neutral @a ~ ~ ~ 0.7 0.5
playsound entity.shulker.shoot neutral @a ~ ~ ~ 1 1.6
# リセット
kill @e[type=marker,tag=SpreadMarker,distance=..10,limit=1]
tag @s remove Landing

# 発射回数を記録
scoreboard players add @s 1102.Shot 1
8 changes: 8 additions & 0 deletions Asset/data/asset/functions/object/alias/1102/init.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/alias/1102/init
#
# Init処理のエイリアス
#
# @within asset_manager:object/init/init.m

# 元のInit処理を呼び出す
function asset:object/1102.turret/init/
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/alias/1102/register
#
# Objectのデータ指定処理のエイリアス
#
# @within asset_manager:object/summon/register.m

# 元の登録処理を呼び出す
function asset:object/1102.turret/register
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/alias/1102/summon
#
# Object召喚処理のエイリアス
#
# @within asset_manager:object/summon/summon.m

# 元の召喚処理を呼び出す
function asset:object/1102.turret/summon/
8 changes: 8 additions & 0 deletions Asset/data/asset/functions/object/alias/1102/tick.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/alias/1102/tick
#
# Tick時処理のエイリアス
#
# @within asset_manager:object/tick/tick.m

# 元のTick処理を呼び出す
function asset:object/1102.turret/tick/
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/0294.turret/trigger/1.trigger",
"asset:artifact/0464.lightning_exploit/trigger/1.trigger",
"asset:artifact/1199.healer_trance/trigger/1.trigger",
"asset:artifact/1183.cosmo_site/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/0294.turret/give/1.trigger",
"asset:artifact/1193.firebrand/give/1.trigger",
"asset:artifact/0464.lightning_exploit/give/1.trigger",
"asset:artifact/1202.scrap_maker/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/0294.turret/register",
"asset:artifact/1193.firebrand/register",
"asset:artifact/0464.lightning_exploit/register",
"asset:artifact/1202.scrap_maker/register",
Expand Down
3 changes: 2 additions & 1 deletion Asset/data/asset/tags/functions/object/load.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:object/1102.turret/load",
"asset:object/2026.lastbattle_platform/load",
"asset:object/2198.rubiel_scythe/load",
"asset:object/2197.rubiel_knife/load",
Expand Down Expand Up @@ -48,4 +49,4 @@
"asset:object/1059.book_of_hero/load",
"asset:object/2031.giant_pumpkin/load"
]
}
}

0 comments on commit 0e64a9d

Please sign in to comment.