Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/abilities/Bounty-Hunter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export default (G: Game) => {
target.takeDamage(damage);
G.log('%CreatureName' + ability.creature.id + '% used ' + ability.title + ' twice');
}, 1000);
} else target.takeDamage(damage);
} else target.takeDamage(damage);
},
},

Expand Down
6 changes: 5 additions & 1 deletion src/abilities/Chimera.js → src/abilities/Chimera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { Damage } from '../damage';
import { Team } from '../utility/team';
import * as matrices from '../utility/matrices';
import * as arrayUtils from '../utility/arrayUtils';
import Game from '../game';

/** Creates the abilities
* @param {Object} G the game object
* @return {void}
*/
export default (G) => {
export default (G: Game) => {
G.abilities[45] = [
// First Ability: Cyclic Duality
{
Expand Down Expand Up @@ -73,6 +74,7 @@ export default (G) => {

G.grid.queryCreature({
fnOnConfirm: function () {
// eslint-disable-next-line
ability.animation(...arguments);
},
team: this._targetTeam,
Expand Down Expand Up @@ -134,6 +136,7 @@ export default (G) => {

G.grid.queryDirection({
fnOnConfirm: function () {
// eslint-disable-next-line
ability.animation(...arguments);
},
flipped: chimera.player.flipped,
Expand Down Expand Up @@ -260,6 +263,7 @@ export default (G) => {

G.grid.queryDirection({
fnOnConfirm: function () {
// eslint-disable-next-line
ability.animation(...arguments);
},
flipped: chimera.player.flipped,
Expand Down
2 changes: 1 addition & 1 deletion src/abilities/Golden-Wyrm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export default (G: Game) => {

_highlightDestination: function (hex: Hex) {
const ghostData = this.game.retrieveCreatureStats(this.creature.type);
this.game.grid.previewCreature(hex, ghostData, this.creature.player);
this.game.grid.previewCreature(hex, ghostData, this.creature.player);
this.creature.tracePosition({
x: hex.x,
y: hex.y,
Expand Down
4 changes: 2 additions & 2 deletions src/ability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class Ability {
_damaged: boolean;
_executeHealthThreshold: number;
_highlightDestination: (...args: any) => void;

_getDirections: () => number[];
_activateOnAttacker: (...arg: any) => boolean;
_activateOnTarget: (t: Creature) => void;
_pushMove: (destination: Hex, target: Creature, targetDestination: Hex) => void;
Expand Down Expand Up @@ -164,7 +164,7 @@ export class Ability {
resetTimesUsed(): void {
this.timesUsedThisTurn = 0;
}

directions: [1, 1, 1, 1, 1, 1];
constructor(creature: Creature, abilityID: AbilitySlot, game: Game) {
this.creature = creature;
Expand Down
34 changes: 13 additions & 21 deletions src/sound/soundsys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { getUrl } from '../assets';
import { MusicPlayer } from './musicplayer';
import { clamp } from '../utility/math';


export type AudioMode = 'full' | 'sfx' | 'muted';
let currentAudioMode: AudioMode = 'full';

Expand Down Expand Up @@ -75,51 +74,45 @@ export class SoundSys {
}
}

get musicVolume() {
return this._musicVol;
}
set musicVolume(level: number) {
if (this.envHasSound) {
this._musicVol = clamp(level, 0, 1);
this.musicGainNode.gain.value = this._musicVol;
}
}

get effectsVolume() {
return this._effectsVol;
}
set effectsVolume(level: number) {
if (this.envHasSound) {
this._effectsVol = clamp(level, 0, 1);
this.effectsGainNode.gain.value = this._effectsVol * this._allEffectsCoeff;
}
}

get heartbeatVolume() {
return this._heartbeatVol;
}
set heartbeatVolume(level: number) {
if (this.envHasSound) {
this._heartbeatVol = clamp(level, 0, 1);
this.heartbeatGainNode.gain.value = this._heartbeatVol * this._allEffectsCoeff;
}
}

get announcerVolume() {
return this._announcerVol;
}
set announcerVolume(level: number) {
if (this.envHasSound) {
this._announcerVol = clamp(level, 0, 1);
this.announcerGainNode.gain.value = this._announcerVol * this._allEffectsCoeff;
}
}

get musicVolume() {
return this._musicVol;
}

get effectsVolume() {
return this._effectsVol;
}

get heartbeatVolume() {
return this._heartbeatVol;
}

get announcerVolume() {
return this._announcerVol;
}


set allEffectsMultiplier(level: number) {
if (this.envHasSound) {
this._allEffectsCoeff = clamp(level, 0, 1);
Expand Down Expand Up @@ -209,7 +202,6 @@ export function isNullAudioBufferSourcNode(o: any) {

type SoundSysAudioBufferSourceNode = AudioBufferSourceNode | NullAudioBufferSourceNode;


export function setAudioMode(mode, soundSysInstance, uiInstance) {
currentAudioMode = mode;

Expand Down Expand Up @@ -249,4 +241,4 @@ export function cycleAudioMode(soundSysInstance: SoundSys, uiInstance: any): Aud

setAudioMode(newMode, soundSysInstance, uiInstance);
return newMode;
}
}
45 changes: 22 additions & 23 deletions src/ui/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { DEBUG_DISABLE_HOTKEYS } from '../debug';

import { cycleAudioMode, getAudioMode, AudioMode } from '../sound/soundsys';


/**
* Class UI
*
Expand Down Expand Up @@ -125,24 +124,24 @@ export class UI {
);
this.buttons.push(this.btnFullscreen);

// Audio Button
this.btnAudio = new Button(
{
$button: $j('.toggle-music-player'),
hasShortcut: true,
click: () => {
this.game.signals.ui.dispatch('toggleMusicPlayer');
},
overridefreeze: true,
},
{ isAcceptingInput: () => this.interfaceAPI.isAcceptingInput },
);
this.buttons.push(this.btnAudio);
this.btnAudio.$button.on('contextmenu', (e) => {
e.preventDefault();
const newMode = cycleAudioMode(this.game.soundsys);
this.updateAudioIcon(newMode);
});
// Audio Button
this.btnAudio = new Button(
{
$button: $j('.toggle-music-player'),
hasShortcut: true,
click: () => {
this.game.signals.ui.dispatch('toggleMusicPlayer');
},
overridefreeze: true,
},
{ isAcceptingInput: () => this.interfaceAPI.isAcceptingInput },
);
this.buttons.push(this.btnAudio);
this.btnAudio.$button.on('contextmenu', (e) => {
e.preventDefault();
const newMode = cycleAudioMode(this.game.soundsys);
this.updateAudioIcon(newMode);
});
// Skip Turn Button
this.btnSkipTurn = new Button(
{
Expand Down Expand Up @@ -1909,26 +1908,26 @@ this.btnAudio.$button.on('contextmenu', (e) => {
updateAudioIcon(mode) {
let iconKey = 'icons/audio';
let tooltipText = 'Audio: Full';

if (mode === 'sfx') {
iconKey = 'icons/SFX';
tooltipText = 'Audio: SFX';
} else if (mode === 'muted') {
iconKey = 'icons/muted';
tooltipText = 'Audio: Muted';
}

const iconUrl = getUrl(iconKey);
const $audioImg = $j('#audio img');
if ($audioImg.length) {
$audioImg.attr('src', iconUrl);
}

const $tooltip = $j('#audio-tooltip');
if ($tooltip.length) {
$tooltip.text(tooltipText);
}
}
}
updateAbilityUpgrades() {
const game = this.game,
creature = game.activeCreature;
Expand Down
4 changes: 2 additions & 2 deletions src/utility/hexgrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1687,8 +1687,8 @@ export class HexGrid {
(!player.flipped
? creatureData.display['offset-x']
: HEX_WIDTH_PX * creatureData.size -
preview.texture.width -
creatureData.display['offset-x']) +
preview.texture.width -
creatureData.display['offset-x']) +
preview.texture.width / 2;
preview.y = hex.displayPos.y + creatureData.display['offset-y'] + preview.texture.height;
preview.alpha = 0.5;
Expand Down
Loading