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

♻️ [Artifact 1048] サンダーストームの処理をObjectAssetへ移行 #1077

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
Expand Up @@ -15,7 +15,7 @@
# 神器の名前 (TextComponentString)
data modify storage asset:artifact Name set value '{"text":"サンダーストーム","color":"gold","bold":true}'
# 神器の説明文 (TextComponentString[])
data modify storage asset:artifact Lore set value ['{"text":"雷雲を呼び出し、広範囲の敵を雷で攻撃する"}','{"text":"現在MP割合が少ないほどダメージが増加する"}','{"text":"まばゆい煌めきとともに稲妻が空を裂く","color":"gold"}']
data modify storage asset:artifact Lore set value ['{"text":"雷雲を呼び出し、広範囲の敵を雷で攻撃する"}','{"text":"減少したMP割合に比例してダメージが増加する(最大300)"}','{"text":"まばゆい煌めきとともに稲妻が空を裂く","color":"gold"}']
# 消費アイテム ({Item: TextComponent, Count: int, Extra?: TextComponent}) (オプション)
# data modify storage asset:artifact ConsumeItem.Item set value
# data modify storage asset:artifact ConsumeItem.Count set value
Expand All @@ -29,7 +29,7 @@
# 神器の発動条件 (TextComponentString) (オプション)
# data modify storage asset:artifact Condition set value
# 攻撃に関する情報 -Damage量 (literal[]/literal) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.Damage set value [340,640]
data modify storage asset:artifact AttackInfo.Damage set value [340]
# 攻撃に関する情報 -攻撃タイプ (string[]) Wikiを参照 (オプション)
data modify storage asset:artifact AttackInfo.AttackType set value [Magic]
# 攻撃に関する情報 -攻撃属性 (string[]) Wikiを参照 (オプション)
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,41 @@

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

# MP減少率を計算
# 最大MPを取得する
function api:mp/get_max
execute store result score $MPMaxValue Temporary run data get storage api: Return.MaxMP
# 使用直前のMPを取得する
function api:mp/get_current
execute store result score $MPValue Temporary run data get storage api: Return.CurrentMP

# MP現在量を100倍する
scoreboard players operation $MPValue Temporary *= $100 Const

# 割る
scoreboard players operation $MPValue Temporary /= $MPMaxValue Temporary
scoreboard players operation $MPValue Temporary -= $100 Const

# マーカーを持ってくる
# MP減少割合を計算
# 最大MPを取得する
function api:mp/get_max
execute store result score $MPMaxValue Temporary run data get storage api: Return.MaxMP
# 使用直前のMPを取得する
function api:mp/get_current
execute store result score $MPValue Temporary run data get storage api: Return.CurrentMP

# 現MPの割合算出
scoreboard players operation $MPValue Temporary *= $100 Const
scoreboard players operation $MPValue Temporary /= $MPMaxValue Temporary

# 反転させる
scoreboard players operation $MPValue Temporary -= $100 Const
scoreboard players operation $MPValue Temporary *= $-1 Const

# ダメージ計算 Damage = 340 + (1 - MP割合) * 3
scoreboard players add $Damage Temporary 340
scoreboard players operation $MPValue Temporary *= $3 Const
scoreboard players operation $Damage Temporary += $MPValue Temporary

# 再帰でMarkerを視点先のブロックの位置まで移動させる
execute anchored eyes run tp 0-0-0-0-0 ^ ^ ^ ~ ~
scoreboard players set $T4.Temp Temporary 64
execute as 0-0-0-0-0 at @s positioned ^ ^ ^0.25 if block ^ ^ ^ #lib:no_collision run function asset:artifact/1048.thunder_storm/trigger/3.1.main_loop
execute as 0-0-0-0-0 at @s positioned ^ ^ ^0.25 if block ^ ^ ^ #lib:no_collision run function asset:artifact/1048.thunder_storm/trigger/recursive

# Marker召喚
# MP消費を引き継ぐ
execute as 0-0-0-0-0 at @s run summon marker ^ ^ ^ {Tags:["T4.Marker","T4.MarkerInit"]}
scoreboard players operation $T4.Temp Temporary = @s UserID
execute as @e[type=marker,tag=T4.MarkerInit,distance=..24] run scoreboard players operation @s T4.OwnerID = $T4.Temp Temporary
execute as @e[type=marker,tag=T4.MarkerInit,distance=..24] run scoreboard players operation @s T4.MPPer = $MPValue Temporary
execute as @e[type=marker,tag=T4.MarkerInit,distance=..24] run tag @s remove T4.MarkerInit

