Armour Ignoring Damage

Discussion in 'Plugin Development' started by Jakesully123456, Jul 15, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Jakesully123456

    I need to make it so that damage dealt is not modified by armour.
     
  2. Offline

    Zombie_Striker

    @Jakesully123456
    Then what you need to do is make a map with <Material,Integer> so you can store what the damage would be (unmodified) if they had no armour. Then on the player taking damage, check the map to see if the item they were damaged with is in the map. If it is, apply that damage, else assume its 0.5 or 1 damage.
     
  3. Offline

    Jakesully123456

    This won't work, I need to make Damageable.damage(Double, DamageSource) be armour ignoring.
    @Zombie_Striker
     
  4. Offline

    Zombie_Striker

    @Jakesully123456
    So, then nothing will work. You can't modify that method to be armour ignoring.
     
  5. Offline

    Jakesully123456

    Is there no way around this?

    And if not @Zombie_Striker can I change armour modifiers?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
  6. Offline

    Zombie_Striker

    @Jakesully123456
    No, since what you're looking for is to change a method, there is no way around it

    And No, armour modifiers are constant. As long as you have it registered that the player has armour, the damage will be modified.
     
  7. Offline

    Jakesully123456

    Well, what about doing player.setHealth(player.getHealth()-damage), that should work?
     
  8. Offline

    Zombie_Striker

    @Jakesully123456
    Yes, that would work, but that would be exactly the same idea as what I said in my first post that you said "wouldn't work".

    As long as you can store the data as to what the damage would be (us-modified), using #setheath would work
     
  9. Offline

    Jakesully123456

    Just wrote this function:
    Code:
        public void damage(LivingEntity damaged, Player damager, double damage) {
            double health = damaged.getHealth();
            health -= damage;
            if (health <= 0) {
                damaged.setHealth(1);
                damaged.damage(20, damager);
            } else {
                damaged.damage(0);
                damaged.setHealth(health);
            }
        }
    No problem with this?
     
  10. Offline

    Zombie_Striker

    @Jakesully123456
    Umm, why would you need to dame the entity by 20 if you're setting the health to 1. You should instead use damge(100 o,damager) to reduce it to one line.
     
Thread Status:
Not open for further replies.

Share This Page