[FUN/MECH] CriticalHits v0.2 - Adjustable Damage Control [740]

Discussion in 'Inactive/Unsupported Plugins' started by videege, Apr 9, 2011.

  1. Offline

    videege

    CriticalHits - The Adjustable Damage plugin:
    Version: v0.2 [Now with Permissions support!]
    CriticalHits is a very simple plugin which allows you to adjust the damage dealt by items on an individual or group basis in addition to specifying "critical hit" events.

    Features:
    • Set base damage for any item or group of items.
    • Set critical damage (as well as additional random damage) and the chance to score a critical hit on a per item basis.
    • Use permissions to limit which players benefit from the entry.
    Download version 0.2
    Source Code
    Config Explanation
    The config.yml file is pretty standard fare. Put the item ID's (good reference here) as string keys under the "items" root key. You can make a group of items by specifying space-delimited item keys as well (i.e, '272 273') as well as global entries via the asterisk ('*').
    Each item can have these properties defined (note: you can leave these pretty much any of these out to utilize Minecraft defaults).
    • baseDamage: This is the base damage of the item (i.e., how much damage it deals when a critical hit is not achieved.) Range: [0,20]
    • baseCritDamage: This is the base damage for a critical hit with the item. This can be in absolute terms [0,20] or relative to the base damage ('2x').
    • critDamageModifier: This is an amount of damage that is added at random to baseCritDamage when a critical hit is scored. Any amount of damage from {0, critDamageModifier} can be added.
    • critChance: This is the percentage chance of scoring a critical hit with this item on a {0, 100} scale (integers only please).
    • permission: This is the permission required for this entry.
    It should be noted that the damage values listed above are in terms of bukkit health points (i.e, 0 = no hearts, 20 = 10 hearts).
    Finally, the one remaining global setting, "notifyOnCrit" is flag which turns critical hit notification on/off. If this is set to true players will receive a message when they score a critical hit.

    Feeling confused? Here's a sample config that shows off the options:
    Code:
    items:
        #with the exception of global entries (see below), the plugin will match the first
        #critical hit entry on this list that the player has permission for.  If no matching entry
        #is found, the plugin will then start looking at global entries.
        '*':                             #global "knights" entry
            baseDamage: 3                #knights do 3 damage with everything (1.5 hearts)
            baseCritDamage: 5            #critical hits hit for 2.5 hearts (note: this is how you specify absolute critical damage)
            critChance: 10               #10% chance of critical hit with any item
            critDamageModifer: 2         #critical hits have up to 2 bonus damage (1 heart)
            permission: somerpg.knight   #requires the permission "somerpg.knight"
    
        '267 272':                       #stone sword and iron sword, special "Knights" entry
            #no baseDamage, this tells the plugin to use the default event damage
            baseCritDamage: '2.5x'       #'2.5x' tells the plugin to multiply base damage by 2.5
            critChance: 50               #knights have a 50% chance of crit with these weapons
            critDamageModifer: 4         #critical hits have up to 4 bonus damage (2 hearts)
            permission: somerpg.knight   #requires the permission "somerpg.knight"
    
        '267 272':                       #stone sword and iron sword, general entry
            #no baseDamage, this tells the plugin to use the default event damage
            baseCritDamage: '2x'         #'2x' tells the plugin to multiply base damage by 2
            critChance: 30               #30% chance of crit
            #no critDamageModifier, this means no bonus crit damage
            #no permissions, this means anybody can get this critical hit
    
        '268':                           #wooden sword, monk entry
            baseDamage: 6                #monks do 3 hearts damage with wooden swords
            baseCritDamage: 16           #monks hit for 8 hearts damage on a critical hit
            critChance: 30               #30% chance of crit
            #no critDamageModifier, this means no bonus crit damage
            permission: somerpg.monk     #requires the permission "somerpg.monk"
    notifyOnCrit: true
    
    Features Planned
    Version 0.3:
    • Allow LivingEntities to score critical hits (i.e., monsters).
    • Allow damage reduction based on the victim entity (i.e., swords do half damage against skeletons).
    Changelog:
    Version 0.2
    • Permissions support
    • Relative crit damage specification
    • Global entries
    • Grouped entries
    Version 0.1
    • Releasing initial version.
    Version 0.1
    • Releasing initial version.
     
    kahlilnc, Phaedrus and Finer1 like this.
  2. Offline

    Aznboi

    epic man
     
  3. Offline

    gsand

    AWESOME!
     
  4. Offline

    dubby

    I was about to do a similar plugin, myself.

    Would it be possible for you to remove the if-check on line 20 of your EventListener?

    If I'm right, that's the only thing that keeps the damage multiplier from affecting monsters as well.
     
  5. Offline

    videege

    I was originally going to put in an option for monsters to be able to score critical hits, but seeing as they don't use items (except for the skeleton), I scrapped it in this initial version. I'll probably add in the option to set the chance for monsters to score critical hits in the future, something along the lines of:

    Code:
    entities:
        'zombie':
            baseDamage: 3
            <et cetera>
         ....
     
  6. Offline

    Nytemare3701

    Request: Permissions support. I wish for monks to use woodsword (texture pack shows as a bo-staff) to great effect.
     
  7. Offline

    videege

    Would you want a global permissions setting which allows you to score critical hits (with any item specified in the config), or custom permissions on a per-item basis? For example:

    Code:
    items:
        '268':
            baseDamage: 2
            baseCritDamage: 10
            critDamageModifer: 4
            critChance: 50
            permission: monk
    The plugin could then check if the player had the permission "criticalhits.monk" before rolling for a critical hit. With this change you could specify the same item multiple times (with different settings) for various permissions.
     
  8. Offline

    Nytemare3701

    That sounds great. the more options the better when it comes to availability.
     
  9. Offline

    dubby

    Increasing my skeleton's damage is exactly what I'm wanting to do! xD
    Don't Zombie Pigmen use gold swords, too?
     
  10. Offline

    videege

    I'll take a look at it. I like separating out monsters from the items in the interest of customization (as well as allowing zombies to score hits, etc.). Look for v0.2 sometime tomorrow or Monday.
     
  11. Offline

    dubby

    Awesome and awesome. You saved me a ton of work.
     
  12. Offline

    Thoth

    critDamageModifier: 7.5
    baseCritDamage: 8
    critChanceModifier: 8
    baseDamage: 3.5
    critChance: 05

    I'm trying to make my golden sword deal 3.5 hearts w/o a crit and 8 with a crit

    what am I doing wrong
     
  13. Offline

    BioRage

    [REQ]

    Can you add Permissions? I'd like to try this on RPG Style Stuff.

    I.E Give Knights Critical Chances, so Mage's WON'T.

    Thanks.
     
  14. Offline

    Kevin Forte

    This is awesome, thanks a ton! I'm a little confused though as to how the config works, I've read your explanation a few times and it isn't totally clicking for me. The critChance is a % that a critical will occur, the baseDamage is how much damage something does normally, but I don't understand the baseCritDamage and critChanceModifier. If I wanted say a 2x critical modifier for everything, how would I go about doing that? If the baseDamage were 2, and I wanted the tool to hit 4 20% of the time, what would that look like?
     
  15. Offline

    dubby

    I got to thinking, and i was wondering if you plan to ave Axes in your config file?

    Furthermore, do you think it would be possible to add a damage reduction feature based on which monster you're fighting?

    For example:
    Skeleton's aren't meaty, so swords and arrows would only do half of their base damage and no crits
    But axes, with their choppy powers would be normal power and have a chance for crits
     
  16. Offline

    DuneTrader

    This plugin, this plugin my friend, shall help in such great ways:) I will be able to make it to where weapons do more damage, items that people can't normally get (Ice, Sponged, Grass, Bedrock) Can do tremendous damage, making it to where I can have rare items of power to give to players in quests! This will make a great addition to my RP server, keep up the good work:)
     
  17. Offline

    blainicus

    Would it be possible to post a version of this for 617? If not it's fine, it's just that multiplay doesn't use dev versions. Keep this up to date! It means a lot to hardcore survivalists!
     
  18. Offline

    videege

    baseDamage is on a scale of 0-20 (see OP). Each point of baseDamage is 1/2 heart, so if you want baseDamage to be 3.5 hearts, it should really be 7, and baseCritDamage should be 16.

    Updated to version 0.2. See OP!

    baseCritDamage is how much damage a critical hit does. As of version 0.2, you can now specify relative damage (i.e, a multiplier like you have above) or absolute damage (just like you do for baseDamage). There's no field for critChanceModifier; were you thinking of critDamageModifier? (critDamageModifier lets you add bonus damage on top of the damage for a critical hit, so you can give critical hit damage some variability).

    Code:
    items:
        '*':
            #no base damage (use default damage)
            baseCritDamage: '2x'
            critChance: 50    #50% chance of global crits
        '274': #stone pickaxe ('some tool')
            baseDamage: 2
            baseCritDamage: 4 #used 4 here, but it could also be '2x'
            critChance: 20    #20% of the time
    This example is a little redundant but I hope it clears things up for you.

    I'm not sure what you mean by axes, but a damage reduction setting sounds interesting; I'll look into it for v0.3!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  19. Offline

    Kevin Forte

    It definitely does, thanks!
     
  20. Offline

    videege

    Pretty sure 670 is a recommended build, but I'm also pretty sure that this works on 617. Let me know if it doesn't for some reason.
     
  21. Offline

    nemafow

    Hmm, I seem to be getting an error on a Critical Hit! (only shows up occassionaly while we are testing, so thats why I think its on a Critical Hit. Any thoughts? Bukkit 670.

    2011-04-13 21:30:40 [SEVERE] Could not pass event ENTITY_DAMAGE to CriticalHits
    java.lang.IllegalArgumentException: n must be positive
    at java.util.Random.nextInt(Unknown Source)
    at com.barronsoftware.videege.CriticalHits.CriticalItem.getCriticalDamage(CriticalItem.java:28)
    at com.barronsoftware.videege.CriticalHits.CriticalHitsEntityListener.onEntityDamage(CriticalHitsEntityListener.java:29)
    at org.bukkit.plugin.java.JavaPluginLoader$41.execute(JavaPluginLoader.java:452)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:255)
    at net.minecraft.server.EntityHuman.a(EntityHuman.java:402)
    at net.minecraft.server.EntityPlayer.a(EntityPlayer.java:147)
    at net.minecraft.server.EntityHuman.d(EntityHuman.java:514)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:722)
    at net.minecraft.server.Packet7UseEntity.a(SourceFile:33)
    at net.minecraft.server.NetworkManager.a(NetworkManager.java:198)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:72)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:368)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    2011-04-13 21:30:40 [SEVERE] Could not pass event ENTITY_DAMAGE to CriticalHits
    java.lang.IllegalArgumentException: n must be positive
    at java.util.Random.nextInt(Unknown Source)
    at com.barronsoftware.videege.CriticalHits.CriticalItem.getCriticalDamage(CriticalItem.java:28)
    at com.barronsoftware.videege.CriticalHits.CriticalHitsEntityListener.onEntityDamage(CriticalHitsEntityListener.java:29)
    at org.bukkit.plugin.java.JavaPluginLoader$41.execute(JavaPluginLoader.java:452)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:255)
    at net.minecraft.server.EntityHuman.a(EntityHuman.java:402)
    at net.minecraft.server.EntityPlayer.a(EntityPlayer.java:147)
    at net.minecraft.server.EntityHuman.d(EntityHuman.java:514)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:722)
    at net.minecraft.server.Packet7UseEntity.a(SourceFile:33)
    at net.minecraft.server.NetworkManager.a(NetworkManager.java:198)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:72)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:368)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
     
  22. Offline

    blainicus

    Since 1.5 is coming out tommorow I'm just gonna be patient and see where the versions go with my host :) but thanks for the response. They wouldn't install this plugin for 617 because they have a policy of only installing plugins whos thread version matches theirs.

    That said, keeping upload links for different bukkit version ranges would be greatly appreciated, as well as keeping the title accurate for version ranges :)
     
  23. Offline

    videege

    This appears to be happening because your value for critDamageModifier is negative. Are you trying to reduce the damage of a critical hit? I originally intended for this setting to only add damage to critical hits.

    I'll test it out with 617 and if it looks good I'll update the thread title to reflect that. Sorry for the trouble with your host!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
  24. Offline

    dubby

    did you happen to get entities in v.2?
     
  25. Offline

    nemafow

    Didnt reduce damage, it was x2 or x3, I've removed it for now because it was spamming my server, when 1.5 comes out and a new version of CritHits comes out I'll give it a shot again
     
  26. Offline

    blainicus

    It's no problem man, thanks for caring. My host is updating to 674 today, although SOME other people might need that info. If you could update the title to include 670+ it would be greatly appreciated, but I'll get by either way :)
     
  27. Offline

    BioRage

    Tested, great plugin, don't let this die.

    Question:
    Is there a possible way for Fist's or "Unarmed"
     
  28. Offline

    videege

    Currently, there is no way to specify unarmed critical hits. Not to worry though, I've got this implemented in v0.3. Will be releasing in the next couple of days.
     
  29. Offline

    BioRage

    Great, thank you.
     
  30. Offline

    kahlilnc

    So basically you make your own permission node and put it in your permissions config, right?
     

Share This Page