From 37ddbe19e6a8a14c6716d0ac145fd07582db06aa Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 26 Jan 2021 18:38:33 -0500 Subject: [PATCH] v0.9.2: implemented the farsight talent --- core/src/main/assets/messages/actors/actors.properties | 2 ++ .../com/shatteredpixel/shatteredpixeldungeon/Dungeon.java | 6 ++++-- .../shatteredpixeldungeon/actors/hero/Talent.java | 8 ++++++-- .../shatteredpixeldungeon/levels/Level.java | 4 +++- .../shatteredpixeldungeon/mechanics/ShadowCaster.java | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 6728a6c79..ad1a1ce0c 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -395,6 +395,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.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.hero.name=you actors.hero.hero.leave=You can't leave yet, the rest of the dungeon awaits below! diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 06eaa2322..15b716e11 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Light; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost; @@ -58,7 +59,6 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.SewerBossLevel; import com.shatteredpixel.shatteredpixeldungeon.levels.SewerLevel; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.SecretRoom; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom; -import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton; @@ -695,7 +695,9 @@ public class Dungeon { //TODO hero max vision is now separate from shadowcaster max vision. Might want to adjust. public static void observe(){ - observe( ShadowCaster.MAX_DISTANCE+1 ); + int dist = Dungeon.hero.viewDistance; + dist *= 1f + 0.25f*Dungeon.hero.pointsInTalent(Talent.FARSIGHT); + observe( dist+1 ); } public static void observe( int dist ) { 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 711aac5b8..fb6e035dc 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 @@ -106,7 +106,7 @@ public enum Talent { //Huntress T3 POINT_BLANK(105, 3), HUNTRESS_T3_2(106, 3), //Sniper T3 - SNIPER_T3_1(107, 3), SNIPER_T3_2(108, 3), SNIPER_T3_3(109, 3), + FARSIGHT(107, 3), SNIPER_T3_2(108, 3), SNIPER_T3_3(109, 3), //Warden T3 WARDEN_T3_1(110, 3), WARDEN_T3_2(111, 3), WARDEN_T3_3(112, 3); @@ -169,6 +169,10 @@ public enum Talent { if (hero.belongings.ring instanceof Ring) hero.belongings.ring.setKnown(); if (hero.belongings.misc instanceof Ring) ((Ring) hero.belongings.misc).setKnown(); } + + if (talent == FARSIGHT){ + Dungeon.observe(); + } } public static class CachedRationsDropped extends CounterBuff{}; @@ -470,7 +474,7 @@ public enum Talent { Collections.addAll(tierTalents, FREERUNNER_T3_1, FREERUNNER_T3_2, FREERUNNER_T3_3); break; case SNIPER: - Collections.addAll(tierTalents, SNIPER_T3_1, SNIPER_T3_2, SNIPER_T3_3); + Collections.addAll(tierTalents, FARSIGHT, SNIPER_T3_2, SNIPER_T3_3); break; case WARDEN: Collections.addAll(tierTalents, WARDEN_T3_1, WARDEN_T3_2, WARDEN_T3_3); 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 20839b02a..a19f031d8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -1074,7 +1074,9 @@ public abstract class Level implements Bundlable { } int viewDist = c.viewDistance; - if (c instanceof Hero && ((Hero) c).subClass == HeroSubClass.SNIPER) viewDist *= 1.5f; + if (c instanceof Hero){ + viewDist *= 1f + 0.25f*((Hero) c).pointsInTalent(Talent.FARSIGHT); + } ShadowCaster.castShadow( cx, cy, fieldOfView, blocking, viewDist ); } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java index 6fda87361..671cd9722 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/mechanics/ShadowCaster.java @@ -28,7 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; //based on: http://www.roguebasin.com/index.php?title=FOV_using_recursive_shadowcasting public final class ShadowCaster { - public static final int MAX_DISTANCE = 12; + public static final int MAX_DISTANCE = 14; //max length of rows as FOV moves out, for each FOV distance //This is used to make the overall FOV circular, instead of square