v1.2.0: made a few improvements to button tooltips

This commit is contained in:
Evan Debenham 2022-03-02 19:25:30 -05:00
parent 01051f1c17
commit d2f8d95f51
8 changed files with 70 additions and 9 deletions

View File

@ -170,6 +170,18 @@ public class ControllerHandler implements ControllerListener {
return Input.Keys.UNKNOWN;
}
public static boolean icControllerKey(int keyCode){
if (keyCode >= Input.Keys.BUTTON_A && keyCode <= Input.Keys.BUTTON_MODE){
return true;
}
else if (keyCode >= Input.Keys.DPAD_UP && keyCode <= Input.Keys.DPAD_LEFT){
return true;
}
return false;
}
public static String customButtonName(int keyCode){
if (lastUsedType == ControllerType.PLAYSTATION){
if (keyCode == Input.Keys.BUTTON_A){

View File

@ -122,6 +122,7 @@ actors.buffs.chill.freezes=%s freezes!
actors.buffs.chill.desc=Not quite frozen, but still much too cold.\n\nChilled targets perform all actions more slowly, depending on how many turns are left in the effect. At its worst, this is equivalent to being slowed.\n\nTurns of chill remaining: %1$s.\nSpeed is reduced by: %2$s%%
actors.buffs.combo.name=Combo
actors.buffs.combo.action_name=combo attack
actors.buffs.combo.combo=%d hit combo!
actors.buffs.combo.bad_target=You must target an enemy in attack range.
actors.buffs.combo.prompt=Select a target to attack.
@ -238,6 +239,7 @@ actors.buffs.mindvision.desc=Somehow you are able to see all creatures on this f
actors.buffs.momentum.momentum=Building Momentum
actors.buffs.momentum.running=Freerunning
actors.buffs.momentum.resting=Recovering
actors.buffs.momentum.action_name=freerun
actors.buffs.momentum.momentum_desc=As he moves, the Freerunner builds momentum, which he can spend to start freerunning.\n\nEach charge of momentum grants two turns of freerunning, and the Freerunner can build up to 10 charges. Momentum is rapidly lost when the Freerunner stops moving.\n\nCurrent momentum charge: %d.
actors.buffs.momentum.running_desc=As he moves, the Freerunner builds momentum, which he can spend to start freerunning.\n\nWhile freerunning, the Freerunner moves at double speed and gains bonus evasion based on his level.\n\nTurns remaining: %d.
actors.buffs.momentum.resting_desc=As he moves, the Freerunner builds momentum, which he can spend to start freerunning.\n\nThe Freerunner needs time to regain his stamina before building momentum again.\n\nTurns remaining: %d.
@ -263,6 +265,7 @@ actors.buffs.poison.rankings_desc=Succumbed to Poison
actors.buffs.poison.desc=Poison works its way through the body, slowly impairing its internal functioning.\n\nPoison deals damage each turn proportional to how long until it expires.\n\nTurns of poison remaining: %s.
actors.buffs.preparation.name=Preparation
actors.buffs.preparation.action_name=prepared strike
actors.buffs.preparation.desc=The Assassin is waiting patiently, preparing to strike from the shadows.
actors.buffs.preparation.desc_dmg=His next attack will deal _%1$d%% bonus damage_, and will execute regular enemies below _%2$d%% health_, or bosses below _%3$d%% health_.
actors.buffs.preparation.desc_dmg_likely=The attack will also be more likely to deal a larger amount of damage.
@ -300,6 +303,9 @@ actors.buffs.slow.name=Slowed
actors.buffs.slow.desc=Slowing magic affects the target's rate of time, to them everything is moving super-fast.\n\nA slowed character performs all actions in twice the amount of time they would normally take.\n\nTurns of slow remaining: %s.
actors.buffs.snipersmark.name=Sniper's mark
actors.buffs.snipersmark.action_name_snapshot=snapshot
actors.buffs.snipersmark.action_name_volley=volley
actors.buffs.snipersmark.action_name_sniper=sniper shot
actors.buffs.snipersmark.desc=The Sniper is honed in on the target she most recently attacked. She is able to perform a special attack with her bow which will vary based on how the bow is augmented.\n\nAn unaugmented bow will fire a _snapshot,_ which deals reduced damage but does not take any time to fire.\n\nA bow augmented for speed will fire a _volley_ of three arrows. Each arrow will deal reduced damage, but can still activate enchantment. This volley takes 1 turn to shoot.\n\nA bow augmented for damage will fire a _sniper shot._ This shot is guaranteed to hit, deals bonus damage based on distance from the target, and takes 2 turns to fire.
actors.buffs.soulmark.name=Soul Marked

View File

@ -171,7 +171,12 @@ public class Combo extends Buff implements ActionIndicator.Action {
}
@Override
public Image getIcon() {
public String actionName() {
return Messages.get(this, "action_name");
}
@Override
public Image actionIcon() {
Image icon;
if (((Hero)target).belongings.weapon() != null){
icon = new ItemSprite(((Hero)target).belongings.weapon().image, null);

View File

@ -193,7 +193,12 @@ public class Momentum extends Buff implements ActionIndicator.Action {
}
@Override
public Image getIcon() {
public String actionName() {
return Messages.get(this, "action_name");
}
@Override
public Image actionIcon() {
Image im = new BuffIcon(BuffIndicator.HASTE, true);
im.hardlight(0x99992E);
return im;

View File

@ -248,9 +248,14 @@ public class Preparation extends Buff implements ActionIndicator.Action {
super.storeInBundle(bundle);
bundle.put(TURNS, turnsInvis);
}
@Override
public String actionName() {
return Messages.get(this, "action_name");
}
@Override
public Image getIcon() {
public Image actionIcon() {
Image actionIco = Effects.get(Effects.Type.WOUND);
tintIcon(actionIco);
return actionIco;

View File

@ -102,7 +102,23 @@ public class SnipersMark extends FlavourBuff implements ActionIndicator.Action {
}
@Override
public Image getIcon() {
public String actionName() {
SpiritBow bow = Dungeon.hero.belongings.getItem(SpiritBow.class);
if (bow == null) return null;
switch (bow.augment){
case NONE: default:
return Messages.get(this, "action_name_snapshot");
case SPEED:
return Messages.get(this, "action_name_volley");
case DAMAGE:
return Messages.get(this, "action_name_sniper");
}
}
@Override
public Image actionIcon() {
return new ItemSprite(ItemSpriteSheet.SPIRIT_BOW, null);
}

View File

@ -105,8 +105,7 @@ public class ActionIndicator extends Tag {
@Override
protected String hoverText() {
//TODO each special action should probably have its own title
return Messages.titleCase(Messages.get(WndKeyBindings.class, "tag_action"));
return Messages.titleCase(action.actionName());
}
public static void setAction(Action action){
@ -127,7 +126,7 @@ public class ActionIndicator extends Tag {
instance.icon = null;
}
if (action != null) {
instance.icon = action.getIcon();
instance.icon = action.actionIcon();
instance.needsLayout = true;
}
}
@ -136,7 +135,9 @@ public class ActionIndicator extends Tag {
public interface Action{
public Image getIcon();
public String actionName();
public Image actionIcon();
public void doAction();

View File

@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.ui;
import com.watabou.input.ControllerHandler;
import com.watabou.input.GameAction;
import com.watabou.input.KeyBindings;
import com.watabou.input.KeyEvent;
@ -85,7 +86,17 @@ public class Button extends Component {
if (keyAction() != null){
ArrayList<Integer> bindings = KeyBindings.getBoundKeysForAction(keyAction());
if (!bindings.isEmpty()){
text += " _(" + KeyBindings.getKeyName(bindings.get(0)) + ")_";
int key = bindings.get(0);
//prefer controller buttons if we are using a controller
if (ControllerHandler.controllerPointerActive()){
for (int code : bindings){
if (ControllerHandler.icControllerKey(code)){
key = code;
break;
}
}
}
text += " _(" + KeyBindings.getKeyName(key) + ")_";
}
}
hoverTip = new Tooltip(text, 80);