From 118eca3d383caec271a59b311ac164a2d74f31c9 Mon Sep 17 00:00:00 2001 From: Daniel Dutra <7233639+dandandandaann@users.noreply.github.com> Date: Wed, 3 Nov 2021 13:33:58 -0300 Subject: [PATCH 1/5] have feet in base character --- src/workshop/BaseCharacter.tsx | 19 +++++++++++---- src/workshop/Characters.tsx | 43 ++++++++++------------------------ 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/src/workshop/BaseCharacter.tsx b/src/workshop/BaseCharacter.tsx index e79b5f2..ad5f719 100644 --- a/src/workshop/BaseCharacter.tsx +++ b/src/workshop/BaseCharacter.tsx @@ -1,19 +1,20 @@ import { CharacterClassName, ICharacter, ICharacterActionDecision } from "../off-limits/ICharacter"; -import { IWeapon, IItem } from "../off-limits/IWeapons"; +import { IWeapon, IItem, isMeleeWeapon } from "../off-limits/IWeapons"; //todo: use this base class somehow in Characters.tsx -export class Character implements ICharacter { +export class BaseCharacter implements ICharacter { name: string = ''; health: number = 5; position: number = 10; weapons: IWeapon[] = []; item?: IItem; - + feet = new Feet(this); + classname(): CharacterClassName { throw new Error("Method not implemented."); } move(){ - throw new Error("Method not implemented."); + this.feet.move(); } chooseAction(): ICharacterActionDecision{ throw new Error("Method not implemented."); @@ -21,4 +22,14 @@ export class Character implements ICharacter { getASCIIStatus(): string { throw new Error("Method not implemented."); } +} + +//todo: something about this class is code smell... +export class Feet { + constructor(private character: ICharacter) { } + move() { + if (this.character.weapons.some(x => isMeleeWeapon(x))) { + this.character.position = Math.max(this.character.position - 5, 1); + } + } } \ No newline at end of file diff --git a/src/workshop/Characters.tsx b/src/workshop/Characters.tsx index 16ba4f4..c65565b 100644 --- a/src/workshop/Characters.tsx +++ b/src/workshop/Characters.tsx @@ -1,6 +1,6 @@ -import { ICharacter, CharacterClassName, equip, ICharacterActionDecision } from '../off-limits/ICharacter'; -import { IWeapon, IItem, isMeleeWeapon } from '../off-limits/IWeapons'; -import { Character } from './BaseCharacter'; +import { CharacterClassName, equip, ICharacterActionDecision } from '../off-limits/ICharacter'; +import { IWeapon, IItem } from '../off-limits/IWeapons'; +import { BaseCharacter } from './BaseCharacter'; import { ClericStartItem, MageStartItem, @@ -12,19 +12,16 @@ import { //todo: customize the chooseAction() to better fight the dragon //todo: update the `getASCIIStatus` function(s) to return X when dead and a unique character per class -export class Warrior implements ICharacter { +export class Warrior extends BaseCharacter { health: number = 5; position: number = 10; weapons: IWeapon[] = []; item?: IItem; - feet = new Feet(this); classname(): CharacterClassName { return 'Warrior'; } - move(){ - this.feet.move(); - } constructor(public name: string, public key: number) { + super(); equip(WarriorStartItem, this); } chooseAction(): ICharacterActionDecision { @@ -37,19 +34,16 @@ export class Warrior implements ICharacter { } } -export class Cleric implements ICharacter{ +export class Cleric extends BaseCharacter{ health: number = 5; position: number = 10; weapons: IWeapon[] = []; item?: IItem; - feet = new Feet(this); classname(): CharacterClassName { return 'Cleric'; } - move(){ - this.feet.move(); - } constructor(public name: string, public key: number) { + super(); equip(ClericStartItem, this); } chooseAction(): ICharacterActionDecision { @@ -62,21 +56,18 @@ export class Cleric implements ICharacter{ } } -export class Mage implements ICharacter { +export class Mage extends BaseCharacter { health: number = 5; position: number = 10; weapons: IWeapon[] = []; item?: IItem; - feet = new Feet(this); classname(): CharacterClassName { return 'Mage'; } constructor(public name: string, public key: number) { + super(); equip(MageStartItem, this); } - move(){ - this.feet.move(); - } chooseAction(): ICharacterActionDecision { return { attack: this.weapons[0] @@ -87,12 +78,11 @@ export class Mage implements ICharacter { } } -export class Thief implements ICharacter { +export class Thief extends BaseCharacter { health: number = 5; position: number = 10; weapons: IWeapon[] = []; item?: IItem; - feet = new Feet(this); move(){ this.feet.move(); } @@ -100,6 +90,7 @@ export class Thief implements ICharacter { return 'Thief'; } constructor(public name: string, public key: number) { + super(); equip(ThiefStartItem, this); } chooseAction(): ICharacterActionDecision { @@ -110,14 +101,4 @@ export class Thief implements ICharacter { getASCIIStatus(): string { return "@"; } -} - -//todo: something about this class is code smell... -export class Feet{ - constructor(private character: ICharacter){} - move(){ - if (this.character.weapons.some(x => isMeleeWeapon(x))){ - this.character.position = Math.max(this.character.position - 5, 1); - } - } -} +} \ No newline at end of file From 0685fff7a0b90b9f3445a62e0b64a877098a21a4 Mon Sep 17 00:00:00 2001 From: Daniel Dutra <7233639+dandandandaann@users.noreply.github.com> Date: Wed, 3 Nov 2021 16:04:30 -0300 Subject: [PATCH 2/5] move shared properties to BaseCharacter --- src/workshop/BaseCharacter.tsx | 18 +++++++--- src/workshop/Characters.tsx | 62 +++++----------------------------- 2 files changed, 23 insertions(+), 57 deletions(-) diff --git a/src/workshop/BaseCharacter.tsx b/src/workshop/BaseCharacter.tsx index ad5f719..c4a2fac 100644 --- a/src/workshop/BaseCharacter.tsx +++ b/src/workshop/BaseCharacter.tsx @@ -3,24 +3,34 @@ import { IWeapon, IItem, isMeleeWeapon } from "../off-limits/IWeapons"; //todo: use this base class somehow in Characters.tsx export class BaseCharacter implements ICharacter { - name: string = ''; health: number = 5; position: number = 10; weapons: IWeapon[] = []; item?: IItem; feet = new Feet(this); + constructor( + public name: string, + public key : number, + private className : CharacterClassName, + private ASCIIStatus : string) { + + } + classname(): CharacterClassName { - throw new Error("Method not implemented."); + return this.className; } + move(){ this.feet.move(); } + chooseAction(): ICharacterActionDecision{ throw new Error("Method not implemented."); } + getASCIIStatus(): string { - throw new Error("Method not implemented."); + return this.ASCIIStatus; } } @@ -28,7 +38,7 @@ export class BaseCharacter implements ICharacter { export class Feet { constructor(private character: ICharacter) { } move() { - if (this.character.weapons.some(x => isMeleeWeapon(x))) { + if (this.character.weapons.length && isMeleeWeapon(this.character.weapons[0])) { this.character.position = Math.max(this.character.position - 5, 1); } } diff --git a/src/workshop/Characters.tsx b/src/workshop/Characters.tsx index c65565b..48da857 100644 --- a/src/workshop/Characters.tsx +++ b/src/workshop/Characters.tsx @@ -1,5 +1,4 @@ -import { CharacterClassName, equip, ICharacterActionDecision } from '../off-limits/ICharacter'; -import { IWeapon, IItem } from '../off-limits/IWeapons'; +import { equip, ICharacterActionDecision } from '../off-limits/ICharacter'; import { BaseCharacter } from './BaseCharacter'; import { ClericStartItem, @@ -13,15 +12,8 @@ import { //todo: update the `getASCIIStatus` function(s) to return X when dead and a unique character per class export class Warrior extends BaseCharacter { - health: number = 5; - position: number = 10; - weapons: IWeapon[] = []; - item?: IItem; - classname(): CharacterClassName { - return 'Warrior'; - } - constructor(public name: string, public key: number) { - super(); + constructor(name: string, key: number) { + super(name, key, 'Warrior', '⚔️'); equip(WarriorStartItem, this); } chooseAction(): ICharacterActionDecision { @@ -29,21 +21,11 @@ export class Warrior extends BaseCharacter { attack: this.weapons[0] } } - getASCIIStatus(): string { - return "@"; - } } export class Cleric extends BaseCharacter{ - health: number = 5; - position: number = 10; - weapons: IWeapon[] = []; - item?: IItem; - classname(): CharacterClassName { - return 'Cleric'; - } - constructor(public name: string, public key: number) { - super(); + constructor(name: string, key: number) { + super(name, key, 'Cleric', '⚒️'); equip(ClericStartItem, this); } chooseAction(): ICharacterActionDecision { @@ -51,21 +33,11 @@ export class Cleric extends BaseCharacter{ attack: this.weapons[0] } } - getASCIIStatus(): string { - return "@"; - } } export class Mage extends BaseCharacter { - health: number = 5; - position: number = 10; - weapons: IWeapon[] = []; - item?: IItem; - classname(): CharacterClassName { - return 'Mage'; - } - constructor(public name: string, public key: number) { - super(); + constructor(name: string, key: number) { + super(name, key, 'Mage', '✨'); equip(MageStartItem, this); } chooseAction(): ICharacterActionDecision { @@ -73,24 +45,11 @@ export class Mage extends BaseCharacter { attack: this.weapons[0] } } - getASCIIStatus(): string { - return "@"; - } } export class Thief extends BaseCharacter { - health: number = 5; - position: number = 10; - weapons: IWeapon[] = []; - item?: IItem; - move(){ - this.feet.move(); - } - classname(): CharacterClassName { - return 'Thief'; - } - constructor(public name: string, public key: number) { - super(); + constructor(name: string, key: number) { + super(name, key, 'Thief', '🗡️'); equip(ThiefStartItem, this); } chooseAction(): ICharacterActionDecision { @@ -98,7 +57,4 @@ export class Thief extends BaseCharacter { attack: this.weapons[0] } } - getASCIIStatus(): string { - return "@"; - } } \ No newline at end of file From 4a0fd3090111f31e6d80bb763a5defd9a9e0c8fa Mon Sep 17 00:00:00 2001 From: Daniel Dutra <7233639+dandandandaann@users.noreply.github.com> Date: Fri, 5 Nov 2021 17:33:29 -0300 Subject: [PATCH 3/5] create new itens --- src/workshop/Characters.tsx | 2 +- src/workshop/Weapons.tsx | 78 +++++++++++++++++++++++++++++++------ 2 files changed, 67 insertions(+), 13 deletions(-) diff --git a/src/workshop/Characters.tsx b/src/workshop/Characters.tsx index 48da857..1df3571 100644 --- a/src/workshop/Characters.tsx +++ b/src/workshop/Characters.tsx @@ -49,7 +49,7 @@ export class Mage extends BaseCharacter { export class Thief extends BaseCharacter { constructor(name: string, key: number) { - super(name, key, 'Thief', '🗡️'); + super(name, key, 'Thief', '🏹'); equip(ThiefStartItem, this); } chooseAction(): ICharacterActionDecision { diff --git a/src/workshop/Weapons.tsx b/src/workshop/Weapons.tsx index 05e4f63..e630109 100644 --- a/src/workshop/Weapons.tsx +++ b/src/workshop/Weapons.tsx @@ -23,7 +23,6 @@ import { IWeapon, IItem, IMeleeWeapon, IRangedWeapon, IConsumableItem, IEnchante // } // WEAPON ARMORY -// todo: add more and better weapons! export class Club implements IMeleeWeapon { name = 'Club'; damage = 1; @@ -31,26 +30,81 @@ export class Club implements IMeleeWeapon { } // ITEM VAULT -// todo: add more and better items! export class UselessAmulet implements IItem { name = 'Useless Amulet'; } +export class Arrow implements IWeapon { + name = 'Arrow'; + damage = 2; +} + +export class Bow implements IRangedWeapon{ + name: string = 'Bow'; + damage: 0 = 0; + projectiles: Arrow[] = []; + constructor(startingArrows: number = 10) { + for (let i = 0; i < startingArrows; i++) { + this.projectiles.push(new Arrow()); + } + } +} + +export class Fireball implements IWeapon { + name = 'Fireball'; + damage = 4; +} +export class FireStaff implements IRangedWeapon{ + name: string = 'Fire Staff'; + damage: 0 = 0; + projectiles: Fireball[] = []; + constructor(manaPoints: number) { + for (let i = 0; i < manaPoints; i++) { + this.projectiles.push(new Fireball()); + } + } +} + +export class HealingWand implements IEnchantedItem { + name = 'Healing Wand'; + fireDamage = 0; + partyHealthBonus = 1; +} + +export class Hammer implements IMeleeWeapon { + name = 'Hammer'; + damage = 5; + meleeRange = 1; +} + +export class Longsword implements IMeleeWeapon { + name = 'Longsword'; + damage = 7; + meleeRange = 2; +} + +export class HealingPotion implements IConsumableItem { + name = 'Healing Potion'; + healthBonus = 5; +} + +export class FireGloves implements IEnchantedItem { + name = 'Fire Gloves'; + fireDamage = 3; +} // ITEM ASSIGNMENTS -// todo: assign starting items -export const WarriorStartItem: IItem|undefined = new Club(); -export const ClericStartItem: IItem|undefined = new Club(); -export const MageStartItem: IItem|undefined = undefined; -export const ThiefStartItem: IItem|undefined = new Club(); +export const WarriorStartItem: IItem|undefined = new Longsword(); +export const ClericStartItem: IItem|undefined = new Hammer(); +export const MageStartItem: IItem|undefined = new FireStaff(30); +export const ThiefStartItem: IItem|undefined = new Bow(20); // TREASURE ASSIGNMENTS -// todo: assign treasure from chests export function GetItemsInTreasureChests(): IItem[]{ return [ new UselessAmulet(), //this will be found by the warrior - new UselessAmulet(), //this will be found by the cleric - new UselessAmulet(), //this will be found by the mage - new UselessAmulet(), //this will be found by the thief + new FireGloves(), //this will be found by the cleric + new HealingWand(), //this will be found by the mage + new HealingPotion(), //this will be found by the thief ]; -} +} \ No newline at end of file From e2f3e1a1616301ddee9999202cb515fcd681e938 Mon Sep 17 00:00:00 2001 From: Daniel Dutra <7233639+dandandandaann@users.noreply.github.com> Date: Fri, 5 Nov 2021 19:12:07 -0300 Subject: [PATCH 4/5] fix move and choose action logic --- src/workshop/BaseCharacter.tsx | 22 ++++++++----- src/workshop/Characters.tsx | 29 +++++------------- src/workshop/Weapons.tsx | 56 +++++++++++++++++++--------------- 3 files changed, 52 insertions(+), 55 deletions(-) diff --git a/src/workshop/BaseCharacter.tsx b/src/workshop/BaseCharacter.tsx index c4a2fac..3bc5f42 100644 --- a/src/workshop/BaseCharacter.tsx +++ b/src/workshop/BaseCharacter.tsx @@ -1,9 +1,9 @@ import { CharacterClassName, ICharacter, ICharacterActionDecision } from "../off-limits/ICharacter"; -import { IWeapon, IItem, isMeleeWeapon } from "../off-limits/IWeapons"; +import { IWeapon, IItem, isMeleeWeapon, IConsumableItem, IEnchantedItem, IMeleeWeapon } from "../off-limits/IWeapons"; +import { isWeaponFitForUse as isWeaponFit } from "./Weapons"; -//todo: use this base class somehow in Characters.tsx export class BaseCharacter implements ICharacter { - health: number = 5; + health: number = 10; position: number = 10; weapons: IWeapon[] = []; item?: IItem; @@ -14,7 +14,6 @@ export class BaseCharacter implements ICharacter { public key : number, private className : CharacterClassName, private ASCIIStatus : string) { - } classname(): CharacterClassName { @@ -25,8 +24,15 @@ export class BaseCharacter implements ICharacter { this.feet.move(); } - chooseAction(): ICharacterActionDecision{ - throw new Error("Method not implemented."); + chooseAction(): ICharacterActionDecision { + if (this.health < 3 && this.item && (this.item as IConsumableItem).healthBonus) + return { use: this.item }; + if (this.health < 5 && this.item && (this.item as IEnchantedItem).partyHealthBonus) + return { use: this.item }; + + let availableWeapons = this.weapons.filter(weapon => isWeaponFit(weapon)); + + return { attack: availableWeapons[0] }; } getASCIIStatus(): string { @@ -34,11 +40,11 @@ export class BaseCharacter implements ICharacter { } } -//todo: something about this class is code smell... export class Feet { constructor(private character: ICharacter) { } move() { - if (this.character.weapons.length && isMeleeWeapon(this.character.weapons[0])) { + if (this.character.weapons.length && + isMeleeWeapon(this.character.weapons.filter(weapon => isWeaponFit(weapon))[0])) { this.character.position = Math.max(this.character.position - 5, 1); } } diff --git a/src/workshop/Characters.tsx b/src/workshop/Characters.tsx index 1df3571..f6c7649 100644 --- a/src/workshop/Characters.tsx +++ b/src/workshop/Characters.tsx @@ -1,26 +1,19 @@ import { equip, ICharacterActionDecision } from '../off-limits/ICharacter'; +import { IEnchantedItem } from '../off-limits/IWeapons'; import { BaseCharacter } from './BaseCharacter'; import { ClericStartItem, MageStartItem, + ThieAditionalfStartItem as ThiefAditionalStartItem, ThiefStartItem, WarriorStartItem, } from './Weapons'; -//todo: too many duplicate classes in this file! -//todo: customize the chooseAction() to better fight the dragon -//todo: update the `getASCIIStatus` function(s) to return X when dead and a unique character per class - export class Warrior extends BaseCharacter { constructor(name: string, key: number) { super(name, key, 'Warrior', '⚔️'); equip(WarriorStartItem, this); } - chooseAction(): ICharacterActionDecision { - return { - attack: this.weapons[0] - } - } } export class Cleric extends BaseCharacter{ @@ -28,11 +21,6 @@ export class Cleric extends BaseCharacter{ super(name, key, 'Cleric', '⚒️'); equip(ClericStartItem, this); } - chooseAction(): ICharacterActionDecision { - return { - attack: this.weapons[0] - } - } } export class Mage extends BaseCharacter { @@ -40,10 +28,11 @@ export class Mage extends BaseCharacter { super(name, key, 'Mage', '✨'); equip(MageStartItem, this); } + chooseAction(): ICharacterActionDecision { - return { - attack: this.weapons[0] - } + if (this.item && (this.item as IEnchantedItem).partyHealthBonus) // mage prioritizes healing + return { use: this.item }; + return super.chooseAction(); } } @@ -51,10 +40,6 @@ export class Thief extends BaseCharacter { constructor(name: string, key: number) { super(name, key, 'Thief', '🏹'); equip(ThiefStartItem, this); - } - chooseAction(): ICharacterActionDecision { - return { - attack: this.weapons[0] - } + equip(ThiefAditionalStartItem, this); } } \ No newline at end of file diff --git a/src/workshop/Weapons.tsx b/src/workshop/Weapons.tsx index e630109..3e4b061 100644 --- a/src/workshop/Weapons.tsx +++ b/src/workshop/Weapons.tsx @@ -1,4 +1,4 @@ -import { IWeapon, IItem, IMeleeWeapon, IRangedWeapon, IConsumableItem, IEnchantedItem } from "../off-limits/IWeapons"; +import { IWeapon, IItem, IMeleeWeapon, IRangedWeapon, IConsumableItem, IEnchantedItem, isMeleeWeapon, isRangedWeapon } from "../off-limits/IWeapons"; // INTERFACE QUICK REFERENCE // export interface IItem { @@ -29,21 +29,16 @@ export class Club implements IMeleeWeapon { meleeRange = 1; } -// ITEM VAULT -export class UselessAmulet implements IItem { - name = 'Useless Amulet'; -} - export class Arrow implements IWeapon { name = 'Arrow'; - damage = 2; + damage = 5; } export class Bow implements IRangedWeapon{ name: string = 'Bow'; damage: 0 = 0; projectiles: Arrow[] = []; - constructor(startingArrows: number = 10) { + constructor(startingArrows: number = 5) { for (let i = 0; i < startingArrows; i++) { this.projectiles.push(new Arrow()); } @@ -65,46 +60,57 @@ export class FireStaff implements IRangedWeapon{ } } -export class HealingWand implements IEnchantedItem { - name = 'Healing Wand'; - fireDamage = 0; - partyHealthBonus = 1; -} - export class Hammer implements IMeleeWeapon { name = 'Hammer'; damage = 5; meleeRange = 1; } - export class Longsword implements IMeleeWeapon { name = 'Longsword'; - damage = 7; + damage = 6; meleeRange = 2; } - -export class HealingPotion implements IConsumableItem { - name = 'Healing Potion'; - healthBonus = 5; +export class Dagger implements IMeleeWeapon { + name = 'Dagger'; + damage = 3; + meleeRange = 0; } +// ITEM VAULT +export class UselessAmulet implements IItem { + name = 'Useless Amulet'; +} export class FireGloves implements IEnchantedItem { name = 'Fire Gloves'; - fireDamage = 3; + fireDamage = 1; +} +export class HealingWand implements IEnchantedItem { + name = 'Healing Wand'; + fireDamage = 0; + partyHealthBonus = 1; +} +export class HealingPotion implements IConsumableItem { + name = 'Healing Potion'; + healthBonus = 5; } // ITEM ASSIGNMENTS export const WarriorStartItem: IItem|undefined = new Longsword(); export const ClericStartItem: IItem|undefined = new Hammer(); -export const MageStartItem: IItem|undefined = new FireStaff(30); -export const ThiefStartItem: IItem|undefined = new Bow(20); +export const MageStartItem: IItem|undefined = new FireStaff(3); +export const ThiefStartItem: IItem|undefined = new Bow(6); +export const ThieAditionalfStartItem: IItem|undefined = new Dagger(); // TREASURE ASSIGNMENTS export function GetItemsInTreasureChests(): IItem[]{ return [ - new UselessAmulet(), //this will be found by the warrior + new HealingPotion(), //this will be found by the warrior new FireGloves(), //this will be found by the cleric new HealingWand(), //this will be found by the mage - new HealingPotion(), //this will be found by the thief + new UselessAmulet(), //this will be found by the thief ]; +} + +export function isWeaponFitForUse(weapon: IWeapon) { + return isMeleeWeapon(weapon) || (isRangedWeapon(weapon) && (weapon as IRangedWeapon).projectiles.length > 0); } \ No newline at end of file From 5ca4db602d477e4f49167f19c8283ea551a8c06e Mon Sep 17 00:00:00 2001 From: Daniel Dutra <7233639+dandandandaann@users.noreply.github.com> Date: Tue, 9 Nov 2021 11:14:27 -0300 Subject: [PATCH 5/5] add images for characters, dragon and items --- public/assets/OOP Bow.svg | 193 +++++++ public/assets/OOP Chest.svg | 403 ++++++++++++++ public/assets/OOP Daniel.svg | 785 ++++++++++++++++++++++++++++ public/assets/OOP Dragon.svg | 586 +++++++++++++++++++++ public/assets/OOP FireGloves.svg | 505 ++++++++++++++++++ public/assets/OOP Greg.svg | 785 ++++++++++++++++++++++++++++ public/assets/OOP HealingPotion.svg | 361 +++++++++++++ public/assets/OOP HealingWand.svg | 159 ++++++ public/assets/OOP Justin.svg | 785 ++++++++++++++++++++++++++++ public/assets/OOP Longsword.svg | 255 +++++++++ public/assets/OOP Nicho.svg | 785 ++++++++++++++++++++++++++++ public/assets/OOP UselessAmulet.svg | 161 ++++++ src/index.tsx | 8 +- src/off-limits/ChestText.tsx | 10 +- src/off-limits/CombatUI.tsx | 7 +- src/off-limits/Dragon.tsx | 16 +- src/off-limits/LootUI.tsx | 25 +- src/style.css | 28 +- src/workshop/Characters.tsx | 8 +- 19 files changed, 5817 insertions(+), 48 deletions(-) create mode 100644 public/assets/OOP Bow.svg create mode 100644 public/assets/OOP Chest.svg create mode 100644 public/assets/OOP Daniel.svg create mode 100644 public/assets/OOP Dragon.svg create mode 100644 public/assets/OOP FireGloves.svg create mode 100644 public/assets/OOP Greg.svg create mode 100644 public/assets/OOP HealingPotion.svg create mode 100644 public/assets/OOP HealingWand.svg create mode 100644 public/assets/OOP Justin.svg create mode 100644 public/assets/OOP Longsword.svg create mode 100644 public/assets/OOP Nicho.svg create mode 100644 public/assets/OOP UselessAmulet.svg diff --git a/public/assets/OOP Bow.svg b/public/assets/OOP Bow.svg new file mode 100644 index 0000000..5749ef9 --- /dev/null +++ b/public/assets/OOP Bow.svg @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/OOP Chest.svg b/public/assets/OOP Chest.svg new file mode 100644 index 0000000..afd805d --- /dev/null +++ b/public/assets/OOP Chest.svg @@ -0,0 +1,403 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/OOP Daniel.svg b/public/assets/OOP Daniel.svg new file mode 100644 index 0000000..0b2824e --- /dev/null +++ b/public/assets/OOP Daniel.svg @@ -0,0 +1,785 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/OOP Dragon.svg b/public/assets/OOP Dragon.svg new file mode 100644 index 0000000..c933172 --- /dev/null +++ b/public/assets/OOP Dragon.svg @@ -0,0 +1,586 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/OOP FireGloves.svg b/public/assets/OOP FireGloves.svg new file mode 100644 index 0000000..fce31df --- /dev/null +++ b/public/assets/OOP FireGloves.svg @@ -0,0 +1,505 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/OOP Greg.svg b/public/assets/OOP Greg.svg new file mode 100644 index 0000000..1291f0e --- /dev/null +++ b/public/assets/OOP Greg.svg @@ -0,0 +1,785 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/OOP HealingPotion.svg b/public/assets/OOP HealingPotion.svg new file mode 100644 index 0000000..6af6b7d --- /dev/null +++ b/public/assets/OOP HealingPotion.svg @@ -0,0 +1,361 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/OOP HealingWand.svg b/public/assets/OOP HealingWand.svg new file mode 100644 index 0000000..2269fdc --- /dev/null +++ b/public/assets/OOP HealingWand.svg @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/OOP Justin.svg b/public/assets/OOP Justin.svg new file mode 100644 index 0000000..cd8680e --- /dev/null +++ b/public/assets/OOP Justin.svg @@ -0,0 +1,785 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/OOP Longsword.svg b/public/assets/OOP Longsword.svg new file mode 100644 index 0000000..c4d61a4 --- /dev/null +++ b/public/assets/OOP Longsword.svg @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/OOP Nicho.svg b/public/assets/OOP Nicho.svg new file mode 100644 index 0000000..9f28d25 --- /dev/null +++ b/public/assets/OOP Nicho.svg @@ -0,0 +1,785 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/OOP UselessAmulet.svg b/public/assets/OOP UselessAmulet.svg new file mode 100644 index 0000000..578094c --- /dev/null +++ b/public/assets/OOP UselessAmulet.svg @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index 7531b07..25e3765 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -25,10 +25,10 @@ export interface AppState { function getNewGameState(): AppState{ return { characters: [ - new Warrior('Conan', 1), - new Cleric('Cuthbert', 2), - new Mage('Merlin', 3), - new Thief('Bilbo', 4) + new Warrior('Greg', 1), + new Cleric('Justin', 2), + new Mage('Nicho', 3), + new Thief('Daniel', 4) ], chests: GetItemsInTreasureChests().map(x => {return {item: x, opened: false}}), dragonHP: 100, diff --git a/src/off-limits/ChestText.tsx b/src/off-limits/ChestText.tsx index d9e487d..6fbe8f2 100644 --- a/src/off-limits/ChestText.tsx +++ b/src/off-limits/ChestText.tsx @@ -2,12 +2,8 @@ import React from "react"; export const ChestText: React.FC = () => { return ( - - {' ______ ___\n' + - '// // \\\\\n' + - '#=====##===#\n' + - '| [8] || |\n' + - '|_____||___|\n'+'\n'} - +
+ +
); }; \ No newline at end of file diff --git a/src/off-limits/CombatUI.tsx b/src/off-limits/CombatUI.tsx index d654910..6e1b698 100644 --- a/src/off-limits/CombatUI.tsx +++ b/src/off-limits/CombatUI.tsx @@ -10,7 +10,7 @@ export const CombatUI: React.FC<{ return (
- +
@@ -82,10 +82,11 @@ export const CharacterCombatUI: React.FC<{ }> = (props) => { const isDead = props.character.health <= 0; const hpClass = props.character.health <= 1 ? 'red' : props.character.health < 5 ? 'yellow': '' + const playerImage = `/assets/OOP ${props.character.getASCIIStatus()}.svg`; return ( - - {props.character.getASCIIStatus()} + + [{props.character?.health}] diff --git a/src/off-limits/Dragon.tsx b/src/off-limits/Dragon.tsx index 97b2403..03bae58 100644 --- a/src/off-limits/Dragon.tsx +++ b/src/off-limits/Dragon.tsx @@ -14,21 +14,7 @@ export const Dragon: React.FC<{
BOSS DRAGON
{hpString}
- {' _/=======() \n' + - '(/___ /|\\ ()==========__\n' + - ' _/ | \\ //| ______/ )\n' + - ' _| \\ // | _/\n' + - ' |/|_ // //\n' + - ' (oo) _// /\n' + - ' //_/_/ / |\n' + - ' @@/ |= |\n' + - ' _=_ |\n' + - ' == |_ snd\n' + - ' __(===( )\\\n' + - ' (((~) __(_/ |\n' + - ' (((~) /\n' + - ' ______/ /\n' + - 'Art by Shanaka Dias'} + ); }; diff --git a/src/off-limits/LootUI.tsx b/src/off-limits/LootUI.tsx index 31499e2..2361c3d 100644 --- a/src/off-limits/LootUI.tsx +++ b/src/off-limits/LootUI.tsx @@ -38,14 +38,23 @@ export const LootUI: React.FC<{ {x.name} the {x.classname()} finds { - props.state.chests[i].opened ?
: + props.state.chests[i].opened ? + + : + } ))} diff --git a/src/style.css b/src/style.css index d7e3479..d704bea 100644 --- a/src/style.css +++ b/src/style.css @@ -12,7 +12,7 @@ body { white-space: pre; } .dragon { - width: 49%; + width: 30%; display: inline-block; } .hp { @@ -21,16 +21,12 @@ body { .game { display: flex; } -.left { - display: inline-block; - width: 49%; -} -table.grid { +table.grid, table.combat-grid { font-family: monospace; font-size: 1em; margin: auto; } -.grid td { +.grid td, .combat-grid td { border-collapse: collapse; text-align: center; width: 3em; @@ -39,6 +35,10 @@ table.grid { padding: 0; border: 1px solid darkgreen; } +.combat-grid tbody td { + width: 128px; + height: 128px; +} .block { display: block; } @@ -98,4 +98,18 @@ td.loot-chest{ } .yellow{ color: yellow; +} + +.size-128px { + height: 128px; + width: 128px; +} + +.size-dragon { + height: 400px; + width: 400px; +} + +.display-block { + display: block; } \ No newline at end of file diff --git a/src/workshop/Characters.tsx b/src/workshop/Characters.tsx index f6c7649..9807e0e 100644 --- a/src/workshop/Characters.tsx +++ b/src/workshop/Characters.tsx @@ -11,21 +11,21 @@ import { export class Warrior extends BaseCharacter { constructor(name: string, key: number) { - super(name, key, 'Warrior', '⚔️'); + super(name, key, 'Warrior', 'Greg'); equip(WarriorStartItem, this); } } export class Cleric extends BaseCharacter{ constructor(name: string, key: number) { - super(name, key, 'Cleric', '⚒️'); + super(name, key, 'Cleric', 'Justin'); equip(ClericStartItem, this); } } export class Mage extends BaseCharacter { constructor(name: string, key: number) { - super(name, key, 'Mage', '✨'); + super(name, key, 'Mage', 'Nicho'); equip(MageStartItem, this); } @@ -38,7 +38,7 @@ export class Mage extends BaseCharacter { export class Thief extends BaseCharacter { constructor(name: string, key: number) { - super(name, key, 'Thief', '🏹'); + super(name, key, 'Thief', 'Daniel'); equip(ThiefStartItem, this); equip(ThiefAditionalStartItem, this); }
50ft - {props.state.chests[i].item.name} - - - - + + + + {props.state.chests[i].item.name} + + + + +