diff --git a/TODO.md b/TODO.md index d372cfe..39b72f2 100644 --- a/TODO.md +++ b/TODO.md @@ -34,7 +34,7 @@ Map/story Character sheet --------------- -* Improve action and attribute tooltips +* Improve attribute tooltips * Implement sliders for personality traits * Center the portraits when there are less than 5 diff --git a/src/ui/battle/ActionTooltip.ts b/src/ui/battle/ActionTooltip.ts index 85737e7..fce461e 100644 --- a/src/ui/battle/ActionTooltip.ts +++ b/src/ui/battle/ActionTooltip.ts @@ -6,7 +6,7 @@ module TK.SpaceTac.UI { /** * Fill the tooltip */ - static fill(filler: TooltipBuilder, ship: Ship, action: BaseAction, position: number) { + static fill(filler: TooltipBuilder, ship: Ship, action: BaseAction, position?: number): boolean { let builder = filler.styled({ size: 20 }); let icon = builder.image(`action-${action.code}`); @@ -49,17 +49,21 @@ module TK.SpaceTac.UI { builder.text(description, 30, 170, { size: 16 }); } - let shortcut = ""; - if (action instanceof EndTurnAction) { - shortcut = "[ space ]"; - } else if (position == 9) { - shortcut = "[ 0 ]"; - } else if (position >= 0 && position < 9) { - shortcut = `[ ${position + 1} ]`; - } - if (shortcut) { - builder.text(shortcut, 150, 120, { color: "#aaaaaa", size: 12 }); + if (typeof position != "undefined") { + let shortcut = ""; + if (action instanceof EndTurnAction) { + shortcut = "[ space ]"; + } else if (position == 9) { + shortcut = "[ 0 ]"; + } else if (position >= 0 && position < 9) { + shortcut = `[ ${position + 1} ]`; + } + if (shortcut) { + builder.text(shortcut, 150, 120, { color: "#aaaaaa", size: 12 }); + } } + + return true; } } } diff --git a/src/ui/character/CharacterSheet.ts b/src/ui/character/CharacterSheet.ts index 5b24f2d..aa41f00 100644 --- a/src/ui/character/CharacterSheet.ts +++ b/src/ui/character/CharacterSheet.ts @@ -306,8 +306,7 @@ module TK.SpaceTac.UI { builder.in(builder.container("items"), builder => { let actions = ship.actions.listAll().filter(action => !(action instanceof EndTurnAction)); actions.forEach(action => { - let button = builder.button(`action-${action.code}`, 24, 0, undefined, - action.getEffectsDescription()); + let button = builder.button(`action-${action.code}`, 24, 0, undefined, filler => ActionTooltip.fill(filler, ship, action)); button.setScale(0.375); }); builder.distribute("y", 40, 688);