private static float movementDamageBonus(Creature creature, float value) {
   if (!(creature instanceof Player)) {
     return value;
   }
   Player player = (Player) creature;
   int h = player.getMoveController().getMovementHeading();
   if (h < 0) {
     return value;
   }
   switch (h) {
     case 7:
     case 0:
     case 1:
       value = value * 1.1f;
       break;
     case 6:
     case 2:
       value -= value * 0.2f;
       break;
     case 5:
     case 4:
     case 3:
       value -= value * 0.2f;
       break;
   }
   return value;
 }
示例#2
0
文件: Skill.java 项目: soulxj/aion-cn
  /**
   * Check if the skill can be used
   *
   * @return True if the skill can be used
   */
  public boolean canUseSkill() {
    Properties properties = skillTemplate.getProperties();
    if (properties != null && !properties.validate(this)) {
      log.debug("properties failed");
      return false;
    }

    if (!preCastCheck()) return false;

    // check for counter skill
    if (effector instanceof Player) {
      Player player = (Player) effector;
      if (this.skillTemplate.getCounterSkill() != null) {
        long time = player.getLastCounterSkill(skillTemplate.getCounterSkill());
        if ((time + 5000) < System.currentTimeMillis()) {
          log.debug("chain skill failed, too late");
          return false;
        }
      }

      if (skillMethod == SkillMethod.ITEM
          && duration > 0
          && player.getMoveController().isInMove()) {
        PacketSendUtility.sendPacket(
            player,
            SM_SYSTEM_MESSAGE.STR_ITEM_CANCELED(new DescriptionId(getItemTemplate().getNameId())));
        return false;
      }
    }
    if (!validateEffectedList()) return false;

    return true;
  }
  public static float getMovementModifier(Creature creature, StatEnum stat, float value) {
    if (!(creature instanceof Player) || stat == null) {
      return value;
    }

    Player player = (Player) creature;
    int h = player.getMoveController().getMovementHeading();
    if (h < 0) {
      return value;
    }
    // 7 0 1
    // \ | /
    // 6- -2
    // / | \
    // 5 4 3
    switch (h) {
      case 7:
      case 0:
      case 1:
        switch (stat) {
          case WATER_RESISTANCE:
          case WIND_RESISTANCE:
          case FIRE_RESISTANCE:
          case EARTH_RESISTANCE:
          case ELEMENTAL_RESISTANCE_DARK:
          case ELEMENTAL_RESISTANCE_LIGHT:
          case PHYSICAL_DEFENSE:
            return value * 0.8f;
        }
        break;
      case 6:
      case 2:
        switch (stat) {
          case EVASION:
            return value + 300;
          case SPEED:
            return value * 0.8f;
        }
        break;
      case 5:
      case 4:
      case 3:
        switch (stat) {
          case PARRY:
          case BLOCK:
            return value + 500;
          case SPEED:
            return value * 0.6f;
        }
        break;
    }
    return value;
  }