v2.3.0: added icons to floating text for dmg, DOTs, healing, & currency

This commit is contained in:
Evan Debenham
2023-12-04 12:53:26 -05:00
parent 4f8f576794
commit 1c8b13fa62
27 changed files with 176 additions and 66 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

View File

@@ -1266,7 +1266,6 @@ actors.mobs.necromancer$necroskeleton.desc=This skeleton has been summoned by a
actors.mobs.mob.died=You hear something die in the distance.
actors.mobs.mob.rage=#$%^
actors.mobs.mob.exp=%+dEXP
actors.mobs.mob.rankings_desc=Slain by: %s
actors.mobs.monk.name=dwarf monk

View File

@@ -712,8 +712,7 @@ items.potions.potionofpurity.protected=A protective film envelops you!
items.potions.potionofpurity.desc=This magical reagent will quickly neutralize all harmful area-bound effects in a large area. Drinking it will give you temporary immunity to such effects.
items.potions.potionofstrength.name=potion of strength
items.potions.potionofstrength.msg_1=+1 str
items.potions.potionofstrength.msg_2=Newfound strength surges through your body.
items.potions.potionofstrength.msg=Newfound strength surges through your body, you now have %d strength!
items.potions.potionofstrength.desc=This powerful liquid will course through your muscles, permanently increasing your strength by one point.
items.potions.potionoftoxicgas.name=potion of toxic gas
@@ -755,8 +754,7 @@ items.potions.elixirs.elixiroficytouch.name=elixir of icy touch
items.potions.elixirs.elixiroficytouch.desc=When consumed, this elixir will allow the drinker to sap the heat from enemies they attack. This effect will make the drinker immune to the cold, and allow them to chill enemies with physical attacks.
items.potions.elixirs.elixirofmight.name=elixir of might
items.potions.elixirs.elixirofmight.msg_1=+1 str, +%d hp
items.potions.elixirs.elixirofmight.msg_2=Newfound strength surges through your body.
items.potions.elixirs.elixirofmight.msg=Newfound strength surges through your body, you now have %d strength!
items.potions.elixirs.elixirofmight.desc=This powerful liquid will course through your muscles, permanently increasing your strength by one point and temporarily increasing maximum health by %d points. The health boost scales with your maximum health, but will slowly wear off as you gain levels.
items.potions.elixirs.elixirofmight$htboost.name=max health boost
items.potions.elixirs.elixirofmight$htboost.desc=Your body feels unnaturally strong and healthy.\n\nYour maximum health is boosted for an extended period of time. As you gain levels, the boost will steadily fade.\n\nCurrent boost amount: %d.\nLevels remaining: %d.
@@ -1954,9 +1952,6 @@ items.brokenseal.choose_title=Choose a Glyph
items.brokenseal.choose_desc=Both this armor and the broken seal are carrying a glyph. Pick which glyph should be kept.\n\nNote that if you pick the glyph that is currently on the armor, the seal will not be able to transfer it later.
items.dewdrop.name=dewdrop
items.dewdrop.heal=+%dHP
items.dewdrop.shield=+%dSHLD
items.dewdrop.both=+%1$dHP, +%2$dSHLD
items.dewdrop.already_full=You already have full health.
items.dewdrop.desc=A crystal clear dewdrop.\n\nDue to the magic of this place, pure water has minor restorative properties.

View File

