v0.2.3: reworked ring of evasion, again

This commit is contained in:
Evan Debenham 2014-12-03 16:49:27 -05:00
parent a3cb4a2542
commit 23bfbfd3e7
3 changed files with 31 additions and 19 deletions

View File

@ -282,7 +282,7 @@ public class Hero extends Char {
bonus += ((RingOfEvasion.Evasion)buff).effectiveLevel; bonus += ((RingOfEvasion.Evasion)buff).effectiveLevel;
} }
float evasion = bonus == 0 ? 1 : (float)Math.pow( 1.15, bonus ); float evasion = (float)Math.pow( 1.15, bonus );
if (paralysed) { if (paralysed) {
evasion /= 2; evasion /= 2;
} }
@ -1183,8 +1183,11 @@ public class Hero extends Char {
@Override @Override
public int stealth() { public int stealth() {
//no logic here since removal of Ring of Shadows, may do something here in future. int stealth = super.stealth();
return super.stealth(); for (Buff buff : buffs( RingOfEvasion.Evasion.class )) {
stealth += ((RingOfEvasion.Evasion)buff).effectiveLevel;
}
return stealth;
} }
@Override @Override

View File

@ -431,6 +431,11 @@ public abstract class Mob extends Char {
GLog.n( "%s: \"%s\" ", name, str ); GLog.n( "%s: \"%s\" ", name, str );
} }
//returns true when a mob sees the hero, and is currently targeting them.
public boolean focusingHero() {
return enemySeen && (target == Dungeon.hero.pos);
}
public interface AiState { public interface AiState {
public boolean act( boolean enemyInFOV, boolean justAlerted ); public boolean act( boolean enemyInFOV, boolean justAlerted );
public String status(); public String status();

View File

@ -17,7 +17,9 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.items.rings; package com.shatteredpixel.shatteredpixeldungeon.items.rings;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
public class RingOfEvasion extends Ring { public class RingOfEvasion extends Ring {
@ -33,9 +35,10 @@ public class RingOfEvasion extends Ring {
@Override @Override
public String desc() { public String desc() {
return isKnown() ? return isKnown() ?
"This ring increases the wearer's ability to focus and anticipate the movements of an enemy. " + "This ring obfuscates the true position of the wearer, making them harder to detect and attack." +
"The longer the wearer stands still, the more focused they will become. " + "This ring is much stronger while the user remains undetected, and if the user is targeted the power of " +
"A degraded ring will instead make dodging harder." : "evasion will slowly fade away, remaining undetected will restore the ring's effectiveness." +
"A degraded ring will instead make the user easier to detect and strike.":
super.desc(); super.desc();
} }
@ -55,22 +58,23 @@ public class RingOfEvasion extends Ring {
@Override @Override
public boolean act() { public boolean act() {
if (level >= 0) { boolean seen = false;
if (pos == target.pos && effectiveLevel < level) {
effectiveLevel++; for (Mob enemy : Dungeon.level.mobs.toArray(new Mob[0])){
} else if (pos != target.pos) { if (enemy.focusingHero()) {
effectiveLevel = 0; seen = true;
pos = target.pos; break;
}
} else if (level < 0) {
if (pos == target.pos && effectiveLevel < 0) {
effectiveLevel++;
} else if (pos != target.pos) {
effectiveLevel = level;
pos = target.pos;
} }
} }
if (level < 1){
effectiveLevel = level;
} else if (seen) {
effectiveLevel = Math.max(effectiveLevel - 1, 0);
} else {
effectiveLevel = Math.min(effectiveLevel + 1, level);
}
return super.act(); return super.act();
} }
} }