From 9a74c44844ae796508947de369e0644bcb74a1c3 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 28 Nov 2022 17:24:05 -0500 Subject: [PATCH] v2.0.0: implemented duelist abilities for the accurate weapons --- .../assets/messages/items/items.properties | 8 +++ .../items/weapon/melee/BattleAxe.java | 12 +++++ .../items/weapon/melee/HandAxe.java | 20 ++++++++ .../items/weapon/melee/Mace.java | 51 +++++++++++++++++++ .../items/weapon/melee/WarHammer.java | 12 +++++ 5 files changed, 103 insertions(+) diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index 4590d1d6d..8306b484f 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -1488,6 +1488,8 @@ items.weapon.melee.assassinsblade.desc=A small wavy blade made of obsidian, diff items.weapon.melee.battleaxe.name=battle axe items.weapon.melee.battleaxe.stats_desc=This is a rather accurate weapon. +items.weapon.melee.battleaxe.ability_name=heavy blow +items.weapon.melee.battleaxe.ability_desc=The Duelist can perform a _heavy blow_ with a battle axe. This strong but predictable attack has -75% accuracy, but deals +35% damage and applies vulnerable for 5 turns if it hits. Heavy blow can surprise attack. items.weapon.melee.battleaxe.desc=The enormous steel head of this battle axe puts considerable heft behind each wide stroke. items.weapon.melee.crossbow.name=crossbow @@ -1540,6 +1542,8 @@ items.weapon.melee.greatsword.desc=This towering blade inflicts heavy damage by items.weapon.melee.handaxe.name=hand axe items.weapon.melee.handaxe.stats_desc=This is a rather accurate weapon. +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 +45% damage and applies vulnerable 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 @@ -1553,6 +1557,8 @@ items.weapon.melee.longsword.desc=This sword's long razor-sharp steel blade shin items.weapon.melee.mace.name=mace items.weapon.melee.mace.stats_desc=This is a rather accurate weapon. +items.weapon.melee.mace.ability_name=heavy blow +items.weapon.melee.mace.ability_desc=The Duelist can perform a _heavy blow_ with a mace. This strong but predictable attack has -75% accuracy, but deals +40% damage and applies vulnerable for 5 turns if it hits. Heavy blow can surprise attack. items.weapon.melee.mace.desc=The large iron head of this weapon inflicts substantial damage. items.weapon.melee.magesstaff.name=mage's staff @@ -1635,6 +1641,8 @@ items.weapon.melee.sword$cleavetracker.desc=The duelist is ready to follow up on items.weapon.melee.warhammer.name=war hammer items.weapon.melee.warhammer.stats_desc=This is a rather accurate weapon. +items.weapon.melee.warhammer.ability_name=heavy blow +items.weapon.melee.warhammer.ability_desc=The Duelist can perform a _heavy blow_ with a war hammer. This strong but predictable attack has -75% accuracy, but deals +30% damage and applies vulnerable for 5 turns if it hits. Heavy blow can surprise attack. items.weapon.melee.warhammer.desc=Few creatures can withstand the crushing blow of this towering mass of lead and steel, but it takes great strength to use effectively. items.weapon.melee.whip.name=whip diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/BattleAxe.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/BattleAxe.java index af52f0876..c7890597a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/BattleAxe.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/BattleAxe.java @@ -22,6 +22,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public class BattleAxe extends MeleeWeapon { @@ -41,4 +43,14 @@ public class BattleAxe extends MeleeWeapon { lvl*(tier+1); //scaling unchanged } + @Override + public String targetingPrompt() { + return Messages.get(this, "prompt"); + } + + @Override + protected void duelistAbility(Hero hero, Integer target) { + Mace.heavyBlowAbility(hero, target, 1.35f, this); + } + } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/HandAxe.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/HandAxe.java index f626fd94d..cf820406d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/HandAxe.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/HandAxe.java @@ -22,7 +22,17 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vulnerable; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Callback; public class HandAxe extends MeleeWeapon { @@ -41,4 +51,14 @@ public class HandAxe extends MeleeWeapon { lvl*(tier+1); //scaling unchanged } + @Override + public String targetingPrompt() { + return Messages.get(this, "prompt"); + } + + @Override + protected void duelistAbility(Hero hero, Integer target) { + Mace.heavyBlowAbility(hero, target, 1.45f, this); + } + } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Mace.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Mace.java index 7ab053e0c..540c3b3ea 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Mace.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Mace.java @@ -22,7 +22,17 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vulnerable; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.audio.Sample; +import com.watabou.utils.Callback; public class Mace extends MeleeWeapon { @@ -41,4 +51,45 @@ public class Mace extends MeleeWeapon { lvl*(tier+1); //scaling unchanged } + @Override + public String targetingPrompt() { + return Messages.get(this, "prompt"); + } + + @Override + protected void duelistAbility(Hero hero, Integer target) { + Mace.heavyBlowAbility(hero, target, 1.40f, this); + } + + public static void heavyBlowAbility(Hero hero, Integer target, float dmgMulti, MeleeWeapon wep){ + if (target == null) { + return; + } + + Char enemy = Actor.findChar(target); + if (enemy == null || enemy == hero || hero.isCharmedBy(enemy) || !Dungeon.level.heroFOV[target]) { + GLog.w(Messages.get(wep, "ability_no_target")); + return; + } + + if (!hero.canAttack(enemy)){ + GLog.w(Messages.get(wep, "ability_bad_position")); + return; + } + + hero.sprite.attack(enemy.pos, new Callback() { + @Override + public void call() { + if (hero.attack(enemy, dmgMulti, 0, 0.25f)) { + Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); + if (enemy.isAlive()){ + Buff.affect(enemy, Vulnerable.class, 5f); + } + } + hero.spendAndNext(hero.attackDelay()); + wep.onAbilityUsed(hero); + } + }); + } + } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/WarHammer.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/WarHammer.java index 2c532686a..271f3149d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/WarHammer.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/WarHammer.java @@ -22,6 +22,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; public class WarHammer extends MeleeWeapon { @@ -41,4 +43,14 @@ public class WarHammer extends MeleeWeapon { lvl*(tier+1); //scaling unchanged } + @Override + public String targetingPrompt() { + return Messages.get(this, "prompt"); + } + + @Override + protected void duelistAbility(Hero hero, Integer target) { + Mace.heavyBlowAbility(hero, target, 1.30f, this); + } + }