v2.1.2: improved the logic and VFX for sandals active ability

This commit is contained in:
Evan Debenham
2023-06-15 13:39:11 -04:00
parent 8d3226ba5a
commit 5a70a482ae

View File

@@ -29,11 +29,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicImmune;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.bags.VelvetPouch;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Blindweed;
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
@@ -52,12 +54,12 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.PathFinder;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
import com.watabou.utils.Reflection;
@@ -313,17 +315,23 @@ public class SandalsOfNature extends Artifact {
@Override
public void onSelect(Integer cell) {
if (cell != null){
PathFinder.buildDistanceMap(curUser.pos, BArray.not(Dungeon.level.solid,null), 3);
if (PathFinder.distance[cell] == Integer.MAX_VALUE){
if (!Dungeon.level.heroFOV[cell] || Dungeon.level.distance(curUser.pos, cell) > 3){
GLog.w(Messages.get(SandalsOfNature.class, "out_of_range"));
} else {
CellEmitter.get( cell ).burst( LeafParticle.GENERAL, 6 );
Ballistica aim = new Ballistica(curUser.pos, cell, Ballistica.STOP_TARGET);
for (int c : aim.subPath(0, aim.dist)){
CellEmitter.get( c ).burst( LeafParticle.GENERAL, 6 );
}
Splash.at(DungeonTilemap.tileCenterToWorld( cell ), -PointF.PI/2, PointF.PI/2, seedColors.get(curSeedEffect), 6);
Invisibility.dispel(curUser);
Plant plant = ((Plant.Seed) Reflection.newInstance(curSeedEffect)).couch(cell, null);
plant.activate(Actor.findChar(cell));
Sample.INSTANCE.play(Assets.Sounds.TRAMPLE, 1, Random.Float( 0.96f, 1.05f ) );
Sample.INSTANCE.play(Assets.Sounds.PLANT);
Sample.INSTANCE.playDelayed(Assets.Sounds.TRAMPLE, 0.25f, 1, Random.Float( 0.96f, 1.05f ) );
charge -= seedChargeReqs.get(curSeedEffect);
Talent.onArtifactUsed(Dungeon.hero);