v0.3.0: BIG refactor to buff display, more clear and extendable code, instead of a nest of instanceof statements
This commit is contained in:
parent
9fad20a071
commit
6a7c42634a
|
@ -349,72 +349,18 @@ public abstract class Char extends Actor {
|
|||
buffs.add( buff );
|
||||
Actor.add( buff );
|
||||
|
||||
if (sprite != null) {
|
||||
if (buff instanceof Poison) {
|
||||
|
||||
CellEmitter.center( pos ).burst( PoisonParticle.SPLASH, 5 );
|
||||
sprite.showStatus( CharSprite.NEGATIVE, "poisoned" );
|
||||
|
||||
} else if (buff instanceof Amok) {
|
||||
|
||||
sprite.showStatus( CharSprite.NEGATIVE, "amok" );
|
||||
|
||||
} else if (buff instanceof Slow) {
|
||||
|
||||
sprite.showStatus( CharSprite.NEGATIVE, "slowed" );
|
||||
|
||||
} else if (buff instanceof Chill) {
|
||||
|
||||
sprite.showStatus( CharSprite.NEGATIVE, "chilled" );
|
||||
sprite.add( CharSprite.State.CHILLED );
|
||||
|
||||
} else if (buff instanceof MindVision) {
|
||||
|
||||
sprite.showStatus( CharSprite.POSITIVE, "mind" );
|
||||
sprite.showStatus( CharSprite.POSITIVE, "vision" );
|
||||
|
||||
} else if (buff instanceof Paralysis) {
|
||||
|
||||
sprite.add( CharSprite.State.PARALYSED );
|
||||
sprite.showStatus( CharSprite.NEGATIVE, "paralysed" );
|
||||
|
||||
} else if (buff instanceof Terror) {
|
||||
|
||||
sprite.showStatus( CharSprite.NEGATIVE, "frightened" );
|
||||
|
||||
} else if (buff instanceof Roots) {
|
||||
|
||||
sprite.showStatus( CharSprite.NEGATIVE, "rooted" );
|
||||
|
||||
} else if (buff instanceof Cripple) {
|
||||
|
||||
sprite.showStatus( CharSprite.NEGATIVE, "crippled" );
|
||||
|
||||
} else if (buff instanceof Bleeding) {
|
||||
|
||||
sprite.showStatus( CharSprite.NEGATIVE, "bleeding" );
|
||||
|
||||
} else if (buff instanceof Vertigo) {
|
||||
|
||||
sprite.showStatus( CharSprite.NEGATIVE, "dizzy" );
|
||||
|
||||
} else if (buff instanceof Sleep) {
|
||||
sprite.idle();
|
||||
if (sprite != null)
|
||||
switch(buff.type){
|
||||
case POSITIVE:
|
||||
sprite.showStatus(CharSprite.POSITIVE, buff.toString()); break;
|
||||
case NEGATIVE:
|
||||
sprite.showStatus(CharSprite.NEGATIVE, buff.toString());break;
|
||||
case NEUTRAL:
|
||||
sprite.showStatus(CharSprite.NEUTRAL, buff.toString()); break;
|
||||
case SILENT: default:
|
||||
break; //show nothing
|
||||
}
|
||||
|
||||
else if (buff instanceof Burning) {
|
||||
sprite.add( CharSprite.State.BURNING );
|
||||
} else if (buff instanceof Levitation) {
|
||||
sprite.add( CharSprite.State.LEVITATING );
|
||||
} else if (buff instanceof Frost) {
|
||||
sprite.add( CharSprite.State.FROZEN );
|
||||
} else if (buff instanceof Invisibility || buff instanceof CloakOfShadows.cloakStealth) {
|
||||
if (!(buff instanceof Shadows)) {
|
||||
sprite.showStatus( CharSprite.POSITIVE, "invisible" );
|
||||
}
|
||||
sprite.add( CharSprite.State.INVISIBLE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void remove( Buff buff ) {
|
||||
|
@ -422,19 +368,6 @@ public abstract class Char extends Actor {
|
|||
buffs.remove( buff );
|
||||
Actor.remove( buff );
|
||||
|
||||
if (buff instanceof Burning) {
|
||||
sprite.remove( CharSprite.State.BURNING );
|
||||
} else if (buff instanceof Levitation) {
|
||||
sprite.remove( CharSprite.State.LEVITATING );
|
||||
} else if ((buff instanceof Invisibility || buff instanceof CloakOfShadows.cloakStealth) && invisible <= 0) {
|
||||
sprite.remove( CharSprite.State.INVISIBLE );
|
||||
} else if (buff instanceof Paralysis) {
|
||||
sprite.remove( CharSprite.State.PARALYSED );
|
||||
} else if (buff instanceof Frost) {
|
||||
sprite.remove( CharSprite.State.FROZEN );
|
||||
} else if (buff instanceof Chill) {
|
||||
sprite.remove( CharSprite.State.CHILLED );
|
||||
}
|
||||
}
|
||||
|
||||
public void remove( Class<? extends Buff> buffClass ) {
|
||||
|
@ -452,21 +385,7 @@ public abstract class Char extends Actor {
|
|||
|
||||
public void updateSpriteState() {
|
||||
for (Buff buff:buffs) {
|
||||
if (buff instanceof Burning) {
|
||||
sprite.add( CharSprite.State.BURNING );
|
||||
} else if (buff instanceof Levitation) {
|
||||
sprite.add( CharSprite.State.LEVITATING );
|
||||
} else if (buff instanceof Invisibility || buff instanceof CloakOfShadows.cloakStealth) {
|
||||
sprite.add( CharSprite.State.INVISIBLE );
|
||||
} else if (buff instanceof Paralysis) {
|
||||
sprite.add( CharSprite.State.PARALYSED );
|
||||
} else if (buff instanceof Frost) {
|
||||
sprite.add( CharSprite.State.FROZEN );
|
||||
} else if (buff instanceof Light) {
|
||||
sprite.add( CharSprite.State.ILLUMINATED );
|
||||
} else if (buff instanceof Chill) {
|
||||
sprite.add( CharSprite.State.CHILLED );
|
||||
}
|
||||
buff.fx( true );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
|||
|
||||
public class Amok extends FlavourBuff {
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.AMOK;
|
||||
|
|
|
@ -29,6 +29,10 @@ import com.watabou.utils.Random;
|
|||
|
||||
public class Bleeding extends Buff {
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
protected int level;
|
||||
|
||||
private static final String LEVEL = "level";
|
||||
|
|
|
@ -22,6 +22,10 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
|||
|
||||
public class Blindness extends FlavourBuff {
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach() {
|
||||
super.detach();
|
||||
|
|
|
@ -27,6 +27,11 @@ public class Buff extends Actor {
|
|||
|
||||
public Char target;
|
||||
|
||||
//determines how the buff is announced when it is shown.
|
||||
//buffs that work behind the scenes, or have other visual indicators can usually be silent.
|
||||
public enum buffType {POSITIVE, NEGATIVE, NEUTRAL, SILENT};
|
||||
public buffType type = buffType.SILENT;
|
||||
|
||||
public HashSet<Class<?>> resistances = new HashSet<Class<?>>();
|
||||
|
||||
public HashSet<Class<?>> immunities = new HashSet<Class<?>>();
|
||||
|
@ -40,10 +45,15 @@ public class Buff extends Actor {
|
|||
this.target = target;
|
||||
target.add( this );
|
||||
|
||||
return target.buffs().contains(this);
|
||||
if (target.buffs().contains(this)){
|
||||
if (target.sprite != null) fx( true );
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
fx( false );
|
||||
target.remove( this );
|
||||
}
|
||||
|
||||
|
@ -57,6 +67,14 @@ public class Buff extends Actor {
|
|||
return BuffIndicator.NONE;
|
||||
}
|
||||
|
||||
public void fx(boolean on) {
|
||||
//do nothing by default
|
||||
};
|
||||
|
||||
public String desc(){
|
||||
return "";
|
||||
}
|
||||
|
||||
public static<T extends Buff> T append( Char target, Class<T> buffClass ) {
|
||||
try {
|
||||
T buff = buffClass.newInstance();
|
||||
|
@ -103,8 +121,4 @@ public class Buff extends Actor {
|
|||
public static void detach( Char target, Class<? extends Buff> cl ) {
|
||||
detach( target.buff( cl ) );
|
||||
}
|
||||
|
||||
public String desc(){
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resis
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
@ -50,6 +51,10 @@ public class Burning extends Buff implements Hero.Doom {
|
|||
|
||||
private static final String LEFT = "left";
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
|
@ -134,6 +139,12 @@ public class Burning extends Buff implements Hero.Doom {
|
|||
return BuffIndicator.FIRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.add(CharSprite.State.BURNING);
|
||||
else target.sprite.remove(CharSprite.State.BURNING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Burning";
|
||||
|
|
|
@ -28,6 +28,10 @@ public class Charm extends FlavourBuff {
|
|||
|
||||
private static final String OBJECT = "object";
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.food.FrozenCarpaccio;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.utils.Random;
|
||||
|
@ -19,6 +20,10 @@ public class Chill extends FlavourBuff {
|
|||
|
||||
private static final String TXT_FREEZES = "%s freezes!";
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachTo(Char target) {
|
||||
//can't chill what's frozen!
|
||||
|
@ -70,6 +75,12 @@ public class Chill extends FlavourBuff {
|
|||
return BuffIndicator.FROST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.add(CharSprite.State.CHILLED);
|
||||
else target.sprite.remove(CharSprite.State.CHILLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Chilled";
|
||||
|
|
|
@ -23,6 +23,10 @@ public class Cripple extends FlavourBuff {
|
|||
|
||||
public static final float DURATION = 10f;
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.CRIPPLE;
|
||||
|
|
|
@ -23,6 +23,10 @@ import com.watabou.utils.Random;
|
|||
|
||||
public class Drowsy extends Buff {
|
||||
|
||||
{
|
||||
type = buffType.NEUTRAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.DROWSY;
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.food.MysteryMeat;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
||||
|
@ -36,6 +37,10 @@ public class Frost extends FlavourBuff {
|
|||
|
||||
private static final float DURATION = 5f;
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
|
@ -92,6 +97,12 @@ public class Frost extends FlavourBuff {
|
|||
return BuffIndicator.FROST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.add(CharSprite.State.FROZEN);
|
||||
else target.sprite.remove(CharSprite.State.FROZEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Frozen";
|
||||
|
|
|
@ -23,6 +23,10 @@ public class Fury extends Buff {
|
|||
|
||||
public static float LEVEL = 0.4f;
|
||||
|
||||
{
|
||||
type = buffType.POSITIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.HP > target.HT * LEVEL) {
|
||||
|
@ -41,6 +45,6 @@ public class Fury extends Buff {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Fury";
|
||||
return "Furious";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,17 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Invisibility extends FlavourBuff {
|
||||
|
||||
public static final float DURATION = 15f;
|
||||
|
||||
{
|
||||
type = buffType.POSITIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
|
@ -49,6 +54,12 @@ public class Invisibility extends FlavourBuff {
|
|||
return BuffIndicator.INVISIBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.add( CharSprite.State.INVISIBLE );
|
||||
else if (target.invisible == 0) target.sprite.remove( CharSprite.State.INVISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Invisible";
|
||||
|
|
|
@ -19,6 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
|||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Levitation extends FlavourBuff {
|
||||
|
@ -48,6 +49,12 @@ public class Levitation extends FlavourBuff {
|
|||
return BuffIndicator.LEVITATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.add(CharSprite.State.LEVITATING);
|
||||
else target.sprite.remove(CharSprite.State.LEVITATING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Levitating";
|
||||
|
|
|
@ -19,6 +19,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
|||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Light extends FlavourBuff {
|
||||
|
@ -51,6 +52,12 @@ public class Light extends FlavourBuff {
|
|||
return BuffIndicator.LIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.add(CharSprite.State.ILLUMINATED);
|
||||
else target.sprite.remove(CharSprite.State.ILLUMINATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Illuminated";
|
||||
|
|
|
@ -28,6 +28,10 @@ public class MagicalSleep extends Buff {
|
|||
private static final float STEP = 1f;
|
||||
public static final float SWS = 1.5f;
|
||||
|
||||
{
|
||||
type = buffType.NEUTRAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target ) && !target.immunities().contains(Sleep.class)) {
|
||||
|
|
|
@ -26,6 +26,10 @@ public class MindVision extends FlavourBuff {
|
|||
|
||||
public int distance = 2;
|
||||
|
||||
{
|
||||
type = buffType.POSITIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.MIND_VISION;
|
||||
|
|
|
@ -29,6 +29,10 @@ public class Ooze extends Buff {
|
|||
|
||||
private static final String TXT_HERO_KILLED = "%s killed you...";
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.OOZE;
|
||||
|
|
|
@ -19,12 +19,17 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
|||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
|
||||
public class Paralysis extends FlavourBuff {
|
||||
|
||||
private static final float DURATION = 10f;
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (super.attachTo( target )) {
|
||||
|
@ -46,6 +51,12 @@ public class Paralysis extends FlavourBuff {
|
|||
return BuffIndicator.PARALYSIS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.add(CharSprite.State.PARALYSED);
|
||||
else target.sprite.remove(CharSprite.State.PARALYSED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Paralysed";
|
||||
|
|
|
@ -22,10 +22,11 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PoisonParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements.Resistance;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.utils.Bundle;
|
||||
|
||||
public class Poison extends Buff implements Hero.Doom {
|
||||
|
@ -34,6 +35,10 @@ public class Poison extends Buff implements Hero.Doom {
|
|||
|
||||
private static final String LEFT = "left";
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
|
@ -61,6 +66,15 @@ public class Poison extends Buff implements Hero.Doom {
|
|||
return "Poisoned";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachTo(Char target) {
|
||||
if (super.attachTo(target)){
|
||||
CellEmitter.center(target.pos).burst( PoisonParticle.SPLASH, 5 );
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean act() {
|
||||
if (target.isAlive()) {
|
||||
|
|
|
@ -22,6 +22,10 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
|||
|
||||
public class Roots extends FlavourBuff {
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachTo( Char target ) {
|
||||
if (!target.flying && super.attachTo( target )) {
|
||||
|
|
|
@ -19,6 +19,11 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
|
|||
|
||||
public class Sleep extends FlavourBuff {
|
||||
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.idle();
|
||||
}
|
||||
|
||||
public static final float SWS = 1.5f;
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,10 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
|||
|
||||
public class Slow extends FlavourBuff {
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
private static final float DURATION = 10f;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,6 +29,10 @@ public class Terror extends FlavourBuff {
|
|||
|
||||
private static final String OBJECT = "object";
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle(bundle);
|
||||
|
@ -48,7 +52,7 @@ public class Terror extends FlavourBuff {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Terror";
|
||||
return "Terrified";
|
||||
}
|
||||
|
||||
public static void recover( Char target ) {
|
||||
|
|
|
@ -14,6 +14,10 @@ public class Venom extends Poison implements Hero.Doom {
|
|||
|
||||
private static final String DAMAGE = "damage";
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeInBundle( Bundle bundle ) {
|
||||
super.storeInBundle( bundle );
|
||||
|
|
|
@ -24,6 +24,10 @@ public class Vertigo extends FlavourBuff {
|
|||
|
||||
public static final float DURATION = 10f;
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.VERTIGO;
|
||||
|
|
|
@ -26,6 +26,10 @@ public class Weakness extends FlavourBuff {
|
|||
|
||||
private static final float DURATION = 40f;
|
||||
|
||||
{
|
||||
type = buffType.NEGATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.WEAKNESS;
|
||||
|
|
|
@ -1179,7 +1179,6 @@ public class Hero extends Char {
|
|||
GLog.w( "You are blinded!" );
|
||||
} else if (buff instanceof Fury) {
|
||||
GLog.w( "You become furious!" );
|
||||
sprite.showStatus( CharSprite.POSITIVE, "furious" );
|
||||
} else if (buff instanceof Charm) {
|
||||
GLog.w( "You are charmed!" );
|
||||
} else if (buff instanceof Cripple) {
|
||||
|
@ -1195,9 +1194,6 @@ public class Hero extends Char {
|
|||
interrupt();
|
||||
}
|
||||
|
||||
else if (buff instanceof Light) {
|
||||
sprite.add( CharSprite.State.ILLUMINATED );
|
||||
}
|
||||
}
|
||||
|
||||
BuffIndicator.refreshHero();
|
||||
|
@ -1207,9 +1203,7 @@ public class Hero extends Char {
|
|||
public void remove( Buff buff ) {
|
||||
super.remove( buff );
|
||||
|
||||
if (buff instanceof Light) {
|
||||
sprite.remove( CharSprite.State.ILLUMINATED );
|
||||
} else if (buff instanceof RingOfMight.Might){
|
||||
if (buff instanceof RingOfMight.Might){
|
||||
if (((RingOfMight.Might)buff).level > 0){
|
||||
HT -= ((RingOfMight.Might) buff).level * 5;
|
||||
HP = Math.min(HT, HP);
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
|
@ -229,6 +230,12 @@ public class CloakOfShadows extends Artifact {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fx(boolean on) {
|
||||
if (on) target.sprite.add( CharSprite.State.INVISIBLE );
|
||||
else if (target.invisible == 0) target.sprite.remove( CharSprite.State.INVISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Cloaked";
|
||||
|
@ -241,7 +248,6 @@ public class CloakOfShadows extends Artifact {
|
|||
stealthed = false;
|
||||
cooldown = 10 - (level / 3);
|
||||
|
||||
|
||||
updateQuickslot();
|
||||
super.detach();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user