Double Damage

Discussion in 'Plugin Development' started by Konkz, Feb 27, 2014.

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

    Konkz

    Hello,

    I am a bit stuck on the coding of something I'm doing.

    What I am attempting to achieve is 'doubling' the damage dealt if player is facing away (so if I'm looking North and I get attacked from South) that damage is doubled.

    Not sure how to go about it, thanks in advance.
     
  2. Offline

    SuperOmegaCow

    Konkz
    Listen to the player damage event. Check if the damager is facing the same direction as the player, and there you go.
     
  3. Offline

    Vandrake

    You need to check the Yaw, if the Attacker's Yaw is between a certain range(Id recommend -45º and +45º [that gives you a 90º angle]) double the damage
     
  4. Offline

    Konkz

    Would this work? I can't check, no friends. ;)
    Code:java
    1. if (attacker.getLocation().getDirection() == victim.getLocation().getDirection()) {
    2. //code
    3. }
     
  5. Offline

    Minesuchtiiii

    I think so ...
    Then simply:
    Code:java
    1. e.getDamage().multiply(2);
    2.  

    or something like that, sorry don't tested in eclpise...:D
     
  6. Offline

    Vandrake

    Nah it wouldn't.
    First you need to get the yaw of attacker and yaw of attackED.

    check if their difference is within a value(recommended before) and if it is double. If you don't have friends just do it like me. Cracked client and offline-mode to server :3
     
Thread Status:
Not open for further replies.

Share This Page