v0.9.4: various refactors and improvements to buff and talent icon code

This commit is contained in:
Evan Debenham 2021-07-06 19:25:49 -04:00
parent 72275d240d
commit daa569b4fe
12 changed files with 131 additions and 96 deletions

View File

@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIcon;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.noosa.Image; import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
@ -182,7 +183,7 @@ public class Momentum extends Buff implements ActionIndicator.Action {
@Override @Override
public Image getIcon() { public Image getIcon() {
Image im = new Image(Assets.Interfaces.BUFFS_LARGE, 144, 32, 16, 16); Image im = new BuffIcon(BuffIndicator.HASTE, true);
im.hardlight(0x99992E); im.hardlight(0x99992E);
return im; return im;
} }

View File

@ -23,9 +23,13 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.hero;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Combo;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Fury;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIcon;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
import com.watabou.noosa.Image; import com.watabou.noosa.Image;
@ -70,34 +74,33 @@ public enum HeroSubClass {
} }
} }
//FIXME shouldn't hardcode these, probably want to just have a BuffIcon class
public Image icon(){ public Image icon(){
switch (this){ switch (this){
case GLADIATOR: default: case GLADIATOR: default:
return new Image(Assets.Interfaces.BUFFS_LARGE, 16, 16, 16, 16); return new BuffIcon(BuffIndicator.COMBO, true);
case BERSERKER: case BERSERKER:
return new Image(Assets.Interfaces.BUFFS_LARGE, 32, 16, 16, 16); return new BuffIcon(BuffIndicator.FURY, true);
case WARLOCK: case WARLOCK:
return new Image(Assets.Interfaces.BUFFS_LARGE, 64, 32, 16, 16); return new BuffIcon(BuffIndicator.CORRUPT, true);
case BATTLEMAGE: case BATTLEMAGE:
Image im = new Image(Assets.Interfaces.BUFFS_LARGE, 32, 48, 16, 16); Image im = new BuffIcon(BuffIndicator.UPGRADE, true);
im.hardlight(1f, 1f, 0f); im.hardlight(1f, 1f, 0f);
return im; return im;
case ASSASSIN: case ASSASSIN:
im = new Image(Assets.Interfaces.BUFFS_LARGE, 160, 32, 16, 16); im = new BuffIcon(BuffIndicator.PREPARATION, true);
im.hardlight(1f, 0f, 0f); im.hardlight(1f, 0f, 0f);
return im; return im;
case FREERUNNER: case FREERUNNER:
im = new Image(Assets.Interfaces.BUFFS_LARGE, 48, 48, 16, 16); im = new BuffIcon(BuffIndicator.MOMENTUM, true);
im.hardlight(1f, 1f, 0f); im.hardlight(1f, 1f, 0f);
return im; return im;
case SNIPER: case SNIPER:
return new Image(Assets.Interfaces.BUFFS_LARGE, 176, 16, 16, 16); return new BuffIcon(BuffIndicator.MARK, true);
case WARDEN: case WARDEN:
return new Image(Assets.Interfaces.BUFFS_LARGE, 208, 0, 16, 16); return new BuffIcon(BuffIndicator.BARKSKIN, true);
} }
} }

View File

@ -0,0 +1,34 @@
package com.shatteredpixel.shatteredpixeldungeon.ui;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm;
public class BuffIcon extends Image {
private static TextureFilm smallFilm;
private static final int SML_SIZE = 7;
private static TextureFilm largeFilm;
private static final int LRG_SIZE = 16;
//TODO maybe roll fading behaviour into this too?
public BuffIcon(Buff buff, boolean large){
this(buff.icon(), large);
buff.tintIcon(this);
}
public BuffIcon(int icon, boolean large){
super( large ? Assets.Interfaces.BUFFS_LARGE : Assets.Interfaces.BUFFS_SMALL );
if (large){
if (largeFilm == null) largeFilm = new TextureFilm(texture, LRG_SIZE, LRG_SIZE);
frame(largeFilm.get(icon));
} else {
if (smallFilm == null ) smallFilm = new TextureFilm(texture, SML_SIZE, SML_SIZE);
frame(smallFilm.get(icon));
}
}
}

