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

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

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

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 1328
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:ender_eye"
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text":"スノーボールキャノン","color":"#baf5ff"}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"translate":"長押しすることでチャージし、%1$sを離すことで","color":"white","with":[{"keybind":"key.use"}]}','{"text":"チャージ時間に比例した弾数の雪玉を発射する(最大60発)","color":"white"}','{"text":"フルチャージ時は弾の収束率・弾速・連射速度が強化される","color":"white"}','{"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 "30x?"
# 攻撃に関する情報 -攻撃タイプ (string[]) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.AttackType set value [Physical]
# 攻撃に関する情報 -攻撃属性 (string[]) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.ElementType set value [Water]
# 攻撃に関する情報 -防御無視 (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
# 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 160
# 種別クールダウン ({Type: string, Duration: int}) (オプション)
data modify storage asset:artifact TypeCooldown.Type set value "longRange"
data modify storage asset:artifact TypeCooldown.Duration set value 70
# グローバルクールダウン (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", "Urban", "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,8 @@
#> asset:artifact/1328.snowball_canon/register
#
# 神器プールへの登録処理
#
# @within tag/function asset:artifact/register

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

# チャージ用Effectがあれば強制的にチャージ続行
# 該当エフェクトが射撃中の場合は続行しない
data modify storage api: Argument.ID set value 347
function api:entity/mob/effect/get/from_id
execute if data storage api: Return.Effect unless data storage api: Return.Effect.Field{IsShooting:true} run return run function asset:artifact/1328.snowball_canon/trigger/charge

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

# 射撃中は再使用させない
execute if entity @s[tag=CanUsed] if data storage api: Return.Effect.Field{IsShooting:true} run tag @s remove CanUsed

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

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

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

# 仕様書: チャージ1tickにつき弾数+1
# 初期装填数がBullet、チャージ1回での追加装填数がAddBullet、最大装填数がMaxBullet
# フルチャージか否かで弾速と拡散が変わる
# 当然弾速が早い方が強いし、拡散は小さい方が良い

# 調整用数値
data modify storage api: Argument.FieldOverride.Damage set value 30
data modify storage api: Argument.FieldOverride.Bullet set value 1
data modify storage api: Argument.FieldOverride.AddBullet set value 1
data modify storage api: Argument.FieldOverride.MaxBullet set value 60
data modify storage api: Argument.FieldOverride.Spread set value {Neutral:0.15,FullCharge:0.05}
data modify storage api: Argument.FieldOverride.Motion set value {Neutral:0.8,FullCharge:1.35}

# チャージ用Effect付与
data modify storage api: Argument.ID set value 347
function api:entity/mob/effect/give
function api:entity/mob/effect/reset
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#> asset:artifact/1328.snowball_canon/trigger/_index.d
# @private

#> tag
# @within function asset:artifact/1328.snowball_canon/trigger/**
#declare
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#> asset:artifact/1328.snowball_canon/trigger/charge
#
#
#
# @within function asset:artifact/1328.snowball_canon/trigger/2.check_condition

# チャージ演出
execute if data storage api: Return.Effect.Field{IsFullCharge:false} if predicate lib:random_pass_per/20 anchored eyes run particle snowflake ^-0.3 ^-0.4 ^0.5 0 0 0 0.05 1
execute if data storage api: Return.Effect.Field{IsFullCharge:false} run playsound ogg:mob.breeze.charge1 player @a ~ ~ ~ 0.4 0.7

execute if data storage api: Return.Effect.Field{IsFullCharge: true} if predicate lib:random_pass_per/50 anchored eyes run particle snowflake ^-0.3 ^-0.4 ^0.5 0 0 0 0.2 1
execute if data storage api: Return.Effect.Field{IsFullCharge: true} run playsound ogg:mob.breeze.charge1 player @a ~ ~ ~ 0.4 1.2

# チャージ用Effect付与
data modify storage api: Argument.ID set value 347
function api:entity/mob/effect/give
function api:entity/mob/effect/reset
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:effect/0347.snowball_canon/_/re-given
#
# Effectが上書きされた時に実行されるfunction
#
# @within tag/function asset:effect/re-given

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

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

execute if data storage asset:context {id:347} run function asset:effect/0347.snowball_canon/tick/
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#> asset:effect/0347.snowball_canon/re-given/
#
# Effectが上書きされた時の処理
#
# @within function asset:effect/0347.snowball_canon/_/re-given

#> Private
# @private
#declare score_holder $Bullet
#declare score_holder $AddBullet
#declare score_holder $MaxBullet

# フィールド引継ぎ
data modify storage asset:context this set from storage asset:context PreviousField

# そもそも: 現時点でフルチャージ済みならreturn
execute if data storage asset:context this{IsFullCharge:true} run return fail

# 各数値取得
execute store result score $Bullet Temporary run data get storage asset:context this.Bullet
execute store result score $AddBullet Temporary run data get storage asset:context this.AddBullet
execute store result score $MaxBullet Temporary run data get storage asset:context this.MaxBullet

# 最大数は超えないように弾数を増やす
scoreboard players operation $Bullet Temporary += $AddBullet Temporary
execute store result storage asset:context this.Bullet int 1 run scoreboard players operation $Bullet Temporary < $MaxBullet Temporary

# フルチャージしたならその判定を保存
execute if score $Bullet Temporary = $MaxBullet Temporary run data modify storage asset:context this.IsFullCharge set value true

# リセット
scoreboard players reset $Bullet Temporary
scoreboard players reset $AddBullet Temporary
scoreboard players reset $MaxBullet Temporary
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#> asset:effect/0347.snowball_canon/register
#
# Effectのデータを指定
#
# @within function asset:effect/0347.snowball_canon/_/register

# ExtendsSafe (boolean) (default = false)
# data modify storage asset:effect ExtendsSafe set value true
# ID (int)
data modify storage asset:effect ID set value 347
# 名前 (TextComponentString)
data modify storage asset:effect Name set value '{"text":"雪玉発射!!!","color":"#baf5ff"}'
# 説明文 (TextComponentString[])
data modify storage asset:effect Description set value []
# 効果時間 (int) (default = API || error)
data modify storage asset:effect Duration set value 2
# スタック (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 false
# 死亡時のエフェクトの処理 (default = "remove")
# data modify storage asset:effect ProcessOnDied set value
# 消すのに必要なレベル (int) (default = 1)
# data modify storage asset:effect RequireClearLv set value
# エフェクトを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.Bullet set value 1
data modify storage asset:effect Field.MaxBullet set value 60
data modify storage asset:effect Field.IsFullCharge set value false
data modify storage asset:effect Field.IsShooting set value false
data modify storage asset:effect Field.Spread set value {Neutral:0.3,FullCharge:0.1}
data modify storage asset:effect Field.Motion set value {Neutral:0.7,FullCharge:1.5}
data modify storage asset:effect Field.Damage set value 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:effect/0347.snowball_canon/tick/
#
# Effectのtick処理
#
# @within function asset:effect/0347.snowball_canon/_/tick

# Durationが1なら発射する
execute if data storage asset:context {Duration:1} anchored eyes positioned ^-0.3 ^-0.4 ^0.5 run function asset:effect/0347.snowball_canon/tick/shoot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#> asset:effect/0347.snowball_canon/tick/fire
#
# fireといっても雪玉だけどな!
#
# @within function asset:effect/0347.snowball_canon/tick/shoot

#> Private
# @private
#declare tag SpreadMarker

# フルチャージか否かで拡散と弾速が変わる

# 前方拡散
summon marker ~ ~ ~ {Tags:["SpreadMarker"]}
data modify storage lib: Argument.Distance set value 0.5
execute if data storage asset:context this{IsFullCharge:false} run data modify storage lib: Argument.Spread set from storage asset:context this.Spread.Neutral
execute if data storage asset:context this{IsFullCharge: true} run data modify storage lib: Argument.Spread set from storage asset:context this.Spread.FullCharge
execute as @e[type=marker,tag=SpreadMarker,distance=..0.01,limit=1] run function lib:forward_spreader/circle

# Object召喚
data modify storage api: Argument.ID set value 1155
data modify storage api: Argument.FieldOverride.Damage set from storage asset:context this.Damage
execute if data storage asset:context this{IsFullCharge:false} run data modify storage api: Argument.FieldOverride.Motion set from storage asset:context this.Motion.Neutral
execute if data storage asset:context this{IsFullCharge: true} run data modify storage api: Argument.FieldOverride.Motion set from storage asset:context this.Motion.FullCharge
execute store result storage api: Argument.FieldOverride.UserID int 1 run scoreboard players get @s UserID
execute facing entity @e[type=marker,tag=SpreadMarker,distance=..10,limit=1] eyes run function api:object/summon

# リセット
kill @e[type=marker,tag=SpreadMarker,distance=..10]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#> asset:effect/0347.snowball_canon/tick/save_full_charge
#
#
#
# @within function asset:effect/0347.snowball_canon/tick/shoot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#> asset:effect/0347.snowball_canon/tick/shoot
#
#
#
# @within function asset:effect/0347.snowball_canon/tick/

# 弾数のデクリメント
execute store result storage asset:context this.Bullet int 0.9999999999 run data get storage asset:context this.Bullet

# 射撃中の判定を設定
data modify storage asset:context this.IsShooting set value true

# 弾数が0でなければDurationを少し戻す
# フルチャージか否かで間隔が変わる
execute unless data storage asset:context this{Bullet:0} if data storage asset:context this{IsFullCharge:false} run data modify storage asset:context Duration set value 3
execute unless data storage asset:context this{Bullet:0} if data storage asset:context this{IsFullCharge: true} run data modify storage asset:context Duration set value 2

# 演出
particle item_snowball ^ ^-0.2 ^ 0 0 0 0.5 1 normal @a
playsound minecraft:entity.snowball.throw player @a ~ ~ ~ 0.6 0.65

# 発射
function asset:effect/0347.snowball_canon/tick/fire
33 changes: 33 additions & 0 deletions Asset/data/asset/functions/object/1155.snowball/hit/.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#> asset:object/1155.snowball/hit/
#
# 継承先などから実行される処理
#
# @within asset:object/alias/1155/hit

#> Private
# @private
#declare tag Hit
#declare score_holder $UserID

# 判定がかなり広いが、これは雪玉の割れる位置の関係なのか
# スケルトンなどの敵にヒットすると稀に当たらないため、広く取っておく
# あと少し下側からの判定にしておく

# 判定を広くはとるが、その中で最も近い敵をターゲットにする
execute positioned ~-1.5 ~-1.7 ~-1.5 run tag @e[type=#lib:living_without_player,tag=Enemy,tag=!Uninterferable,dx=2,dy=2,dz=2] add Hit

# ダメージ
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 "Water"
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 api:damage/modifier
execute as @e[type=#lib:living_without_player,tag=Hit,distance=..10,sort=nearest,limit=1] run function api:damage/
function api:damage/reset

# super
function asset:object/super.method

# リセット
tag @e[type=#lib:living_without_player,tag=Hit,distance=..10] remove Hit
scoreboard players reset $UserID Temporary
Loading