Agregado valores a los yaku

master
Araozu 2020-10-27 15:10:19 -05:00
parent 913e8aa6b0
commit 73628596cc
4 changed files with 67 additions and 8 deletions

View File

@ -1,4 +1,4 @@
export const servidor = "0.0.0.0:8080"; // "rimajonb.araozu.dev"; // "0.0.0.0:8080"; //
export const servidorF = `http://${servidor}`;
export const wsServidor = `ws://${servidor}`;
export const servidor = "rimajonb.araozu.dev"; // "0.0.0.0:8080"; //
export const servidorF = `https://${servidor}`;
export const wsServidor = `wss://${servidor}`;

View File

@ -7,7 +7,7 @@ div.contenedor-pantalla-ganador(v-if="manoGanadora" :style="'--escala: 1.5; --ph
hr
h2 Yaku:
h3.yaku(v-for="y in yaku") {{ y }}
h3.yaku(v-for="y in yaku") {{ y }} : {{ obtValorYaku(y) }} puntos
hr
@ -23,6 +23,7 @@ import { useDimensions } from "@/components/useDimensions";
import { Mano } from "@/views/Juego/types/Mano";
import grupoCartas from "@/components/grupo-cartas.vue"
import { OportunidadWin } from "@/views/Juego/types/Oportunidad";
import { obtValorYaku, Yaku } from "@/views/Juego/types/valoresYaku";
export default defineComponent({
name: "pantalla-ganador",
@ -71,7 +72,7 @@ export default defineComponent({
return cartas;
});
const yaku = computed<Array<string>>(() => {
const yaku = computed<Array<Yaku>>(() => {
if (manoGanadora.value === undefined) return [];
const oportunidadWin = manoGanadora.value!!.oportunidades.find((o) => o.nombreOportunidad === "Win")!! as OportunidadWin;
@ -79,7 +80,12 @@ export default defineComponent({
});
const valorMano = computed(() => {
const n = yaku.value.length;
let n = 0;
for (const y of yaku.value) {
n += obtValorYaku(y)
}
if (n === 0) return 100;
const preValor = 1000 + (270 * n**2) - (18 * n**3);
// Eliminar los 2 ultimos números.
return Math.floor(preValor / 100) * 100;
@ -90,7 +96,8 @@ export default defineComponent({
cartasManoGanadora,
phx,
valorMano,
yaku
yaku,
obtValorYaku
}
}
});

View File

@ -1,3 +1,5 @@
import { Yaku } from "@/views/Juego/types/valoresYaku";
export declare interface Oportunidad {
cartaDescartada: number;
nombreOportunidad: string;
@ -19,5 +21,5 @@ export declare class OportunidadWin implements Oportunidad {
cartaDescartada: number;
nombreOportunidad: string;
esTsumo: boolean;
yaku: string[];
yaku: Yaku[];
}

View File

@ -0,0 +1,50 @@
export type Yaku =
| "DragonesFull"
| "Verde"
| "RealezaDragones"
| "RealezaFull"
| "TripleTriplesCerrados"
| "EscaleraFull"
| "Exterior"
| "Escalera"
| "TripleCuadruples"
| "Negro"
| "Rojo"
| "SemiExterior"
| "ParUnico"
| "DragonJugador"
| "DragonPartida"
| "Interior"
| "TripleTriples"
| "TripleSecuenciaCerrada"
| "Realeza"
| "DobleSecuenciaPura"
| "Cerrado"
export const obtValorYaku = (y: Yaku): number => {
switch (y) {
case "DragonesFull": return 10
case "Verde": return 10
case "RealezaDragones": return 7
case "RealezaFull": return 7
case "TripleTriplesCerrados": return 3
case "EscaleraFull": return 3
case "Exterior": return 3
case "Escalera": return 2
case "TripleCuadruples": return 2
case "Negro": return 2
case "Rojo": return 2
case "SemiExterior": return 2
case "ParUnico": return 1
case "DragonJugador": return 1
case "DragonPartida": return 1
case "Interior": return 1
case "TripleTriples": return 1
case "TripleSecuenciaCerrada": return 1
case "Realeza": return 1
case "DobleSecuenciaPura": return 1
case "Cerrado": return 0
}
}