Skip to content

Commit

Permalink
Fixed issue - more right click dash consistency when able to use mate…
Browse files Browse the repository at this point in the history
…rialization [bounty: 4 XTR]. Now the dark priest will always be shown as an active unit when you right-click on an empty grid.
  • Loading branch information
Nazar Herasymchuk committed Oct 15, 2023
1 parent b9e6121 commit 8cc5b67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/abilities/Dark-Priest.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export default (G) => {

// Ask the creature to summon
G.UI.materializeToggled = true;
G.UI.toggleDash('randomize');
G.UI.toggleDash(true);
},

fnOnSelect: function (hex, args) {
Expand Down
7 changes: 4 additions & 3 deletions src/ui/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -1018,8 +1018,7 @@ export class UI {
$j('#materialize_button p').text(game.msg.ui.dash.selectUnit);
// Bind button for random unit selection
this.materializeButton.click = () => {
const creatureId = this.showRandomCreature();
this.lastViewedCreature = creatureId;
this.lastViewedCreature = this.showRandomCreature();
};
// Apply the changes
$j('#card .sideA').on('click', this.materializeButton.click);
Expand Down Expand Up @@ -1470,7 +1469,9 @@ export class UI {
if (randomize && !this.lastViewedCreature) {
// Optional: select a random creature from the grid
this.showRandomCreature();
} else if (this.lastViewedCreature) {
} else if (!randomize) {
this.showCreature('--', game.activeCreature.team, '');
} else if (this.lastViewedCreature) {
this.showCreature(this.lastViewedCreature, game.activeCreature.team, '');
} else {
this.showCreature(game.activeCreature.type, game.activeCreature.team, '');
Expand Down
13 changes: 2 additions & 11 deletions src/utility/hexgrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1052,17 +1052,8 @@ export class HexGrid {
game.UI.showCreature(hex.creature.type, hex.creature.player.id, 'grid');
} else {
if (game.activeCreature.isDarkPriest()) {
// If ability used, default to Dark Priest and say materialize has been used
if (game.activeCreature.abilities[3].used) {
game.UI.showCreature(
game.activeCreature.type,
game.activeCreature.player.id,
'emptyHex',
);
} else if (game.UI.lastViewedCreature) {
game.UI.showCreature(game.UI.lastViewedCreature, game.UI.selectedPlayer, 'emptyHex');
} else if (game.UI.selectedCreatureObj) {
game.UI.toggleDash(true);
if (game.UI.selectedCreatureObj) {
game.UI.toggleDash(false);
} else {
game.UI.showCreature(
game.activeCreature.type,
Expand Down

0 comments on commit 8cc5b67

Please sign in to comment.