ernegreiros / BatalhaNaval

Projeto de um jogo de Batalha Naval para a matéria de IES-300
MIT License
0 stars 0 forks source link

Banco atualizações #48

Open ernegreiros opened 3 years ago

ernegreiros commented 3 years ago

Modelagem mais recente do banco de dados: -- Criar Tabelas CREATE TABLE Users( ID int IDENTITY(1,1) PRIMARY KEY, Name varchar(255) NOT NULL, Login varchar(30) NOT NULL, Password varchar(30) NOT NULL, Code varchar(30) Not null, Money float NOT NULL, );

CREATE TABLE Match( ID int IDENTITY(1,1) PRIMARY KEY, Player1 int NOT NULL, Player2 int NOT NULL, Status int NOT NULL, CurrentPlayer int not null, Winner int NULL, FOREIGN KEY (Player1) REFERENCES Users(ID), FOREIGN KEY (Player2) REFERENCES Users(ID), );

CREATE TABLE BattleField( ID int IDENTITY(1,1) PRIMARY KEY, PlayerId int NOT NULL, PosX int NOT NULL, PosY int NOT NULL, MatchId int NOT NULL, FOREIGN KEY (PlayerId) REFERENCES Users(ID), FOREIGN KEY (MatchId) REFERENCES Match(ID), );

CREATE TABLE SpecialPowers( ID int IDENTITY(1,1) PRIMARY KEY, Name varchar(30) not null, Cost float not null, Quantifier int not null, Type int not null, Compensation float not null default 0, );

CREATE TABLE MatchSpecialPowers( ID int IDENTITY(1,1) PRIMARY KEY, MatchId int not null, PlayerId int not null, SpecialPowerId int not null, Used bit not null default 0 );

CREATE TABLE Themes( ID int IDENTITY(1,1) PRIMARY KEY, Name varchar(30) not null, Description varchar(100) not null, ImagePath VARCHAR(MAX) NOT NULL );

CREATE TABLE Ships( ID int IDENTITY(1,1) PRIMARY KEY, Name varchar(30) not null, Type int not null, ImagePath VARCHAR(MAX) NOT NULL, ThemeId int not null, FOREIGN KEY (ThemeId) REFERENCES Themes(ID) );

--Deletar Tabelas /* DROP TABLE Ships

DROP TABLE Themes

DROP TABLE MatchSpecialPowers

DROP TABLE SpecialPowers

DROP TABLE BattleField

DROP TABLE Match

DROP TABLE Users */

PePires58 commented 3 years ago

CREATE TABLE BattleField( ID int IDENTITY(1,1) PRIMARY KEY, PlayerId int NOT NULL, PosX int NOT NULL, PosY int NOT NULL, MatchId int NOT NULL, Attacked int not null default 0, FOREIGN KEY (PlayerId) REFERENCES Users(ID), FOREIGN KEY (MatchId) REFERENCES Match(ID), );

CREATE TABLE Match( ID int IDENTITY(1,1) PRIMARY KEY, Player1 int NOT NULL, Player2 int NOT NULL, Status int NOT NULL, CurrentPlayer int not null, Winner int NULL, MatchContrl int not null default 1, FOREIGN KEY (Player1) REFERENCES Users(ID), FOREIGN KEY (Player2) REFERENCES Users(ID), );

**CREATE TABLE MatchAttacks( MatchId int not null, PosX int not null, PosY int not null, Target int not null FOREIGN KEY (Target) references Users(ID) );

CREATE TABLE BattleFieldDefended( ID int IDENTITY(1,1) PRIMARY KEY, PlayerId int NOT NULL, PosX int NOT NULL, PosY int NOT NULL, MatchId int NOT NULL, MatchContrl int not null default 0, FOREIGN KEY (PlayerId) REFERENCES Users(ID), FOREIGN KEY (MatchId) REFERENCES Match(ID), );**

Criar issue para incluir novo campo no battle ship para identificar coordenadas já atacadas Criar issue para criar tabela de matchattack para saber quais coordenadas já foram atacadas, considerando inclusive a que não tem barcos Criar issue para quando criar a partida, cadastrar na tabela MatchSpecialPowers os poderes como used = 0

@ernegreiros

ltakato commented 3 years ago

atualização tabela - Match

CREATE TABLE Match( ID int IDENTITY(1,1) PRIMARY KEY, Player1 int NOT NULL, Player2 int NOT NULL, Player1Ready int not null default 0, Player2Ready int not null default 0, Status int NOT NULL, CurrentPlayer int not null, Winner int NULL, MatchContrl int not null default 1, FOREIGN KEY (Player1) REFERENCES Users(ID), FOREIGN KEY (Player2) REFERENCES Users(ID), );