Skip to content

Commit

Permalink
アストロスケルトン実装
Browse files Browse the repository at this point in the history
  • Loading branch information
EllaCoat committed Dec 27, 2024
1 parent f2cc47f commit 5d4667e
Show file tree
Hide file tree
Showing 23 changed files with 371 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#> asset:mob/0417.astro_skeleton/_index.d
# @private

#> tag
# @within function asset:mob/0417.astro_skeleton/**
#declare
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#> asset:mob/0417.astro_skeleton/attack/
#
# Mobの攻撃時の処理
#
# @within function asset:mob/alias/417/attack

# バニラの攻撃じゃなかったら return
execute unless data storage asset:context Attack{IsVanilla:true} run return fail

# 演出
execute as @p[tag=Victim] at @s run particle dust 0.925 0.975 0.2 1 ~ ~ ~ 0.5 1 0.5 0 30
playsound entity.blaze.hurt hostile @a ~ ~ ~ 1 0.65

# ダメージ
# 引数の設定
# 与えるダメージ
data modify storage lib: Argument.Damage set value 37.0f
# 第一属性
data modify storage lib: Argument.AttackType set value "Physical"
# 第二属性
data modify storage lib: Argument.ElementType set value "Thunder"
# デスログ
data modify storage lib: Argument.DeathMessage append value '[{"translate": "%1$sは%2$sによって射抜かれた","with":[{"selector":"@s"},{"nbt":"Return.AttackerName","storage":"lib:","interpret":true}]}]'
# 補正functionを実行
function lib:damage/modifier
# ダメージを与える
execute as @p[tag=Victim] at @s run function lib:damage/
# リセット
function lib:damage/reset

# 攻撃力低下エフェクト付与
data modify storage api: Argument set value {ID:101,Duration:200}
function api:global_vars/get_difficulty
execute store result storage api: Argument.Stack int 2 run data get storage api: Return.Difficulty 1
execute as @p[tag=Victim] run function api:entity/mob/effect/give
function api:entity/mob/effect/reset

# 耐性低下エフェクト付与
data modify storage api: Argument set value {ID:107,Duration:200}
function api:global_vars/get_difficulty
execute store result storage api: Argument.Stack int 2 run data get storage api: Return.Difficulty 1
execute as @p[tag=Victim] run function api:entity/mob/effect/give
function api:entity/mob/effect/reset
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#> asset:mob/0417.astro_skeleton/register
#
# Mobのデータを指定
#
# @within function asset:mob/alias/417/register

# 他のモブに継承されることを許可するか (boolean) (オプション)
# data modify storage asset:mob ExtendsSafe set value
# 継承されることを前提とした、抽象的なモブであるかどうか(boolean)
data modify storage asset:mob IsAbstract set value false
# ID (int)
data modify storage asset:mob ID set value 417
# Type (string) Wikiを参照
data modify storage asset:mob Type set value "Enemy"
# 干渉可能か否か (boolean)
data modify storage asset:mob Interferable set value true
# 名前 (TextComponentString) (オプション)
data modify storage asset:mob Name set value '[{"text":"アストロスケルトン","color":"white"}]'
# Mobの説明文 (TextComponentString[]) (オプション)
# data modify storage asset:mob Lore set value
# 武器
# メインハンド (Compound(Item)) (オプション)
data modify storage asset:mob Weapon.Mainhand set value {id:"minecraft:bow",Count:1b,tag:{Enchantments:[{id:"punch",lvl:1s}]}}
# オフハンド (Compound(Item)) (オプション)
# data modify storage asset:mob Weapon.Offhand set value
# 武器ドロップ率 ([float, float]) (オプション)
# data modify storage asset:mob WeaponDropChances set value
# 防具
# 頭 (Compound(Item)) (オプション)
data modify storage asset:mob Armor.Head set value {id:"minecraft:glass",Count:1b}
# 胴 (Compound(Item)) (オプション)
data modify storage asset:mob Armor.Chest set value {id:"minecraft:leather_chestplate",Count:1b,tag:{display:{color:14737632},Trim:{material:"minecraft:quartz",pattern:"minecraft:coast"},Unbreakable:1b}}
# 脚 (Compound(Item)) (オプション)
data modify storage asset:mob Armor.Legs set value {id:"minecraft:leather_leggings",Count:1b,tag:{display:{color:14737632},Trim:{material:"minecraft:quartz",pattern:"minecraft:coast"},Unbreakable:1b}}
# 足 (Compound(Item)) (オプション)
data modify storage asset:mob Armor.Feet set value {id:"minecraft:leather_boots",Count:1b,tag:{display:{color:14737632},Trim:{material:"minecraft:quartz",pattern:"minecraft:coast"},Unbreakable:1b}}
# 防具ドロップ率 ([float, float]) (オプション)
# data modify storage asset:mob ArmorDropChances set value
# 体力 (double) (オプション)
data modify storage asset:mob Health set value 3500
# 攻撃力 (double) (オプション)
# data modify storage asset:mob AttackDamage set value
# 防御力 (double) (オプション) // 被ダメージがある程度大きい場合1ptにつき0.8%カット、小さい場合1ptにつき約4%カット 20pt以上は頭打ち
# data modify storage asset:mob Defense set value
# 特殊防御力 (double) (オプション) // 4pointにつきダメージを大きく減らす
# data modify storage asset:mob SpecialDefense set value
# 移動速度 (double) (オプション)
data modify storage asset:mob Speed set value 0.2
# 索敵範囲 (double) (オプション)
data modify storage asset:mob FollowRange set value 32
# ノックバック耐性 (double) (オプション)
data modify storage asset:mob KnockBackResist set value 0.5
# 属性倍率 // 1.0fで100% 最低でも25%は軽減されずに入る
# 物理倍率 (float) (オプション)
data modify storage asset:mob Resist.Physical set value 0.75
# 魔法倍率 (float) (オプション)
data modify storage asset:mob Resist.Magic set value 0.75
# 火倍率 (float) (オプション)
data modify storage asset:mob Resist.Fire set value 1
# 水倍率 (float) (オプション)
data modify storage asset:mob Resist.Water set value 1
# 雷倍率 (float) (オプション)
data modify storage asset:mob Resist.Thunder set value 1
# フィールド
# data modify storage asset:mob Field.myValue set value
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:mob/0417.astro_skeleton/summon/
#
# Object召喚処理の呼び出し時に実行されるfunction
#
# @within asset:mob/alias/417/summon

# 元となるEntityを召喚する
summon skeleton ~ ~ ~ {Tags:["MobInit","AntiBurn","AlwaysSlowFall"],DeathLootTable:"empty"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#> asset:mob/0417.astro_skeleton/summon/debug
#
# 動作チェック用の召喚処理 使い終わったら消してもいいかも
#
# @user
# @private

# 召喚
data modify storage api: Argument.ID set value 417
function api:mob/summon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#> asset:mob/0417.astro_skeleton/tick/
#
# Mobのtick時の処理
#
# @within asset:mob/alias/417/tick

# スコアを増やす
scoreboard players add @s General.Mob.Tick 1

# 300Tick時にテレポート
execute if score @s General.Mob.Tick matches 300.. run function asset:mob/0417.astro_skeleton/tick/teleport
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#> asset:mob/0417.astro_skeleton/tick/teleport
#
# テレポーターを召喚
#
# @within function asset:mob/0417.astro_skeleton/tick/

# オーバーライドを設定
execute store result storage api: Argument.FieldOverride.MobUUID int 1 run scoreboard players get @s MobUUID

# 召喚
data modify storage api: Argument.ID set value 2170
execute at @a[tag=!PlayerShouldInvulnerable,distance=..64,sort=random,limit=1] run function api:object/summon

# リセット
scoreboard players reset @s General.Mob.Tick
8 changes: 8 additions & 0 deletions Asset/data/asset/functions/mob/alias/417/attack.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:mob/alias/417/attack
#
# Mobの攻撃時の処理のエイリアス
#
# @within asset_manager:mob/triggers/attack/attack.m

# 本来の処理を呼び出す
function asset:mob/0417.astro_skeleton/attack/
8 changes: 8 additions & 0 deletions Asset/data/asset/functions/mob/alias/417/register.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:mob/alias/417/register
#
# Mobのデータ指定処理のエイリアス
#
# @within asset_manager:mob/triggers/summon/register.m

# 元の登録処理を呼び出す
function asset:mob/0417.astro_skeleton/register
8 changes: 8 additions & 0 deletions Asset/data/asset/functions/mob/alias/417/summon.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:mob/alias/417/summon
#
# Mob召喚処理のエイリアス
#
# @within asset_manager:mob/triggers/summon/summon.m

# 本来の処理を呼び出す
function asset:mob/0417.astro_skeleton/summon/
8 changes: 8 additions & 0 deletions Asset/data/asset/functions/mob/alias/417/tick.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:mob/alias/417/tick
#
# Tick時処理のエイリアス
#
# @within asset_manager:mob/triggers/tick/tick.m

# 元のTick処理を呼び出す
function asset:mob/0417.astro_skeleton/tick/
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#> asset:object/2170.astro_teleport/_index.d
# @private

#> tag
# @within function asset:object/2170.astro_teleport/**
#declare score_holder $2170.Temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#> asset:object/2170.astro_teleport/init/
#
# Objectのinit時の処理
#
# @within asset:object/alias/2170/init

# ブロックの直上に来るようにループ処理を行う
scoreboard players set $2170.Temp Temporary 32
execute if block ~ ~ ~ #lib:no_collision unless block ~ ~-0.25 ~ #lib:no_collision run scoreboard players set $2170.Temp Temporary -100
execute if score $2170.Temp Temporary matches 1.. run function asset:object/2170.astro_teleport/init/loop

# ループしてもダメだったらキル
execute if score $2170.Temp Temporary matches 0 run kill @s

# TP
execute at @s run tp @s ~ ~ ~ ~ 0

# リセット
scoreboard players reset $2170.Temp Temporary

# オーバーライドを設定
data modify storage api: Argument.FieldOverride set value {Color:16776960,Scale:[5f,5f,0.01f],Tick:30}

# 召喚
data modify storage api: Argument.ID set value 2063
execute at @s run function api:object/summon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#> asset:object/2170.astro_teleport/init/loop
#
# ループ処理
#
# @within function
# asset:object/2170.astro_teleport/init/
# asset:object/2170.astro_teleport/init/loop

# 少し下げて判定
scoreboard players remove $2170.Temp Temporary 1
tp @s ~ ~-0.25 ~ ~ ~
execute at @s if block ~ ~ ~ #lib:no_collision unless block ~ ~-0.25 ~ #lib:no_collision run scoreboard players set $2170.Temp Temporary -100
execute at @s if score $2170.Temp Temporary matches 1.. run function asset:object/2170.astro_teleport/init/loop
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#> asset:object/2170.astro_teleport/register
#
# Objectのデータを指定
#
# @within function asset:object/alias/2170/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 2170
# フィールド(オプション)
# data modify storage asset:object Field.myValue set value
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/2170.astro_teleport/summon/
#
# Object召喚処理の呼び出し時に実行されるfunction
#
# @within asset:object/alias/2170/summon

# 元となるEntityを召喚する
summon marker ~ ~ ~ {Tags:["ObjectInit"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#> asset:object/2170.astro_teleport/summon/debug
#
# 動作チェック用の召喚処理 使い終わったら消してもいいかも
#
# @user
# @private

# 召喚
data modify storage api: Argument.ID set value 2170
function api:object/summon
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#> asset:object/2170.astro_teleport/tick/
#
# Objectのtick時の処理
#
# @within asset:object/alias/2170/tick

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

# 30Tick時にテレポートとダメージ
execute if score @s General.Object.Tick matches 30 run function asset:object/2170.astro_teleport/tick/teleport

# 消滅処理
kill @s[scores={General.Object.Tick=31..}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#> asset:object/2170.astro_teleport/tick/teleport
#
# ダメージ
#
# @within function asset:object/2170.astro_teleport/tick/

# 円
particle end_rod ~-0.0 ~0.0 ~2.5 ~-0.0 ~1000000000.0 ~2.5 0.00000000010 0 force @a[distance=..32]
particle end_rod ~0.957 ~0.0 ~2.31 ~0.957 ~1000000000.0 ~2.31 0.00000000010 0 force @a[distance=..32]
particle end_rod ~1.768 ~0.0 ~1.768 ~1.768 ~1000000000.0 ~1.768 0.00000000010 0 force @a[distance=..32]
particle end_rod ~2.31 ~0.0 ~0.957 ~2.31 ~1000000000.0 ~0.957 0.00000000010 0 force @a[distance=..32]
particle end_rod ~2.5 ~0.0 ~0.0 ~2.5 ~1000000000.0 ~0.0 0.00000000010 0 force @a[distance=..32]
particle end_rod ~2.31 ~0.0 ~-0.957 ~2.31 ~1000000000.0 ~-0.957 0.00000000010 0 force @a[distance=..32]
particle end_rod ~1.768 ~0.0 ~-1.768 ~1.768 ~1000000000.0 ~-1.768 0.00000000010 0 force @a[distance=..32]
particle end_rod ~0.957 ~0.0 ~-2.31 ~0.957 ~1000000000.0 ~-2.31 0.00000000010 0 force @a[distance=..32]
particle end_rod ~-0.0 ~0.0 ~-2.5 ~-0.0 ~1000000000.0 ~-2.5 0.00000000010 0 force @a[distance=..32]
particle end_rod ~-0.957 ~0.0 ~-2.31 ~-0.957 ~1000000000.0 ~-2.31 0.00000000010 0 force @a[distance=..32]
particle end_rod ~-1.768 ~0.0 ~-1.768 ~-1.768 ~1000000000.0 ~-1.768 0.00000000010 0 force @a[distance=..32]
particle end_rod ~-2.31 ~0.0 ~-0.957 ~-2.31 ~1000000000.0 ~-0.957 0.00000000010 0 force @a[distance=..32]
particle end_rod ~-2.5 ~0.0 ~0.0 ~-2.5 ~1000000000.0 ~0.0 0.00000000010 0 force @a[distance=..32]
particle end_rod ~-2.31 ~0.0 ~0.957 ~-2.31 ~1000000000.0 ~0.957 0.00000000010 0 force @a[distance=..32]
particle end_rod ~-1.768 ~0.0 ~1.768 ~-1.768 ~1000000000.0 ~1.768 0.00000000010 0 force @a[distance=..32]
particle end_rod ~-0.957 ~0.0 ~2.31 ~-0.957 ~1000000000.0 ~2.31 0.00000000010 0 force @a[distance=..32]

# 音
playsound ogg:block.respawn_anchor.set_spawn1 hostile @a[distance=..32] ~ ~ ~ 1 1.4
playsound entity.wither.shoot hostile @a[distance=..32] ~ ~ ~ 0.9 1.5

# 引数の設定
# 与えるダメージ
execute if predicate api:global_vars/difficulty/max/normal run data modify storage api: Argument.Damage set value 30f
# 第一属性
data modify storage api: Argument.AttackType set value "Magic"
# 第二属性
data modify storage api: Argument.ElementType set value "None"
# デスログ
data modify storage api: Argument.DeathMessage append value '[{"translate": "%1$sは%2$sのテレポートに巻き込まれ、次元の狭間に吸い込まれてしまった","with":[{"selector":"@s"},{"nbt":"Return.AttackerName","storage":"api:","interpret":true}]}]'
# 補正functionを実行
data modify storage api: Argument.MobUUID set from storage asset:context this.MobUUID
function api:damage/modifier_manual
# ダメージを与える
execute as @a[gamemode=!creative,distance=..2.5] at @s run function api:damage/
# リセット
function api:damage/reset

# テレポート
execute store result score $2170.Temp Temporary run data get storage asset:context this.MobUUID
execute as @e[type=skeleton,scores={MobID=417},distance=..128] if score @s MobUUID = $2170.Temp Temporary run tp @s ^ ^ ^ ~ ~
scoreboard players reset $2170.Temp Temporary

# キル
kill @s
8 changes: 8 additions & 0 deletions Asset/data/asset/functions/object/alias/2170/init.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/alias/2170/init
#
# Init処理のエイリアス
#
# @within asset_manager:object/init/init.m

# 元のInit処理を呼び出す
function asset:object/2170.astro_teleport/init/
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/alias/2170/register
#
# Objectのデータ指定処理のエイリアス
#
# @within asset_manager:object/summon/register.m

# 元の登録処理を呼び出す
function asset:object/2170.astro_teleport/register
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:object/alias/2170/summon
#
# Object召喚処理のエイリアス
#
# @within asset_manager:object/summon/summon.m

# 元の召喚処理を呼び出す
function asset:object/2170.astro_teleport/summon/
Loading

0 comments on commit 5d4667e

Please sign in to comment.