Skip to content

✨ [Artifact1674] バウンシーランチャーの作成 - #2188

Open
k22992068-crypto wants to merge 10 commits into
masterfrom
dev/mizame_artifact1674
Open

k22992068-crypto wants to merge 10 commits into
masterfrom
dev/mizame_artifact1674

Conversation

@k22992068-crypto

Copy link
Copy Markdown
Contributor

No description provided.

Comment on lines +29 to +32
# リセット
scoreboard players reset $OwnerID Temporary
scoreboard players reset $HitEnemyID Temporary
tag @a remove 1AI.Owner

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これ、resetって関数あるんだしそれ呼び出せばいいんじゃない?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resetは前のtick で当たってた時にreturnする処理で使っているのですが、そこにもろもろのreset処理を統合すると不要な処理が増えませんか?

@tatuharu tatuharu left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このレビューはハルがAI自動レビューの動作テストのためにOpus5.5 Extra Highを使用してレビューを行なったものです。鵜呑みにせず、指摘を採用するかはお任せします。

指摘が 4 件あります。詳細は行コメントに書いています。

  • 〔不具合〕register の arityRegistryWithColor の綴りが誤っていて、赤色の神器プールに入らない
  • 〔不具合〕反射先の判定に tag=Enemy がなく、敵でない Mob へ向きを変える
  • 〔不具合〕ExtendedCollision を持つ Mob に当たると、同じ Mob の別の当たり判定へ反射し、ダメージなしで素通りする
  • 〔確認〕敵が1体だけだと、壁で跳ね返って戻ってきても2回目以降はダメージを与えない

# @within tag/function asset:artifact/register

data modify storage asset:artifact RarityRegistry[2] append value [1674]
data modify storage asset:artifact arityRegistryWithColor.Red[2] append value [1674]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RarityRegistryWithColor の先頭の R が抜けています。arityRegistryWithColor は、本体の asset_manager:artifact/load が用意する RarityRegistryWithColor とは別のパスなので、1674は赤色の神器プールに登録されません。

本体の api:artifact/core/from_rarity/ は、Argument.Color が "red" のときに asset:artifact RarityRegistryWithColor.Red から抽選します。欠片加工機(world_manager:gimmick/shard_processor/process/complete)は欠片の ShardColor をこの引数に渡すので、ハイレッドシャード(赤、レアリティ2)から1674が出なくなります。ほかの神器の register(1661、1662 など)は RarityRegistryWithColor.Red[...] と書いています。

Suggested change
data modify storage asset:artifact arityRegistryWithColor.Red[2] append value [1674]
data modify storage asset:artifact RarityRegistryWithColor.Red[2] append value [1674]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正を確認しました。de8d78e7cでRarityRegistryWithColor.Red[2]に登録するようになっています。

検証用サーバー(Minecraft 1.20.4、Asset 1ee2e17、TheSkyBlessing bfb8eb9de)で読み込んだあとにRarityRegistryWithColor.Red[2]を読むと、先頭に[1674]が入っていました。