# スケジュール設定
schedule function asset:artifact/1048.thunder_storm/trigger/4.schedule 1t
# Markerの位置で召喚
data modify storage api: Argument.ID set value 1044
execute store result storage api: Argument.FieldOverride.Damage int 1 run scoreboard players get $Damage Temporary
execute store result storage api: Argument.FieldOverride.UserID int 1 run scoreboard players get @s UserID
execute positioned as 0-0-0-0-0 run function api:object/summon

# リセット
execute in overworld run tp 0-0-0-0-0 0.0 0.0 0.0
scoreboard players reset $T4.Temp Temporary
scoreboard players reset $Damage Temporary
scoreboard players reset $MPValue Temporary
scoreboard players reset $MPMaxValue Temporary

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#> tag
# @within function asset:artifact/1048.thunder_storm/trigger/**
#declare score_holder $T4.Temp
#declare score_holder $T4.OwnerId
#declare score_holder $Damage
#declare score_holder $MPMaxValue
#declare score_holder $MPValue
#declare tag T4.Marker
#declare tag T4.MarkerInit
#declare tag T4.Owner
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#> asset:artifact/1048.thunder_storm/trigger/recursive
#
# 再帰でObjectの召喚位置を決める
#
# @within function
# asset:artifact/1048.thunder_storm/trigger/3.main
# asset:artifact/1048.thunder_storm/trigger/recursive

# 移動
tp @s ~ ~ ~

# 再帰
scoreboard players remove $T4.Temp Temporary 1
execute at @s positioned ^ ^ ^0.25 if block ^ ^ ^ #lib:no_collision if score $T4.Temp Temporary matches 1.. run function asset:artifact/1048.thunder_storm/trigger/recursive

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#> asset:object/1044.thunder_storm/register
#
# Objectのデータを指定
#
# @within function asset:object/alias/1044/register

# 継承(オプション)
# data modify storage asset:object Extends append value
# function asset:object/extends
# 他のObjectに継承されることを許可するか (boolean) (オプション)
# data modify storage asset:object ExtendsSafe set value
# 継承されることを前提とした、抽象的なObjectであるかどうか(boolean)
data modify storage asset:object IsAbstract set value false
# Tickするかどうか(boolean) (オプション)
# data modify storage asset:object IsTicking set value

# ID (int)
data modify storage asset:object ID set value 1044
# フィールド(オプション)
data modify storage asset:object Field.Damage set value 1
data modify storage asset:object Field.UserID set value -1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset:object/1044.thunder_storm/summon/
#
# Object召喚処理の呼び出し時に実行されるfunction
#
# @within asset:object/alias/1044/summon

# 元となるEntityを召喚する
execute as 0-0-0-0-0 in minecraft:overworld positioned as @s run tp @s ~ ~ ~ ~ 0
data modify storage asset:temp Args.Rotation set from entity 0-0-0-0-0 Rotation
function asset:object/1044.thunder_storm/summon/m with storage asset:temp Args
data remove storage asset:temp Args
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#> asset:object/1044.thunder_storm/summon/debug
#
# 動作チェック用の召喚処理 使い終わったら消してもいいかも
#
# @user
# @private

# 召喚
data modify storage api: Argument.ID set value 1044
function api:object/summon
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/1044.thunder_storm/summon/m
#
# @input args:
# Rotation : float @ 2
# @within function asset:object/1044.thunder_storm/summon/

# 元となるEntityを召喚する
$summon marker ~ ~ ~ {Rotation:$(Rotation),Tags:["ObjectInit"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#> asset:object/1044.thunder_storm/tick/
#
# Objectのtick時の処理
#
# @within asset:object/alias/1044/tick

# Tick加算
scoreboard players add @s General.Object.Tick 1

# 演出
execute store result storage asset:temp Args.Num int 1 run scoreboard players get @s General.Object.Tick
execute if score @s General.Object.Tick matches ..20 run function asset:object/1044.thunder_storm/tick/vfx/ready/m with storage asset:temp Args
data remove storage asset:temp Args

# スコアが一定以上なら発動
execute if score @s General.Object.Tick matches 21.. run function asset:object/1044.thunder_storm/tick/cast

# 消滅処理
kill @s[scores={General.Object.Tick=1000..}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#> asset:object/1044.thunder_storm/tick/cast
#
#
#
# @within function asset:object/1044.thunder_storm/tick/

#> Private
# @private
#declare score_holder $UserID

# vfx
function asset:object/1044.thunder_storm/tick/vfx/cast

# playsound
playsound entity.lightning_bolt.thunder player @a[distance=..32] ~ ~ ~ 1 2
playsound entity.lightning_bolt.thunder player @a[distance=..32] ~ ~ ~ 1 1.99
playsound block.respawn_anchor.deplete player @a[distance=..32] ~ ~ ~ 1 0
playsound block.respawn_anchor.deplete player @a[distance=..32] ~ ~ ~ 1 0.1
playsound block.end_portal.spawn player @a[distance=..32] ~ ~ ~ 0.2 2 0.2

# ダメージ
data modify storage api: Argument.Damage set from storage asset:context this.Damage
data modify storage api: Argument.AttackType set value "Magic"
data modify storage api: Argument.ElementType set value "Thunder"
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,tag=Enemy,tag=!Uninterferable,distance=..6] run function api:damage/
function api:damage/reset

# リセット
scoreboard players reset $UserID Temporary

# 消滅
kill @s
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#> asset:artifact/1048.thunder_storm/trigger/6.1.cast_vfx
#> asset:object/1044.thunder_storm/tick/vfx/cast
#
# 発動演出
#
# @within function asset:artifact/1048.thunder_storm/trigger/6.cast
#
# @within function asset:object/1044.thunder_storm/tick/cast

# コレクション 1--平面.001
particle dust 100000000 100000000 5000000 1.15 ^-0.0 ^0.0 ^2.0 0.0 0.0 0.0 0.0 1 normal
Expand Down Expand Up @@ -799,8 +799,3 @@ particle flash ^ ^ ^ 0 0 0 0 1 normal
particle flash ^ ^ ^ 0 0 0 0 1 normal
particle flash ^ ^ ^ 0 0 0 0 1 normal

playsound entity.lightning_bolt.thunder player @a[distance=..32] ~ ~ ~ 1 2
playsound entity.lightning_bolt.thunder player @a[distance=..32] ~ ~ ~ 1 1.99
playsound block.respawn_anchor.deplete player @a[distance=..32] ~ ~ ~ 1 0
playsound block.respawn_anchor.deplete player @a[distance=..32] ~ ~ ~ 1 0.1
playsound block.end_portal.spawn player @a[distance=..32] ~ ~ ~ 0.2 2 0.2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#> asset:artifact/1048.thunder_storm/trigger/vfx/fc_1
# @within function asset:artifact/1048.thunder_storm/trigger/vfx/m
#> asset:object/1044.thunder_storm/tick/vfx/ready/fc_1
# @within function asset:object/1044.thunder_storm/tick/vfx/ready/m

# frame 1 / 20
# 円
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#> asset:artifact/1048.thunder_storm/trigger/vfx/fc_10
# @within function asset:artifact/1048.thunder_storm/trigger/vfx/m
#> asset:object/1044.thunder_storm/tick/vfx/ready/fc_10
# @within function asset:object/1044.thunder_storm/tick/vfx/ready/m

# frame 10 / 20
# 円
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#> asset:artifact/1048.thunder_storm/trigger/vfx/fc_11
# @within function asset:artifact/1048.thunder_storm/trigger/vfx/m
#> asset:object/1044.thunder_storm/tick/vfx/ready/fc_11
# @within function asset:object/1044.thunder_storm/tick/vfx/ready/m

# frame 11 / 20
# 円
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#> asset:artifact/1048.thunder_storm/trigger/vfx/fc_12
# @within function asset:artifact/1048.thunder_storm/trigger/vfx/m
#> asset:object/1044.thunder_storm/tick/vfx/ready/fc_12
# @within function asset:object/1044.thunder_storm/tick/vfx/ready/m

# frame 12 / 20
# 円
Expand Down
Loading