From 7577e295412655f4c494e26831be3fb86f5e60b8 Mon Sep 17 00:00:00 2001 From: joe boone Date: Mon, 30 Sep 2024 23:36:21 +0200 Subject: [PATCH 1/9] Added Ghost balloon --- resources/balloons/ghost/balloon.svg | 67 ++++++++++++++++++++++++++++ src/balloons/ghost.ts | 18 ++++++++ src/balloons/index.ts | 3 +- tests/balloons/ghost.test.ts | 23 ++++++++++ 4 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 resources/balloons/ghost/balloon.svg create mode 100644 src/balloons/ghost.ts create mode 100644 tests/balloons/ghost.test.ts diff --git a/resources/balloons/ghost/balloon.svg b/resources/balloons/ghost/balloon.svg new file mode 100644 index 0000000..76dddb1 --- /dev/null +++ b/resources/balloons/ghost/balloon.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/balloons/ghost.ts b/src/balloons/ghost.ts new file mode 100644 index 0000000..e060036 --- /dev/null +++ b/src/balloons/ghost.ts @@ -0,0 +1,18 @@ +import Default, { BalloonOptions } from './default'; + +export default class Ghost extends Default { + public static readonly spawn_chance: number = 0.1; + // @ts-ignore + public get name(): 'ghost' { + return 'ghost'; + } + + public get options(): BalloonOptions { + return { + ...super.options, + imageUrl: 'balloon.svg', + riseDuration: [15000, 20000], + swingDuration: [3, 4], + }; + } +} \ No newline at end of file diff --git a/src/balloons/index.ts b/src/balloons/index.ts index 0f1a3a0..5b797d4 100644 --- a/src/balloons/index.ts +++ b/src/balloons/index.ts @@ -2,4 +2,5 @@ export { default as Default } from './default'; export { default as Confetti } from './confetti'; export { default as Gold } from './gold'; export { default as Splitter } from './splitter'; -export { default as Fast } from './fast'; \ No newline at end of file +export { default as Fast } from './fast'; +export { default as Ghost } from './ghost'; \ No newline at end of file diff --git a/tests/balloons/ghost.test.ts b/tests/balloons/ghost.test.ts new file mode 100644 index 0000000..58e7b23 --- /dev/null +++ b/tests/balloons/ghost.test.ts @@ -0,0 +1,23 @@ +import { Ghost } from '@/balloons'; +import fetchMock from 'jest-fetch-mock'; + +fetchMock.enableMocks(); + +describe('Ghost Balloon', () => { + let balloon: Ghost; + + beforeEach(() => { + balloon = new Ghost(); + + fetchMock.resetMocks(); + }); + + test('name should be "ghost"', () => { + expect(balloon.name).toBe('ghost'); + }); + + test('name should be the same as the class name', () => { + expect(balloon.name).toBe('ghost'); + expect(balloon.name).toBe(Ghost.name.toLowerCase()); + }); +}); From 5fc8b400094b1e19bbd040bb165311c0941496ff Mon Sep 17 00:00:00 2001 From: joe boone Date: Mon, 30 Sep 2024 23:38:07 +0200 Subject: [PATCH 2/9] increased the speed of the Fast balloon --- src/balloons/fast.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/balloons/fast.ts b/src/balloons/fast.ts index 43597cd..ffc9e28 100644 --- a/src/balloons/fast.ts +++ b/src/balloons/fast.ts @@ -12,7 +12,7 @@ export default class Fast extends Default { return { ...super.options, imageUrl: 'balloon.svg', - riseDuration: [5000, 7500], + riseDuration: [2000, 4000], size: [65, 75], }; } From 5ddacb13fc3408733c3400e7b308944e0fc37903 Mon Sep 17 00:00:00 2001 From: joe boone Date: Wed, 2 Oct 2024 17:50:04 +0200 Subject: [PATCH 3/9] - fixed fast balloon speed - more comments on ghost balloon.svg - option changes to ghost.ts --- resources/balloons/ghost/balloon.svg | 11 +++++------ src/balloons/fast.ts | 2 +- src/balloons/ghost.ts | 2 ++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/resources/balloons/ghost/balloon.svg b/resources/balloons/ghost/balloon.svg index 76dddb1..7ee0eb5 100644 --- a/resources/balloons/ghost/balloon.svg +++ b/resources/balloons/ghost/balloon.svg @@ -3,16 +3,15 @@ - Date: Wed, 16 Oct 2024 13:32:27 +0200 Subject: [PATCH 4/9] fixes + docs --- docs/README.md | 2 ++ docs/balloons/ghost.md | 21 +++++++++++++++++++++ resources/balloons/ghost/balloon.svg | 14 +++++++++----- src/balloons/ghost.ts | 1 - 4 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 docs/balloons/ghost.md diff --git a/docs/README.md b/docs/README.md index e2920c2..97a2d95 100644 --- a/docs/README.md +++ b/docs/README.md @@ -278,6 +278,7 @@ title Balloon spawn chances "Confetti" : 0.10 "Fast": 0.10 "Gold": 0.05 + "Ghost": 0.10 ``` ## Inheritance Tree @@ -291,6 +292,7 @@ Default --|> Balloon Confetti --|> Default Fast --|> Default Gold --|> Default +Ghost --|> Default Splitter --|> Default ``` diff --git a/docs/balloons/ghost.md b/docs/balloons/ghost.md new file mode 100644 index 0000000..d853eb5 --- /dev/null +++ b/docs/balloons/ghost.md @@ -0,0 +1,21 @@ +# Ghost + +This is a balloon spawned from the spiritworld. Just like a ghost this balloon sways from side to side en turns slightly invisible. + +```mermaid +classDiagram +direction LR +class Balloon { <> } +click Balloon href "#abstract-balloon-class" "Abstract balloon class" + +class Ghost { + +spawn_chance: number$ + +<< get >>name: string + +<< get >>options: BalloonOptions +} +Ghost --|> Balloon +``` + +Has a custom image resource in [`/resources/balloons/ghost/balloon.svg`](/resources/balloons/ghost/balloon.svg). + +![Ghost balloon](/resources/balloons/ghost/balloon.svg) \ No newline at end of file diff --git a/resources/balloons/ghost/balloon.svg b/resources/balloons/ghost/balloon.svg index 7ee0eb5..7583adc 100644 --- a/resources/balloons/ghost/balloon.svg +++ b/resources/balloons/ghost/balloon.svg @@ -1,16 +1,20 @@ Date: Wed, 16 Oct 2024 16:24:47 +0200 Subject: [PATCH 5/9] Move ghost styles to separate stylesheet #340 Co-authored-by: SimonStnn simon.stijnen.23@gmail.com --- resources/balloons/ghost/balloon.svg | 16 ---------------- resources/balloons/ghost/ghost.css | 17 +++++++++++++++++ src/balloons/ghost.ts | 21 +++++++++++++++++++-- 3 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 resources/balloons/ghost/ghost.css diff --git a/resources/balloons/ghost/balloon.svg b/resources/balloons/ghost/balloon.svg index 7583adc..f96b899 100644 --- a/resources/balloons/ghost/balloon.svg +++ b/resources/balloons/ghost/balloon.svg @@ -1,21 +1,5 @@ - Date: Wed, 16 Oct 2024 16:31:19 +0200 Subject: [PATCH 6/9] Changes by BanaantjeJowie --- resources/balloons/ghost/balloon.svg | 3 --- 1 file changed, 3 deletions(-) diff --git a/resources/balloons/ghost/balloon.svg b/resources/balloons/ghost/balloon.svg index f96b899..e36ac91 100644 --- a/resources/balloons/ghost/balloon.svg +++ b/resources/balloons/ghost/balloon.svg @@ -8,7 +8,6 @@ stroke-linejoin="round" stroke-linecap="round" /> - - @@ -37,7 +35,6 @@ stroke-dashoffset="0" stroke-linecap="round" /> - Date: Mon, 21 Oct 2024 09:41:11 +0200 Subject: [PATCH 7/9] - swingOffset of GhostBalloon changed to 70 - riseDuration changed to [20000,40000] --- src/balloons/ghost.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/balloons/ghost.ts b/src/balloons/ghost.ts index db004dd..7e740f6 100644 --- a/src/balloons/ghost.ts +++ b/src/balloons/ghost.ts @@ -16,9 +16,9 @@ export default class Ghost extends Default { return { ...super.options, imageUrl: 'balloon.svg', - riseDuration: [15000, 20000], + riseDuration: [20000, 40000], swingDuration: [3, 4], - swingOffset: 25, + swingOffset: 70, fadeSpeed: [2000, 3000], }; } From 38b0b720400f4c9613e704c68e435da9bdbc9f76 Mon Sep 17 00:00:00 2001 From: BanaantjeJowie Date: Mon, 21 Oct 2024 11:28:08 +0200 Subject: [PATCH 8/9] changed riseDuration according to suggestion --- src/balloons/ghost.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/balloons/ghost.ts b/src/balloons/ghost.ts index 7e740f6..bf8c04e 100644 --- a/src/balloons/ghost.ts +++ b/src/balloons/ghost.ts @@ -16,7 +16,7 @@ export default class Ghost extends Default { return { ...super.options, imageUrl: 'balloon.svg', - riseDuration: [20000, 40000], + riseDuration: [18000, 21000], swingDuration: [3, 4], swingOffset: 70, fadeSpeed: [2000, 3000], From 5c0394e113bb502ce3df832afc4411f7be8a2ad1 Mon Sep 17 00:00:00 2001 From: joe boone Date: Mon, 21 Oct 2024 11:44:37 +0200 Subject: [PATCH 9/9] requested changes --- src/popup/pages/Discovery.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/popup/pages/Discovery.tsx b/src/popup/pages/Discovery.tsx index 22b37a6..97b7acf 100644 --- a/src/popup/pages/Discovery.tsx +++ b/src/popup/pages/Discovery.tsx @@ -104,7 +104,7 @@ export default () => { balloon: new balloon(), }; }), - ...new Array(1).fill({ + ...new Array(0).fill({ name: 'default', count: 0, balloon: new Balloons.Default(),