From ddc89ac3c6ff04e793d151a34687b4b8ddbeeddd Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 22 Nov 2022 14:38:41 -0500 Subject: [PATCH] v2.0.0: improved weapon ability errors messages --- core/src/main/assets/messages/items/items.properties | 9 ++++----- .../items/weapon/melee/MeleeWeapon.java | 4 ++-- .../shatteredpixeldungeon/items/weapon/melee/Rapier.java | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 208b651df..92d1b5156 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1566,8 +1566,10 @@ items.weapon.melee.meleeweapon.stats_known=This _tier-%1$d_ melee weapon deals _ items.weapon.melee.meleeweapon.stats_unknown=Typically this _tier-%1$d_ melee weapon deals _%2$d-%3$d damage_ and requires _%4$d strength_ to use properly. items.weapon.melee.meleeweapon.probably_too_heavy=Probably this weapon is too heavy for you. items.weapon.melee.meleeweapon.stats_desc= -items.weapon.melee.meleeweapon.ability_equip=You must equip that weapon to use its ability. -items.weapon.melee.meleeweapon.ability_charge=You don't have enough energy to use that ability. +items.weapon.melee.meleeweapon.ability_need_equip=You must equip that weapon to use its ability. +items.weapon.melee.meleeweapon.ability_no_charge=You don't have enough energy to use that ability. +items.weapon.melee.meleeweapon.ability_no_target=There is no target there. +items.weapon.melee.meleeweapon.ability_bad_position=That target can't be reached. items.weapon.melee.meleeweapon.prompt=Select a Target items.weapon.melee.shortsword.name=shortsword @@ -1581,9 +1583,6 @@ items.weapon.melee.rapier.name=rapier items.weapon.melee.rapier.stats_desc=This weapon blocks 0-1 damage. items.weapon.melee.rapier.ability_name=lunge items.weapon.melee.rapier.ability_desc=The duelist can _lunge_ with a rapier at an enemy 1 tile away. This moves toward the enemy, deals +67% damage, and is guaranteed to hit. -items.weapon.melee.rapier.no_target=There is no target at that location. -items.weapon.melee.rapier.bad_distance=The target must be 1 tile away. -items.weapon.melee.rapier.cant_reach=You cannot reach that target. items.weapon.melee.rapier.desc=A slim straight sword that offers some protection in exchange for less slashing power. items.weapon.melee.roundshield.name=round shield diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index 018a91188..6214eff5d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -83,9 +83,9 @@ public class MeleeWeapon extends Weapon { if (action.equals(AC_ABILITY)){ if (!isEquipped(hero)) { - GLog.w(Messages.get(this, "ability_equip")); + GLog.w(Messages.get(this, "ability_need_equip")); } else if (Buff.affect(hero, Charger.class).charges < abilityChargeUse()) { - GLog.w(Messages.get(this, "ability_charge")); + GLog.w(Messages.get(this, "ability_no_charge")); usesTargeting = false; } else { 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 bc2bcbd43..ea15b9336 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 @@ -70,13 +70,13 @@ public class Rapier extends MeleeWeapon { } Char enemy = Actor.findChar(target); - if (enemy == null){ - GLog.w(Messages.get(this, "no_target")); + if (enemy == null || enemy == hero || hero.isCharmedBy(enemy) || !Dungeon.level.heroFOV[target]){ + GLog.w(Messages.get(this, "ability_no_target")); return; } if (Dungeon.level.distance(hero.pos, enemy.pos) != 2){ - GLog.w(Messages.get(this, "bad_distance")); + GLog.w(Messages.get(this, "ability_bad_position")); return; } @@ -92,7 +92,7 @@ public class Rapier extends MeleeWeapon { } if (lungeCell == -1){ - GLog.w(Messages.get(this, "cant_reach")); + GLog.w(Messages.get(this, "ability_bad_position")); return; }