Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚚 [神器2] 祝福をAssetリポジトリに迎え入れる #273

Merged
merged 3 commits into from
Oct 6, 2024
Merged
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/0002.blessing/give/1.trigger
#
# 神器の取得処理の呼び出し時に実行されるfunction
#
# @within tag/function asset:artifact/give

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

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

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 2
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:carrot_on_a_stick"
# 神器の名前 (TextComponentString)
function asset:artifact/0002.blessing/give/get_random_name
data modify storage asset:artifact Name set value '[{"storage":"asset:temp","nbt":"02.Name"},{"text":"の祝福"}]'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text":"この世界を浄化する者に祝福を与える"}']
# MP以外の消費物 (TextComponentString) (オプション)
# data modify storage asset:artifact CostText set value
# 使用回数 (int) (オプション)
data modify storage asset:artifact RemainingCount set value 1
# 神器を発動できるスロット (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 [0,0]
# 攻撃に関する情報 -攻撃タイプ (string[]) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.AttackType set value [Physical,Magic]
# 攻撃に関する情報 -攻撃属性 (string[]) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.ElementType set value [Fire,Water,Thunder,None]
# 攻撃に関する情報 -防御無視 (boolean) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.BypassResist set value
# 攻撃に関する情報 -範囲攻撃 (string) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.IsRangeAttack set value
# 攻撃に関する情報 -攻撃範囲 (literal) Wikiを参照 (オプション)
# data modify storage asset:artifact AttackInfo.AttackRange set value
# MP消費量 (int)
data modify storage asset:artifact MPCost set value 0
# MP必要量 (int) (オプション)
# data modify storage asset:artifact MPRequire set value
# 神器のクールダウン (int) (オプション)
# data modify storage asset:artifact LocalCooldown 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
# 扱える神 (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

# リセット
data remove storage asset:temp 02.Name
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#> asset:artifact/0002.blessing/give/get_random_name
#
#
#
# @within function asset:artifact/0002.blessing/give/2.give

#> Length
# @private
#declare score_holder $CandidatesLength
#declare score_holder $Argument.Index

# セッション開ける
function lib:array/session/open
# 名前候補リスト
data modify storage lib: Array set value ['深淵','奈落','天空','始原','神威','太陽','生命','満月','星雲','極光','蒼天','夜闇']
# 候補リストの長さを取得
execute store result score $CandidatesLength Temporary if data storage lib: Array[]
# ターゲットの名前をランダムに決める
execute store result score $Argument.Index Lib run function lib:random/
scoreboard players operation $Argument.Index Lib %= $CandidatesLength Temporary
# 移動
function lib:array/move
# 取得
data modify storage asset:temp 02.Name set from storage lib: Array[-1]
# リセット
function lib:array/session/close
scoreboard players reset $CandidatesLength
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> asset:artifact/0002.blessing/trigger/0.load
#
# 神器に利用するスコアボード等の初期化処理
#
# @within tag/function asset:artifact/load

#> 定義類はここに
# @within function asset:artifact/0002.blessing/trigger/**
scoreboard objectives add 02.Trigger trigger
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:artifact/0002.blessing/trigger/1.trigger
#
# 指定したイベントタイミングで実行されるfunction
#
# @within tag/function asset:artifact/**

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

# 神器の基本的な条件の確認を行うfunction、成功している場合CanUsedタグが付く auto/feet/legs/chest/head/mainhand/offhandを記載してね
function asset:artifact/common/check_condition/auto
# すでに選択待機中ならキャンセル
execute if score @s 02.Trigger matches 0 run tag @s remove CanUsed
execute if score @s 02.Trigger matches 0 run tellraw @s [{"text":"前回の能力ボーナスが未選択です","color":"red"}]
execute if score @s 02.Trigger matches 0 run function asset:artifact/0002.blessing/trigger/show_trigger_chat
# CanUsedタグをチェックして3.main.mcfunctionを実行する
execute if entity @s[tag=CanUsed] run function asset:artifact/0002.blessing/trigger/3.main
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#> asset:artifact/0002.blessing/trigger/3.main
#
# 神器のメイン処理部
#
# @within function asset:artifact/0002.blessing/trigger/2.check_condition

# 基本的な使用時の処理(MP消費や使用回数の処理など)を行う auto/feet/legs/chest/head/mainhand/offhandを記載してね
function asset:artifact/common/use/auto

# ここから先は神器側の効果の処理を書く
# 固定加算量 : HP +2, MP +4
# 50島攻略時 : HP+100, MP+200
# 追加選択 : HP +1, MP +2, Atk +1%, Def +1%
# 50島極振り時: HP +50, MP+100, Atk+50%, Def+50%

# 固定加算
scoreboard players add $BonusHealth Global 2
execute as @a run function api:modifier/max_health/update_bonus
scoreboard players add $BonusMP Global 4
execute as @a run function api:modifier/max_mp/update_bonus
# 選択トリガー
scoreboard players enable @s 02.Trigger
# チャット
function asset:artifact/0002.blessing/trigger/show_trigger_chat
# リスナー
schedule function asset:artifact/0002.blessing/trigger/listener 1t
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#> asset:artifact/0002.blessing/trigger/_index.d
# @private

