From 4d1e0e5e2395eeb5f1dba8c6d646ec385aae17b5 Mon Sep 17 00:00:00 2001
From: VladimirLezhnin <115662980+VladimirLezhnin@users.noreply.github.com>
Date: Tue, 19 Mar 2024 17:38:49 +0500
Subject: [PATCH 1/6] FirstTask
---
.idea/.gitignore | 5 ++
.idea/modules.xml | 8 +++
.idea/vcs.xml | 6 ++
.idea/west.iml | 12 ++++
package-lock.json | 149 +++++++++++++++++++++++++++++++++-------------
src/TaskQueue.js | 92 ++++++++++++++--------------
6 files changed, 184 insertions(+), 88 deletions(-)
create mode 100644 .idea/.gitignore
create mode 100644 .idea/modules.xml
create mode 100644 .idea/vcs.xml
create mode 100644 .idea/west.iml
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..b58b603
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,5 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..e0e865a
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/west.iml b/.idea/west.iml
new file mode 100644
index 0000000..24643cc
--- /dev/null
+++ b/.idea/west.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 62879f0..1ba4a4a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,81 +1,117 @@
{
"name": "west",
"version": "0.0.1",
- "lockfileVersion": 1,
+ "lockfileVersion": 3,
"requires": true,
- "dependencies": {
- "async": {
+ "packages": {
+ "": {
+ "name": "west",
+ "version": "0.0.1",
+ "dependencies": {
+ "http-server": "^0.12.3"
+ }
+ },
+ "node_modules/async": {
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
"integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",
- "requires": {
+ "dependencies": {
"lodash": "^4.17.14"
}
},
- "basic-auth": {
+ "node_modules/basic-auth": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-1.1.0.tgz",
- "integrity": "sha1-RSIe5Cn37h5QNb4/UVM/HN/SmIQ="
+ "integrity": "sha1-RSIe5Cn37h5QNb4/UVM/HN/SmIQ=",
+ "engines": {
+ "node": ">= 0.6"
+ }
},
- "colors": {
+ "node_modules/colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
- "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="
+ "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
+ "engines": {
+ "node": ">=0.1.90"
+ }
},
- "corser": {
+ "node_modules/corser": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
- "integrity": "sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c="
+ "integrity": "sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c=",
+ "engines": {
+ "node": ">= 0.4.0"
+ }
},
- "debug": {
+ "node_modules/debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
- "requires": {
+ "deprecated": "Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)",
+ "dependencies": {
"ms": "^2.1.1"
}
},
- "ecstatic": {
+ "node_modules/ecstatic": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-3.3.2.tgz",
"integrity": "sha512-fLf9l1hnwrHI2xn9mEDT7KIi22UDqA2jaCwyCbSUJh9a1V+LEUSL/JO/6TIz/QyuBURWUHrFL5Kg2TtO1bkkog==",
- "requires": {
+ "deprecated": "This package is unmaintained and deprecated. See the GH Issue 259.",
+ "dependencies": {
"he": "^1.1.1",
"mime": "^1.6.0",
"minimist": "^1.1.0",
"url-join": "^2.0.5"
+ },
+ "bin": {
+ "ecstatic": "lib/ecstatic.js"
}
},
- "eventemitter3": {
+ "node_modules/eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
},
- "follow-redirects": {
+ "node_modules/follow-redirects": {
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz",
- "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA=="
+ "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "engines": {
+ "node": ">=4.0"
+ }
},
- "he": {
+ "node_modules/he": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
- "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
+ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
+ "bin": {
+ "he": "bin/he"
+ }
},
- "http-proxy": {
+ "node_modules/http-proxy": {
"version": "1.18.1",
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
"integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
- "requires": {
+ "dependencies": {
"eventemitter3": "^4.0.0",
"follow-redirects": "^1.0.0",
"requires-port": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
}
},
- "http-server": {
+ "node_modules/http-server": {
"version": "0.12.3",
"resolved": "https://registry.npmjs.org/http-server/-/http-server-0.12.3.tgz",
"integrity": "sha512-be0dKG6pni92bRjq0kvExtj/NrrAd28/8fCXkaI/4piTwQMSDSLMhWyW0NI1V+DBI3aa1HMlQu46/HjVLfmugA==",
- "requires": {
+ "dependencies": {
"basic-auth": "^1.0.3",
"colors": "^1.4.0",
"corser": "^2.0.1",
@@ -86,75 +122,106 @@
"portfinder": "^1.0.25",
"secure-compare": "3.0.1",
"union": "~0.5.0"
+ },
+ "bin": {
+ "hs": "bin/http-server",
+ "http-server": "bin/http-server"
+ },
+ "engines": {
+ "node": ">=6"
}
},
- "lodash": {
+ "node_modules/lodash": {
"version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
},
- "mime": {
+ "node_modules/mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
- "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=4"
+ }
},
- "minimist": {
+ "node_modules/minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
- "mkdirp": {
+ "node_modules/mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
- "requires": {
+ "dependencies": {
"minimist": "^1.2.5"
+ },
+ "bin": {
+ "mkdirp": "bin/cmd.js"
}
},
- "ms": {
+ "node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
- "opener": {
+ "node_modules/opener": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
- "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A=="
+ "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==",
+ "bin": {
+ "opener": "bin/opener-bin.js"
+ }
},
- "portfinder": {
+ "node_modules/portfinder": {
"version": "1.0.28",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz",
"integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==",
- "requires": {
+ "dependencies": {
"async": "^2.6.2",
"debug": "^3.1.1",
"mkdirp": "^0.5.5"
+ },
+ "engines": {
+ "node": ">= 0.12.0"
}
},
- "qs": {
+ "node_modules/qs": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.4.tgz",
- "integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ=="
+ "integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ==",
+ "engines": {
+ "node": ">=0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
},
- "requires-port": {
+ "node_modules/requires-port": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
},
- "secure-compare": {
+ "node_modules/secure-compare": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz",
"integrity": "sha1-8aAymzCLIh+uN7mXTz1XjQypmeM="
},
- "union": {
+ "node_modules/union": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz",
"integrity": "sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==",
- "requires": {
+ "dependencies": {
"qs": "^6.4.0"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
}
},
- "url-join": {
+ "node_modules/url-join": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/url-join/-/url-join-2.0.5.tgz",
"integrity": "sha1-WvIvGMBSoACkjXuCxenC4v7tpyg="
diff --git a/src/TaskQueue.js b/src/TaskQueue.js
index f3a9c6a..c689015 100644
--- a/src/TaskQueue.js
+++ b/src/TaskQueue.js
@@ -1,55 +1,53 @@
-const TaskQueue = function() {
- function TaskQueue() {
- this.tasks = [];
- this.running = false;
- }
- TaskQueue.prototype.push = function(run, dispose, duration) {
- if (duration === undefined || duration === null) {
- this.tasks.push({runAndContinue: run, dispose});
- } else {
- this.tasks.push({
- runAndContinue: (continuation) => {
- run();
- setTimeout(() => {
- continuation();
- }, duration);
- },
- dispose
- });
- }
- runNextTask(this);
- };
+function runNextTask(taskQueue) {
+ if (taskQueue.running || taskQueue.tasks.length === 0) {
+ return;
+ }
+ taskQueue.running = true;
+ const task = taskQueue.tasks.shift();
- TaskQueue.prototype.continueWith = function(action) {
- this.push(action, null, 0);
- };
+ if (task.runAndContinue) {
+ setTimeout(() => {
+ task.runAndContinue(() => {
+ task.dispose && task.dispose();
+ taskQueue.running = false;
- function runNextTask(taskQueue) {
- if (taskQueue.running || taskQueue.tasks.length === 0) {
- return;
- }
- taskQueue.running = true;
- const task = taskQueue.tasks.shift();
+ setTimeout(() => {
+ runNextTask(taskQueue);
+ });
+ });
+ }, 0);
+ }
+ else {
+ runNextTask(taskQueue);
+ }
+}
- if (task.runAndContinue) {
- setTimeout(() => {
- task.runAndContinue(() => {
- task.dispose && task.dispose();
- taskQueue.running = false;
+export default class TaskQueue {
- setTimeout(() => {
- runNextTask(taskQueue);
- });
- });
- }, 0);
- }
- else {
- runNextTask(taskQueue);
- }
+ constructor() {
+ this.tasks = [];
+ this.running = false;
}
+}
- return TaskQueue;
-}();
+TaskQueue.prototype.push = function(run, dispose, duration) {
+ if (duration === undefined || duration === null) {
+ this.tasks.push({runAndContinue: run, dispose});
+ } else {
+ this.tasks.push({
+ runAndContinue: (continuation) => {
+ run();
+ setTimeout(() => {
+ continuation();
+ }, duration);
+ },
+ dispose
+ });
+ }
+ runNextTask(this);
+};
-export default TaskQueue;
+TaskQueue.prototype.continueWith = function(action) {
+ this.push(action, null, 0);
+};
From cd1fb4def27aedf43e56e2ccd58eb0e5acc95dca Mon Sep 17 00:00:00 2001
From: Vearsmon
Date: Tue, 19 Mar 2024 17:56:19 +0500
Subject: [PATCH 2/6] task 2
---
src/index.js | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/index.js b/src/index.js
index a01f912..e8b426e 100644
--- a/src/index.js
+++ b/src/index.js
@@ -30,27 +30,36 @@ function getCreatureDescription(card) {
// Основа для утки.
-function Duck() {
- this.quacks = function () { console.log('quack') };
- this.swims = function () { console.log('float: both;') };
+class Duck extends Card {
+ constructor() {
+ super('Мирная утка', 2);
+ }
}
+Duck.prototype.quacks = function () { console.log('quack') };
+Duck.prototype.swims = function () { console.log('float: both;') };
+
// Основа для собаки.
-function Dog() {
+class Dog extends Card {
+ constructor() {
+ super('Пес-бандит', 3);
+ }
}
// Колода Шерифа, нижнего игрока.
const seriffStartDeck = [
- new Card('Мирный житель', 2),
- new Card('Мирный житель', 2),
- new Card('Мирный житель', 2),
+ new Duck(),
+ new Duck(),
+ new Duck()
];
// Колода Бандита, верхнего игрока.
const banditStartDeck = [
- new Card('Бандит', 3),
+ new Dog(),
+ new Dog(),
+ new Dog()
];
From 892a77bc7cdde40081ecc7174bb7d2a77701cff8 Mon Sep 17 00:00:00 2001
From: VladimirLezhnin <115662980+VladimirLezhnin@users.noreply.github.com>
Date: Tue, 19 Mar 2024 18:35:02 +0500
Subject: [PATCH 3/6] Task3
---
src/index.js | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/index.js b/src/index.js
index e8b426e..2434a5e 100644
--- a/src/index.js
+++ b/src/index.js
@@ -3,12 +3,10 @@ import Game from './Game.js';
import TaskQueue from './TaskQueue.js';
import SpeedRate from './SpeedRate.js';
-// Отвечает является ли карта уткой.
function isDuck(card) {
return card && card.quacks && card.swims;
}
-// Отвечает является ли карта собакой.
function isDog(card) {
return card instanceof Dog;
}
@@ -27,10 +25,22 @@ function getCreatureDescription(card) {
return 'Существо';
}
+class Creature extends Card {
+ constructor(name, power) {
+ super(name, power, null);
+ }
+}
+
+Creature.prototype.getDescriptions = function () {
+ let arr = [];
+ arr.push(getCreatureDescription(this));
+ arr.push(Object.getPrototypeOf(Creature.prototype).getDescriptions.call(this));
+ return arr;
+}
// Основа для утки.
-class Duck extends Card {
+class Duck extends Creature {
constructor() {
super('Мирная утка', 2);
}
@@ -40,8 +50,7 @@ Duck.prototype.quacks = function () { console.log('quack') };
Duck.prototype.swims = function () { console.log('float: both;') };
-// Основа для собаки.
-class Dog extends Card {
+class Dog extends Creature {
constructor() {
super('Пес-бандит', 3);
}
@@ -52,7 +61,8 @@ class Dog extends Card {
const seriffStartDeck = [
new Duck(),
new Duck(),
- new Duck()
+ new Duck(),
+ new Card('sos', 1)
];
// Колода Бандита, верхнего игрока.
From 92679e73135f6d4347ba202c9577b5cfbab61b53 Mon Sep 17 00:00:00 2001
From: Vearsmon
Date: Tue, 19 Mar 2024 18:53:13 +0500
Subject: [PATCH 4/6] task 4
---
src/index.js | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/index.js b/src/index.js
index 2434a5e..e7edcfc 100644
--- a/src/index.js
+++ b/src/index.js
@@ -51,25 +51,34 @@ Duck.prototype.swims = function () { console.log('float: both;') };
class Dog extends Creature {
+ constructor(name = 'Пес-бандит', pow = 3) {
+ super(name, pow);
+ }
+}
+
+class Trasher extends Dog {
constructor() {
- super('Пес-бандит', 3);
+ super('Громила', 5);
}
+
+ modifyTakenDamage(value, fromCard, gameContext, continuation) {
+ this.view.signalAbility(() => {super.modifyTakenDamage(value - 1, fromCard, gameContext, continuation); })
+ };
+
+ getDescriptions() {
+ return ["-1 к получаемому урону", ...super.getDescriptions()];
+ };
}
-// Колода Шерифа, нижнего игрока.
const seriffStartDeck = [
new Duck(),
new Duck(),
new Duck(),
- new Card('sos', 1)
+ new Duck(),
];
-
-// Колода Бандита, верхнего игрока.
const banditStartDeck = [
- new Dog(),
- new Dog(),
- new Dog()
+ new Trasher(),
];
From 6eaf89c0dc8d2d2dbdaab073dd3c499154af99cf Mon Sep 17 00:00:00 2001
From: Vearsmon
Date: Tue, 19 Mar 2024 19:21:05 +0500
Subject: [PATCH 5/6] task 6
---
src/index.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/src/index.js b/src/index.js
index e7edcfc..d6872a1 100644
--- a/src/index.js
+++ b/src/index.js
@@ -70,15 +70,61 @@ class Trasher extends Dog {
};
}
+class Lad extends Dog {
+ constructor(name='Браток', pow=2) {
+ super(name, pow);
+ }
+
+ static getInGameCount() {
+ return this.inGameCount || 0;
+ }
+
+ static setInGameCount(value) {
+ this.inGameCount = value;
+ }
+
+ doAfterComingIntoPlay(gameContext, continuation) {
+ const {currentPlayer, oppositePlayer, position, updateView} = gameContext;
+ Lad.inGameCount += 1;
+ continuation();
+ }
+
+ doBeforeRemoving(continuation) {
+ Lad.inGameCount -= 1;
+ continuation();
+ }
+
+ static getBonus() {
+ return this.inGameCount * (this.inGameCount + 1) / 2;
+ }
+
+ modifyDealedDamageToCreature(value, toCard, gameContext, continuation) {
+ continuation(value + (Lad.getBonus() || 0));
+ }
+
+ modifyTakenDamage(value, fromCard, gameContext, continuation) {
+ continuation(value - (Lad.getBonus() || 0));
+ }
+
+ getDescriptions() {
+ if (Lad.prototype.hasOwnProperty('modifyDealedDamageToCreature'))
+ return ['Чем их больше, тем они сильнее', ...super.getDescriptions()]
+ return super.getDescriptions()
+ }
+}
const seriffStartDeck = [
new Duck(),
new Duck(),
new Duck(),
new Duck(),
+ new Duck(),
];
const banditStartDeck = [
new Trasher(),
+ new Lad(),
+ new Lad(),
+ new Lad(),
];
From 73d159b1c2b229d8e1217a7114541bbf3cf9f34e Mon Sep 17 00:00:00 2001
From: Vearsmon
Date: Tue, 19 Mar 2024 19:32:35 +0500
Subject: [PATCH 6/6] task 5 by Vladimir
---
src/index.js | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/index.js b/src/index.js
index d6872a1..971d09f 100644
--- a/src/index.js
+++ b/src/index.js
@@ -70,6 +70,30 @@ class Trasher extends Dog {
};
}
+class Gatling extends Creature {
+
+ constructor() {
+ super('Гатлинг', 6);
+ }
+
+ attack(gameContext, continuation) {
+ const taskQueue = new TaskQueue();
+ const {currentPlayer, oppositePlayer, position, updateView} = gameContext;
+ let table = gameContext.oppositePlayer.table;
+ for(let i = 0; i < table.length; i++) {
+ taskQueue.push(onDone => this.view.showAttack(onDone));
+ taskQueue.push(onDone => {
+ const oppositeCard = oppositePlayer.table[i];
+ if (oppositeCard) {
+ this.dealDamageToCreature(2, oppositeCard, gameContext, onDone);
+ }
+ });
+ }
+ taskQueue.continueWith(continuation);
+ }
+}
+
+
class Lad extends Dog {
constructor(name='Браток', pow=2) {
super(name, pow);