@@ -28,6 +28,7 @@ public class Assets {
public static final String FIREBALL = "effects/fireball.png";
public static final String SPECKS = "effects/specks.png";
public static final String SPELL_ICONS = "effects/spell_icons.png";
public static final String TEXT_ICONS = "effects/text_icons.png";
}
public static class Environment {

View File

@@ -79,6 +79,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Elemental;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Tengu;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.PrismaticImage;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
@@ -86,6 +87,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Potential;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.exotic.PotionOfCleansing;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.Pickaxe;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRetribution;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
@@ -785,10 +787,26 @@ public abstract class Char extends Actor {
}
if (sprite != null) {
sprite.showStatus(HP > HT / 2 ?
//defaults to normal damage icon if no other ones apply
int icon = FloatingText.PHYS_DMG;
if (AntiMagic.RESISTS.contains(src.getClass())) icon = FloatingText.MAGIC_DMG;
if (src instanceof Pickaxe) icon = FloatingText.PICK_DMG;
if (src instanceof Hunger) icon = FloatingText.HUNGER;
if (src instanceof Burning) icon = FloatingText.BURNING;
if (src instanceof Electricity) icon = FloatingText.SHOCKING;
if (src instanceof Bleeding) icon = FloatingText.BLEEDING;
if (src instanceof ToxicGas) icon = FloatingText.TOXIC;
if (src instanceof Corrosion) icon = FloatingText.CORROSION;
if (src instanceof Poison) icon = FloatingText.POISON;
if (src instanceof Ooze) icon = FloatingText.OOZE;
if (src instanceof Viscosity.DeferedDamage) icon = FloatingText.DEFERRED;
sprite.showStatusWithIcon(HP > HT / 2 ?
CharSprite.WARNING :
CharSprite.NEGATIVE,
Integer.toString(dmg + shielded));
Integer.toString(dmg + shielded),
icon);
}
if (HP < 0) HP = 0;

View File

@@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal.WarriorShield;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@@ -212,6 +213,7 @@ public class Berserk extends Buff implements ActionIndicator.Action {
WarriorShield shield = target.buff(WarriorShield.class);
int shieldAmount = Math.round(shield.maxShield() * shieldMultiplier);
shield.supercharge(shieldAmount);
target.sprite.showStatusWithIcon( CharSprite.POSITIVE, String.valueOf(shieldAmount), FloatingText.SHIELDING );
BuffIndicator.refreshHero();
}

View File

@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
@@ -53,7 +54,8 @@ public class Healing extends Buff {
((Hero) target).resting = false;
}
}
target.sprite.showStatusWithIcon(CharSprite.POSITIVE, String.valueOf(healingThisTick()), FloatingText.HEALING);
healingLeft -= healingThisTick();
if (healingLeft <= 0){

View File

@@ -47,6 +47,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
@@ -260,7 +261,7 @@ public class ElementalStrike extends ArmorAbility {
if (heal > 0){
hero.HP += heal;
hero.sprite.emitter().start( Speck.factory( Speck.HEALING ), 0.4f, 1 );
hero.sprite.showStatus( CharSprite.POSITIVE, Integer.toString( heal ) );
hero.sprite.showStatusWithIcon( CharSprite.POSITIVE, Integer.toString( heal ), FloatingText.HEALING );
}
}

View File

@@ -46,6 +46,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
@@ -344,7 +345,13 @@ public class ElementalBlast extends ArmorAbility {
mob.HP += healing;
mob.sprite.emitter().burst(Speck.factory(Speck.HEALING), 4);
mob.sprite.showStatus(CharSprite.POSITIVE, "+%dHP", healing + shielding);
if (healing > 0) {
mob.sprite.showStatusWithIcon(CharSprite.POSITIVE, String.valueOf(healing), FloatingText.HEALING);
}
if (shielding > 0){
mob.sprite.showStatusWithIcon(CharSprite.POSITIVE, String.valueOf(shielding), FloatingText.SHIELDING);
}
} else {
if (!mob.properties().contains(Char.Property.UNDEAD)) {
Charm charm = Buff.affect(mob, Charm.class, effectMulti*Charm.DURATION/2f);

View File

@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.PlateArmor;
@@ -51,6 +52,7 @@ public class ArmoredBrute extends Brute {
@Override
protected void triggerEnrage () {
Buff.affect(this, ArmoredRage.class).setShield(HT/2 + 1);
sprite.showStatusWithIcon( CharSprite.POSITIVE, String.valueOf(HT/2 + 1), FloatingText.SHIELDING );
if (Dungeon.level.heroFOV[pos]) {
sprite.showStatus( CharSprite.NEGATIVE, Messages.get(this, "enraged") );
}

View File

@@ -27,11 +27,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ShieldBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.BruteSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
@@ -93,6 +95,7 @@ public class Brute extends Mob {
protected void triggerEnrage(){
Buff.affect(this, BruteRage.class).setShield(HT/2 + 4);
sprite.showStatusWithIcon( CharSprite.POSITIVE, String.valueOf(HT/2 + 4), FloatingText.SHIELDING );
if (Dungeon.level.heroFOV[pos]) {
SpellSprite.show( this, SpellSprite.BERSERK);
}

View File

@@ -43,6 +43,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Sleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Slow;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.TargetedCell;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SparkParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
@@ -335,6 +336,7 @@ public class DM300 extends Mob {
}
Sample.INSTANCE.play(Assets.Sounds.LIGHTNING);
sprite.emitter().start(SparkParticle.STATIC, 0.05f, 20);
sprite.showStatusWithIcon(CharSprite.POSITIVE, String.valueOf(30 + (HT - HP)/10), FloatingText.SHIELDING);
}
Buff.affect(this, Barrier.class).setShield( 30 + (HT - HP)/10);

View File

@@ -53,6 +53,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.duelist.Feint;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.DirectableAlly;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.Surprise;
import com.shatteredpixel.shatteredpixeldungeon.effects.Wound;
@@ -94,12 +95,6 @@ public abstract class Mob extends Char {
alignment = Alignment.ENEMY;
}
private static final String TXT_DIED = "You hear something died in the distance";
protected static final String TXT_NOTICE1 = "?!";
protected static final String TXT_RAGE = "#$%^";
protected static final String TXT_EXP = "%+dEXP";
public AiState SLEEPING = new Sleeping();
public AiState HUNTING = new Hunting();
@@ -794,7 +789,7 @@ public abstract class Mob extends Char {
}
if (exp > 0) {
Dungeon.hero.sprite.showStatus(CharSprite.POSITIVE, Messages.get(this, "exp", exp));
Dungeon.hero.sprite.showStatusWithIcon(CharSprite.POSITIVE, String.valueOf(exp), FloatingText.EXPERIENCE);
}
Dungeon.hero.earnExp(exp, getClass());

View File

@@ -21,13 +21,16 @@
package com.shatteredpixel.shatteredpixeldungeon.effects;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.RenderedText;
import com.watabou.noosa.TextureFilm;
import com.watabou.utils.Callback;
import com.watabou.utils.SparseArray;
@@ -38,6 +41,39 @@ public class FloatingText extends RenderedTextBlock {
private static final float LIFESPAN = 1f;
private static final float DISTANCE = DungeonTilemap.SIZE;
public static final int ICON_SIZE = 7;
public static TextureFilm iconFilm = new TextureFilm( Assets.Effects.TEXT_ICONS, ICON_SIZE, ICON_SIZE );
public static int NO_ICON = -1;
//combat damage icons
public static int PHYS_DMG = 0;
public static int MAGIC_DMG = 1;
public static int PICK_DMG = 2;
//debuff/dot damage icons
public static int HUNGER = 4;
public static int BURNING = 5;
public static int SHOCKING = 6;
public static int BLEEDING = 7;
public static int TOXIC = 8;
public static int CORROSION = 9;
public static int POISON = 10;
public static int OOZE = 11;
public static int DEFERRED = 12;
//positive icons
public static int HEALING = 18;
public static int SHIELDING = 19;
public static int EXPERIENCE= 20;
//currency icons
public static int GOLD = 22;
public static int ENERGY = 23;
private Image icon;
private boolean iconLeft;
private float timeLeft;
private int key = -1;
@@ -65,10 +101,38 @@ public class FloatingText extends RenderedTextBlock {
for (RenderedText t : words){
t.y -= yMove;
}
if (icon != null){
icon.alpha(p > 0.5f ? 1 : p * 2);
icon.y -= yMove;
}
}
}
}
@Override
protected synchronized void layout() {
super.layout();
if (icon != null){
if (iconLeft){
icon.x = left();
} else {
icon.x = left() + width() - icon.width();
}
icon.y = top();
PixelScene.align(icon);
}
}
@Override
public float width() {
float width = super.width();
if (icon != null){
width += icon.width()-0.5f;
}
return width;
}
@Override
public void kill() {
if (key != -1) {
@@ -86,7 +150,7 @@ public class FloatingText extends RenderedTextBlock {
super.destroy();
}
public void reset( float x, float y, String text, int color ) {
public void reset( float x, float y, String text, int color, int iconIdx, boolean left ) {
revive();
@@ -95,6 +159,18 @@ public class FloatingText extends RenderedTextBlock {
text( text );
hardlight( color );
if (iconIdx != NO_ICON){
icon = new Image( Assets.Effects.TEXT_ICONS);
icon.frame(iconFilm.get(iconIdx));
add(icon);
iconLeft = left;
if (iconLeft){
align(RIGHT_ALIGN);
}
} else {
icon = null;
}
setPos(
PixelScene.align( Camera.main, x - width() / 2),
PixelScene.align( Camera.main, y - height())
@@ -104,27 +180,23 @@ public class FloatingText extends RenderedTextBlock {
}
/* STATIC METHODS */
public static void show( float x, float y, String text, int color ) {
Game.runOnRenderThread(new Callback() {
@Override
public void call() {
FloatingText txt = GameScene.status();
if (txt != null){
txt.reset(x, y, text, color);
}
}
});
public static void show( float x, float y, String text, int color) {
show(x, y, -1, text, color, -1, false);
}
public static void show( float x, float y, int key, String text, int color ) {
public static void show( float x, float y, int key, String text, int color) {
show(x, y, key, text, color, -1, false);
}
public static void show( float x, float y, int key, String text, int color, int iconIdx, boolean left ) {
Game.runOnRenderThread(new Callback() {
@Override
public void call() {
FloatingText txt = GameScene.status();
if (txt != null){
txt.reset(x, y, text, color);
push(txt, key);
txt.reset(x, y, text, color, iconIdx, left);
if (key != -1) push(txt, key);
}
}
});

View File

@@ -27,7 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@@ -86,13 +86,11 @@ public class Dewdrop extends Item {
if (effect > 0 || shield > 0) {
hero.HP += effect;
if (shield > 0) Buff.affect(hero, Barrier.class).incShield(shield);
hero.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
if (effect > 0 && shield > 0){
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Dewdrop.class, "both", effect, shield) );
} else if (effect > 0){
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Dewdrop.class, "heal", effect) );
} else {
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(Dewdrop.class, "shield", shield) );
if (effect > 0){
hero.sprite.showStatusWithIcon( CharSprite.POSITIVE, String.valueOf(effect), FloatingText.HEALING);
}
if (shield > 0) {
hero.sprite.showStatusWithIcon( CharSprite.POSITIVE, String.valueOf(effect), FloatingText.SHIELDING );
}
} else if (!force) {

View File

@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.noosa.audio.Sample;
@@ -33,8 +34,6 @@ import java.util.ArrayList;
public class EnergyCrystal extends Item {
private static final String TXT_VALUE = "%+d";
{
image = ItemSpriteSheet.ENERGY;
stackable = true;
@@ -60,7 +59,7 @@ public class EnergyCrystal extends Item {
//TODO track energy collected maybe? We do already track recipes crafted though..
GameScene.pickUp( this, pos );
hero.sprite.showStatus( 0x44CCFF, TXT_VALUE, quantity );
hero.sprite.showStatusWithIcon( 0x44CCFF, String.valueOf(quantity), FloatingText.ENERGY );
hero.spendAndNext( TIME_TO_PICK_UP );
Sample.INSTANCE.play( Assets.Sounds.ITEM );

View File

@@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
@@ -36,8 +37,6 @@ import java.util.ArrayList;
public class Gold extends Item {
private static final String TXT_VALUE = "%+d";
{
image = ItemSpriteSheet.GOLD;
stackable = true;
@@ -64,7 +63,7 @@ public class Gold extends Item {
Badges.validateGoldCollected();
GameScene.pickUp( this, pos );
hero.sprite.showStatus( CharSprite.NEUTRAL, TXT_VALUE, quantity );
hero.sprite.showStatusWithIcon( CharSprite.NEUTRAL, String.valueOf(quantity), FloatingText.GOLD );
hero.spendAndNext( TIME_TO_PICK_UP );
Sample.INSTANCE.play( Assets.Sounds.GOLD, 1, 1, Random.Float( 0.9f, 1.1f ) );

View File

@@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor.Glyph;
@@ -56,7 +57,7 @@ public class Metabolism extends Glyph {
defender.HP += healing;
defender.sprite.emitter().burst( Speck.factory( Speck.HEALING ), 1 );
defender.sprite.showStatus( CharSprite.POSITIVE, Integer.toString( healing ) );
defender.sprite.showStatusWithIcon( CharSprite.POSITIVE, Integer.toString( healing ), FloatingText.HEALING);
}
}

View File

@@ -23,6 +23,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class PotionOfExperience extends Potion {
@@ -38,6 +40,7 @@ public class PotionOfExperience extends Potion {
@Override
public void apply( Hero hero ) {
identify();
hero.sprite.showStatusWithIcon(CharSprite.POSITIVE, String.valueOf(hero.maxExp()), FloatingText.EXPERIENCE);
hero.earnExp( hero.maxExp(), getClass() );
new Flare( 6, 32 ).color(0xFFFF00, true).show( curUser.sprite, 2f );
}

View File

@@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.items.potions;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@@ -41,10 +40,8 @@ public class PotionOfStrength extends Potion {
@Override
public void apply( Hero hero ) {
identify();
hero.STR++;
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(this, "msg_1") );
GLog.p( Messages.get(this, "msg_2") );
GLog.p( Messages.get(this, "msg", hero.STR()) );
Badges.validateStrengthAttained();
Badges.validateDuelistUnlock();

View File

@@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.AlchemicalCatalyst;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@@ -54,8 +53,7 @@ public class ElixirOfMight extends Elixir {
boost.reset();
hero.updateHT( true );
hero.sprite.showStatus( CharSprite.POSITIVE, Messages.get(this, "msg_1", boost.boost() ));
GLog.p( Messages.get(this, "msg_2") );
GLog.p( Messages.get(this, "msg", hero.STR()) );
Badges.validateStrengthAttained();
Badges.validateDuelistUnlock();

View File

@@ -26,7 +26,9 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfHealing;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class PotionOfShielding extends ExoticPotion {
@@ -44,6 +46,7 @@ public class PotionOfShielding extends ExoticPotion {
} else {
//~75% of a potion of healing
Buff.affect(hero, Barrier.class).setShield((int) (0.6f * hero.HT + 10));
hero.sprite.showStatusWithIcon( CharSprite.POSITIVE, String.valueOf((int) (0.6f * hero.HT + 10)), FloatingText.SHIELDING );
}
}
}

View File

@@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mimic;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.effects.Beam;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BloodParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle;
@@ -93,7 +94,12 @@ public class WandOfTransfusion extends Wand {
ch.HP += healing;
ch.sprite.emitter().burst(Speck.factory(Speck.HEALING), 2 + buffedLvl() / 2);
ch.sprite.showStatus(CharSprite.POSITIVE, "+%dHP", healing + shielding);
if (healing > 0) {
ch.sprite.showStatusWithIcon(CharSprite.POSITIVE, String.valueOf(healing), FloatingText.HEALING);
}
if (shielding > 0){
ch.sprite.showStatusWithIcon(CharSprite.POSITIVE, String.valueOf(shielding), FloatingText.SHIELDING);
}
if (!freeCharge) {
damageHero(selfDmg);

View File

@@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vertigo;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.NPC;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
@@ -287,7 +288,7 @@ public class WandOfWarding extends Wand {
}
HP = Math.min(HT, HP+heal);
if (sprite != null) sprite.showStatus(CharSprite.POSITIVE, Integer.toString(heal));
if (sprite != null) sprite.showStatusWithIcon(CharSprite.POSITIVE, Integer.toString(heal), FloatingText.HEALING);
}

View File

@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
@@ -54,7 +55,7 @@ public class Vampiric extends Weapon.Enchantment {
attacker.HP += healAmt;
attacker.sprite.emitter().start( Speck.factory( Speck.HEALING ), 0.4f, 1 );
attacker.sprite.showStatus( CharSprite.POSITIVE, Integer.toString( healAmt ) );
attacker.sprite.showStatusWithIcon( CharSprite.POSITIVE, Integer.toString( healAmt ), FloatingText.HEALING );
}
}

View File

@@ -28,9 +28,10 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Healing;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.effects.FloatingText;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.utils.Bundle;
@@ -94,7 +95,7 @@ public class Sungrass extends Plant {
target.HP += (int)partialHeal;
level -= (int)partialHeal;
partialHeal -= (int)partialHeal;
target.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1);
target.sprite.showStatusWithIcon(CharSprite.POSITIVE, "1", FloatingText.HEALING);
if (target.HP >= target.HT) {
target.HP = target.HT;

View File

@@ -189,6 +189,10 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
}
public void showStatus( int color, String text, Object... args ) {
showStatusWithIcon(color, text, FloatingText.NO_ICON, args);
}
public void showStatusWithIcon( int color, String text, int icon, Object... args ) {
if (visible) {
if (args.length > 0) {
text = Messages.format( text, args );
@@ -196,9 +200,9 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
float x = destinationCenter().x;
float y = destinationCenter().y - height()/2f;
if (ch != null) {
FloatingText.show( x, y, ch.pos, text, color );
FloatingText.show( x, y, ch.pos, text, color, icon, true );
} else {
FloatingText.show( x, y, text, color );
FloatingText.show( x, y, -1, text, color, icon, true );
}
}
}