Skip to content
Draft
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/0027.bow_of_apollo/_index.d
# @private

#> declare
# @within function asset:artifact/0027.bow_of_apollo/**
#declare tag R.LockCharge
#declare score_holder $ChargeState
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#> asset:artifact/0027.bow_of_apollo/define_const
# @within function asset:artifact/0027.bow_of_apollo/*/3.main

# チャージ
data modify storage asset:temp R.Const.Charge set value [{Cap:100,Consumption:5},{Cap:300,Consumption:5},{Cap:500,Consumption:5}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#> asset:artifact/0027.bow_of_apollo/get_charge/
#
# チャージ状態を取得する
#
# @input score R.MPCharge
# @output storage asset:temp R.ChargeState
# @within function asset:artifact/0027.bow_of_apollo/**

# 定数をコピー
data modify storage asset:temp R.Temp.ChargeList set from storage asset:temp R.Const.Charge
# それぞれチェックする
scoreboard players set $ChargeState Temporary 0
function asset:artifact/0027.bow_of_apollo/get_charge/recursive
# 返り値
execute store result storage asset:temp R.ChargeState int 1 run scoreboard players get $ChargeState Temporary
# リセット
scoreboard players reset $ChargeState Temporary
data remove storage asset:temp R.Temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#> asset:artifact/0027.bow_of_apollo/get_charge/recursive
# @within function
# asset:artifact/0027.bow_of_apollo/get_charge/
# asset:artifact/0027.bow_of_apollo/get_charge/recursive

#> private
# @private
#declare score_holder $Cap

# データを取得
execute store result score $Cap Temporary run data get storage asset:temp R.Temp.ChargeList[0].Cap
# チェック
execute if score @s R.MPCharge >= $Cap Temporary run scoreboard players add $ChargeState Temporary 1
# リセット
scoreboard players reset $Cap Temporary
# 再帰
data remove storage asset:temp R.Temp.ChargeList[0]
execute if data storage asset:temp R.Temp.ChargeList[0] run function asset:artifact/0027.bow_of_apollo/get_charge/recursive
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#> asset:artifact/0027.bow_of_apollo/give/1.trigger
#
# 神器の取得処理の呼び出し時に実行されるfunction
#
# @within tag/function asset:artifact/give

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

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

# 神器のID (int) スプレッドシートの値を入れる
data modify storage asset:artifact ID set value 27
# 神器のベースアイテム
data modify storage asset:artifact Item set value "minecraft:bow"
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text":"アポロンの弓","color":"#c0c0c0"}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text":"弓を溜め続けると魔力を消費してチャージする。"}','{"text":"チャージの段階に応じて射程・ダメージが増加する。"}','{"text":"ただし、一度魔力が尽きるとそれ以上チャージされなくなる。"}','{"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 "shot"
# 神器の発動条件 (TextComponentString) (オプション)
# data modify storage asset:artifact Condition set value
# 攻撃に関する情報 -Damage量 (literal[]/literal) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.Damage set value [500,2000]
# 攻撃に関する情報 -攻撃タイプ (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 45
# MP消費量 (int)
data modify storage asset:artifact MPCost set value 500
# MP必要量 (int) (オプション)
data modify storage asset:artifact MPRequire set value 100
# 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 "longRange"
data modify storage asset:artifact TypeCooldown.Duration set value 200
# グローバルクールダウン (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,10 @@
#> asset:artifact/0027.bow_of_apollo/load
#
# 神器に利用するスコアボード等の初期化処理
#
# @within tag/function asset:artifact/load

#> declare
# @within function asset:artifact/0027.bow_of_apollo/**
scoreboard objectives add R.LatestChargeTick dummy
scoreboard objectives add R.MPCharge dummy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:artifact/0027.bow_of_apollo/register
#
# 神器プールへの登録処理
#
# @within tag/function asset:artifact/register

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

# 神器の基本的な条件の確認を行う
data modify storage asset:artifact DisabledCheckFlag set value {MPRequire:true}
function asset:artifact/common/check_condition/mainhand

# 成功している場合、3.main.mcfunctionを実行する
execute if entity @s[tag=CanUsed] run function asset:artifact/0027.bow_of_apollo/using_item/3.main
tag @s remove CanUsed
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#> asset:artifact/0027.bow_of_apollo/using_item/3.main
#
# 神器のメイン処理部
#
# @within function asset:artifact/0027.bow_of_apollo/using_item/2.check_condition

# 定数の設定
function asset:artifact/0027.bow_of_apollo/define_const
# 状況の更新
function asset:artifact/0027.bow_of_apollo/using_item/init
execute store result score @s R.LatestChargeTick run data get storage global Time
# チャージ
function asset:artifact/0027.bow_of_apollo/using_item/charge/
# リセット
data remove storage asset:temp R
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#> asset:artifact/0027.bow_of_apollo/using_item/charge/
# @within function asset:artifact/0027.bow_of_apollo/using_item/3.main

#> private
# @private
#declare score_holder $CurrentMP
#declare score_holder $Cap
#declare score_holder $Fluc
#declare score_holder $Consumption

# ロック状態ならここで終了
execute if entity @s[tag=R.LockCharge] run return fail

# チャージ段階を取得
function asset:artifact/0027.bow_of_apollo/get_charge/
# 現段階の消費量を取得
function asset:artifact/0027.bow_of_apollo/using_item/charge/get_current.m with storage asset:temp R
execute unless data storage asset:temp R.Charge run return fail
# その他定数を取得
function api:mp/get_current
execute store result score $CurrentMP Temporary run data get storage api: Return.CurrentMP
execute store result score $Cap Temporary run data get storage asset:temp R.Charge.Cap
execute store result score $Consumption Temporary run data get storage asset:temp R.Charge.Consumption
# MPをチャージする
# $Fluc = min($Consumption, $CurrentMP, 100 - MPCharge) * -1
scoreboard players operation $Fluc Temporary = $Cap Temporary
scoreboard players operation $Fluc Temporary -= @s R.MPCharge
scoreboard players operation $Fluc Temporary < $CurrentMP Temporary
scoreboard players operation $Fluc Temporary < $Consumption Temporary
execute store result storage api: Argument.Fluctuation int -1 run scoreboard players get $Fluc Temporary
data modify storage api: Argument.DisableLog set value true
function api:mp/fluctuation
scoreboard players operation @s R.MPCharge += $Fluc Temporary
# チャージ完了時以外で最大値を吸収できなかったらロックする
execute unless score @s R.MPCharge = $Cap Temporary if score $Fluc Temporary < $Consumption Temporary run tag @s add R.LockCharge
# リセット
scoreboard players reset $Fluc Temporary
scoreboard players reset $CurrentMP Temporary
scoreboard players reset $Consumption Temporary
data remove storage asset:temp R.Charge
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#> asset:artifact/0027.bow_of_apollo/using_item/charge/get_current.m
# @input args ChargeState : int
# @within function asset:artifact/0027.bow_of_apollo/using_item/charge/

$data modify storage asset:temp R.Charge set from storage asset:temp R.Const.Charge[$(ChargeState)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#> asset:artifact/0027.bow_of_apollo/using_item/init
# @within function asset:artifact/0027.bow_of_apollo/using_item/3.main

#> private
# @private
#declare score_holder $Diff

# 現在時刻を取得
execute store result score $Diff Temporary run data get storage global Time
# 最終使用時刻から2t経過していたらリセット
scoreboard players operation $Diff Temporary -= @s R.LatestChargeTick
execute if score $Diff Temporary matches 2.. run tag @s remove R.LockCharge
execute if score $Diff Temporary matches 2.. run scoreboard players reset @s R.MPCharge
# リセット
scoreboard players reset $Diff Temporary
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/0027.bow_of_apollo/give/1.trigger",
"asset:artifact/1252.fox_candle/give/1.trigger",
"asset:artifact/1343.coffee_milk_pack/give/1.trigger",
"asset:artifact/1342.fruit_milk_pack/give/1.trigger",
Expand Down Expand Up @@ -530,4 +531,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/0027.bow_of_apollo/load",
"asset:artifact/1252.fox_candle/trigger/0.load",
"asset:artifact/1311.yearning_rose/damage_from_entity/0.load",
"asset:artifact/1220.sacred_hardener/trigger/0.load",
Expand Down
3 changes: 2 additions & 1 deletion 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/0027.bow_of_apollo/register",
"asset:artifact/1252.fox_candle/register",
"asset:artifact/1343.coffee_milk_pack/register",
"asset:artifact/1342.fruit_milk_pack/register",
Expand Down Expand Up @@ -308,4 +309,4 @@
"asset:artifact/1027.fire_of_rebirth/register",
"asset:artifact/1111.rod_o_redeem/register"
]
}
}
1 change: 1 addition & 0 deletions Asset/data/asset/tags/functions/artifact/using_item.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:artifact/0027.bow_of_apollo/using_item/1.trigger",
"asset:artifact/1220.sacred_hardener/trigger/1.trigger",
"asset:artifact/1269.apocalypse/using_item/1.trigger",
"asset:artifact/1228.fatalerror/trigger/1.trigger",
Expand Down
Loading