Example #1
0
  @Override
  public void doSpacialAttack(ItemStack stack, EntityPlayer player) {
    World world = player.worldObj;

    NBTTagCompound tag = ItemSlashBlade.getItemTagCompound(stack);

    player.worldObj.playSoundAtEntity(player, "mob.blaze.hit", 0.2F, 0.6F);

    if (!world.isRemote) {

      final int cost = -20;
      if (!ItemSlashBlade.ProudSoul.tryAdd(tag, cost, false)) {
        stack.damageItem(10, player);
      }

      ItemSlashBlade blade = (ItemSlashBlade) stack.getItem();

      {
        AxisAlignedBB bb = player.getEntityBoundingBox();
        bb = bb.expand(5.0f, 0.25f, 5.0f);

        List<Entity> list =
            world.getEntitiesInAABBexcluding(player, bb, EntitySelectorAttackable.getInstance());

        for (Entity curEntity : list) {
          StylishRankManager.setNextAttackType(player, StylishRankManager.AttackTypes.CircleSlash);
          blade.attackTargetEntity(stack, curEntity, player, true);
          player.onCriticalHit(curEntity);
        }
      }

      float baseModif = blade.getBaseAttackModifiers(tag);
      int level =
          Math.max(1, EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack));
      float magicDamage = (baseModif / 2.0f);

      int rank = StylishRankManager.getStylishRank(player);
      if (5 <= rank)
        magicDamage += ItemSlashBlade.AttackAmplifier.get(tag) * (0.25f + (level / 5.0f));

      for (int i = 0; i < 6; i++) {
        EntityDrive entityDrive = new EntityDrive(world, player, magicDamage, false, 0);
        entityDrive.setLocationAndAngles(
            player.posX,
            player.posY + (double) player.getEyeHeight() / 2D,
            player.posZ,
            player.rotationYaw + 60 * i /*+ (entityDrive.getRand().nextFloat() - 0.5f) * 60*/,
            0); // (entityDrive.getRand().nextFloat() - 0.5f) * 60);
        entityDrive.setDriveVector(0.5f);
        entityDrive.setLifeTime(10);
        entityDrive.setIsMultiHit(false);
        entityDrive.setRoll(90.0f /*+ 120 * (entityDrive.getRand().nextFloat() - 0.5f)*/);
        if (entityDrive != null) {
          world.spawnEntityInWorld(entityDrive);
        }
      }
    }

    ItemSlashBlade.setComboSequence(tag, ItemSlashBlade.ComboSequence.Battou);
  }
Example #2
0
  @Override
  public void doSpacialAttack(ItemStack stack, EntityPlayer player) {
    World world = player.worldObj;

    NBTTagCompound tag = ItemSlashBlade.getItemTagCompound(stack);

    if (!world.isRemote) {

      final int cost = -20;
      if (!ItemSlashBlade.ProudSoul.tryAdd(tag, cost, false)) {
        stack.damageItem(10, player);
      }

      ItemSlashBlade blade = (ItemSlashBlade) stack.getItem();

      float baseModif = blade.getBaseAttackModifiers(tag);
      int level =
          Math.max(1, EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack));
      float magicDamage = (baseModif / 2.0f);

      int rank = StylishRankManager.getStylishRank(player);
      if (5 <= rank)
        magicDamage += ItemSlashBlade.AttackAmplifier.get(tag) * (0.25f + (level / 5.0f));

      final float[] speeds = {0.25f, 0.3f, 0.35f};
      for (int i = 0; i < speeds.length; i++) {
        EntityDrive entityDrive = new EntityDrive(world, player, magicDamage, false, 0);
        entityDrive.setInitialSpeed(speeds[i]);
        if (entityDrive != null) {
          world.spawnEntityInWorld(entityDrive);
        }
      }
      {
        EntityDrive entityDrive = new EntityDrive(world, player, magicDamage, true, 0);
        entityDrive.setInitialSpeed(0.225f);
        if (entityDrive != null) {
          world.spawnEntityInWorld(entityDrive);
        }
      }
    }

    ItemSlashBlade.setComboSequence(tag, ItemSlashBlade.ComboSequence.Kiriage);
  }