#> Private
# @within function asset:artifact/0002.blessing/trigger/**
#declare tag 01.Target
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#> asset:artifact/0002.blessing/trigger/listener
#
#
#
# @within function
# asset:artifact/0002.blessing/trigger/3.main
# asset:artifact/0002.blessing/trigger/listener

# チェック
execute as @a[scores={02.Trigger=1..}] run function asset:artifact/0002.blessing/trigger/on_trigger
# ループ
execute if entity @a[scores={02.Trigger=0},limit=1] run schedule function asset:artifact/0002.blessing/trigger/listener 1t
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#> asset:artifact/0002.blessing/trigger/on_trigger
#
#
#
# @within function asset:artifact/0002.blessing/trigger/listener

# エラー値
execute unless score @s 02.Trigger matches 1..4 run function lib:message/invalid_operation
execute unless score @s 02.Trigger matches 1..4 run function asset:artifact/0002.blessing/trigger/show_trigger_chat
# 体力
execute if score @s 02.Trigger matches 1 run scoreboard players add $BonusHealth Global 1
execute if score @s 02.Trigger matches 1 as @a run function api:modifier/max_health/update_bonus
# MP
execute if score @s 02.Trigger matches 2 run scoreboard players add $BonusMP Global 2
execute if score @s 02.Trigger matches 2 as @a run function api:modifier/max_mp/update_bonus
# 攻撃
execute if score @s 02.Trigger matches 3 run scoreboard players add $BonusAttack Global 1
execute if score @s 02.Trigger matches 3 as @a run function api:modifier/attack/base/update_bonus
# 防御
execute if score @s 02.Trigger matches 4 run scoreboard players add $BonusDefense Global 1
execute if score @s 02.Trigger matches 4 as @a run function api:modifier/defense/base/update_bonus
# リセット
scoreboard players reset @s 02.Trigger
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:artifact/0002.blessing/trigger/rejoin_process
#
# 使い方は必ずwikiを見ること
#
# @within tag/function asset:rejoin

execute if score @s 02.Trigger matches 0 run function asset:artifact/0002.blessing/trigger/show_trigger_chat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#> asset:artifact/0002.blessing/trigger/show_trigger_chat
#
#
#
# @within function asset:artifact/0002.blessing/trigger/*

# 出力
tellraw @s {"text":"能力ボーナスを一つ選んでください"}
tellraw @s [{"text":"[選ぶ]","clickEvent":{"action":"run_command","value":"/trigger 02.Trigger set 1"},"color":"gold"},{"text":" 体力(現在値: +","color":"white"},{"score":{"name": "$BonusHealth","objective":"Global"},"color":"aqua"},{"text":") +","color":"white"},{"text":"1","color":"aqua"}]
tellraw @s [{"text":"[選ぶ]","clickEvent":{"action":"run_command","value":"/trigger 02.Trigger set 2"},"color":"gold"},{"text":" 魔力(現在値: +","color":"white"},{"score":{"name": "$BonusMP","objective":"Global"},"color":"aqua"},{"text":") +","color":"white"},{"text":"2","color":"aqua"}]
tellraw @s [{"text":"[選ぶ]","clickEvent":{"action":"run_command","value":"/trigger 02.Trigger set 3"},"color":"gold"},{"text":" 攻撃(現在値: +","color":"white"},{"score":{"name": "$BonusAttack","objective":"Global"},"color":"aqua"},{"text":"%) +","color":"white"},{"text":"1","color":"aqua"},{"text":"%","color":"white"}]
tellraw @s [{"text":"[選ぶ]","clickEvent":{"action":"run_command","value":"/trigger 02.Trigger set 4"},"color":"gold"},{"text":" 防御(現在値: +","color":"white"},{"score":{"name": "$BonusDefense","objective":"Global"},"color":"aqua"},{"text":"%) +","color":"white"},{"text":"1","color":"aqua"},{"text":"%","color":"white"}]
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/0002.blessing/trigger/1.trigger",
"asset:artifact/1024.brave_rod/trigger/1.trigger",
"asset:artifact/0999.sextaple_ultima/trigger/1.trigger",
"asset:artifact/0837.the_world_knife/trigger/1.trigger",
Expand Down
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/0002.blessing/give/1.trigger",
"asset:artifact/1108.white_lily_of_priestess/give/1.trigger",
"asset:artifact/1106.rainbow_candy/give/1.trigger",
"asset:artifact/1104.orange/give/1.trigger",
Expand Down Expand Up @@ -380,4 +381,4 @@
"asset:artifact/0735.collision_plate/give/1.trigger",
"asset:artifact/0745.blade_of_whirlwind/give/1.trigger"
]
}
}
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/artifact/load.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/0002.blessing/trigger/0.load",
"asset:artifact/1024.brave_rod/trigger/0.load",
"asset:artifact/0837.the_world_knife/trigger/0.load",
"asset:artifact/0600.xtal/trigger/0.load",
Expand Down
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/rejoin.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/0002.blessing/trigger/rejoin_process",
"asset:artifact/1024.brave_rod/trigger/rejoin_process",
"asset:artifact/0837.the_world_knife/trigger/rejoin_process",
"asset:artifact/0600.xtal/trigger/rejoin_process",
Expand Down
Loading