Coder Social home page Coder Social logo

mccmd-scoredamage's Introduction

I'm Chen, who develops Datapack and tools for Minecraft

Fav Lang: Scala > TypeScript >> Java

Contacts:

github stats languages

mccmd-scoredamage's People

Contributors

chencmd avatar neponpon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

neponpon

mccmd-scoredamage's Issues

プレイヤーは同じtickでの2回目以降の実行で死亡しない。

概要

プレイヤーに対して同じtick内で複数回実行したときに、2回目以降で合計が現在体力以上のダメージを与えた時に死亡しない。
11ダメージを2回実行して22ダメージを与えたとしても体力が1.0f残ってしまう。
2回目以降であっても現在体力以上のダメージを与えれば死亡する。

再現方法

以下に示す「使用コマンド」を実行する。
1tickで実行できればいいのでFunctionもしくはCommandBlockで実行する。

私の想定する動作

同じtickで複数回実行したとき、そのダメージの合計が現在体力以上なら死亡する。
11ダメージを2回実行すると、合計22ダメージとなって死亡する。

検証環境

使用コマンド

data modify storage score_damage: Argument set value {Damage:11d}
execute as @p run function score_damage:api/attack
data modify storage score_damage: Argument set value {Damage:11d}
execute as @p run function score_damage:api/attack

参考動画

https://twitter.com/i/status/1659186999390269440


考えられる原因

$Health ScoreDamageCoreを設定するとき、毎回@s Healthから取得しており、同tickですでに設定された@s ScoreToHealthと違いが生じる。
すると、@s ScoreToHealthは0以下になるが、$SubtractedHealth ScoreToHealthは1以上のままという場合が起こり、結果killされなくなる。

修正方法の提案

score_damage:core/get_statusで現在HPを取得するとき、@s ScoreToHealthが設定されていればその100倍の値を$Health ScoreDamageCoreに設定する。

無敵時間のパラメータ追加

  • {MultiDamage:false}
  • modify ~ byUUID set from entity ~
    等の設定
引数名 必須 説明 デフォルト
MultiDamage x boolean 無敵時間を貫通するか(バニラ標準と同等の無敵時間) false
byUUID x UUID 攻撃者のUUID(無敵時間有効時に使用) -

どのように実装するか

  • byUUIDを参照してダメージ演出用のAECにOwnerを設定
  • ダメージをScoreDamage内包のスコアに保存
  • HurtTimeが0sで保存ダメージを削除
  • MultiDamageがfalseの時、保存されたダメージスコアを参照して減算

Argument.Knockbackの作成

  • {Knockback:true}
    のような設定
引数名 必須 説明 デフォルト
Knockback x boolean ノックバックを有効にするか false

Originally posted by @nea-c in #1

コマンドを実行してもデータパックが動かない

実行したコマンド↓
/data modify storage score_damage: Argument set value {Damage:10.00,DamageType:"Fall",BypassResistance:true}
/execute as @e[distance=..5] run function score_damage:api/attack
/data remove storage score_damage: Argument

データパック=>ちゃんと読み込まれている
実行=>エラーは出ない、114個のコマンドが実行されたと出ている
結果=>Healthに変化がない

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.