bastion-siege-logic
Advanced tools
Comparing version 2.4.4 to 2.5.0
@@ -22,5 +22,5 @@ "use strict"; | ||
const raw = { | ||
gold: (_a = regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.gold}`), (_a !== null && _a !== void 0 ? _a : 0)), | ||
gold: (_a = regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.gold}`)) !== null && _a !== void 0 ? _a : 0, | ||
gems: regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.gem}`), | ||
terra: (_b = regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.terra}`), (_b !== null && _b !== void 0 ? _b : 0)), | ||
terra: (_b = regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.terra}`)) !== null && _b !== void 0 ? _b : 0, | ||
karma: regexHelper.getOptionalNumber(content, `(-?\\d+)${emoji_1.EMOJI.karma}`) | ||
@@ -129,3 +129,3 @@ }; | ||
// Won attacks against 0 karma targets grant 0 karma | ||
battlereport.karma = (_a = raw.karma, (_a !== null && _a !== void 0 ? _a : 0)); | ||
battlereport.karma = (_a = raw.karma) !== null && _a !== void 0 ? _a : 0; | ||
} | ||
@@ -150,4 +150,4 @@ else if (raw.karma) { | ||
return { | ||
enemies: (_a = raw.losers, (_a !== null && _a !== void 0 ? _a : [raw.enemy])), | ||
friends: (_b = raw.winners, (_b !== null && _b !== void 0 ? _b : [raw.me])), | ||
enemies: (_a = raw.losers) !== null && _a !== void 0 ? _a : [raw.enemy], | ||
friends: (_b = raw.winners) !== null && _b !== void 0 ? _b : [raw.me], | ||
me: raw.me | ||
@@ -157,4 +157,4 @@ }; | ||
return { | ||
enemies: (_c = raw.winners, (_c !== null && _c !== void 0 ? _c : [raw.enemy])), | ||
friends: (_d = raw.losers, (_d !== null && _d !== void 0 ? _d : [raw.me])), | ||
enemies: (_c = raw.winners) !== null && _c !== void 0 ? _c : [raw.enemy], | ||
friends: (_d = raw.losers) !== null && _d !== void 0 ? _d : [raw.me], | ||
me: raw.me | ||
@@ -161,0 +161,0 @@ }; |
@@ -39,9 +39,9 @@ "use strict"; | ||
townhall: regexHelper.getNumberStrict(content, `${emoji_1.EMOJI.townhall}\\s+(\\d+)`), | ||
storage: (_a = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.storage}\\s+(\\d+)`), (_a !== null && _a !== void 0 ? _a : 0)), | ||
storage: (_a = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.storage}\\s+(\\d+)`)) !== null && _a !== void 0 ? _a : 0, | ||
houses: regexHelper.getNumberStrict(content, `${emoji_1.EMOJI.houses}\\s+(\\d+)`), | ||
farm: (_b = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.farm}\\s+(\\d+)`), (_b !== null && _b !== void 0 ? _b : 0)), | ||
sawmill: (_c = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.sawmill}\\s+(\\d+)`), (_c !== null && _c !== void 0 ? _c : 0)), | ||
mine: (_d = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.mine}\\s+(\\d+)`), (_d !== null && _d !== void 0 ? _d : 0)), | ||
barracks: (_e = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.barracks}\\s+(\\d+)`), (_e !== null && _e !== void 0 ? _e : 0)), | ||
wall: (_f = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.wall}\\s+(\\d+)`), (_f !== null && _f !== void 0 ? _f : 0)) | ||
farm: (_b = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.farm}\\s+(\\d+)`)) !== null && _b !== void 0 ? _b : 0, | ||
sawmill: (_c = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.sawmill}\\s+(\\d+)`)) !== null && _c !== void 0 ? _c : 0, | ||
mine: (_d = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.mine}\\s+(\\d+)`)) !== null && _d !== void 0 ? _d : 0, | ||
barracks: (_e = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.barracks}\\s+(\\d+)`)) !== null && _e !== void 0 ? _e : 0, | ||
wall: (_f = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.wall}\\s+(\\d+)`)) !== null && _f !== void 0 ? _f : 0 | ||
}; | ||
@@ -55,4 +55,4 @@ return { buildings }; | ||
const workshop = { | ||
trebuchet: (_a = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.trebuchet}${gametext_1.GAMETEXT.trebuchet.en}\\s+(\\d+)`), (_a !== null && _a !== void 0 ? _a : 0)), | ||
ballista: (_b = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.ballista}${gametext_1.GAMETEXT.ballista.en}\\s+(\\d+)`), (_b !== null && _b !== void 0 ? _b : 0)) | ||
trebuchet: (_a = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.trebuchet}${gametext_1.GAMETEXT.trebuchet.en}\\s+(\\d+)`)) !== null && _a !== void 0 ? _a : 0, | ||
ballista: (_b = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.ballista}${gametext_1.GAMETEXT.ballista.en}\\s+(\\d+)`)) !== null && _b !== void 0 ? _b : 0 | ||
}; | ||
@@ -63,4 +63,4 @@ return { workshop }; | ||
const workshop = { | ||
trebuchet: (_c = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.trebuchet}${gametext_1.GAMETEXT.trebuchet.ru}\\s+(\\d+)`), (_c !== null && _c !== void 0 ? _c : 0)), | ||
ballista: (_d = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.ballista}${gametext_1.GAMETEXT.ballista.ru}\\s+(\\d+)`), (_d !== null && _d !== void 0 ? _d : 0)) | ||
trebuchet: (_c = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.trebuchet}${gametext_1.GAMETEXT.trebuchet.ru}\\s+(\\d+)`)) !== null && _c !== void 0 ? _c : 0, | ||
ballista: (_d = regexHelper.getOptionalNumber(content, `${emoji_1.EMOJI.ballista}${gametext_1.GAMETEXT.ballista.ru}\\s+(\\d+)`)) !== null && _d !== void 0 ? _d : 0 | ||
}; | ||
@@ -67,0 +67,0 @@ return { workshop }; |
@@ -98,3 +98,2 @@ "use strict"; | ||
function joined(input) { | ||
var _a; | ||
const content = text_cleanup_1.inputTextCleanup(input); | ||
@@ -105,3 +104,3 @@ const info = castle_1.determineCastle(content); | ||
type: 'castleSiegeYouJoined', | ||
castle: (_a = info) === null || _a === void 0 ? void 0 : _a.castle | ||
castle: info === null || info === void 0 ? void 0 : info.castle | ||
}; | ||
@@ -108,0 +107,0 @@ } |
@@ -63,5 +63,5 @@ "use strict"; | ||
return { | ||
karma: (_a = regexHelper.getOptionalNumber(content, `(-?\\d+)${emoji_1.EMOJI.karma}`), (_a !== null && _a !== void 0 ? _a : 0)), | ||
terra: (_b = regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.terra}`), (_b !== null && _b !== void 0 ? _b : 0)), | ||
wins: (_c = regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.wins}`), (_c !== null && _c !== void 0 ? _c : 0)) | ||
karma: (_a = regexHelper.getOptionalNumber(content, `(-?\\d+)${emoji_1.EMOJI.karma}`)) !== null && _a !== void 0 ? _a : 0, | ||
terra: (_b = regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.terra}`)) !== null && _b !== void 0 ? _b : 0, | ||
wins: (_c = regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.wins}`)) !== null && _c !== void 0 ? _c : 0 | ||
}; | ||
@@ -68,0 +68,0 @@ } |
@@ -113,3 +113,3 @@ "use strict"; | ||
if (isEnglish || isRussian) { | ||
const karma = (_a = regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.karma}`), (_a !== null && _a !== void 0 ? _a : 0)); | ||
const karma = (_a = regexHelper.getOptionalNumber(content, `(\\d+)${emoji_1.EMOJI.karma}`)) !== null && _a !== void 0 ? _a : 0; | ||
const terra = regexHelper.getNumberStrict(content, `(\\d+)${emoji_1.EMOJI.terra}`); | ||
@@ -116,0 +116,0 @@ if (isEnglish) { |
@@ -25,2 +25,3 @@ import { Buildings } from './buildings'; | ||
export declare function calcSemitotalGoldIncome(buildings: Buildings): number; | ||
export declare function calcNeeded(cost: ConstructionResources, currentResources: ConstructionResources): ConstructionResources; | ||
export declare function calcMinutesNeeded(cost: ConstructionResources, buildings: Buildings, currentResources: ConstructionResources): number; | ||
@@ -27,0 +28,0 @@ export declare function calcMinutesNeededToFillStorage(buildings: Buildings, currentResources: Resources): number; |
@@ -47,2 +47,10 @@ "use strict"; | ||
exports.calcSemitotalGoldIncome = calcSemitotalGoldIncome; | ||
function calcNeeded(cost, currentResources) { | ||
return { | ||
gold: Math.max(0, cost.gold - currentResources.gold), | ||
wood: Math.max(0, cost.wood - currentResources.wood), | ||
stone: Math.max(0, cost.stone - currentResources.stone) | ||
}; | ||
} | ||
exports.calcNeeded = calcNeeded; | ||
function calcMinutesNeeded(cost, buildings, currentResources) { | ||
@@ -49,0 +57,0 @@ const needed = { |
{ | ||
"name": "bastion-siege-logic", | ||
"version": "2.4.4", | ||
"version": "2.5.0", | ||
"description": "", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=8.3" | ||
}, | ||
@@ -38,15 +38,8 @@ "scripts": { | ||
"@types/node": "^13.1.4", | ||
"@typescript-eslint/eslint-plugin": "^2.15.0", | ||
"@typescript-eslint/parser": "^2.15.0", | ||
"ava": "^2.0.0", | ||
"ava": "^3.5.0", | ||
"del-cli": "^3.0.0", | ||
"eslint-config-xo-typescript": "^0.24.1", | ||
"nyc": "^15.0.0", | ||
"typescript": "^3.7.4", | ||
"xo": "^0.25.3" | ||
"xo": "^0.27.2" | ||
}, | ||
"ava": { | ||
"babel": false, | ||
"compileEnhancements": false | ||
}, | ||
"nyc": { | ||
@@ -53,0 +46,0 @@ "extension": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
135752
7
1922