v0.4.1: reworked ring of evasion again.. again
This commit is contained in:
committed by
Evan Debenham
parent
11f79b5e2c
commit
cc1c156428
@@ -20,10 +20,6 @@
|
||||
*/
|
||||
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 {
|
||||
|
||||
@Override
|
||||
@@ -31,43 +27,6 @@ public class RingOfEvasion extends Ring {
|
||||
return new Evasion();
|
||||
}
|
||||
|
||||
//yup, the only ring in the game with logic inside of its class
|
||||
public class Evasion extends RingBuff {
|
||||
public int effectiveLevel;
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
|
||||
effectiveLevel = Math.min(0, RingOfEvasion.this.level());
|
||||
return super.attachTo(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
|
||||
boolean seen = false;
|
||||
|
||||
for (Mob enemy : Dungeon.level.mobs.toArray(new Mob[0])){
|
||||
if (enemy.focusingHero()) {
|
||||
seen = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (RingOfEvasion.this.level() < 1){
|
||||
effectiveLevel = RingOfEvasion.this.level();
|
||||
} else if (seen) {
|
||||
effectiveLevel = Math.max(effectiveLevel - 1, 0);
|
||||
} else {
|
||||
effectiveLevel = Math.min(effectiveLevel + 1, RingOfEvasion.this.level());
|
||||
}
|
||||
|
||||
return super.act();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int level() {
|
||||
return effectiveLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user