Zarius / Bukkit-OtherBlocks

OtherBlocks (now known as OtherDrops) plugin for Bukkit (dev build: https://www.mediafire.com/?i6ows1g6kus2o0l)
http://dev.bukkit.org/server-mods/otherdrops/
GNU General Public License v3.0
17 stars 17 forks source link

"health" condition #203

Open sehrgut opened 11 years ago

sehrgut commented 11 years ago

I'd like to encourage not-quite-to-the-death PVP on my server by allowing players to capture each other's heads. Essentials /give allows me to award the trophy, but I'd love to have a "health" condition (or better yet, separate player-health and victim-health conditions) so that I can award the trophy on wearing someone down to a particular number of half-hearts.

otherdrops:
  PLAYER:
    - action: HIT
      command: "/$give %p head:3 player:%v"
      message.server: %p has acquired %v's head
      victim-health: 4
CelticMinstrel commented 11 years ago

Why not specify the number of half-hearts instead of the number of hearts? Is there some reason to shun non-integer values? It makes more sense to me to specify "2.5 hearts" than it does to specify "5 half-hearts".

sehrgut commented 11 years ago

Half-hearts are actually the integer value of health. You have 10 hearts in the GUI, displaying health from 0 to 20. It's not a continuous value: you can't have health of 8.6, for example.

Sent from my iPhone

On Apr 4, 2013, at 9:51 PM, CelticMinstrel notifications@github.com wrote:

Why not specify the number of hearts instead of the number of half-hearts? Is there some reason to shun non-integer values?

— Reply to this email directly or view it on GitHub.

CultistO commented 11 years ago

If you look at the health parameter of the scoreboard system you have a max health of 20, on the wiki, things have their health listed by half hearts (behind the graphic) and in programming there are many reasons to avoid decimals when it is easy to do so. Also as I think sehrgut has pointed out, there is an assumption created when you have a certain number of digits of accuracy, that anything with that many digits should work, (as long as you don't exceed the min/max,) whereas in this case you would have to jump by 0.5.

CelticMinstrel commented 11 years ago

The reasons to avoid decimals are for internal representation purposes, not for output, and even so they probably don't apply when dealing with powers of 0.5. Considering the GUI, full hearts is a more natural mapping. Sure, it's stored as half-hearts (due to the reasons for avoiding decimals), but that's an internal representation; there's no reason to consider that when deciding how to display output or take input.

Of course, it's true that you can't have a value of 8.6, but it's easy to just round that off to 8.5.