Comment on lines +38 to +39
execute if entity @e[type=#lib:living_without_player,tag=!1AI.HitEnemy,tag=!Uninterferable,distance=..12] run function asset:object/1204.bouncy_ball/hit_entity/reflect
execute unless entity @e[type=#lib:living_without_player,tag=!1AI.HitEnemy,tag=!Uninterferable,distance=..12] run function asset:object/1204.bouncy_ball/hit_entity/random_direction

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

反射先を選ぶ条件に tag=Enemy がないため、Enemy でない Mob にも向きを変えます。本体の asset_manager:mob/summon/set_tag は Type が "Friend" の Asset Mob に Friend を付け、Enemy は付けません。例えば、0342 スーパードラゴンの呼び鈴で呼び出す 0444 スーパードラゴン(horse)は Friend で、Interferable が true なので Uninterferable も付きません。一方、命中判定の detect_hit_entity/.mcfunction:7 は tag=Enemy を条件にしているので、ボールはその Mob に当たらずに通り抜けます。そのときも reflect.mcfunction:8 で反射回数は1減ります。12m以内に Enemy がおらず Enemy でない Mob だけがいる場合も、ランダムな方向ではなくその Mob へ向かいます。Lore の「近くの敵に向かって跳ね返る」とも合いません。

この2行と reflect.mcfunction:10 の両方に tag=Enemy を足すと、反射先が命中判定と同じ対象になります。

Suggested change
execute if entity @e[type=#lib:living_without_player,tag=!1AI.HitEnemy,tag=!Uninterferable,distance=..12] run function asset:object/1204.bouncy_ball/hit_entity/reflect
execute unless entity @e[type=#lib:living_without_player,tag=!1AI.HitEnemy,tag=!Uninterferable,distance=..12] run function asset:object/1204.bouncy_ball/hit_entity/random_direction
execute if entity @e[type=#lib:living_without_player,tag=Enemy,tag=!1AI.HitEnemy,tag=!Uninterferable,distance=..12] run function asset:object/1204.bouncy_ball/hit_entity/reflect
execute unless entity @e[type=#lib:living_without_player,tag=Enemy,tag=!1AI.HitEnemy,tag=!Uninterferable,distance=..12] run function asset:object/1204.bouncy_ball/hit_entity/random_direction

reflect.mcfunction:10 は次のようになります。

    tp @s ^ ^ ^ facing entity @e[type=#lib:living_without_player,tag=Enemy,tag=!1AI.HitEnemy,tag=!Uninterferable,distance=..12,sort=random,limit=1] eyes

12行目のタグ付けにも tag=Enemy がありません。Enemy と Enemy でない Mob が同時にボールの判定の箱に重なると、12行目は sort=nearest で選んだ1体にタグを付けるため、Enemy でない Mob が選ばれて27行目でダメージを受けることがあります。12行目にも tag=Enemy を足すと防げます。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正を確認しました。1ee2e175aで、タグを付ける12行目、反射先を選ぶ43・44行目、reflect.mcfunctionの10行目のすべてにtag=Enemyが付いています。

検証用サーバー(Minecraft 1.20.4、Asset 1ee2e17、TheSkyBlessing bfb8eb9de)で、ハスクHEから4ブロックの位置にEnemyでない村人を、約6ブロックの位置にもう1体のハスクHFを置き、HEに向けて撃ちました。ボールはHEとHFに交互に計7回当たり、村人へは一度も向かいませんでした。

#反射回数を1減らす
execute store result storage asset:context this.ReflectionLimit int 0.9999999999 run data get storage asset:context this.ReflectionLimit 1
#向きを変える
tp @s ^ ^ ^ facing entity @e[type=#lib:living_without_player,tag=!1AI.HitEnemy,tag=!Uninterferable,distance=..12,sort=random,limit=1] eyes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ExtendedCollision を持つ Mob に当たったとき、同じ Mob の別の当たり判定が反射先の候補に残ります。候補から外れるのは、hit_entity/.mcfunction:12 で 1AI.HitEnemy を付けた1体だけです。

例えば 0410 黒龍の init/locator は頭部の当たり判定(AJ の hitbox_head_0〜hitbox_head_9)のすべてに ExtendedCollision と同じ ForwardTargetMobUUID を設定しています。反射先にこの別の当たり判定が選ばれると、到着時に hit_entity/.mcfunction:17 で ForwardTargetMobUUID が HitEnemyID と一致するので、ボールはダメージを与えずに通り抜けます。このとき反射回数は8行目ですでに1減っています。sort=random は条件に合う entity から等しく選ぶため、当たり判定の多い Mob の近くでは、ほかの敵よりも同じ Mob が選ばれやすくなります。

直すには、向きを変える前に、MobUUID または ForwardTargetMobUUID が this.HitEnemyID と一致する entity にも 1AI.HitEnemy を付け、hit_entity/.mcfunction:42 でタグを外す範囲をその探索範囲まで広げる必要があります。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正を確認しました。1ee2e175aで、ダメージを与えたあとにMobUUIDかForwardTargetMobUUIDがHitEnemyIDと一致する敵にも1AI.HitEnemyを付け、タグを外す範囲も64mに広げています。

検証用サーバー(Minecraft 1.20.4、Asset 1ee2e17、TheSkyBlessing bfb8eb9de)で、asset:mob/0410.heiloang/init/locatorを使って同じ本体へ転送する当たり判定を3つ(A・B・C)置き、別のハスクも1体置いて、Aに向けて撃ちました。ボールはAに当たったあとハスクへ向かい、そのあとは本体の当たり判定とハスクに交互に当たりました。当たった8回のすべてでダメージが入り、同じ本体の別の当たり判定へ続けて向かうことはありませんでした。

Comment on lines +16 to +17
execute if score @e[tag=1AI.HitEnemy,tag=!ExtendedCollision,distance=..5,sort=nearest,limit=1] MobUUID = $HitEnemyID Temporary run return run function asset:object/1204.bouncy_ball/hit_entity/reset
execute if score @e[tag=1AI.HitEnemy,tag=ExtendedCollision,distance=..5,sort=nearest,limit=1] ForwardTargetMobUUID = $HitEnemyID Temporary run return run function asset:object/1204.bouncy_ball/hit_entity/reset

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.HitEnemyID は damage.mcfunction:12-13 でしか更新されず、壁での反射やランダムな方向転換では元に戻りません。そのため、この判定は直前の tick に限らず、最後にダメージを与えた敵に次に当たったときは常に成立します。近くに敵が1体しかいない場面では、壁で跳ね返って同じ敵に戻ってきても、2回目以降はダメージを与えずに通り抜けます。

Mizame さんは Lapis-LJA さんのコメントへの返信で、この処理を「前のtick で当たってた時にreturnする処理」と説明しています。意図が直前の tick の重なりを除くことであれば、今の実装はそれより広い範囲を除いています。同じ敵への連続ヒットをボールが消えるまで防ぐ仕様であれば、このままで問題ありません。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正を確認しました。1ee2e175aで、ブロックで跳ね返るたびにHitEnemyIDを-1に戻すようになったので、壁で跳ね返ったボールは直前に当たった敵にもまた当たります。

検証用サーバー(Minecraft 1.20.4、Asset 1ee2e17、TheSkyBlessing bfb8eb9de)で、ハスクに当たった直後の状態(HitEnemyIDがそのハスクのMobUUID)のボールを召喚し、ハスクと反対側の壁へ向けて飛ばすと、壁で跳ね返ったあとにハスクに当たりました。壁がなく、同じ状態でハスクへ直接飛ばした場合は、これまでどおり素通りしました。

なお、近くにほかの敵がいないときのランダムな方向転換では反射回数が減らないため、3×3×3の石の箱に閉じ込めたハスクに撃つと、1発で18回当たり、反射回数は35のままでした。意図どおりであれば、このままで問題ありません。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants