From d567c7a2830489d5a14040fa071c4565a612e652 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 13 Feb 2021 21:14:36 -0500 Subject: [PATCH] v0.9.2: implemented the seer shot talent --- .../main/assets/messages/actors/actors.properties | 2 ++ .../shatteredpixeldungeon/Dungeon.java | 9 ++++++++- .../shatteredpixeldungeon/actors/hero/Talent.java | 14 ++++++++++++-- .../items/weapon/SpiritBow.java | 12 ++++++++++++ .../shatteredpixeldungeon/levels/Level.java | 7 +++++++ 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 151e256d9..1143d5313 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -441,6 +441,8 @@ actors.hero.talent.durable_projectiles.title=durable projectiles actors.hero.talent.durable_projectiles.desc=_+1:_ Thrown weapons have _+50% durability_ when used by the Huntress.\n\n_+2:_ Thrown weapons have _+75% durability_ when used by the Huntress. actors.hero.talent.point_blank.title=point blank actors.hero.talent.point_blank.desc=_+1:_ When the Huntress uses a thrown weapon at melee range it has _-30% accuracy,_ instead of -50%.\n\n_+2:_ When the Huntress uses a thrown weapon at melee range it has _-10% accuracy,_ instead of -50%.\n\n_+3:_ When the Huntress uses a thrown weapon at melee range it has _+10% accuracy,_ instead of -50%.\n\nNote that thrown weapons always have +50% accuracy when used at a distance. +actors.hero.talent.seer_shot.title=seer shot +actors.hero.talent.seer_shot.desc=_+1:_ When the huntress fires an arrow at the ground, it grants vision in a 3*3 area around it for _5 turns_. This has a 20 turn cooldown.\n\n_+2:_ When the huntress fires an arrow at the ground, it grants vision in a 3*3 area around it for _10 turns_. This has a 20 turn cooldown.\n\n_+3:_ When the huntress fires an arrow at the ground, it grants vision in a 3*3 area around it for _15 turns_. This has a 20 turn cooldown. actors.hero.talent.farsight.title=farsight actors.hero.talent.farsight.desc=_+1:_ The Sniper's vision range is _increased by 25%_\n\n_+2:_ The Sniper's vision range is _increased by 50%_\n\n_+3:_ The Sniper's vision range is _increased by 75%_ actors.hero.talent.shared_enchantment.title=shared enchantment diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index c07ede3ee..cf98d267d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -697,7 +697,6 @@ public class Dungeon { Rankings.INSTANCE.submit( true, cause ); } - //TODO hero max vision is now separate from shadowcaster max vision. Might want to adjust. public static void observe(){ int dist = Dungeon.hero.viewDistance; dist *= 1f + 0.25f*Dungeon.hero.pointsInTalent(Talent.FARSIGHT); @@ -770,6 +769,14 @@ public class Dungeon { GameScene.updateFog(h.pos, 2); } + Talent.SeerShotTracker seerShot = hero.buff(Talent.SeerShotTracker.class); + if (seerShot != null && seerShot.depth == Dungeon.depth){ + BArray.or( level.visited, level.heroFOV, seerShot.pos - 1 - level.width(), 3, level.visited ); + BArray.or( level.visited, level.heroFOV, seerShot.pos - 1, 3, level.visited ); + BArray.or( level.visited, level.heroFOV, seerShot.pos - 1 + level.width(), 3, level.visited ); + GameScene.updateFog(seerShot.pos, 2); + } + GameScene.afterObserve(); } 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 00e48b822..d4b2ab62a 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 @@ -104,7 +104,7 @@ public enum Talent { //Huntress T2 INVIGORATING_MEAL(100), RESTORED_NATURE(101), REJUVENATING_STEPS(102), HEIGHTENED_SENSES(103), DURABLE_PROJECTILES(104), //Huntress T3 - POINT_BLANK(105, 3), HUNTRESS_T3_2(106, 3), + POINT_BLANK(105, 3), SEER_SHOT(106, 3), //Sniper T3 FARSIGHT(107, 3), SHARED_ENCHANTMENT(108, 3), SHARED_UPGRADES(109, 3), //Warden T3 @@ -137,6 +137,16 @@ public enum Talent { public static class EnhancedRingsTracker extends FlavourBuff{}; public static class BountyHunterTracker extends FlavourBuff{}; public static class RejuvenatingStepsCooldown extends FlavourBuff{}; + public static class SeerShotTracker extends FlavourBuff{ + public int depth, pos; //TODO bundle + + @Override + public void detach() { + GameScene.updateFog(pos, 2); + super.detach(); + } + } + public static class SeerShotCooldown extends FlavourBuff{}; int icon; int maxPoints; @@ -457,7 +467,7 @@ public enum Talent { Collections.addAll(tierTalents, ENHANCED_RINGS, LIGHT_CLOAK); break; case HUNTRESS: - Collections.addAll(tierTalents, POINT_BLANK, HUNTRESS_T3_2); + Collections.addAll(tierTalents, POINT_BLANK, SEER_SHOT); break; } for (Talent talent : tierTalents){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java index 2f2075603..942ec98d2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java @@ -25,7 +25,9 @@ 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.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.effects.Splash; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting; @@ -337,6 +339,16 @@ public class SpiritBow extends Weapon { }); } else { + + if (Actor.findChar(dst) == null + && user.hasTalent(Talent.SEER_SHOT) + && user.buff(Talent.SeerShotCooldown.class) == null){ + Talent.SeerShotTracker seerShot = Buff.affect(user, Talent.SeerShotTracker.class, 5*user.pointsInTalent(Talent.SEER_SHOT)); + seerShot.depth = Dungeon.depth; + seerShot.pos = dst; + Buff.affect(user, Talent.SeerShotCooldown.class, 20f); + } + super.cast(user, dst); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 6fc7f3658..25e52e9df 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -1190,6 +1190,13 @@ public abstract class Level implements Bundlable { BArray.or(fieldOfView, m.fieldOfView, fieldOfView); } } + + Talent.SeerShotTracker seerShot = c.buff(Talent.SeerShotTracker.class); + if (seerShot != null && seerShot.depth == Dungeon.depth){ + for (int i : PathFinder.NEIGHBOURS9) + fieldOfView[seerShot.pos+i] = true; + } + } if (c == Dungeon.hero) {