-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
215 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// import Bitcoin from "./scripts/Bitcoin"; | ||
// import Space from "./scripts/Space"; | ||
import * as EventModules from "./events"; | ||
|
||
export default class EventsCreator { | ||
constructor() { | ||
this.events = []; | ||
} | ||
|
||
createEvent(type) { | ||
return new EventModules[type](); | ||
} | ||
|
||
createAllEvents() { | ||
Object.values(EventModules).forEach((Module) => | ||
this.events.push(new Module()) | ||
); | ||
return this.events; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default class Cars { | ||
constructor() { | ||
this.name = "cars"; | ||
this.description = | ||
"Крупнейшие мировые автоконцерны объявили о конце эры автомобилей с двигателями внутреннего сгорания. С этого года они начнут массовый выпуск электрокаров."; | ||
this.active = false; | ||
} | ||
|
||
activateEvent() { | ||
this.active = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import WorldMap from "../../assets/worldRussiaCrimeaLow.json"; | ||
|
||
export default class Dollar { | ||
constructor() { | ||
this.name = "dollar"; | ||
this.description = | ||
"Ряд стран отказалось от доллара США при заключении междуанродных сделок в пользу своих национальных валют."; | ||
this.active = false; | ||
this.countries = []; | ||
this.excludedCountries = ["RU", "US"]; | ||
} | ||
|
||
activateEvent() { | ||
Array.prototype.push.apply(this.excludedCountries, this.countries); | ||
if (this.countries.length) { | ||
Array.prototype.push.apply( | ||
this.countries, | ||
this.getRandomCountries(this.getRandom(3, 10)) | ||
); | ||
} else { | ||
this.countries = this.getRandomCountries(this.getRandom(3, 10)); | ||
} | ||
} | ||
|
||
getRandomCountries(qty) { | ||
return WorldMap.countries | ||
.map((country) => { | ||
return country.id; | ||
}) | ||
.filter((country) => !this.excludedCountries.includes(country)) | ||
.sort(() => 0.5 - Math.random()) | ||
.slice(0, qty); | ||
} | ||
|
||
getRandom(min, max) { | ||
min = Math.ceil(min); | ||
max = Math.floor(max); | ||
return Math.floor(Math.random() * (max - min + 1)) + min; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default class EconomicCrysis { | ||
constructor() { | ||
this.name = "economic-crysis"; | ||
this.description = | ||
"Мир снова охватил экономический кризис. Мировая валютная система в упадке. Доллар США и Евро резко падают в цене."; | ||
this.active = false; | ||
} | ||
|
||
activateEvent() { | ||
this.active = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default class Opec { | ||
constructor() { | ||
this.name = "opec"; | ||
this.description = | ||
"Страны ОПЕК отказываются удерживать квоты на добычу углеводородов. Цены на мировом рынке нефти и природного газа снова бьют истоический минимум."; | ||
this.active = false; | ||
} | ||
|
||
activateEvent() { | ||
this.active = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default class Sanctions { | ||
constructor() { | ||
this.name = "sanctions"; | ||
this.description = | ||
"Страны Европейского Союза отказались продлевать экономиеские санкции против России. Они снова высказывают интерес к сотрудничеству в высокотехнологичных отраслях экономики."; | ||
this.active = false; | ||
} | ||
|
||
activateEvent() { | ||
this.active = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default class SpaceX { | ||
constructor() { | ||
this.name = "space-x"; | ||
this.description = | ||
"Компания Space-X терпит колоссальные убытки. Ни один из ее коммерческих проектов не окупился. Частные инвесторы больше не хотят вкладыать деньги в космические программы."; | ||
this.active = false; | ||
} | ||
|
||
activateEvent() { | ||
this.active = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import WorldMap from "../../assets/worldRussiaCrimeaLow.json"; | ||
|
||
export default class WorkignDay { | ||
constructor() { | ||
this.name = "working-day"; | ||
this.description = | ||
"В ряде стран правительства вводят под давлением общественности законы о сокращении рабочего дня до шести часов."; | ||
this.active = false; | ||
this.countries = []; | ||
this.excludedCountries = ["RU"]; | ||
} | ||
|
||
activateEvent() { | ||
Array.prototype.push.apply(this.excludedCountries, this.countries); | ||
if (this.countries.length) { | ||
Array.prototype.push.apply( | ||
this.countries, | ||
this.getRandomCountries(this.getRandom(3, 10)) | ||
); | ||
} else { | ||
this.countries = this.getRandomCountries(this.getRandom(3, 10)); | ||
} | ||
} | ||
|
||
getRandomCountries(qty) { | ||
return WorldMap.countries | ||
.map((country) => { | ||
return country.id; | ||
}) | ||
.filter((country) => !this.excludedCountries.includes(country)) | ||
.sort(() => 0.5 - Math.random()) | ||
.slice(0, qty); | ||
} | ||
|
||
getRandom(min, max) { | ||
min = Math.ceil(min); | ||
max = Math.floor(max); | ||
return Math.floor(Math.random() * (max - min + 1)) + min; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters