v0.7.0c: bugfixes:

- fixed reach weapons not working for non-heroes
- fixed stealth using integers rather than floats
- fixed magical sleep decrementing paralysis without incrementing it
This commit is contained in:
Evan Debenham 2018-11-10 21:17:59 -05:00
parent 7ae41e180a
commit 7424c5d5eb
6 changed files with 20 additions and 19 deletions

View File

@ -491,7 +491,7 @@ public abstract class Char extends Actor {
} }
} }
public int stealth() { public float stealth() {
return 0; return 0;
} }

View File

@ -35,19 +35,19 @@ public class MagicalSleep extends Buff {
@Override @Override
public boolean attachTo( Char target ) { public boolean attachTo( Char target ) {
if (!target.isImmune(Sleep.class) && super.attachTo( target )) { if (!target.isImmune(Sleep.class) && super.attachTo( target )) {
if (target instanceof Hero) target.paralysed++;
if (target instanceof Hero) {
if (target.HP == target.HT) { if (target.HP == target.HT) {
GLog.i(Messages.get(this, "toohealthy")); GLog.i(Messages.get(this, "toohealthy"));
detach(); detach();
return true;
} else { } else {
GLog.i(Messages.get(this, "fallasleep")); GLog.i(Messages.get(this, "fallasleep"));
} }
else if (target instanceof Mob) } else if (target instanceof Mob) {
((Mob)target).state = ((Mob)target).SLEEPING; ((Mob) target).state = ((Mob) target).SLEEPING;
}
target.paralysed++;
return true; return true;
} else { } else {

View File

@ -1292,11 +1292,11 @@ public class Hero extends Char {
} }
@Override @Override
public int stealth() { public float stealth() {
int stealth = super.stealth(); float stealth = super.stealth();
if (belongings.armor != null){ if (belongings.armor != null){
stealth = Math.round(belongings.armor.stealthFactor(this, stealth)); stealth = belongings.armor.stealthFactor(this, stealth);
} }
return stealth; return stealth;

View File

@ -691,7 +691,7 @@ public abstract class Mob extends Char {
@Override @Override
public boolean act( boolean enemyInFOV, boolean justAlerted ) { public boolean act( boolean enemyInFOV, boolean justAlerted ) {
if (enemyInFOV && Random.Int( distance( enemy ) + enemy.stealth() + (enemy.flying ? 2 : 0) ) == 0) { if (enemyInFOV && Random.Float( distance( enemy ) + enemy.stealth() + (enemy.flying ? 2 : 0) ) < 1) {
enemySeen = true; enemySeen = true;
@ -726,7 +726,7 @@ public abstract class Mob extends Char {
@Override @Override
public boolean act( boolean enemyInFOV, boolean justAlerted ) { public boolean act( boolean enemyInFOV, boolean justAlerted ) {
if (enemyInFOV && (justAlerted || Random.Int( distance( enemy ) / 2 + enemy.stealth() ) == 0)) { if (enemyInFOV && (justAlerted || Random.Float( distance( enemy ) / 2f + enemy.stealth() ) < 1)) {
enemySeen = true; enemySeen = true;

View File

@ -22,9 +22,9 @@
package com.shatteredpixel.shatteredpixeldungeon.items; package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; import com.shatteredpixel.shatteredpixeldungeon.utils.BArray;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -114,8 +114,9 @@ abstract public class KindOfWeapon extends EquipableItem {
return false; return false;
} else { } else {
boolean[] passable = BArray.not(Dungeon.level.solid, null); boolean[] passable = BArray.not(Dungeon.level.solid, null);
for (Mob m : Dungeon.level.mobs) for (Char ch : Actor.chars()) {
passable[m.pos] = false; if (ch != owner) passable[ch.pos] = false;
}
PathFinder.buildDistanceMap(target, passable, reachFactor(owner)); PathFinder.buildDistanceMap(target, passable, reachFactor(owner));

View File

@ -571,11 +571,11 @@ public class DriedRose extends Artifact {
} }
@Override @Override
public int stealth() { public float stealth() {
int stealth = super.stealth(); float stealth = super.stealth();
if (rose != null && rose.armor != null){ if (rose != null && rose.armor != null){
stealth = Math.round(rose.armor.stealthFactor(this, stealth)); stealth = rose.armor.stealthFactor(this, stealth);
} }
return stealth; return stealth;