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

View File

@ -431,6 +431,11 @@ public abstract class Mob extends Char {
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 boolean act( boolean enemyInFOV, boolean justAlerted );
public String status();

View File

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