Skip to content

Commit

Permalink
🚚 [神器2] 祝福をこちらに戻す
Browse files Browse the repository at this point in the history
  • Loading branch information
haiiro2gou committed Jan 1, 2024
1 parent 52dc82a commit 2192dab
Show file tree
Hide file tree
Showing 18 changed files with 270 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Asset/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020-2022 ProjectTSB

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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+40%, Def+40%

# 固定加算
scoreboard players add $MaxHealth Global 20000
execute as @a run function player_manager:bonus/update_health_bonus
scoreboard players add $MaxMP Global 4
execute as @a run function player_manager:bonus/update_mp_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 $MaxHealth Global 10000
execute if score @s 02.Trigger matches 1 as @a run function player_manager:bonus/update_health_bonus
# MP
execute if score @s 02.Trigger matches 2 run scoreboard players add $MaxMP Global 2
execute if score @s 02.Trigger matches 2 as @a run function player_manager:bonus/update_mp_bonus
# 攻撃
execute if score @s 02.Trigger matches 3 run scoreboard players add $AttackBonus Global 1
execute if score @s 02.Trigger matches 3 as @a run function player_manager:bonus/update_attack_bonus
# 防御
execute if score @s 02.Trigger matches 4 run scoreboard players add $DefenseBonus Global 1
execute if score @s 02.Trigger matches 4 as @a run function player_manager:bonus/update_defense_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,21 @@
#> asset:artifact/0002.blessing/trigger/show_trigger_chat
#
#
#
# @within function asset:artifact/0002.blessing/trigger/*

#> For tellraw
# @private
#declare score_holder $ReadableHealth

# 体力だけx10000なので戻す
scoreboard players operation $ReadableHealth Temporary = $MaxHealth Global
scoreboard players operation $ReadableHealth Temporary /= $10000 Const
# 出力
tellraw @s {"text":"能力ボーナスを一つ選んでください"}
tellraw @s [{"text":"[選ぶ]","clickEvent":{"action":"run_command","value":"/trigger 02.Trigger set 1"},"color":"gold"},{"text":" 体力(現在値: +","color":"white"},{"score":{"name": "$ReadableHealth","objective":"Temporary"},"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": "$MaxMP","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": "$AttackBonus","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": "$DefenseBonus","objective":"Global"},"color":"aqua"},{"text":"%) +","color":"white"},{"text":"1","color":"aqua"},{"text":"%","color":"white"}]
# リセット
scoreboard players reset $ReadableHealth Temporary
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"asset:artifact/0002.blessing/trigger/1.trigger"
]
}
5 changes: 5 additions & 0 deletions Asset/data/asset/tags/functions/artifact/give.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"asset:artifact/0002.blessing/give/1.trigger"
]
}
5 changes: 5 additions & 0 deletions Asset/data/asset/tags/functions/artifact/load.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"asset:artifact/0002.blessing/trigger/0.load"
]
}
5 changes: 5 additions & 0 deletions Asset/data/asset/tags/functions/rejoin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"asset:artifact/0002.blessing/trigger/rejoin_process"
]
}
6 changes: 6 additions & 0 deletions Asset/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"pack": {
"pack_format": 18,
"description": "Mobや神器のAssetを入れるDatapack"
}
}

0 comments on commit 2192dab

Please sign in to comment.