diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index fe7949119..caf25ebab 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -348,93 +348,26 @@ 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 ) { 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 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 ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java index 93255d11a..23c6c46b8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Amok.java @@ -21,6 +21,10 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; public class Amok extends FlavourBuff { + + { + type = buffType.NEGATIVE; + } @Override public int icon() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java index 39a28fa33..d35353569 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Bleeding.java @@ -28,6 +28,10 @@ import com.watabou.utils.PointF; import com.watabou.utils.Random; public class Bleeding extends Buff { + + { + type = buffType.NEGATIVE; + } protected int level; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Blindness.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Blindness.java index 6ea6c2909..5e12430c5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Blindness.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Blindness.java @@ -21,6 +21,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; public class Blindness extends FlavourBuff { + + { + type = buffType.NEGATIVE; + } @Override public void detach() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java index 7aefbab41..b5ae93bd9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java @@ -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> resistances = new HashSet>(); public HashSet> immunities = new HashSet>(); @@ -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 append( Char target, Class buffClass ) { try { T buff = buffClass.newInstance(); @@ -103,8 +121,4 @@ public class Buff extends Actor { public static void detach( Char target, Class cl ) { detach( target.buff( cl ) ); } - - public String desc(){ - return ""; - } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java index 5dac722c9..a627b1a34 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Burning.java @@ -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; @@ -49,6 +50,10 @@ public class Burning extends Buff implements Hero.Doom { private float left; private static final String LEFT = "left"; + + { + type = buffType.NEGATIVE; + } @Override public void storeInBundle( Bundle bundle ) { @@ -133,7 +138,13 @@ public class Burning extends Buff implements Hero.Doom { public int icon() { 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"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Charm.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Charm.java index 155a1485a..e75934fc5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Charm.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Charm.java @@ -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 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Chill.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Chill.java index 0a3a983c3..c56526bfb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Chill.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Chill.java @@ -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"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Cripple.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Cripple.java index de0093383..419bba762 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Cripple.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Cripple.java @@ -22,6 +22,10 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; public class Cripple extends FlavourBuff { public static final float DURATION = 10f; + + { + type = buffType.NEGATIVE; + } @Override public int icon() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java index 23c02e588..218753889 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Drowsy.java @@ -23,6 +23,10 @@ import com.watabou.utils.Random; public class Drowsy extends Buff { + { + type = buffType.NEUTRAL; + } + @Override public int icon() { return BuffIndicator.DROWSY; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java index dfce26838..37b6ac3cd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Frost.java @@ -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; @@ -35,6 +36,10 @@ public class Frost extends FlavourBuff { private static final String TXT_FREEZES = "%s freezes!"; private static final float DURATION = 5f; + + { + type = buffType.NEGATIVE; + } @Override public boolean attachTo( Char target ) { @@ -91,7 +96,13 @@ public class Frost extends FlavourBuff { public int icon() { 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"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Fury.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Fury.java index c7427ef0f..622b86207 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Fury.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Fury.java @@ -22,6 +22,10 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; public class Fury extends Buff { public static float LEVEL = 0.4f; + + { + type = buffType.POSITIVE; + } @Override public boolean act() { @@ -41,6 +45,6 @@ public class Fury extends Buff { @Override public String toString() { - return "Fury"; + return "Furious"; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java index 13c5c9cb4..71c823420 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Invisibility.java @@ -21,11 +21,16 @@ 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 ) { @@ -48,7 +53,13 @@ public class Invisibility extends FlavourBuff { public int icon() { 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"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java index 569b28d67..c94806f08 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Levitation.java @@ -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 { @@ -47,7 +48,13 @@ public class Levitation extends FlavourBuff { public int icon() { 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"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Light.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Light.java index 2ef552320..cfeac9938 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Light.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Light.java @@ -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 { @@ -50,7 +51,13 @@ public class Light extends FlavourBuff { public int icon() { 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"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSleep.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSleep.java index fdf76d624..8068c002b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSleep.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MagicalSleep.java @@ -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)) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MindVision.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MindVision.java index 6e3ae42b2..0a2342ac8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MindVision.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MindVision.java @@ -25,6 +25,10 @@ public class MindVision extends FlavourBuff { public static final float DURATION = 20f; public int distance = 2; + + { + type = buffType.POSITIVE; + } @Override public int icon() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java index b8811f885..fdef21572 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Ooze.java @@ -28,6 +28,10 @@ import com.watabou.utils.Random; public class Ooze extends Buff { private static final String TXT_HERO_KILLED = "%s killed you..."; + + { + type = buffType.NEGATIVE; + } @Override public int icon() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Paralysis.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Paralysis.java index b32cecef9..3bcda0c13 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Paralysis.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Paralysis.java @@ -19,11 +19,16 @@ 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 ) { @@ -45,7 +50,13 @@ public class Paralysis extends FlavourBuff { public int icon() { 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"; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Poison.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Poison.java index dbc9caaee..f095ebc84 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Poison.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Poison.java @@ -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 { @@ -33,6 +34,10 @@ public class Poison extends Buff implements Hero.Doom { protected float left; private static final String LEFT = "left"; + + { + type = buffType.NEGATIVE; + } @Override public void storeInBundle( Bundle bundle ) { @@ -60,7 +65,16 @@ public class Poison extends Buff implements Hero.Doom { public String toString() { 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()) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Roots.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Roots.java index 8b68dc67a..a79e3f536 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Roots.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Roots.java @@ -21,6 +21,10 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; public class Roots extends FlavourBuff { + + { + type = buffType.NEGATIVE; + } @Override public boolean attachTo( Char target ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Sleep.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Sleep.java index 7b57177e1..364542b47 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Sleep.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Sleep.java @@ -18,7 +18,12 @@ 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; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Slow.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Slow.java index ba86a1534..5658228d3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Slow.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Slow.java @@ -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 diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Terror.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Terror.java index 6e9e4e27c..1e8f797f8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Terror.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Terror.java @@ -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 ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Venom.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Venom.java index b49a25865..16997a536 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Venom.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Venom.java @@ -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 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Vertigo.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Vertigo.java index 3eb279b83..1d13f2208 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Vertigo.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Vertigo.java @@ -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; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Weakness.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Weakness.java index 3514f0ff0..72f71d579 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Weakness.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Weakness.java @@ -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; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 1646cd1ba..259e8e3e3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -1158,7 +1158,7 @@ public class Hero extends Char { return; super.add( buff ); - + if (sprite != null) { if (buff instanceof Burning) { GLog.w( "You catch fire!" ); @@ -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) { @@ -1194,10 +1193,7 @@ public class Hero extends Char { GLog.w("Everything is spinning around you!"); 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); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java index 8febee47f..63f280b45 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java @@ -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(); }