From 69d6d6c505c2c1a60c51e4627bc7e765f5dfaa80 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 30 Nov 2020 14:11:31 -0500 Subject: [PATCH] v0.9.1: implemented the improvised projectiles talent --- .../actors/hero/Talent.java | 7 ++++-- .../shatteredpixeldungeon/items/Item.java | 23 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java index 50dda57d0..d26822785 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java @@ -103,8 +103,11 @@ public enum Talent { INVIGORATING_MEAL(52), RESTORED_NATURE(53), REJUVENATING_STEPS(54), - DURABLE_PROJECTILES(55), - HEIGHTENED_SENSES(56); + HEIGHTENED_SENSES(55), + DURABLE_PROJECTILES(56); + + public static class ImprovisedProjectileCooldown extends FlavourBuff{}; + public static class RejuvenatingStepsCooldown extends FlavourBuff{}; int icon; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index cc7f3c1e6..0457acf7a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -26,11 +26,14 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Degrade; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.journal.Catalog; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -545,6 +548,16 @@ public class Item implements Bundlable { public void call() { curUser = user; Item.this.detach(user.belongings.backpack).onThrow(cell); + if (curUser.hasTalent(Talent.IMPROVISED_PROJECTILES) + && !(Item.this instanceof MissileWeapon) + && curUser.buff(Talent.ImprovisedProjectileCooldown.class) == null){ + Char ch = Actor.findChar(cell); + if (ch != null && ch.alignment != curUser.alignment){ + Sample.INSTANCE.play(Assets.Sounds.HIT); + Buff.affect(ch, Blindness.class, 1f + curUser.pointsInTalent(Talent.IMPROVISED_PROJECTILES)); + Buff.affect(curUser, Talent.ImprovisedProjectileCooldown.class, 30f); + } + } user.spendAndNext(delay); } }); @@ -558,6 +571,16 @@ public class Item implements Bundlable { public void call() { curUser = user; Item.this.detach(user.belongings.backpack).onThrow(cell); + if (curUser.hasTalent(Talent.IMPROVISED_PROJECTILES) + && !(Item.this instanceof MissileWeapon) + && curUser.buff(Talent.ImprovisedProjectileCooldown.class) == null){ + Char ch = Actor.findChar(cell); + if (ch != null && ch.alignment != curUser.alignment){ + Sample.INSTANCE.play(Assets.Sounds.HIT); + Buff.affect(ch, Blindness.class, 1f + curUser.pointsInTalent(Talent.IMPROVISED_PROJECTILES)); + Buff.affect(curUser, Talent.ImprovisedProjectileCooldown.class, 30f); + } + } user.spendAndNext(delay); } });