From b76b235066d7cded948cecd9f8a8983298d051b7 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 27 Apr 2019 19:40:46 -0400 Subject: [PATCH] ported over 0.7.2d changes, updated version info --- .../src/com/watabou/noosa}/Halo.java | 9 ++------ build.gradle | 4 ++-- .../actors/buffs/Preparation.java | 2 ++ .../effects/ShieldHalo.java | 2 +- .../effects/TorchHalo.java | 1 + .../items/armor/glyphs/Stone.java | 2 +- .../items/artifacts/CloakOfShadows.java | 16 +++++++++++++ .../items/artifacts/TimekeepersHourglass.java | 23 ++++++++----------- .../items/wands/WandOfCorruption.java | 7 +++--- .../levels/PrisonLevel.java | 2 +- desktop/VersionInfo.txt | 4 ++-- .../watabou/pd/desktop/DesktopLauncher.java | 4 ++-- 12 files changed, 43 insertions(+), 33 deletions(-) rename {core/src/com/shatteredpixel/shatteredpixeldungeon/effects => PD-classes/src/com/watabou/noosa}/Halo.java (87%) diff --git a/core/src/com/shatteredpixel/shatteredpixeldungeon/effects/Halo.java b/PD-classes/src/com/watabou/noosa/Halo.java similarity index 87% rename from core/src/com/shatteredpixel/shatteredpixeldungeon/effects/Halo.java rename to PD-classes/src/com/watabou/noosa/Halo.java index eba82df9..03321a24 100644 --- a/core/src/com/shatteredpixel/shatteredpixeldungeon/effects/Halo.java +++ b/PD-classes/src/com/watabou/noosa/Halo.java @@ -8,7 +8,7 @@ * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,17 +18,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see */ -package com.shatteredpixel.shatteredpixeldungeon.effects; +package com.watabou.noosa; import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Texture; import com.watabou.gltextures.SmartTexture; import com.watabou.gltextures.TextureCache; -import com.watabou.noosa.Image; -import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; - -//TODO externalize bitmap stuff to SPD-classes public class Halo extends Image { private static final Object CACHE_KEY = Halo.class; @@ -65,7 +61,6 @@ public Halo( float radius, int color, float brightness ) { public Halo point( float x, float y ) { this.x = x - (width()/2f); this.y = y - (height()/2f); - PixelScene.align(this); return this; } diff --git a/build.gradle b/build.gradle index c788178f..393b7db1 100644 --- a/build.gradle +++ b/build.gradle @@ -15,9 +15,9 @@ allprojects { apply plugin: "eclipse" apply plugin: "idea" - version = '0.7.2c' + version = '0.7.2d' ext { - versionCode = 339 + versionCode = 340 appName = 'shattered-pixel-dungeon' appTitle = 'Shattered Pixel Dungeon' appId = 'com.shatteredpixel.shatteredpixeldungeon' diff --git a/core/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java b/core/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java index 2bd1a758..93defe5a 100644 --- a/core/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java +++ b/core/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java @@ -249,6 +249,8 @@ public void onSelect(Integer cell) { AttackLevel lvl = AttackLevel.getLvl(turnsInvis); boolean[] passable = Dungeon.level.passable.clone(); + //need to consider enemy cell as passable in case they are on a trap or chasm + passable[cell] = true; PathFinder.buildDistanceMap(Dungeon.hero.pos, passable, lvl.blinkDistance+1); if (PathFinder.distance[cell] == Integer.MAX_VALUE){ GLog.w(Messages.get(Preparation.class, "out_of_reach")); diff --git a/core/src/com/shatteredpixel/shatteredpixeldungeon/effects/ShieldHalo.java b/core/src/com/shatteredpixel/shatteredpixeldungeon/effects/ShieldHalo.java index cc7cbdf8..251c3925 100644 --- a/core/src/com/shatteredpixel/shatteredpixeldungeon/effects/ShieldHalo.java +++ b/core/src/com/shatteredpixel/shatteredpixeldungeon/effects/ShieldHalo.java @@ -21,10 +21,10 @@ package com.shatteredpixel.shatteredpixeldungeon.effects; -import com.shatteredpixel.shatteredpixeldungeon.effects.Halo; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.watabou.glwrap.Blending; import com.watabou.noosa.Game; +import com.watabou.noosa.Halo; import com.watabou.utils.PointF; public class ShieldHalo extends Halo { diff --git a/core/src/com/shatteredpixel/shatteredpixeldungeon/effects/TorchHalo.java b/core/src/com/shatteredpixel/shatteredpixeldungeon/effects/TorchHalo.java index 8fb6e863..9def8c4f 100644 --- a/core/src/com/shatteredpixel/shatteredpixeldungeon/effects/TorchHalo.java +++ b/core/src/com/shatteredpixel/shatteredpixeldungeon/effects/TorchHalo.java @@ -23,6 +23,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.watabou.glwrap.Blending; import com.watabou.noosa.Game; +import com.watabou.noosa.Halo; public class TorchHalo extends Halo { diff --git a/core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stone.java b/core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stone.java index a2f90cfd..1e669109 100644 --- a/core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stone.java +++ b/core/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stone.java @@ -38,7 +38,7 @@ public int proc(Armor armor, Char attacker, Char defender, int damage) { float hitChance; if (evasion >= accuracy){ - hitChance = 1f - (1f - (accuracy/evasion))/2f; + hitChance = (accuracy/evasion)/2f; } else { hitChance = 1f - (evasion/accuracy)/2f; } diff --git a/core/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java b/core/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java index 1cc0140a..e3c962a0 100644 --- a/core/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java +++ b/core/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java @@ -302,5 +302,21 @@ public void detach() { updateQuickslot(); super.detach(); } + + private static final String TURNSTOCOST = "turnsToCost"; + + @Override + public void storeInBundle(Bundle bundle) { + super.storeInBundle(bundle); + + bundle.put( TURNSTOCOST , turnsToCost); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + super.restoreFromBundle(bundle); + + turnsToCost = bundle.getInt( TURNSTOCOST ); + } } } diff --git a/core/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java b/core/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java index 80230560..1715a81d 100644 --- a/core/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java +++ b/core/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java @@ -196,7 +196,7 @@ public void restoreFromBundle( Bundle bundle ) { if (bundle.contains( BUFF )){ Bundle buffBundle = bundle.getBundle( BUFF ); - if (buffBundle.contains( timeFreeze.PARTIALTIME )) + if (buffBundle.contains( timeFreeze.PRESSES )) activeBuff = new timeFreeze(); else activeBuff = new timeStasis(); @@ -289,15 +289,15 @@ public class timeFreeze extends ArtifactBuff { type = buffType.POSITIVE; } - float partialTime = 0f; + float turnsToCost = 0f; - ArrayList presses = new ArrayList(); + ArrayList presses = new ArrayList<>(); public void processTime(float time){ - partialTime += time; + turnsToCost -= time; - while (partialTime >= 2f){ - partialTime -= 2f; + while (turnsToCost < 0f){ + turnsToCost += 2f; charge --; } @@ -336,11 +336,6 @@ public void detach(){ for (Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) if (mob.paralysed <= 0) mob.sprite.remove(CharSprite.State.PARALYSED); GameScene.freezeEmitters = false; - - while (partialTime > 0f){ - partialTime -= 2f; - charge --; - } updateQuickslot(); super.detach(); @@ -350,7 +345,7 @@ public void detach(){ } private static final String PRESSES = "presses"; - private static final String PARTIALTIME = "partialtime"; + private static final String TURNSTOCOST = "turnsToCost"; @Override public void storeInBundle(Bundle bundle) { @@ -361,7 +356,7 @@ public void storeInBundle(Bundle bundle) { values[i] = presses.get(i); bundle.put( PRESSES , values ); - bundle.put( PARTIALTIME , partialTime ); + bundle.put( TURNSTOCOST , turnsToCost); } @Override @@ -372,7 +367,7 @@ public void restoreFromBundle(Bundle bundle) { for (int value : values) presses.add(value); - partialTime = bundle.getFloat( PARTIALTIME ); + turnsToCost = bundle.getFloat( TURNSTOCOST ); } } diff --git a/core/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java b/core/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java index fa0c23bd..f54e66c1 100644 --- a/core/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java +++ b/core/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java @@ -225,6 +225,10 @@ private void corruptEnemy( Mob enemy ){ buff.detach(); } } + if (enemy.alignment == Char.Alignment.ENEMY){ + enemy.rollToDropLoot(); + } + Buff.affect(enemy, Corruption.class); Statistics.enemiesSlain++; @@ -236,9 +240,6 @@ private void corruptEnemy( Mob enemy ){ } else { curUser.earnExp(0, enemy.getClass()); } - if (enemy.alignment == Char.Alignment.ENEMY){ - enemy.rollToDropLoot(); - } } else { Buff.affect(enemy, Doom.class); } diff --git a/core/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java b/core/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java index aafd7750..e8dacfef 100644 --- a/core/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java +++ b/core/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java @@ -23,7 +23,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Wandmaker; -import com.shatteredpixel.shatteredpixeldungeon.effects.Halo; +import com.watabou.noosa.Halo; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.FlameParticle; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.PrisonPainter; diff --git a/desktop/VersionInfo.txt b/desktop/VersionInfo.txt index f0aea7b9..748501f4 100644 --- a/desktop/VersionInfo.txt +++ b/desktop/VersionInfo.txt @@ -1,5 +1,5 @@ -339 +340 333 v0.7.2c v0.7.2! -github.com/00-Evan/shattered-pixel-dungeon-gdx/releases/download/v0.7.2c/ShatteredPD.Desktop.v0.7.2c.jar \ No newline at end of file +github.com/00-Evan/shattered-pixel-dungeon-gdx/releases/download/v0.7.2d/ShatteredPD.Desktop.v0.7.2d.jar \ No newline at end of file diff --git a/desktop/src/com/watabou/pd/desktop/DesktopLauncher.java b/desktop/src/com/watabou/pd/desktop/DesktopLauncher.java index 6b7a1820..628a37d5 100644 --- a/desktop/src/com/watabou/pd/desktop/DesktopLauncher.java +++ b/desktop/src/com/watabou/pd/desktop/DesktopLauncher.java @@ -34,14 +34,14 @@ public class DesktopLauncher { public static void main (String[] arg) { String version = DesktopLauncher.class.getPackage().getSpecificationVersion(); if (version == null) { - version = "0.7.2c"; + version = "0.7.2d"; } int versionCode; try { versionCode = Integer.parseInt(DesktopLauncher.class.getPackage().getImplementationVersion()); } catch (NumberFormatException e) { - versionCode = 339; + versionCode = 340; } LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();