diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 3a269471e..6b4d9e030 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1585,9 +1585,10 @@ items.weapon.melee.handaxe.ability_name=heavy blow items.weapon.melee.handaxe.ability_desc=The Duelist can perform a _heavy blow_ with a hand axe. This strong but predictable attack has -75% accuracy, but deals +65% damage and applies vulnerable and weaken for 5 turns if it hits. Heavy blow can surprise attack. items.weapon.melee.handaxe.desc=A light axe, most commonly used for felling trees. The wide blade works well against foes as well. -items.weapon.melee.knuckles.name=knuckleduster -items.weapon.melee.knuckles.stats_desc=This is a very fast weapon. -items.weapon.melee.knuckles.desc=A piece of iron shaped to fit around the knuckles. Keeps the hands free, yet allows for better attacks than an empty fist. +items.weapon.melee.katana.name=katana +items.weapon.melee.katana.stats_desc=This weapon blocks 0-3 damage. +items.weapon.melee.katana.ability_desc=The Duelist can _lunge_ with a katana at an enemy 1 tile away. This moves toward the enemy, deals +50% damage, and is guaranteed to hit. +items.weapon.melee.katana.desc=A slender sword with a large metal guard above the handle. items.weapon.melee.longsword.name=longsword items.weapon.melee.longsword.ability_name=cleave diff --git a/core/src/main/assets/sprites/items.png b/core/src/main/assets/sprites/items.png index 3acc1e7c1..0c46d64da 100644 Binary files a/core/src/main/assets/sprites/items.png and b/core/src/main/assets/sprites/items.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java index e5b450f07..27aa5fa7b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java @@ -129,6 +129,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Greataxe; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Greatshield; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Greatsword; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.HandAxe; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Katana; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Longsword; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Mace; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; @@ -377,9 +378,10 @@ public class Generator { Flail.class, RunicBlade.class, AssassinsBlade.class, - Crossbow.class + Crossbow.class, + Katana.class }; - WEP_T4.probs = new float[]{ 6, 5, 5, 4, 4, 4 }; + WEP_T4.probs = new float[]{ 6, 5, 5, 4, 4, 4, 4 }; WEP_T5.classes = new Class[]{ Greatsword.class, @@ -620,7 +622,7 @@ public class Generator { floorSet = (int)GameMath.gate(0, floorSet, floorSetTierProbs.length-1); Category c = wepTiers[Random.chances(floorSetTierProbs[floorSet])]; - MeleeWeapon w = (MeleeWeapon)Reflection.newInstance(c.classes[Random.chances(c.probs)]); + MeleeWeapon w = (MeleeWeapon)random(c); w.random(); return w; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Katana.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Katana.java new file mode 100644 index 000000000..511841ab2 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Katana.java @@ -0,0 +1,60 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2023 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; + +public class Katana extends MeleeWeapon { + + { + image = ItemSpriteSheet.KATANA; + hitSound = Assets.Sounds.HIT_SLASH; + hitSoundPitch = 1.1f; + + tier = 4; + } + + @Override + public int max(int lvl) { + return 4*(tier+1) + //20 base, down from 25 + lvl*(tier+1); //scaling unchanged + } + + @Override + public int defenseFactor( Char owner ) { + return 3; //3 extra defence + } + + @Override + public String targetingPrompt() { + return Messages.get(this, "prompt"); + } + + @Override + protected void duelistAbility(Hero hero, Integer target) { + Rapier.lungeAbility(hero, target, 1.5f, 0, this); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java index 80569995e..c30c4e4b9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java @@ -67,6 +67,12 @@ public class Rapier extends MeleeWeapon { @Override protected void duelistAbility(Hero hero, Integer target) { + //+(3+lvl) damage, equivalent to +67% damage, but more consistent + int dmgBoost = augment.damageFactor(3 + level()); + lungeAbility(hero, target, 1, dmgBoost, this); + } + + public static void lungeAbility(Hero hero, Integer target, float dmgMulti, int dmgBoost, MeleeWeapon wep){ if (target == null){ return; } @@ -75,20 +81,20 @@ public class Rapier extends MeleeWeapon { //duelist can lunge out of her FOV, but this wastes the ability instead of cancelling if there is no target if (Dungeon.level.heroFOV[target]) { if (enemy == null || enemy == hero || hero.isCharmedBy(enemy)) { - GLog.w(Messages.get(this, "ability_no_target")); + GLog.w(Messages.get(wep, "ability_no_target")); return; } } if (hero.rooted || Dungeon.level.distance(hero.pos, target) < 2 - || Dungeon.level.distance(hero.pos, target)-1 > reachFactor(hero)){ - GLog.w(Messages.get(this, "ability_bad_position")); + || Dungeon.level.distance(hero.pos, target)-1 > wep.reachFactor(hero)){ + GLog.w(Messages.get(wep, "ability_bad_position")); return; } int lungeCell = -1; for (int i : PathFinder.NEIGHBOURS8){ - if (Dungeon.level.distance(hero.pos+i, target) <= reachFactor(hero) + if (Dungeon.level.distance(hero.pos+i, target) <= wep.reachFactor(hero) && Actor.findChar(hero.pos+i) == null && (Dungeon.level.passable[hero.pos+i] || (Dungeon.level.avoid[hero.pos+i] && hero.flying))){ if (lungeCell == -1 || Dungeon.level.trueDistance(hero.pos + i, target) < Dungeon.level.trueDistance(lungeCell, target)){ @@ -98,7 +104,7 @@ public class Rapier extends MeleeWeapon { } if (lungeCell == -1){ - GLog.w(Messages.get(this, "ability_bad_position")); + GLog.w(Messages.get(wep, "ability_bad_position")); return; } @@ -118,25 +124,25 @@ public class Rapier extends MeleeWeapon { hero.sprite.attack(enemy.pos, new Callback() { @Override public void call() { - //+3+lvl damage, equivalent to +67% damage, but more consistent - beforeAbilityUsed(hero); + + wep.beforeAbilityUsed(hero); AttackIndicator.target(enemy); - if (hero.attack(enemy, 1f, augment.damageFactor(3 + level()), Char.INFINITE_ACCURACY)) { + if (hero.attack(enemy, dmgMulti, dmgBoost, Char.INFINITE_ACCURACY)) { Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); if (!enemy.isAlive()) { - onAbilityKill(hero); + wep.onAbilityKill(hero); } } Invisibility.dispel(); hero.spendAndNext(hero.attackDelay()); - afterAbilityUsed(hero); + wep.afterAbilityUsed(hero); } }); } else { - beforeAbilityUsed(hero); + wep.beforeAbilityUsed(hero); GLog.w(Messages.get(Rapier.class, "ability_no_target")); hero.spendAndNext(hero.speed()); - afterAbilityUsed(hero); + wep.afterAbilityUsed(hero); } } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index fbcb7ac67..44b22b2b0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -245,6 +245,7 @@ public class ItemSpriteSheet { public static final int RUNIC_BLADE = WEP_TIER4+3; public static final int ASSASSINS_BLADE = WEP_TIER4+4; public static final int CROSSBOW = WEP_TIER4+5; + public static final int KATANA = WEP_TIER4+6; static{ assignItemRect(LONGSWORD, 15, 15); assignItemRect(BATTLE_AXE, 16, 16); @@ -252,6 +253,7 @@ public class ItemSpriteSheet { assignItemRect(RUNIC_BLADE, 14, 14); assignItemRect(ASSASSINS_BLADE, 14, 15); assignItemRect(CROSSBOW, 15, 15); + assignItemRect(KATANA, 15, 16); } private static final int WEP_TIER5 = xy(1, 9); //8 slots