v0.7.0b: bugfixes:

- fixed none-heroes being able to use reach weapons through walls
- fixed toolkit rarely being able to go above 100% charge
- fixed antimagic glyph apply to more effects when used by the sad ghost
- fixed elixir of restoration doing nothing when thrown
- fixed exotic items not being identified in rankings (will not fix old rankings)
- fixed bolas incorrectly having 15 strength
- fixed some items not being known to uncursed from shops
- fixed an internal typo in DungeonTileSheet.java
This commit is contained in:
Evan Debenham 2018-11-03 18:20:33 -04:00
parent e298e4671e
commit d9783ffb1c
14 changed files with 94 additions and 33 deletions

View File

@ -108,7 +108,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndResurrect;
@ -411,25 +410,19 @@ public class Hero extends Char {
}
public boolean canAttack(Char enemy){
if (enemy == null || pos == enemy.pos)
if (enemy == null || pos == enemy.pos) {
return false;
}
//can always attack adjacent enemies
if (Dungeon.level.adjacent(pos, enemy.pos))
if (Dungeon.level.adjacent(pos, enemy.pos)) {
return true;
}
KindOfWeapon wep = Dungeon.hero.belongings.weapon;
if (wep != null && Dungeon.level.distance( pos, enemy.pos ) <= wep.reachFactor(this)){
boolean[] passable = BArray.not(Dungeon.level.solid, null);
for (Mob m : Dungeon.level.mobs)
passable[m.pos] = false;
PathFinder.buildDistanceMap(enemy.pos, passable, wep.reachFactor(this));
return PathFinder.distance[pos] <= wep.reachFactor(this);
if (wep != null){
return wep.canReach(this, enemy.pos);
} else {
return false;
}

View File

@ -99,7 +99,7 @@ public class Statue extends Mob {
@Override
protected boolean canAttack(Char enemy) {
return Dungeon.level.distance( pos, enemy.pos ) <= weapon.reachFactor(this);
return super.canAttack(enemy) || weapon.canReach(this, enemy.pos);
}
@Override

View File

@ -132,11 +132,7 @@ public class MirrorImage extends NPC {
@Override
protected boolean canAttack(Char enemy) {
if (hero.belongings.weapon != null){
return Dungeon.level.distance( pos, enemy.pos ) <= hero.belongings.weapon.reachFactor(this);
} else {
return super.canAttack(enemy);
}
return super.canAttack(enemy) || (hero.belongings.weapon != null && hero.belongings.weapon.canReach(this, enemy.pos));
}
@Override

View File

@ -95,6 +95,18 @@ public class ItemStatusHandler<T extends Item> {
}
}
public void saveClassesSelectively( Bundle bundle, ArrayList<Class<?extends Item>> clsToSave ){
List<Class<? extends T>> items = Arrays.asList(this.items);
for (Class<?extends Item> cls : clsToSave){
if (items.contains(cls)){
Class<? extends T> toSave = items.get(items.indexOf(cls));
String itemName = toSave.toString();
bundle.put( itemName + PFX_LABEL, itemLabels.get( toSave ) );
bundle.put( itemName + PFX_KNOWN, known.contains( toSave ) );
}
}
}
private void restore( Bundle bundle, ArrayList<String> labelsLeft ) {
ArrayList<Class<? extends T>> unlabelled = new ArrayList<>();

View File

@ -21,10 +21,14 @@
package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Random;
abstract public class KindOfWeapon extends EquipableItem {
@ -105,6 +109,20 @@ abstract public class KindOfWeapon extends EquipableItem {
return 1;
}
public boolean canReach( Char owner, int target){
if (Dungeon.level.distance( owner.pos, target ) > reachFactor(owner)){
return false;
} else {
boolean[] passable = BArray.not(Dungeon.level.solid, null);
for (Mob m : Dungeon.level.mobs)
passable[m.pos] = false;
PathFinder.buildDistanceMap(target, passable, reachFactor(owner));
return PathFinder.distance[owner.pos] <= reachFactor(owner);
}
}
public int defenseFactor( Char owner ) {
return 0;
}

View File

@ -113,7 +113,8 @@ public class AlchemistsToolkit extends Artifact {
partialCharge -= 1;
charge++;
if (charge == chargeCap){
if (charge >= chargeCap){
charge = chargeCap;
partialCharge = 0;
break;
}

View File

@ -41,7 +41,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfPsionicBlast;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
@ -505,11 +504,7 @@ public class DriedRose extends Artifact {
@Override
protected boolean canAttack(Char enemy) {
if (rose != null && rose.weapon != null) {
return Dungeon.level.distance(pos, enemy.pos) <= rose.weapon.reachFactor(this);
} else {
return super.canAttack(enemy);
}
return super.canAttack(enemy) || (rose != null && rose.weapon != null && rose.weapon.canReach(this, enemy.pos));
}
@Override
@ -546,7 +541,7 @@ public class DriedRose extends Artifact {
public void damage(int dmg, Object src) {
//TODO improve this when I have proper damage source logic
if (rose != null && rose.armor != null && rose.armor.hasGlyph(AntiMagic.class, this)
&& RingOfElements.RESISTS.contains(src.getClass())){
&& AntiMagic.RESISTS.contains(src.getClass())){
dmg -= Random.NormalIntRange(rose.armor.DRMin(), rose.armor.DRMax())/3;
}

View File

@ -168,7 +168,19 @@ public class Potion extends Item {
}
public static void saveSelectively( Bundle bundle, ArrayList<Item> items ) {
handler.saveSelectively( bundle, items );
ArrayList<Class<?extends Item>> classes = new ArrayList<>();
for (Item i : items){
if (i instanceof ExoticPotion){
if (!classes.contains(ExoticPotion.exoToReg.get(i.getClass()))){
classes.add(ExoticPotion.exoToReg.get(i.getClass()));
}
} else if (i instanceof Potion){
if (!classes.contains(i.getClass())){
classes.add(i.getClass());
}
}
}
handler.saveClassesSelectively( bundle, classes );
}
@SuppressWarnings("unchecked")

View File

@ -21,12 +21,16 @@
package com.shatteredpixel.shatteredpixeldungeon.items.potions.elixirs;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Healing;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfCleansing;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
public class ElixirOfRestoration extends Elixir {
@ -40,6 +44,22 @@ public class ElixirOfRestoration extends Elixir {
PotionOfCleansing.cleanse(hero);
}
@Override
public void shatter(int cell) {
if (Actor.findChar(cell) == null){
super.shatter(cell);
} else {
if (Dungeon.level.heroFOV[cell]) {
Sample.INSTANCE.play(Assets.SND_SHATTER);
splash(cell);
}
if (Actor.findChar(cell) != null){
PotionOfCleansing.cleanse(Actor.findChar(cell));
}
}
}
@Override
public int price() {
//prices of ingredients

View File

@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
import com.shatteredpixel.shatteredpixeldungeon.items.Recipe;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ScrollOfAntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAffection;
@ -114,7 +115,19 @@ public abstract class Scroll extends Item {
}
public static void saveSelectively( Bundle bundle, ArrayList<Item> items ) {
handler.saveSelectively( bundle, items );
ArrayList<Class<?extends Item>> classes = new ArrayList<>();
for (Item i : items){
if (i instanceof ExoticScroll){
if (!classes.contains(ExoticScroll.exoToReg.get(i.getClass()))){
classes.add(ExoticScroll.exoToReg.get(i.getClass()));
}
} else if (i instanceof Scroll){
if (!classes.contains(i.getClass())){
classes.add(i.getClass());
}
}
}
handler.saveClassesSelectively( bundle, classes );
}
@SuppressWarnings("unchecked")

View File

@ -45,7 +45,7 @@ public class Bolas extends MissileWeapon {
@Override
public int STRReq(int lvl) {
return 15;
return 13;
}
@Override

View File

@ -284,7 +284,8 @@ public class ShopRoom extends SpecialRoom {
default:
rare = new Stylus();
}
rare.cursed = rare.cursedKnown = false;
rare.cursed = false;
rare.cursedKnown = true;
itemsToSpawn.add( rare );
//hard limit is 63 items + 1 shopkeeper, as shops can't be bigger than 8x8=64 internally

View File

@ -325,7 +325,7 @@ public class DungeonTileSheet {
public static final int DOOR_SIDEWAYS_LOCKED = WALL_OVERHANG+24;
public static final int STATUE_OVERHANG = WALL_OVERHANG+26;
public static final int ALCHEMY_POT_OVERHAND = WALL_OVERHANG+27;
public static final int ALCHEMY_POT_OVERHANG = WALL_OVERHANG+27;
public static final int BARRICADE_OVERHANG = WALL_OVERHANG+28;
public static final int HIGH_GRASS_OVERHANG = WALL_OVERHANG+29;

View File

@ -76,7 +76,7 @@ public class DungeonWallsTilemap extends DungeonTilemap {
} else if (pos + mapWidth < size && (map[pos+mapWidth] == Terrain.STATUE || map[pos+mapWidth] == Terrain.STATUE_SP)){
return DungeonTileSheet.STATUE_OVERHANG;
} else if (pos + mapWidth < size && map[pos+mapWidth] == Terrain.ALCHEMY){
return DungeonTileSheet.ALCHEMY_POT_OVERHAND;
return DungeonTileSheet.ALCHEMY_POT_OVERHANG;
} else if (pos + mapWidth < size && map[pos+mapWidth] == Terrain.BARRICADE){
return DungeonTileSheet.BARRICADE_OVERHANG;
} else if (pos + mapWidth < size && map[pos+mapWidth] == Terrain.HIGH_GRASS){