-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into rewrite/artifact-event-system
- Loading branch information
Showing
26 changed files
with
296 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
TheSkyBlessing/data/api/functions/entity/player/absorption/add.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#> api:entity/player/absorption/add | ||
# | ||
# プレイヤーに緩衝体力を付与します | ||
# | ||
# 複数の緩衝体力がある際は、Argument.Priority が大きいものから消費されます。 | ||
# Argument.Priority は 0 ~ 10 の整数である必要があります。 | ||
# | ||
# また、その UUID の全ての緩衝体力が消費された時、Argument.WipedCallback が呼び出されます。 | ||
# | ||
# @input | ||
# as player | ||
# storage api: | ||
# Argument.Amount : double @ 0.. | ||
# Argument.UUID : [int] @ 4 | ||
# Argument.Priority? : int @ 1..10 (default: 0) | ||
# Argument.WipedCallback? : string (function) | ||
# @api | ||
|
||
# Validation | ||
execute unless data storage api: Argument.Amount run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" Amount","color":"red"}] | ||
execute unless data storage api: Argument.Amount run return fail | ||
execute unless data storage api: Argument.UUID run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" UUID","color":"red"}] | ||
execute unless data storage api: Argument.UUID run return fail | ||
|
||
# Default value | ||
execute unless data storage api: Argument.Priority run data modify storage api: Argument.Priority set value 0 | ||
|
||
# Call core | ||
function api:entity/player/absorption/core/upsert.m with storage api: Argument | ||
|
||
# Reset | ||
data remove storage api: Argument.Amount | ||
data remove storage api: Argument.UUID | ||
data remove storage api: Argument.Priority | ||
data remove storage api: Argument.WipedCallback |
5 changes: 5 additions & 0 deletions
5
TheSkyBlessing/data/api/functions/entity/player/absorption/core/get.m.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#> api:entity/player/absorption/core/get.m | ||
# @input args UUID: [int] @ 4 | ||
# @within function api:entity/player/absorption/get | ||
|
||
$data modify storage api: Return.Absorption set from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{UUID:$(UUID)}] |
5 changes: 5 additions & 0 deletions
5
TheSkyBlessing/data/api/functions/entity/player/absorption/core/remove.m.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#> api:entity/player/absorption/core/remove.m | ||
# @input args UUID: [int] @ 4 | ||
# @within function api:entity/player/absorption/remove | ||
|
||
$data remove storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{UUID:$(UUID)}] |
26 changes: 26 additions & 0 deletions
26
TheSkyBlessing/data/api/functions/entity/player/absorption/core/upsert.m.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#> api:entity/player/absorption/core/upsert.m | ||
# @input args UUID: [int] @ 4 | ||
# @within function api:entity/player/absorption/add | ||
|
||
#> Private | ||
# @private | ||
#declare score_holder $ExistsAbsorption | ||
|
||
# EntityStorage | ||
function oh_my_dat:please | ||
|
||
# InsertItem 作成 | ||
data modify storage api: InsertItem set value {} | ||
execute store result storage api: InsertItem.Amount double 0.01 run data get storage api: Argument.Amount 100 | ||
data modify storage api: InsertItem.UUID set from storage api: Argument.UUID | ||
data modify storage api: InsertItem.Priority set from storage api: Argument.Priority | ||
data modify storage api: InsertItem.WipedCallback set from storage api: Argument.WipedCallback | ||
|
||
# Upsert 処理 | ||
$execute store result score $ExistsAbsorption Temporary if data storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{UUID:$(UUID)}] | ||
$execute if score $ExistsAbsorption Temporary matches 1.. run data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{UUID:$(UUID)}] set from storage api: InsertItem | ||
execute unless score $ExistsAbsorption Temporary matches 1.. run data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions append from storage api: InsertItem | ||
|
||
# リセット | ||
scoreboard players reset $ExistsAbsorption Temporary | ||
data remove storage api: InsertItem |
19 changes: 19 additions & 0 deletions
19
TheSkyBlessing/data/api/functions/entity/player/absorption/get.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#> api:entity/player/absorption/get | ||
# | ||
# プレイヤーの緩衝体力を取得します | ||
# | ||
# @input | ||
# as player | ||
# storage api: | ||
# Argument.UUID : [int] @ 4 | ||
# @api | ||
|
||
# Validation | ||
execute unless data storage api: Argument.UUID run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" UUID","color":"red"}] | ||
execute unless data storage api: Argument.UUID run return fail | ||
|
||
# Default value | ||
function api:entity/player/absorption/core/get.m with storage api: Argument | ||
|
||
# Reset | ||
data remove storage api: Argument.UUID |
19 changes: 19 additions & 0 deletions
19
TheSkyBlessing/data/api/functions/entity/player/absorption/remove.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#> api:entity/player/absorption/remove | ||
# | ||
# プレイヤーの緩衝体力を削除します | ||
# | ||
# @input | ||
# as player | ||
# storage api: | ||
# Argument.UUID : [int] @ 4 | ||
# @api | ||
|
||
# Validation | ||
execute unless data storage api: Argument.UUID run tellraw @a [{"storage":"global","nbt":"Prefix.ERROR"},{"text":"引数が足りません","color":"white"},{"text":" UUID","color":"red"}] | ||
execute unless data storage api: Argument.UUID run return fail | ||
|
||
# Default value | ||
function api:entity/player/absorption/core/remove.m with storage api: Argument | ||
|
||
# Reset | ||
data remove storage api: Argument.UUID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
TheSkyBlessing/data/debug/functions/mob/summon.m.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#> debug:mob/summon.m | ||
# | ||
# マクロで指定されたIDのMobを召喚します | ||
# | ||
# @input args: | ||
# ID : int | ||
# @private | ||
# @user | ||
|
||
# マクロからIDを取得し召喚 | ||
$data modify storage api: Argument.ID set value $(ID) | ||
function api:mob/summon |
26 changes: 0 additions & 26 deletions
26
TheSkyBlessing/data/lib/functions/score_to_health_wrapper/core/absorb_damage.mcfunction
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
TheSkyBlessing/data/lib/functions/score_to_health_wrapper/core/absorb_damage/.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#> lib:score_to_health_wrapper/core/absorb_damage/ | ||
# @within function lib:score_to_health_wrapper/proc | ||
|
||
#> Private | ||
# @within function | ||
# lib:score_to_health_wrapper/core/absorb_damage/ | ||
# lib:score_to_health_wrapper/core/absorb_damage/foreach | ||
#declare score_holder $BaseDamage | ||
|
||
# EntityStorage 呼び出し | ||
function oh_my_dat:please | ||
|
||
# 計算用に値を移す | ||
scoreboard players operation $BaseDamage Temporary = @s ScoreToHPFluc | ||
scoreboard players operation $BaseDamage Temporary *= $-1 Const | ||
|
||
# OMD から緩衝体力を Priority の昇順で取得する (OMD -> Absorptions) | ||
function lib:score_to_health_wrapper/core/absorb_damage/get_absorptions | ||
# ダメージを緩衝体力で軽減する (Absorptions -> NewAbsorptions) | ||
data modify storage lib: NewAbsorptions set value [] | ||
execute if data storage lib: Absorptions[0] run function lib:score_to_health_wrapper/core/absorb_damage/foreach | ||
# 残った緩衝体力を戻す (NewAbsorptions -> OMD) | ||
function oh_my_dat:please | ||
data modify storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions set from storage lib: NewAbsorptions | ||
|
||
# ダメージを戻す | ||
scoreboard players operation $BaseDamage Temporary *= $-1 Const | ||
scoreboard players operation @s ScoreToHPFluc = $BaseDamage Temporary | ||
|
||
# リセット | ||
scoreboard players reset $BaseDamage Temporary |
6 changes: 6 additions & 0 deletions
6
...lib/functions/score_to_health_wrapper/core/absorb_damage/call_wiped_callback.m.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#> lib:score_to_health_wrapper/core/absorb_damage/call_wiped_callback.m | ||
# @input args | ||
# WipedCallback: string (function) | ||
# @within function lib:score_to_health_wrapper/core/absorb_damage/foreach | ||
|
||
$function $(WipedCallback) |
36 changes: 36 additions & 0 deletions
36
...Blessing/data/lib/functions/score_to_health_wrapper/core/absorb_damage/foreach.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#> lib:score_to_health_wrapper/core/absorb_damage/foreach | ||
# @within function | ||
# lib:score_to_health_wrapper/core/absorb_damage/ | ||
# lib:score_to_health_wrapper/core/absorb_damage/foreach | ||
|
||
#> Private | ||
# @private | ||
#declare score_holder $Absorption | ||
#declare score_holder $isCompleteAbsorb | ||
|
||
# データ取得 | ||
data modify storage lib: HeadAbsorption set from storage lib: Absorptions[-1] | ||
data remove storage lib: Absorptions[-1] | ||
# 緩衝体力を取得 | ||
execute store result score $Absorption Temporary run data get storage lib: HeadAbsorption.Amount 100 | ||
|
||
# 緩衝体力とダメージの数字を比較する | ||
execute store result score $isCompleteAbsorb Temporary if score $BaseDamage Temporary < $Absorption Temporary | ||
# ダメージよりも緩衝体力のほうが大きくない場合(同一も)、その分ダメージを軽減する | ||
execute if score $isCompleteAbsorb Temporary matches 0 run scoreboard players operation $BaseDamage Temporary -= $Absorption Temporary | ||
execute if score $isCompleteAbsorb Temporary matches 0 if data storage lib: HeadAbsorption.WipedCallback run function lib:score_to_health_wrapper/core/absorb_damage/call_wiped_callback.m with storage lib: HeadAbsorption | ||
# ダメージよりも緩衝体力のほうが大きい場合、ダメージを全て削除し、その分緩衝体力を減少させる | ||
execute if score $isCompleteAbsorb Temporary matches 1 run scoreboard players operation $Absorption Temporary -= $BaseDamage Temporary | ||
execute if score $isCompleteAbsorb Temporary matches 1 run scoreboard players set $BaseDamage Temporary 0 | ||
execute if score $isCompleteAbsorb Temporary matches 1 run data modify storage lib: NewAbsorptions append from storage lib: HeadAbsorption | ||
execute if score $isCompleteAbsorb Temporary matches 1 store result storage lib: NewAbsorptions[-1].Amount double 0.01 run scoreboard players get $Absorption Temporary | ||
|
||
# リセット | ||
data remove storage lib: HeadAbsorption | ||
scoreboard players reset $Absorption Temporary | ||
scoreboard players reset $isCompleteAbsorb Temporary | ||
|
||
# ダメージを緩衝しきった場合、残っている緩衝体力を全て NewAbsorption に追加する | ||
execute if score $BaseDamage Temporary matches ..0 if data storage lib: Absorptions[0] run function lib:score_to_health_wrapper/core/absorb_damage/revert | ||
# ダメージを緩衝しきれず、かつまだ緩衝体力がある場合、再帰的に緩衝する | ||
execute if score $BaseDamage Temporary matches 1.. if data storage lib: Absorptions[0] run function lib:score_to_health_wrapper/core/absorb_damage/foreach |
25 changes: 25 additions & 0 deletions
25
.../data/lib/functions/score_to_health_wrapper/core/absorb_damage/get_absorptions.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#> lib:score_to_health_wrapper/core/absorb_damage/get_absorptions | ||
# @within function lib:score_to_health_wrapper/core/absorb_damage/ | ||
|
||
# セッション開く | ||
function lib:array/session/open | ||
|
||
# Priority 10 -> 0 の順に追加 | ||
data modify storage lib: Array append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{Priority:10}] | ||
data modify storage lib: Array append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{Priority:9}] | ||
data modify storage lib: Array append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{Priority:8}] | ||
data modify storage lib: Array append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{Priority:7}] | ||
data modify storage lib: Array append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{Priority:6}] | ||
data modify storage lib: Array append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{Priority:5}] | ||
data modify storage lib: Array append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{Priority:4}] | ||
data modify storage lib: Array append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{Priority:3}] | ||
data modify storage lib: Array append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{Priority:2}] | ||
data modify storage lib: Array append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{Priority:1}] | ||
data modify storage lib: Array append from storage oh_my_dat: _[-4][-4][-4][-4][-4][-4][-4][-4].Absorptions[{Priority:0}] | ||
# 反転させる (0 -> 10) | ||
function lib:array/reverse | ||
# Absorptions に移す | ||
data modify storage lib: Absorptions set from storage lib: Array | ||
|
||
# セッション閉じる | ||
function lib:array/session/close |
15 changes: 15 additions & 0 deletions
15
...yBlessing/data/lib/functions/score_to_health_wrapper/core/absorb_damage/revert.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#> lib:score_to_health_wrapper/core/absorb_damage/revert | ||
# @within function lib:score_to_health_wrapper/core/absorb_damage/foreach | ||
|
||
# セッション開ける | ||
function lib:array/session/open | ||
|
||
# 残っている Absorptions を移す | ||
data modify storage lib: Array set from storage lib: Absorptions | ||
# 反転させる | ||
function lib:array/reverse | ||
# NewAbsorptions に追加する | ||
data modify storage lib: NewAbsorptions append from storage lib: Array[] | ||
|
||
# セッション閉じる | ||
function lib:array/session/close |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
data modify storage api: Argument.UUID set value [I; -1,0,0,0] | ||
data modify storage api: Argument.Amount set value 100 | ||
data modify storage api: Argument.Operation set value "add" | ||
|
||
data modify storage api: Argument.ID set value 65533 | ||
data modify storage api: Argument.Duration set value 200 | ||
function api:entity/mob/effect/give | ||
function api:modifier/max_health/add |
3 changes: 3 additions & 0 deletions
3
TheSkyBlessing/data/minecraft/functions/tests/absorption_api/callback1.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#> minecraft:tests/absorption_api/callback1 | ||
# @within function minecraft:test | ||
say callback1 called |
3 changes: 3 additions & 0 deletions
3
TheSkyBlessing/data/minecraft/functions/tests/absorption_api/callback2.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#> minecraft:tests/absorption_api/callback2 | ||
# @within function minecraft:test | ||
say callback2 called |
3 changes: 3 additions & 0 deletions
3
TheSkyBlessing/data/minecraft/functions/tests/absorption_api/callback3.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#> minecraft:tests/absorption_api/callback3 | ||
# @within function minecraft:test | ||
say callback3 called |
17 changes: 17 additions & 0 deletions
17
TheSkyBlessing/data/minecraft/functions/tests/absorption_api/test.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
data modify storage api: Argument.Amount set value 4 | ||
data modify storage api: Argument.UUID set value [I; -1, 0, 0, 3] | ||
data modify storage api: Argument.Priority set value 1 | ||
data modify storage api: Argument.WipedCallback set value "minecraft:callback3" | ||
function api:entity/player/absorption/add | ||
|
||
data modify storage api: Argument.Amount set value 4 | ||
data modify storage api: Argument.UUID set value [I; -1, 0, 0, 2] | ||
data modify storage api: Argument.Priority set value 1 | ||
data modify storage api: Argument.WipedCallback set value "minecraft:callback2" | ||
function api:entity/player/absorption/add | ||
|
||
data modify storage api: Argument.Amount set value 4 | ||
data modify storage api: Argument.UUID set value [I; -1, 0, 0, 1] | ||
data modify storage api: Argument.Priority set value 10 | ||
data modify storage api: Argument.WipedCallback set value "minecraft:callback1" | ||
function api:entity/player/absorption/add |
Oops, something went wrong.