Skip to content

Commit

Permalink
katana damage tweaks and balancing
Browse files Browse the repository at this point in the history
  • Loading branch information
Draylar committed Dec 18, 2020
1 parent c3db6ff commit 98b87d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 7 additions & 5 deletions src/main/java/draylar/gateofbabylon/item/KatanaItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class KatanaItem extends SwordItem {
private final float attackDamage;

public KatanaItem(ToolMaterial material, float effectiveDamage, float effectiveSpeed) {
super(material, (int) effectiveDamage - 1, -4 + effectiveSpeed, new Item.Settings().group(GateOfBabylon.GROUP).maxCount(1));
super(material, (int) (effectiveDamage - material.getAttackDamage() - 1), -4 + effectiveSpeed, new Item.Settings().group(GateOfBabylon.GROUP).maxCount(1));
attackDamage = effectiveDamage;
}

Expand Down Expand Up @@ -87,9 +87,9 @@ public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int
HitResult rayTrace = raycast(user, 16, 0, false);

// Play SFX
world.playSound(null, user.getX(), user.getY(), user.getZ(), GOBSounds.KATANA_SWOOP, SoundCategory.PLAYERS, 1.0F, 1.0F);
world.playSound(null, user.getX(), user.getY(), user.getZ(), GOBSounds.KATANA_SWOOP, SoundCategory.PLAYERS, 0.5F, 1.0F);
if(enchantment != null) {
world.playSound(null, user.getX(), user.getY(), user.getZ(), enchantment.getSound(), SoundCategory.PLAYERS, 2.0F, 0.25F);
world.playSound(null, user.getX(), user.getY(), user.getZ(), enchantment.getSound(), SoundCategory.PLAYERS, .5F, 0.25F);
}

// calculate line from player to target
Expand Down Expand Up @@ -125,12 +125,14 @@ public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int
world.getEntitiesByClass(MobEntity.class, new Box(currentPos.add(-2, -2, -2), currentPos.add(2, 2, 2)), entity -> !hitEntities.contains(entity.getUuid())).forEach(entity -> {
// Triggers for entities that aren't tameable, or that aren't tamed, or that aren't owned by the owner of the breath
if (!(entity instanceof TameableEntity) || !((TameableEntity) entity).isTamed() || !((TameableEntity) entity).getOwnerUuid().equals(player.getUuid())) {
entity.damage(DamageSource.player((PlayerEntity) user), getAttackDamage() / 2);

// Apply enchantment effects
if(enchantment != null) {
enchantment.onHit(entity, player, stack);
}

// Damage entity with 75% of stack's power
entity.damage(DamageSource.player((PlayerEntity) user), .75f * EnchantmentHelper.getAttackDamage(stack, entity.getGroup()) + attackDamage);

world.playSound(null, entity.getX(), entity.getY(), entity.getZ(), GOBSounds.KATANA_SWOOP, SoundCategory.PLAYERS, 2F, 1.5F + (float) world.random.nextDouble() * .5f);
world.playSound(null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.PLAYERS, 0.5F, 1.5F + (float) world.random.nextDouble() * .5f);
serverWorld.spawnParticles(ParticleTypes.PORTAL, entity.getX(), entity.getY() + .5, entity.getZ(), 25, 0, 0, 0, .1);
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/draylar/gateofbabylon/registry/GOBItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ public class GOBItems {
public static final WaraxeItem DIAMOND_WARAXE = register("diamond_waraxe", new WaraxeItem(ToolMaterials.DIAMOND, 13, .5f));
public static final WaraxeItem NETHERITE_WARAXE = register("netherite_waraxe", new WaraxeItem(ToolMaterials.NETHERITE, 15, .5f));

public static final KatanaItem WOODEN_KATANA = register("wooden_katana", new KatanaItem(ToolMaterials.WOOD, 4, 1.7f));
public static final KatanaItem STONE_KATANA = register("stone_katana", new KatanaItem(ToolMaterials.STONE, 5, 1.7f));
public static final KatanaItem IRON_KATANA = register("iron_katana", new KatanaItem(ToolMaterials.IRON, 7, 1.8f));
public static final KatanaItem GOLDEN_KATANA = register("golden_katana", new KatanaItem(ToolMaterials.GOLD,4, 1.8f));
public static final KatanaItem DIAMOND_KATANA = register("diamond_katana", new KatanaItem(ToolMaterials.DIAMOND, 10, 1.8f));
public static final KatanaItem NETHERITE_KATANA = register("netherite_katana", new KatanaItem(ToolMaterials.NETHERITE, 12, 1.8f));
public static final KatanaItem WOODEN_KATANA = register("wooden_katana", new KatanaItem(ToolMaterials.WOOD, 5, 1.7f));
public static final KatanaItem STONE_KATANA = register("stone_katana", new KatanaItem(ToolMaterials.STONE, 6, 1.7f));
public static final KatanaItem IRON_KATANA = register("iron_katana", new KatanaItem(ToolMaterials.IRON, 8, 1.8f));
public static final KatanaItem GOLDEN_KATANA = register("golden_katana", new KatanaItem(ToolMaterials.GOLD,5, 1.8f));
public static final KatanaItem DIAMOND_KATANA = register("diamond_katana", new KatanaItem(ToolMaterials.DIAMOND, 11, 1.8f));
public static final KatanaItem NETHERITE_KATANA = register("netherite_katana", new KatanaItem(ToolMaterials.NETHERITE, 13, 1.8f));

public static final CustomBowItem STONE_BOW = register("stone_bow", new CustomBowItem(ToolMaterials.STONE, new Item.Settings().group(GateOfBabylon.GROUP).maxCount(1).maxDamage(425), 30.0F));
public static final CustomBowItem IRON_BOW = register("iron_bow", new CustomBowItem(ToolMaterials.IRON, new Item.Settings().group(GateOfBabylon.GROUP).maxCount(1).maxDamage(750), 25.0F));
Expand Down

0 comments on commit 98b87d1

Please sign in to comment.