Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPGSAGA [Completed] + tests #37

Merged
merged 43 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a2c77e9
Started developing RPGSAGA, wrote classes for character classes
EugeneWWolf Oct 11, 2023
43a56f5
Wrote attack method for abstract character class
EugeneWWolf Oct 14, 2023
48b48cf
Started writing spell system, splitted code into multiple files.
EugeneWWolf Oct 17, 2023
3c2d446
I did a thing, the game still doesn't work.
EugeneWWolf Oct 28, 2023
bd9b9a7
Wow, I wrote some code
EugeneWWolf Nov 1, 2023
cddbd13
Fixed some moments in characterFactory and game
EugeneWWolf Nov 7, 2023
b1cd56a
Minor corrections in code
EugeneWWolf Nov 16, 2023
4784131
I did... something
EugeneWWolf Nov 16, 2023
704e7ef
Restructured files and made 1 file for each class
EugeneWWolf Nov 28, 2023
db1ead1
Small fix of import path in game.ts
EugeneWWolf Nov 28, 2023
64c69f1
Game still doesn't work, but it's close to working state (I hope)
EugeneWWolf Nov 29, 2023
1fccc81
Now the game works, not correctly, but works. Basic attacks without
EugeneWWolf Dec 3, 2023
a601b5c
Refactored code, basic game almost works
EugeneWWolf Dec 3, 2023
b882412
This [basic] game works!
EugeneWWolf Dec 4, 2023
10fc69c
Fixes to the code, everything still works [attacks without abilities]
EugeneWWolf Dec 4, 2023
d0a1c30
Moved maxhp from character class to character generator
EugeneWWolf Dec 4, 2023
b2d28e8
Added more function annotations in game.ts
EugeneWWolf Dec 4, 2023
b785b91
Basic version of game works, still no spells
EugeneWWolf Dec 6, 2023
f526762
Improved log of the game + remade code a little
EugeneWWolf Dec 6, 2023
0db7d8e
Developing spell system
EugeneWWolf Dec 23, 2023
e02d0a2
Continued to develop spell system, now statusEffects are stored in
EugeneWWolf Dec 24, 2023
5b07045
I continued developing a spell system and started doing a complete
EugeneWWolf Dec 30, 2023
8a51dc8
There was an attempt to finish the game (failed at spellSystemManager,
EugeneWWolf Jan 2, 2024
f4ff6d2
Reverted code by hand (before developing spell system, because code has
EugeneWWolf Jan 2, 2024
4206913
Reworking base code without abilities for it to be more testable and etc
EugeneWWolf Jan 2, 2024
e4894e4
Improved code quality (right now without ability system)
EugeneWWolf Jan 3, 2024
c004b34
Small improvements
EugeneWWolf Jan 3, 2024
d10981f
Started doing the "message" thing
EugeneWWolf Jan 5, 2024
1226ba2
Undefined while working with linked list, again
EugeneWWolf Jan 5, 2024
2366da7
Almost done doing the game, mages causing bugs... again
EugeneWWolf Jan 6, 2024
a64a888
Finished the game wooohooo! Only the mirror improvements and minor bug
EugeneWWolf Jan 6, 2024
d757aa4
Now user can choose the amount of players (typing in the console). Also
EugeneWWolf Jan 6, 2024
1590835
Cosmetic improvements
EugeneWWolf Jan 7, 2024
49bb7bf
Restructured folders
EugeneWWolf Jan 7, 2024
e0b2f58
Made tests for userInput + remade index.ts code to make it more testable
EugeneWWolf Jan 7, 2024
46074ac
In proccess of rewriting code to make it more testable...
EugeneWWolf Jan 8, 2024
e850c37
Continued creating tests for my code, refactored characterGenerators'
EugeneWWolf Jan 8, 2024
c71bdea
Refactored my code (help me)
EugeneWWolf Jan 8, 2024
24b76be
Refactored game.ts code (splitted into game.ts and gameUtility.ts)
EugeneWWolf Jan 8, 2024
c4d769c
Fixes in existing tests (testCharacterGenerator)
EugeneWWolf Jan 8, 2024
0ee8d8e
Doing tests little by little
EugeneWWolf Jan 8, 2024
1379c33
Finally finished tests
EugeneWWolf Jan 9, 2024
a78a18e
Small fixes
EugeneWWolf Jan 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rpgsaga/saga/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ module.exports = {
selector: 'typeProperty',
format: ['snake_case', 'camelCase'],
},
{
selector: 'classProperty',
format: ['camelCase'],
leadingUnderscore: 'allow',
}
],
},
settings: {
Expand Down
3 changes: 2 additions & 1 deletion rpgsaga/saga/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"request": "launch",
"runtimeArgs": ["-r", "ts-node/register"],
"args": ["${workspaceFolder}/src/index.ts"],
"outputCapture": "std"
"outputCapture": "std",
"console": "integratedTerminal",
},
{
"type": "node",
Expand Down
104 changes: 91 additions & 13 deletions rpgsaga/saga/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions rpgsaga/saga/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@
},
"author": "",
"license": "ISC",
"dependencies": {},
"dependencies": {
"lodash": "^4.17.21",
"prompt-sync": "^4.2.0"
},
"devDependencies": {
"@types/jest": "^27.0.3",
"@types/jest": "^27.5.2",
"@types/lodash": "^4.14.202",
"@types/node": "^16.11.0",
"@types/prompt-sync": "^4.2.3",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^7.28.0",
Expand All @@ -23,9 +28,9 @@
"eslint-plugin-prettier": "^3.4.0",
"jest": "^27.2.5",
"prettier": "^2.4.1",
"ts-jest": "^27.1.2",
"ts-node": "^10.3.0",
"typescript": "^4.4.4",
"ts-jest": "^27.1.2"
"typescript": "^4.4.4"
},
"jest": {
"preset": "ts-jest"
Expand Down
27 changes: 27 additions & 0 deletions rpgsaga/saga/src/arrayItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Character } from './character';

