bastion-siege-logic
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -17,5 +17,10 @@ export interface Buildings { | ||
} | ||
export declare type BuildingName = keyof Buildings; | ||
export declare type WorkshopName = keyof Workshop; | ||
export declare type ConstructionName = keyof Constructions; | ||
export declare const BUILDINGS: BuildingName[]; | ||
export declare const WORKSHOP: WorkshopName[]; | ||
export declare const CONSTRUCTIONS: ConstructionName[]; | ||
export declare const BUILDING_COST_FACTORS: { | ||
[key: string]: [number, number, number]; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BUILDINGS = ['townhall', 'storage', 'houses', 'farm', 'sawmill', 'mine', 'barracks', 'wall']; | ||
exports.WORKSHOP = ['trebuchet', 'ballista']; | ||
exports.CONSTRUCTIONS = [...exports.BUILDINGS, ...exports.WORKSHOP]; | ||
// Array Content: gold, wood, stone | ||
@@ -4,0 +7,0 @@ exports.BUILDING_COST_FACTORS = { |
@@ -8,2 +8,3 @@ export declare const BASTION_SIEGE_BOT_ID = 252148344; | ||
export * from './buildings'; | ||
export * from './gamescreen'; | ||
export * from './resources'; |
@@ -13,3 +13,4 @@ "use strict"; | ||
__export(require("./buildings")); | ||
__export(require("./gamescreen")); | ||
__export(require("./resources")); | ||
//# sourceMappingURL=index.js.map |
@@ -13,2 +13,6 @@ import { Buildings } from './buildings'; | ||
} | ||
export declare type ConstructionResourceName = keyof ConstructionResources; | ||
export declare type ResourceName = keyof Resources; | ||
export declare const CONSTRUCTION_RESOURCES: ConstructionResourceName[]; | ||
export declare const RESOURCES: ResourceName[]; | ||
export declare function calcGoldCapacity(townhallLevel: number): number; | ||
@@ -25,1 +29,2 @@ export declare function calcStorageCapacity(storageLevel: number): number; | ||
export declare function estimateResourcesAfter(currentResources: Resources, buildings: Buildings, minutes: number): Resources; | ||
export declare function calcResourcesAfterConstruction(before: Resources, cost: ConstructionResources): Resources; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CONSTRUCTION_RESOURCES = ['gold', 'wood', 'stone']; | ||
exports.RESOURCES = ['gold', 'wood', 'stone', 'food']; | ||
function calcGoldCapacity(townhallLevel) { | ||
@@ -116,2 +118,16 @@ return 500000 * townhallLevel; | ||
exports.estimateResourcesAfter = estimateResourcesAfter; | ||
// Gold can be negative afterwards! | ||
function calcResourcesAfterConstruction(before, cost) { | ||
const result = { gold: 0, wood: 0, stone: 0, food: before.food }; | ||
for (const r of exports.CONSTRUCTION_RESOURCES) { | ||
result[r] = before[r] - cost[r]; | ||
if (result[r] < 0 && r !== 'gold') { | ||
// Add negative -> reduce gold | ||
result.gold += result[r] * 2; | ||
result[r] = 0; | ||
} | ||
} | ||
return result; | ||
} | ||
exports.calcResourcesAfterConstruction = calcResourcesAfterConstruction; | ||
//# sourceMappingURL=resources.js.map |
{ | ||
"name": "bastion-siege-logic", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,3 +0,9 @@ | ||
# Bastion Siege Logic [![Build Status](https://travis-ci.com/EdJoPaTo/bastion-siege-logic.svg?branch=master)](https://travis-ci.com/EdJoPaTo/bastion-siege-logic) | ||
# Bastion Siege Logic | ||
[![NPM Version](https://img.shields.io/npm/v/bastion-siege-logic.svg)](https://www.npmjs.com/package/bastion-siege-logic) | ||
[![node](https://img.shields.io/node/v/bastion-siege-logic.svg)](https://www.npmjs.com/package/bastion-siege-logic) | ||
[![Build Status](https://travis-ci.com/EdJoPaTo/bastion-siege-logic.svg?branch=master)](https://travis-ci.com/EdJoPaTo/bastion-siege-logic) | ||
[![Dependency Status](https://david-dm.org/EdJoPaTo/bastion-siege-logic/status.svg)](https://david-dm.org/EdJoPaTo/bastion-siege-logic) | ||
[![Dev Dependency Status](https://david-dm.org/EdJoPaTo/bastion-siege-logic/dev-status.svg)](https://david-dm.org/EdJoPaTo/bastion-siege-logic?type=dev) | ||
This project contains what I reverse engineered about the logic of [BastionSiege](https://telegram.me/BastionSiegeBot?start=ab4b7ba6256a86b6), a Telegram Game made by [@DorianPeregrim](https://t.me/DorianPeregrim). | ||
@@ -4,0 +10,0 @@ |
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
44532
36
564
24