From e70c5bbb41c7c6ce1ded6e96d45af235161b8262 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 10 Jan 2019 02:28:31 -0500 Subject: [PATCH] v0.7.1c: Fixed: - Dwarf King not being able to summon if he could not see an enemy - recycle generating health potions when it shouldn't - soul mark being substantially more common than intended - rare cases where DM-300 could fail to spawn due to too small a level - magical porter rarely causing soft-locks - thrown weapons not having their level IDed from remains --- .../shatteredpixeldungeon/Bones.java | 3 ++- .../shatteredpixeldungeon/actors/mobs/King.java | 14 ++++---------- .../items/spells/Recycle.java | 3 ++- .../shatteredpixeldungeon/items/wands/Wand.java | 2 +- .../levels/CavesBossLevel.java | 8 ++++---- .../shatteredpixeldungeon/scenes/GameScene.java | 5 ++++- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java index 412284409..b95e88ff8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Bones.java @@ -172,7 +172,8 @@ public class Bones { if (item.level() > 3) { item.degrade( item.level() - 3 ); } - item.levelKnown = false; + //thrown weapons are always IDed, otherwise set unknown + item.levelKnown = !(item instanceof MissileWeapon); } item.reset(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java index 20fb0f217..5ef29c750 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java @@ -108,13 +108,6 @@ public class King extends Mob { super.getCloser( target ); } - @Override - protected boolean canAttack( Char enemy ) { - return canTryToSummon() ? - pos == ((CityBossLevel)Dungeon.level).pedestal( nextPedestal ) : - Dungeon.level.adjacent( pos, enemy.pos ); - } - private boolean canTryToSummon() { if (Undead.count < maxArmySize()) { Char ch = Actor.findChar( ((CityBossLevel)Dungeon.level).pedestal( nextPedestal ) ); @@ -125,15 +118,15 @@ public class King extends Mob { } @Override - public boolean attack( Char enemy ) { + protected boolean act() { if (canTryToSummon() && pos == ((CityBossLevel)Dungeon.level).pedestal( nextPedestal )) { summon(); return true; } else { - if (Actor.findChar( ((CityBossLevel)Dungeon.level).pedestal( nextPedestal ) ) == enemy) { + if (enemy != null && Actor.findChar( ((CityBossLevel)Dungeon.level).pedestal( nextPedestal ) ) == enemy) { nextPedestal = !nextPedestal; } - return super.attack(enemy); + return super.act(); } } @@ -218,6 +211,7 @@ public class King extends Mob { } yell( Messages.get(this, "arise") ); + spend( TICK ); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Recycle.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Recycle.java index 7a1e3f4dc..424a56d0a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Recycle.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/Recycle.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.spells; +import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Item; @@ -75,7 +76,7 @@ public class Recycle extends InventorySpell { } else { result = Generator.random(Generator.Category.STONE); } - } while (result.getClass() == item.getClass()); + } while (result.getClass() == item.getClass() || Challenges.isItemBlocked(result)); item.detach(curUser.belongings.backpack); GLog.p(Messages.get(this, "recycled", result.name())); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index 84b3e4983..29b7c1def 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -146,7 +146,7 @@ public abstract class Wand extends Item { if (target != Dungeon.hero && Dungeon.hero.subClass == HeroSubClass.WARLOCK && //standard 1 - 0.92^x chance, plus 7%. Starts at 15% - Random.Float() > (Math.pow(0.92f, (level()*chargesUsed)+1) - 0.7f)){ + Random.Float() > (Math.pow(0.92f, (level()*chargesUsed)+1) - 0.07f)){ SoulMark.prolong(target, SoulMark.class, SoulMark.DURATION + level()); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java index 23094b3fb..6cb03a29d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/CavesBossLevel.java @@ -106,10 +106,10 @@ public class CavesBossLevel extends Level { Rect space = new Rect(); space.set( - Random.IntRange(2, 2 + (int)(width*0.2f)), - Random.IntRange(2, 2 + (int)(height*0.2f)), - Random.IntRange((int)(width * 0.8f - 2), width-2 ), - Random.IntRange((int)(height * 0.8f - 2), height-2 ) + Random.IntRange(2, 6), + Random.IntRange(2, 6), + Random.IntRange(width-6, width-2), + Random.IntRange(height-6, height-2) ); Painter.fillEllipse( this, space, Terrain.EMPTY ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 5d4c0cb33..10a7eab80 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -396,9 +396,12 @@ public class GameScene extends PixelScene { //TODO currently items are only ported to boss rooms, so this works well //might want to have a 'near entrance' function if items can be ported elsewhere int pos; + //try to find a tile with no heap, otherwise just stick items onto a heap. + int tries = 100; do { pos = Dungeon.level.randomRespawnCell(); - } while (Dungeon.level.heaps.get(pos) != null); + tries--; + } while (tries > 0 && Dungeon.level.heaps.get(pos) != null); for (Item item : ported) { Dungeon.level.drop( item, pos ).type = Heap.Type.CHEST; }