v1.1.0: potions of cleansing now have an effect that lasts for 5 turns

This commit is contained in:
Evan Debenham 2021-10-23 17:31:07 -04:00
parent 7839cdce66
commit 2ac630af7f
4 changed files with 51 additions and 3 deletions

View File

@ -720,7 +720,9 @@ items.potions.exotic.potionofadrenalinesurge.name=potion of adrenaline surge
items.potions.exotic.potionofadrenalinesurge.desc=This powerful liquid will give you a greater boost of strength that withers after an extended period of time. items.potions.exotic.potionofadrenalinesurge.desc=This powerful liquid will give you a greater boost of strength that withers after an extended period of time.
items.potions.exotic.potionofcleansing.name=potion of cleansing items.potions.exotic.potionofcleansing.name=potion of cleansing
items.potions.exotic.potionofcleansing.desc=This powerful reagent will completely neutralize all harmful effects on the drinker when quaffed. It can be thrown at a target to cleanse them as well. items.potions.exotic.potionofcleansing.desc=This powerful reagent will render the drinker immune to all harmful effects for a few turns when quaffed. It can be thrown at a target to cleanse them as well.
items.potions.exotic.potionofcleansing$cleanse.name=Cleansed
items.potions.exotic.potionofcleansing$cleanse.desc=A potion of cleansing is granting this character temporary immunity from all harmful effects!\n\nTurns remaining: %s.
items.potions.exotic.potionofcorrosivegas.name=potion of corrosive gas items.potions.exotic.potionofcorrosivegas.name=potion of corrosive gas
items.potions.exotic.potionofcorrosivegas.desc=Uncorking or shattering this pressurized glass will cause its contents to explode into a deadly cloud of corrosive rust-colored gas. The gas spreads more quickly than toxic gas and is more deadly, but also won't last as long. items.potions.exotic.potionofcorrosivegas.desc=Uncorking or shattering this pressurized glass will cause its contents to explode into a deadly cloud of corrosive rust-colored gas. The gas spreads more quickly than toxic gas and is more deadly, but also won't last as long.

View File

@ -50,6 +50,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Haste;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hex; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hex;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LifeLink; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LifeLink;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
@ -74,6 +75,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Elemental;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Potential; import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Potential;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfCleansing;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
@ -730,7 +732,15 @@ public abstract class Char extends Actor {
} }
public synchronized void add( Buff buff ) { public synchronized void add( Buff buff ) {
if (buff(PotionOfCleansing.Cleanse.class) != null) { //cleansing buff
if (buff.type == Buff.buffType.NEGATIVE
&& !(buff instanceof AllyBuff)
&& !(buff instanceof LostInventory)){
return;
}
}
buffs.add( buff ); buffs.add( buff );
if (Actor.chars().contains(this)) Actor.add( buff ); if (Actor.chars().contains(this)) Actor.add( buff );

View File

@ -1571,7 +1571,7 @@ public class Hero extends Char {
super.add( buff ); super.add( buff );
if (sprite != null) { if (sprite != null && buffs().contains(buff)) {
String msg = buff.heroMessage(); String msg = buff.heroMessage();
if (msg != null){ if (msg != null){
GLog.w(msg); GLog.w(msg);

View File

@ -27,10 +27,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AllyBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LostInventory;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
public class PotionOfCleansing extends ExoticPotion { public class PotionOfCleansing extends ExoticPotion {
@ -74,5 +78,37 @@ public class PotionOfCleansing extends ExoticPotion {
((Hunger) b).satisfy(Hunger.STARVING); ((Hunger) b).satisfy(Hunger.STARVING);
} }
} }
Buff.affect(ch, Cleanse.class, Cleanse.DURATION);
}
public static class Cleanse extends FlavourBuff {
public static final float DURATION = 5f;
@Override
public int icon() {
return BuffIndicator.IMMUNITY;
}
@Override
public void tintIcon(Image icon) {
icon.hardlight(1f, 0f, 2f);
}
@Override
public float iconFadePercent() {
return Math.max(0, (DURATION - visualcooldown()) / DURATION);
}
@Override
public String toString() {
return Messages.get(this, "name");
}
@Override
public String desc() {
return Messages.get(this, "desc", dispTurns(visualcooldown()));
}
} }
} }