Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
browntj16 committed Apr 18, 2024
1 parent 31d44e6 commit d6c37c2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
40 changes: 28 additions & 12 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReactNode, createContext, useContext, useState } from "react";
import placeholderSVGURL from "./assets/placeholder.svg";
import { Game, Creature, Building, Player, Ability, Targeter, Card } from "./model";
import { n } from "vitest/dist/reporters-MmQN-57K.js";
import { get } from "./CardMap"

var log = [];
log.push(<div>Player 1 activated "Spell name!"</div>);
Expand Down Expand Up @@ -337,22 +337,22 @@ function LandscapeCard({
// check if creature is undefined
if (creature?.name==null) {
c = CreatureComponent({
cardName: creature.name,
cardText: creature.flavorText,
actionCost: creature.getCost(),
landscapeType: creature.landscapeType,
attack: creature.attack,
defense: creature.defense,
cardName: creature!.name,
cardText: creature!.flavorText,
actionCost: creature!.getCost(),
landscapeType: creature!.landscapeType,
attack: creature!.attack,
defense: creature!.defense,
imagePath: "",
});
}
// check if building is undefined
if (building?.name==null) {
b = CardComponent({
cardName: building.name,
cardText: building.flavorText,
actionCost: building.getCost(),
landscapeType: building.landscapeType,
cardName: building!.name,
cardText: building!.flavorText,
actionCost: building!.getCost(),
landscapeType: building!.landscapeType,
imagePath: "",
});
}
Expand Down Expand Up @@ -384,6 +384,19 @@ function PlayerDisplay({game, player}: {game: Game, player: Player}){
</div>
)
}
function getDemoPlayer(player: Player){
player.deck.push(get("Dark Angel")!);
player.deck.push(get("Dark Angel")!);
player.deck.push(get("Dark Angel")!);
player.deck.push(get("Dark Angel")!);
player.deck.push(get("Dark Angel")!);

player.hand.push(get("Dark Angel")!);
player.hand.push(get("Dark Angel")!);
player.hand.push(get("Dark Angel")!);
player.hand.push(get("Dark Angel")!);
player.hand.push(get("Dark Angel")!);
}
/**
* This is like the big daddy of the components. This makes up pretty much the entire game. Shows players board, hp, hands, etc etc.
* @returns Markup to display the game
Expand Down Expand Up @@ -477,12 +490,15 @@ function PhaseButton({game, imagePath, setPhase, setTurn, setCurrentPlayer}: {ga
}
function App() {
const[begin, setBegin] = useState(false);
let game=new Game();
let h = function(){
setBegin(true);
}
let page=<></>
if(begin){
let game=new Game();
getDemoPlayer(game.players[0]);
getDemoPlayer(game.players[1]);
console.log(game);
page=<GameBoard game={game}></GameBoard>
}
else{
Expand Down
3 changes: 3 additions & 0 deletions src/model.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { get } from "./CardMap";

//============================================================== Enums ==============================================================
export const TurnPhases = {
Play: 0,
Expand Down Expand Up @@ -1424,3 +1426,4 @@ export class Game extends AbstractGame {
}
}
}

0 comments on commit d6c37c2

Please sign in to comment.