From e9f38e53b77c89afbe6a2c50c9fe3219a5437ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=BF=88=E1=B1=A8=E2=98=BF=EA=97=87=F0=9D=95=AD=E0=BC=88?= =?UTF-8?q?=E0=BF=82=E0=BF=88?= <153254701+faraon-bot@users.noreply.github.com> Date: Tue, 31 Dec 2024 01:02:26 -0600 Subject: [PATCH] Add character speed and attack Add character class with speed and attack properties and methods to increase them. * **Character Class** - Create `Character` class with `speed` and `attack` properties. - Add methods `increaseSpeed` and `increaseAttack` to increase speed and attack respectively. * **Character Tests** - Add tests for `increaseSpeed` and `increaseAttack` methods in `character.test.ts`. * **Character Styles** - Add CSS styles for character, speed indicator, and attack indicator in `character.css`. * **Character HTML** - Add HTML structure to display character with speed and attack indicators in `character.html`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/vscode/tree/169?shareId=XXXX-XXXX-XXXX-XXXX). --- .../workbench/contrib/character/character.css | 22 +++++++++++++++++++ .../contrib/character/character.html | 16 ++++++++++++++ .../contrib/character/character.test.ts | 19 ++++++++++++++++ .../workbench/contrib/character/character.ts | 17 ++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 src/vs/workbench/contrib/character/character.css create mode 100644 src/vs/workbench/contrib/character/character.html create mode 100644 src/vs/workbench/contrib/character/character.test.ts create mode 100644 src/vs/workbench/contrib/character/character.ts diff --git a/src/vs/workbench/contrib/character/character.css b/src/vs/workbench/contrib/character/character.css new file mode 100644 index 0000000000000..7352f63f8f1ad --- /dev/null +++ b/src/vs/workbench/contrib/character/character.css @@ -0,0 +1,22 @@ +.character { + display: flex; + flex-direction: column; + align-items: center; +} + +.speed-indicator, +.attack-indicator { + margin: 5px; + padding: 10px; + border: 1px solid #000; + border-radius: 5px; + background-color: #f0f0f0; +} + +.speed-indicator { + color: #007bff; +} + +.attack-indicator { + color: #dc3545; +} diff --git a/src/vs/workbench/contrib/character/character.html b/src/vs/workbench/contrib/character/character.html new file mode 100644 index 0000000000000..c9b7311225a08 --- /dev/null +++ b/src/vs/workbench/contrib/character/character.html @@ -0,0 +1,16 @@ + + + + + + Character + + + +
+
Speed: 10
+
Attack: 5
+
+ + + diff --git a/src/vs/workbench/contrib/character/character.test.ts b/src/vs/workbench/contrib/character/character.test.ts new file mode 100644 index 0000000000000..4994126529a23 --- /dev/null +++ b/src/vs/workbench/contrib/character/character.test.ts @@ -0,0 +1,19 @@ +import { Character } from './character'; + +describe('Character', () => { + let character: Character; + + beforeEach(() => { + character = new Character(10, 5); + }); + + it('should increase speed', () => { + character.increaseSpeed(5); + assert.equal(character.speed, 15); + }); + + it('should increase attack', () => { + character.increaseAttack(3); + assert.equal(character.attack, 8); + }); +}); diff --git a/src/vs/workbench/contrib/character/character.ts b/src/vs/workbench/contrib/character/character.ts new file mode 100644 index 0000000000000..44cfd7351844f --- /dev/null +++ b/src/vs/workbench/contrib/character/character.ts @@ -0,0 +1,17 @@ +export class Character { + speed: number; + attack: number; + + constructor(speed: number, attack: number) { + this.speed = speed; + this.attack = attack; + } + + increaseSpeed(amount: number): void { + this.speed += amount; + } + + increaseAttack(amount: number): void { + this.attack += amount; + } +}