Created
June 16, 2020 18:49
-
-
Save MateusGabi/1bdf35d2f9369aeaee7880f03e69ba51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PaintComponent { | |
Graphics graphics; | |
Images[] animationAttack; | |
} | |
interface IPeca { | |
PaintComponent getPaintComponent() | |
} | |
class PecaGeneric implements IPeca { | |
PaintComponent paintComponent; | |
// overrides | |
} | |
// é o PecaTile de voces | |
interface IPecaTabuleiro extends IPeca { | |
moveOrattack() | |
setTarget() | |
} | |
class PecaTabuleiro extends PecaGeneric implements IPecaTabuleiro { | |
// attris | |
} | |
interface IPecaBanco extends IPeca { | |
} | |
interface IPecaMao extends IPeca { | |
} | |
// é o seu card jogador | |
class PecaMaoJogador implements IPecaMao { | |
// seus attr e constructors | |
} | |
class PlayerMao { | |
Array<IPecaMao> arrayOfPecaMao; | |
PlayerMao() { | |
this.arrayOfPecaMao = new Array<IPecaoMao>(); | |
} | |
setNewPeca(IPecaBanco peca){ | |
// transforma peca banco para ipecaplayer | |
IPecaoMao newIPecaMao = new PecaMaoJogador(); | |
newIPecaMao.setPaintComponent(peca.getPaintComponent()); | |
newIPecaMao.setAttr(peca.getAtt()); | |
//... | |
this.arrayOfPecaMao.add(newIPecaMao) | |
} | |
getPeca(x) { | |
PecaMaoJogador pecaMaoJogador = this.arrayOfPecaMao.get(x) | |
this.arrayOfPecaMao.replace(x, null); | |
return pecaMaoJogador; | |
} | |
} | |
class Player { | |
PlayerMao mao; | |
PlayerMao getMao() { | |
return this.mao; | |
} | |
} | |
class Tabuleiro { | |
Array<Array<IPecaTabuleiro>> matrixOfIPecaTabuleiro; | |
/*try { | |
} catch(NullPointerException e) { | |
System.out.print | |
}*/ | |
Tabuleiro() { | |
this.matrixOfIPecaTabuleiro = new Array<Array<IPecaTabuleiro>>(); | |
} | |
putPecaNoTabuleiro(IPecaMaoJogador pecaMaoJogador) { | |
IPecaTabuleiro newIPecaTabuleiro = new PecaTabuleiro(); | |
newIPecaTabuleiro.setAttr(pecaMaoJogador.getAtt()); | |
//..... | |
// pergunta para onde quer mover? | |
// resposta x, y | |
this.matrixOfIPecaTabuleiro.get(x).set(y, newIPecaTabuleiro) | |
// mesma coisa: | |
// this.matrixOfIPecaTabuleiro[x][y] = newIPecaTabuleiro; | |
} | |
} | |
class Banco { | |
Array<IPecaBanco> arrayOfPecaBanco; | |
// listener() { | |
// x é onde o cara clicou | |
// player | |
// this.comprarPecaEmIndex(x) | |
// } | |
int getRequestedPoint(x) { | |
// regra de megocio | |
return 1 para arqueira, | |
} | |
void comprarPecaEmIndex(x, Player player) throws SaldoIndisponivelException { | |
// verificar se o cara tem pontos para comprara | |
if (this.player.getPontos() < getRequestedPoint(x)) { | |
throw new SaldoIndisponivelException() | |
} | |
// [a, b, c] | |
// replace(b, random()) | |
// [a, c] | |
// << | |
// [] | |
IPecaBanco pecaBanco = this.arrayOfPecaBanco.get(x); | |
// [a, d, c] | |
this.arrayOfPecaBanco.replace(x, this.getRandomPecaBanco()); | |
// move a peca/gerar cópia para a mão do jogador | |
player.getMao().setNewPeca(pecaBanco) | |
} | |
IPecaBanco getRandomPecaBanco() { | |
// ........ | |
} | |
} | |
class Game { | |
Game() { | |
this.playerOne = new Player(); | |
this.playerTwo = new Player(); | |
this.tabuleiro = new Tabuleiro(); | |
this.banco = new Banco(); | |
} | |
//.... | |
listener() { | |
// comprar uma peça do banco | |
// this.playerOne.comprarPeca(this.banco); | |
this.banco.comprarPecaEmIndex(x, this.player); | |
// peça mao para o tabuleiro | |
IPecaMaoJogador pecaMaoJogador = this.playerOne.getMao().getPeca(x); | |
this.tabuleiro.putPecaNoTabuleiro(pecaMaoJogador); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment