Skip to content
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
@@ -0,0 +1,15 @@
#> asset:mob/2002.duplicate_hit_protection_mixin/check_duplicate/
#
# 継承先などから実行される処理
#
# @within asset:mob/alias/2002/check_duplicate

scoreboard players reset @s 2002.DuplicateHitProtectionMixin

execute if entity @s[type= player] store result storage asset:temp Args.ID int 1 run scoreboard players get @s UserID
execute if entity @s[type=!player,tag=!ExtendedCollision] store result storage asset:temp Args.ID int 1 run scoreboard players get @s MobUUID
execute if entity @s[tag= ExtendedCollision] store result storage asset:temp Args.ID int 1 run scoreboard players get @s ForwardTargetMobUUID

execute if entity @s[type= player] run function asset:mob/2002.duplicate_hit_protection_mixin/check_duplicate/check_first_hit/player.m with storage asset:temp Args
execute if entity @s[type=!player] run function asset:mob/2002.duplicate_hit_protection_mixin/check_duplicate/check_first_hit/non-player.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,9 @@
#> asset:mob/2002.duplicate_hit_protection_mixin/check_duplicate/check_first_hit/non-player.m
#
#
#
# @within function asset:mob/2002.duplicate_hit_protection_mixin/check_duplicate/

$execute unless data storage asset:context this.DuplicateHitProtectForNonPlayer.$(ID) run scoreboard players set @s 2002.DuplicateHitProtectionMixin 1

$execute unless data storage asset:context this.DuplicateHitProtectForNonPlayer.$(ID) run data modify storage asset:context this.DuplicateHitProtectForNonPlayer.$(ID) set value true
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> asset:mob/2002.duplicate_hit_protection_mixin/check_duplicate/check_first_hit/player.m
#
#
#
# @within function asset:mob/2002.duplicate_hit_protection_mixin/check_duplicate/

$execute unless data storage asset:context this.DuplicateHitProtectForPlayer.$(ID) run scoreboard players set @s 2002.DuplicateHitProtectionMixin 1

$execute unless data storage asset:context this.DuplicateHitProtectForPlayer.$(ID) run data modify storage asset:context this.DuplicateHitProtectForPlayer.$(ID) set value true
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#> asset:mob/2002.duplicate_hit_protection_mixin/load
#
# Mobに利用するスコアボード等の初期化処理
#
# @within tag/function asset:mob/load

#> 定義類はここに
# @within asset:mob/2002.duplicate_hit_protection_mixin/**
scoreboard objectives add 2002.DuplicateHitProtectionMixin dummy
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#> asset:mob/2002.duplicate_hit_protection_mixin/register
#
# Mobのデータを指定
#
# @within function asset:mob/alias/2002/register

# 他のモブに継承されることを許可するか (boolean) (オプション)
data modify storage asset:mob ExtendsSafe set value true
# 継承されることを前提とした、抽象的なモブであるかどうか(boolean)
data modify storage asset:mob IsAbstract set value true
# ID (int)
data modify storage asset:mob ID set value 2002
# フィールド(オプション)
data modify storage asset:mob Field.DuplicateHitProtectForPlayer set value {}
data modify storage asset:mob Field.DuplicateHitProtectForNonPlayer set value {}

# How to use
# data modify storage api: Argument.Damage set value ...
# data modify storage api: Argument.AttackType set value ...
# data modify storage api: Argument.ElementType set value ...
# execute ... run function api:damage/modifier
# execute as @e[type=#lib:living_without_player,tag=Enemy,tag=!Uninterferable,distance=..50] run function {
# function asset:mob/call.m {method:"check_duplicate"}
# execute if predicate asset:mob/2002.duplicate_hit_protection_mixin/is_first_hit run function api:damage/
# }
# function api:damage/reset
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:mob/2002.duplicate_hit_protection_mixin/reset_duplicate_protection/
#
# 継承先などから実行される処理
#
# @within asset:mob/alias/2002/reset_duplicate_protection

data modify storage asset:context this.DuplicateHitProtectForPlayer set value {}
data modify storage asset:context this.DuplicateHitProtectForNonPlayer set value {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:mob/alias/2002/check_duplicate
#
# メソッド処理のエイリアス
#
# @within asset_manager:mob/triggers/call_method/run_method.m

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

# 元の登録処理を呼び出す
function asset:mob/2002.duplicate_hit_protection_mixin/register
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#> asset:mob/alias/2002/reset_duplicate_protection
#
# メソッド処理のエイリアス
#
# @within asset_manager:mob/triggers/call_method/run_method.m

# 本来の処理を呼び出す
function asset:mob/2002.duplicate_hit_protection_mixin/reset_duplicate_protection/
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"condition": "entity_scores",
"entity": "this",
"scores": {
"2002.DuplicateHitProtectionMixin": {
"min": 1,
"max": 1
}
}
}
3 changes: 2 additions & 1 deletion Asset/data/asset/tags/functions/mob/load.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"values": [
"asset:mob/2002.duplicate_hit_protection_mixin/load",
"asset:mob/0437.lawless_iron_doll/load",
"asset:mob/0301.karmic/load",
"asset:mob/0365.frestchika/load",
Expand Down Expand Up @@ -59,4 +60,4 @@
"asset:mob/0081.snow_cloud/load",
"asset:mob/0139.blast_eye/0.load"
]
}
}