Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 6 additions & 2 deletions src/off-limits/CombatUI.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react";
import { AppState } from "..";
import { Dragon } from "./Dragon";
import { DeadDragon, Dragon } from "./Dragon";
import { ICharacter } from "./ICharacter";
import { LogUI } from "./LogUI";

export const CombatUI: React.FC<{
state: AppState;
}> = (props) => {
return (
<div>
<div className="wrapper">
<div className="game">
<table className="grid">
<thead>
Expand All @@ -35,7 +35,11 @@ export const CombatUI: React.FC<{
))}
</tbody>
</table>
{props.state.dragonHP > 0 ? (
<Dragon hp={props.state.dragonHP} />
) : (
<DeadDragon hp={0} />
)}
{props.state.characters.every((x) => x.health < 1) ? (
<div className="gameover">GAME OVER</div>
) : null}
Expand Down
83 changes: 72 additions & 11 deletions src/off-limits/Dragon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,86 @@ export const Dragon: React.FC<{
}
hpString += '] (' + props.hp + ')';
return (
<div className="dragon ascii">
<div>BOSS DRAGON</div>
<div className="hp">{hpString}</div>
<div> </div>
<div className="dragon ascii hack-center">
<img id="flame1" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame2" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame3" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame4" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame5" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame6" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame7" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame8" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame9" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame10" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame11" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame12" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame13" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame14" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame15" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<img id="flame16" src="https://img.icons8.com/color/48/000000/fire-element--v2.png"/>
<div className="text-center">BOSS DRAGON</div>
<div className="hp text-center">{hpString}</div>
<div className=""> </div>
{' _/=======() \n' +
'(/___ /|\\ ()==========__\n' +
' _/ | \\ //| ______/ )\n' +
' _| \\ // | _/\n' +
' |/|_ // //\n' +
' |/|_/ // //\n' +
' (oo) _// /\n' +
' //_/_/ / |\n' +
' @@/ |= |\n' +
' _=_ |\n' +
' == |_ snd\n' +
' __(===( )\\\n' +
' (((~) __(_/ |\n' +
' (((~) /\n' +
' ______/ /\n' +
' |_=_ |\n' +
' \\ == |_ snd\n' +
' __(===( ) \\\n' +
' (((~) __(_/ |\n' +
' (((~) /\n' +
' ______//\n' +
'Art by Shanaka Dias'}
</div>
);
};

export const DeadDragon: React.FC<{
hp: number;
}> = (props) => {
let hpString = 'HP: [';
for (var i = 1; i < 21; i++) {
if (props.hp >= i * 5) hpString += '█';
else hpString += ' ';
}
hpString += '] (' + props.hp + ')';
return (
<div className="dragon ascii hack-center">
<div className="text-center">BOSS DRAGON</div>
<div className="hp text-center">{hpString}</div>
<div className="spacer"> </div>
<div id="pile1">{
'_/=======() \n' +
'(/___ /|\\ ()==========__\n' +
' _/ | \\ //| ______/ )\n' +
' _| \\ // | _/\n'
}</div>
<div id="pile2">{
'_| \\ // | _/\n' +
' |/|_/ // //\n' +
' (oo) _// /\n' +
' //_/_/ / |\n' +
'@@/ |= |'
}</div>
<div id="pile3">{
'@@/ |= |\n' +
' _=_ |\n' +
' == |_ snd\n' +
' __(===( )'
}</div>
<div id="pile4">{
'🪦 \n'+
' \n'+
' \n'+
' (((~) __(_/ |\n' +
' (((~) /\n' +
' ______/ /\n'
}</div>
</div>
);
};
14 changes: 9 additions & 5 deletions src/off-limits/LogUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ import React from "react";
export const LogUI: React.FC<{
log: string[]
}> = (props) => {
return <div>
<span className="block">☞ {props.log[0]}</span>
<span className="block">{props.log[1]}</span>
<span className="block">{props.log[2]}</span>
<span className="block">{props.log[3]}</span>
return <div className="flex">
<div className="box-outer"> </div>
<div className="pad-top box-center">
<span className="block">☞ {props.log[0]}</span>
<span className="block">{props.log[1]}</span>
<span className="block">{props.log[2]}</span>
<span className="block">{props.log[3]}</span>
</div>
<div className="box-outer"> </div>
</div>
}
15 changes: 0 additions & 15 deletions src/off-limits/LootUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@ export const LootUI: React.FC<{
start: () => void;
loot: (index: number) => void;
}> = (props) => {
useEffect(() => {
const tID = setInterval(() => {
for (let i = 0; i < props.state.chests.length; i++) {
const chest = props.state.chests[i];
if (chest.opened){
continue;
} else {
props.loot(i);
return;
}
}
props.start();
}, 3000);
return () => clearInterval(tID)
});
const anyClosed = props.state.chests.some(x => !x.opened);
return (
<div>
Expand Down
6 changes: 0 additions & 6 deletions src/off-limits/MenuUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ export const MenuUI: React.FC<{
state: AppState;
start: () => void;
}> = (props) => {
useEffect(() => {
const tID = setTimeout(() => {
props.start();
}, 12000);
return () => clearTimeout(tID)
})
return (
<div className="game">
<table className="grid wide">
Expand Down
Loading