export class ArrayItem {
private _player: Character;
private _index: number;

get player() {
return this._player;
}

set player(value: Character) {
this._player = value;
}

get index() {
return this._index;
}

set index(value: number) {
this._index = value;
}

constructor(player: Character, index: number) {
this._player = player;
this._index = index;
}
}
4 changes: 4 additions & 0 deletions rpgsaga/saga/src/attackType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum AttackType {
attack,
spell,
}
59 changes: 59 additions & 0 deletions rpgsaga/saga/src/bina.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { Character } from './character';
import { DoublyLinkedListNode } from './doublyLinkedList/doublyLinkedListNode';
import { Message } from './message';
import { IStatusEffect } from './spell_system/statusEffect/IStatusEffect';

export class Bina {
private _message: Message;

get message() {
return this._message;
}

public receiveMessage(message: Message) {
this._message = message;
}

public performAttack() {
this._message.target.receiveDamage(this._message.damagePoints);

console.log(
`${this._message.attackerInfo} has dealt ${this._message.damagePoints} damage to ${this._message.targetInfo}!`,
);
}

public performSpell(): boolean {
const isSuccessful = this._message.spell.execute(this._message.target);

if (isSuccessful) {
console.log(
`${this._message.attackerInfo} has casted a spell ${this._message.spell.describe()} on ${
this._message.targetInfo
}!`,
);

if (this._message.spell.hasStatusEffect()) {
this.sendStatusEffect(this._message.target, this._message.spell.getStatusEffect());
}
return true;
} else {
console.log(`${this._message.attackerInfo} has failed to cast a spell!`);
return false;
}
}

private sendStatusEffect(target: Character, statusEffect: IStatusEffect) {
if (target.statusEffects.contains(statusEffect)) {
const node: DoublyLinkedListNode = target.statusEffects.head;
while (node !== null) {
if (node.value.describe() === statusEffect.describe()) {
node.value.refresh();
return;
}
}
} else {
statusEffect.refresh();
target.statusEffects.addLast(statusEffect);
}
}
}
Loading
Loading