View File

@ -32,8 +32,8 @@ import com.watabou.gltextures.SmartTexture;
import com.watabou.gltextures.TextureCache; import com.watabou.gltextures.TextureCache;
import com.watabou.noosa.Image; import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm; import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.tweeners.AlphaTweener; import com.watabou.noosa.tweeners.AlphaTweener;
import com.watabou.noosa.ui.Button;
import com.watabou.noosa.ui.Component; import com.watabou.noosa.ui.Component;
import java.util.ArrayList; import java.util.ArrayList;
@ -104,10 +104,7 @@ public class BuffIndicator extends Component {
private static BuffIndicator heroInstance; private static BuffIndicator heroInstance;
private SmartTexture texture; private LinkedHashMap<Buff, BuffButton> buffButtons = new LinkedHashMap<>();
private TextureFilm film;
private LinkedHashMap<Buff, BuffIcon> buffIcons = new LinkedHashMap<>();
private boolean needsRefresh; private boolean needsRefresh;
private Char ch; private Char ch;
@ -129,12 +126,6 @@ public class BuffIndicator extends Component {
} }
} }
@Override
protected void createChildren() {
texture = TextureCache.get( Assets.Interfaces.BUFFS_SMALL );
film = new TextureFilm( texture, SIZE, SIZE );
}
@Override @Override
public synchronized void update() { public synchronized void update() {
super.update(); super.update();
@ -155,9 +146,9 @@ public class BuffIndicator extends Component {
} }
//remove any icons no longer present //remove any icons no longer present
for (Buff buff : buffIcons.keySet().toArray(new Buff[0])){ for (Buff buff : buffButtons.keySet().toArray(new Buff[0])){
if (!newBuffs.contains(buff)){ if (!newBuffs.contains(buff)){
Image icon = buffIcons.get( buff ).icon; Image icon = buffButtons.get( buff ).icon;
icon.origin.set( SIZE / 2f ); icon.origin.set( SIZE / 2f );
icon.alpha(0.6f); icon.alpha(0.6f);
add( icon ); add( icon );
@ -174,24 +165,24 @@ public class BuffIndicator extends Component {
} }
} ); } );
buffIcons.get( buff ).destroy(); buffButtons.get( buff ).destroy();
remove(buffIcons.get( buff )); remove(buffButtons.get( buff ));
buffIcons.remove( buff ); buffButtons.remove( buff );
} }
} }
//add new icons //add new icons
for (Buff buff : newBuffs) { for (Buff buff : newBuffs) {
if (!buffIcons.containsKey(buff)) { if (!buffButtons.containsKey(buff)) {
BuffIcon icon = new BuffIcon( buff ); BuffButton icon = new BuffButton(buff);
add(icon); add(icon);
buffIcons.put( buff, icon ); buffButtons.put( buff, icon );
} }
} }
//layout //layout
int pos = 0; int pos = 0;
for (BuffIcon icon : buffIcons.values()){ for (BuffButton icon : buffButtons.values()){
icon.updateIcon(); icon.updateIcon();
icon.setRect(x + pos * (SIZE + 2), y, 9, 12); icon.setRect(x + pos * (SIZE + 2), y, 9, 12);
PixelScene.align(icon); PixelScene.align(icon);
@ -199,27 +190,28 @@ public class BuffIndicator extends Component {
} }
} }
private class BuffIcon extends Button { private static class BuffButton extends IconButton {
private Buff buff; private Buff buff;
public Image icon; //Todo maybe move into buff icon?
public Image grey; public Image grey;
public BuffIcon( Buff buff ){ public BuffButton(Buff buff ){
super(); super( new BuffIcon(buff, false));
this.buff = buff; this.buff = buff;
icon = new Image( texture ); bringToFront(grey);
icon.frame( film.get( buff.icon() ) ); }
add( icon );
@Override
protected void createChildren() {
super.createChildren();
grey = new Image( TextureCache.createSolid(0xCC666666)); grey = new Image( TextureCache.createSolid(0xCC666666));
add( grey ); add( grey );
} }
public void updateIcon(){ public void updateIcon(){
icon.frame( film.get( buff.icon() ) );
buff.tintIcon(icon); buff.tintIcon(icon);
//round up to the nearest pixel if <50% faded, otherwise round down //round up to the nearest pixel if <50% faded, otherwise round down
float fadeHeight = buff.iconFadePercent() * icon.height(); float fadeHeight = buff.iconFadePercent() * icon.height();
@ -240,8 +232,18 @@ public class BuffIndicator extends Component {
@Override @Override
protected void onClick() { protected void onClick() {
if (buff.icon() != NONE) if (buff.icon() != NONE) GameScene.show(new WndInfoBuff(buff));
GameScene.show(new WndInfoBuff(buff)); }
@Override
protected void onPointerDown() {
//don't affect buff color
Sample.INSTANCE.play( Assets.Sounds.CLICK );
}
@Override
protected void onPointerUp() {
//don't affect buff color
} }
} }

View File

@ -44,15 +44,12 @@ public class TalentButton extends Button {
public static final int WIDTH = 20; public static final int WIDTH = 20;
public static final int HEIGHT = 26; public static final int HEIGHT = 26;
private SmartTexture icons;
private TextureFilm film;
int tier; int tier;
Talent talent; Talent talent;
int pointsInTalent; int pointsInTalent;
boolean upgradeEnabled; boolean upgradeEnabled;
Image icon; TalentIcon icon;
Image bg; Image bg;
ColorBlock fill; ColorBlock fill;
@ -67,24 +64,20 @@ public class TalentButton extends Button {
this.upgradeEnabled = upgradeEnabled; this.upgradeEnabled = upgradeEnabled;
bg.frame(20*(talent.maxPoints()-1), 0, WIDTH, HEIGHT); bg.frame(20*(talent.maxPoints()-1), 0, WIDTH, HEIGHT);
icon.frame( film.get( talent.icon() ) );
icon = new TalentIcon( talent );
add(icon);
} }
@Override @Override
protected void createChildren() { protected void createChildren() {
super.createChildren(); super.createChildren();
icons = TextureCache.get( Assets.Interfaces.TALENT_ICONS );
film = new TextureFilm( icons, 16, 16 );
fill = new ColorBlock(0, 4, 0xFFFFFF44); fill = new ColorBlock(0, 4, 0xFFFFFF44);
add(fill); add(fill);
bg = new Image(Assets.Interfaces.TALENT_BUTTON); bg = new Image(Assets.Interfaces.TALENT_BUTTON);
add(bg); add(bg);
icon = new Image( icons );
add(icon);
} }
@Override @Override

View File

@ -0,0 +1,25 @@
package com.shatteredpixel.shatteredpixeldungeon.ui;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm;
public class TalentIcon extends Image {
private static TextureFilm film;
private static final int SIZE = 16;
public TalentIcon(Talent talent){
this(talent.icon());
}
public TalentIcon(int icon){
super( Assets.Interfaces.TALENT_ICONS );
if (film == null) film = new TextureFilm(texture, SIZE, SIZE);
frame(film.get(icon));
}
}

View File

@ -55,6 +55,8 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.ChangesScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIcon;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.noosa.Image; import com.watabou.noosa.Image;
@ -312,7 +314,7 @@ public class v0_6_X_Changes {
changes.hardlight( CharSprite.NEGATIVE ); changes.hardlight( CharSprite.NEGATIVE );
changeInfos.add(changes); changeInfos.add(changes);
changes.addButton( new ChangeButton(new Image(Assets.Interfaces.BUFFS_LARGE, 64, 0, 16, 16), "Paralysis changes", changes.addButton( new ChangeButton(new BuffIcon(BuffIndicator.PARALYSIS, true), "Paralysis changes",
"Paralysis is an extremely powerful debuff, and its ability to completely immobilize the player or an enemy while they are killed needs to be adjusted.\n" + "Paralysis is an extremely powerful debuff, and its ability to completely immobilize the player or an enemy while they are killed needs to be adjusted.\n" +
"\n" + "\n" +
"Chance to resist paralysis is now based on all recent damage taken while paralyzed, instead of each specific instance of damage separately.\n" + "Chance to resist paralysis is now based on all recent damage taken while paralyzed, instead of each specific instance of damage separately.\n" +
@ -395,7 +397,7 @@ public class v0_6_X_Changes {
changes.hardlight( CharSprite.WARNING ); changes.hardlight( CharSprite.WARNING );
changeInfos.add(changes); changeInfos.add(changes);
changes.addButton( new ChangeButton(new Image(Assets.Interfaces.BUFFS_LARGE, 32, 0, 16, 16), "Changes to debuffs and resistances", changes.addButton( new ChangeButton(new BuffIcon(BuffIndicator.FIRE, true), "Changes to debuffs and resistances",
"The game's resistance system has been totally overhauled, to allow for more flexibility and consistency.\n\n" + "The game's resistance system has been totally overhauled, to allow for more flexibility and consistency.\n\n" +
"Previously, if a character was resistant to something, its effect would be reduced by a random amount between 0% and 100%.\n\n" + "Previously, if a character was resistant to something, its effect would be reduced by a random amount between 0% and 100%.\n\n" +
"Now, resistances are much less random, applying a specific reduction to harmful effects. Currently all resistances are 50%.\n\n" + "Now, resistances are much less random, applying a specific reduction to harmful effects. Currently all resistances are 50%.\n\n" +

View File

@ -54,6 +54,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ShamanSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.SpawnerSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.SpawnerSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.StatueSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.YogSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.YogSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIcon;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.noosa.Image; import com.watabou.noosa.Image;
@ -283,7 +285,7 @@ public class v0_8_X_Changes {
"_-_ Some misc sounds have also been added for: gas spewing, chains being thrown, magical effects charging up, and the player being hit to low health.\n\n" + "_-_ Some misc sounds have also been added for: gas spewing, chains being thrown, magical effects charging up, and the player being hit to low health.\n\n" +
"I've also remastered the title and ending music tracks to improve their quality and volume.")); "I've also remastered the title and ending music tracks to improve their quality and volume."));
changes.addButton( new ChangeButton(new Image(Assets.Interfaces.BUFFS_LARGE, 0, 0, 16, 16), "Item and Buff Icons", changes.addButton( new ChangeButton(new BuffIcon(BuffIndicator.MIND_VISION, true), "Item and Buff Icons",
"_Buff icons now have a new fading behaviour_ that much more accurately communicates how much of their duration is left. Several duplicated buff icons have also been recolored so they are distinct.\n\n" + "_Buff icons now have a new fading behaviour_ that much more accurately communicates how much of their duration is left. Several duplicated buff icons have also been recolored so they are distinct.\n\n" +
"_Item icons have been added to rings!_ To accommodate this, item icons now appear in the top-right of an item's inventory slot. Several existing item icons have also been improved.")); "_Item icons have been added to rings!_ To accommodate this, item icons now appear in the top-right of an item's inventory slot. Several existing item icons have also been improved."));
@ -682,7 +684,7 @@ public class v0_8_X_Changes {
"_-_ Doubled corruption resistance reduction from debuffs, as it was 50% weaker than intended. It is now as strong as listed in 0.7.5 changelog (50% for major debuffs, 25% for minor)\n\n" + "_-_ Doubled corruption resistance reduction from debuffs, as it was 50% weaker than intended. It is now as strong as listed in 0.7.5 changelog (50% for major debuffs, 25% for minor)\n\n" +
"Additionally, corruption is getting access to two of the new debuffs added in 0.8.0: _Hex,_ and _Weakness._")); "Additionally, corruption is getting access to two of the new debuffs added in 0.8.0: _Hex,_ and _Weakness._"));
changes.addButton( new ChangeButton(new Image(Assets.Interfaces.BUFFS_LARGE, 80, 32, 16, 16), "Bless changes", changes.addButton( new ChangeButton(new BuffIcon(BuffIndicator.BLESS, true), "Bless changes",
"Accuracy and evasion bonuses from blessed buff increased to 25% from 20%." )); "Accuracy and evasion bonuses from blessed buff increased to 25% from 20%." ));
changes.addButton( new ChangeButton(new StoneOfAugmentation(), changes.addButton( new ChangeButton(new StoneOfAugmentation(),

View File

@ -42,6 +42,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.SpawnerSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.SpawnerSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.SpinnerSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.SpinnerSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.TalentIcon;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.noosa.Image; import com.watabou.noosa.Image;
@ -401,7 +402,7 @@ public class v0_9_X_Changes {
"_-_ Rather than having a 1/8 chance per enemy, the game now guarantees that every 8th enemy is a champion. This should make champion spawn rates much more consistent.\n" + "_-_ Rather than having a 1/8 chance per enemy, the game now guarantees that every 8th enemy is a champion. This should make champion spawn rates much more consistent.\n" +
"_-_ Removed champion enemy caps, no longer needed now that spawning is more consistent.")); "_-_ Removed champion enemy caps, no longer needed now that spawning is more consistent."));
changes.addButton(new ChangeButton(new Image(Assets.Interfaces.TALENT_ICONS, 80, 16, 16, 16), "On-Upgrade Talents", changes.addButton(new ChangeButton(new TalentIcon(Talent.ENERGIZING_UPGRADE), "On-Upgrade Talents",
"T2 talents are doing very well overall, but I'm handing out a buff to each on-upgrade talent as they're a bit weak and aren't picked often:\n\n" + "T2 talents are doing very well overall, but I'm handing out a buff to each on-upgrade talent as they're a bit weak and aren't picked often:\n\n" +
"_- Energizing Upgrade_ staff charges increased to 2/3 at +1/+2, up from 1/2 at +1/+2.\n" + "_- Energizing Upgrade_ staff charges increased to 2/3 at +1/+2, up from 1/2 at +1/+2.\n" +
"_- Mystical Upgrade_ cloak of shadows charges increased to 2/3 at +1/+2, up from 1/2 at +1/+2.")); "_- Mystical Upgrade_ cloak of shadows charges increased to 2/3 at +1/+2, up from 1/2 at +1/+2."));
@ -420,7 +421,7 @@ public class v0_9_X_Changes {
"_- the Chalice of Blood_ now grants more HP per turn with artifact charging based on its level, instead of based on dungeon depth.\n" + "_- the Chalice of Blood_ now grants more HP per turn with artifact charging based on its level, instead of based on dungeon depth.\n" +
"_-_ This scaling occurs in the same way as how the chalice scales up health regen. The max heal per turn is unchanged at 5.")); "_-_ This scaling occurs in the same way as how the chalice scales up health regen. The max heal per turn is unchanged at 5."));
changes.addButton(new ChangeButton(new Image(Assets.Interfaces.TALENT_ICONS, 48, 48, 16, 16), "Nature's Aid", changes.addButton(new ChangeButton(new TalentIcon(Talent.NATURES_AID), "Nature's Aid",
"I'm nudging nature's down slightly as it is currently the strongest T1 talent by a fair margin:\n\n" + "I'm nudging nature's down slightly as it is currently the strongest T1 talent by a fair margin:\n\n" +
"_- Nature's Aid_ turns of barkskin reduced to 3/5 at +1/+2, from 4/6 at +1/+2.")); "_- Nature's Aid_ turns of barkskin reduced to 3/5 at +1/+2, from 4/6 at +1/+2."));
@ -566,7 +567,7 @@ public class v0_9_X_Changes {
changes.hardlight(CharSprite.NEGATIVE); changes.hardlight(CharSprite.NEGATIVE);
changeInfos.add(changes); changeInfos.add(changes);
changes.addButton( new ChangeButton( new Image(Assets.Interfaces.TALENT_ICONS, 0, 0, 16, 16), Talent.HEARTY_MEAL.title(), changes.addButton( new ChangeButton( new TalentIcon(Talent.HEARTY_MEAL), Talent.HEARTY_MEAL.title(),
"_Hearty Meal_ is currently the strongest tier one talent in the game, so I'm deepening the missing health requirement slightly to make its power a bit harder to access:\n\n" + "_Hearty Meal_ is currently the strongest tier one talent in the game, so I'm deepening the missing health requirement slightly to make its power a bit harder to access:\n\n" +
"_-_ Now grants 2/3 healing when hero is below 50% health, down from 3/5\n" + "_-_ Now grants 2/3 healing when hero is below 50% health, down from 3/5\n" +
"_-_ The full 3/5 heal is still available if the hero is below 25% health")); "_-_ The full 3/5 heal is still available if the hero is below 25% health"));

View File

@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIcon;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton; import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
@ -201,17 +202,12 @@ public class WndHero extends WndTabbed {
private static final int GAP = 2; private static final int GAP = 2;
private SmartTexture icons;
private TextureFilm film;
private float pos; private float pos;
private ScrollPane buffList; private ScrollPane buffList;
private ArrayList<BuffSlot> slots = new ArrayList<>(); private ArrayList<BuffSlot> slots = new ArrayList<>();
@Override @Override
protected void createChildren() { protected void createChildren() {
icons = TextureCache.get( Assets.Interfaces.BUFFS_LARGE );
film = new TextureFilm( icons, 16, 16 );
super.createChildren(); super.createChildren();
@ -260,11 +256,8 @@ public class WndHero extends WndTabbed {
public BuffSlot( Buff buff ){ public BuffSlot( Buff buff ){
super(); super();
this.buff = buff; this.buff = buff;
int index = buff.icon();
icon = new Image( icons ); icon = new BuffIcon(buff, true);
icon.frame( film.get( index ) );
buff.tintIcon(icon);
icon.y = this.y; icon.y = this.y;
add( icon ); add( icon );

View File

@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIcon;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock; import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.gltextures.SmartTexture; import com.watabou.gltextures.SmartTexture;
@ -38,20 +39,12 @@ public class WndInfoBuff extends Window {
private static final int WIDTH = 120; private static final int WIDTH = 120;
private SmartTexture icons;
private TextureFilm film;
public WndInfoBuff(Buff buff){ public WndInfoBuff(Buff buff){
super(); super();
IconTitle titlebar = new IconTitle(); IconTitle titlebar = new IconTitle();
icons = TextureCache.get( Assets.Interfaces.BUFFS_LARGE ); Image buffIcon = new BuffIcon( buff, true );
film = new TextureFilm( icons, 16, 16 );
Image buffIcon = new Image( icons );
buffIcon.frame( film.get(buff.icon()) );
buff.tintIcon(buffIcon);
titlebar.icon( buffIcon ); titlebar.icon( buffIcon );
titlebar.label( Messages.titleCase(buff.toString()), Window.TITLE_COLOR ); titlebar.label( Messages.titleCase(buff.toString()), Window.TITLE_COLOR );

View File

@ -21,18 +21,14 @@
package com.shatteredpixel.shatteredpixeldungeon.windows; package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock; import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
import com.shatteredpixel.shatteredpixeldungeon.ui.TalentIcon;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.gltextures.SmartTexture;
import com.watabou.gltextures.TextureCache;
import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm;
import com.watabou.utils.Callback; import com.watabou.utils.Callback;
public class WndInfoTalent extends Window { public class WndInfoTalent extends Window {
@ -41,21 +37,12 @@ public class WndInfoTalent extends Window {
private static final int WIDTH = 120; private static final int WIDTH = 120;
private SmartTexture icons;
private TextureFilm film;
public WndInfoTalent(Talent talent, int points, Callback onUpgradeButton){ public WndInfoTalent(Talent talent, int points, Callback onUpgradeButton){
super(); super();
IconTitle titlebar = new IconTitle(); IconTitle titlebar = new IconTitle();
icons = TextureCache.get( Assets.Interfaces.TALENT_ICONS ); titlebar.icon( new TalentIcon( talent ) );
film = new TextureFilm( icons, 16, 16 );
Image buffIcon = new Image( icons );
buffIcon.frame( film.get(talent.icon()) );
titlebar.icon( buffIcon );
String title = Messages.titleCase(talent.title()); String title = Messages.titleCase(talent.title());
if (points > 0){ if (points > 0){
title += " +" + points; title += " +" + points;
@ -86,7 +73,6 @@ public class WndInfoTalent extends Window {
resize( WIDTH, (int)upgrade.bottom()+1 ); resize( WIDTH, (int)upgrade.bottom()+1 );
} }
} }
} }