Commit 304381a7 authored by nanahira's avatar nanahira

Merge branch 'master' of git.mycard.moe:mycard/ygopro-arena-revive

parents 50f97279 cbf837a6
...@@ -644,17 +644,17 @@ export class AppService { ...@@ -644,17 +644,17 @@ export class AppService {
if (userscoreA === -5 || userscoreB === -5) { if (userscoreA === -5 || userscoreB === -5) {
pre_exit = true; pre_exit = true;
firstWin = false; firstWin = false;
ptResult.ptA = userA.pt; ptResult.ptA = 0;
ptResult.ptB = userB.pt; ptResult.ptB = 0;
if (userscoreA === -9) { if (userscoreA === -9) {
ptResult.ptA = userA.pt - 2; ptResult.ptA = -2;
this.log.compatLog( this.log.compatLog(
usernameA, usernameA,
'开局退房', '开局退房',
moment(start).format('YYYY-MM-DD HH:mm'), moment(start).format('YYYY-MM-DD HH:mm'),
); );
} else if (userscoreB === -9) { } else if (userscoreB === -9) {
ptResult.ptB = userB.pt - 2; ptResult.ptB = -2;
this.log.compatLog( this.log.compatLog(
usernameB, usernameB,
'开局退房', '开局退房',
...@@ -667,8 +667,8 @@ export class AppService { ...@@ -667,8 +667,8 @@ export class AppService {
//按加减8或16处理:高分赢低分 高分加8低分减8,低分赢高分,低分加16,高分减16. //按加减8或16处理:高分赢低分 高分加8低分减8,低分赢高分,低分加16,高分减16.
if (!pre_exit && userA.pt - userB.pt > 137) { if (!pre_exit && userA.pt - userB.pt > 137) {
if (winner === usernameA) { if (winner === usernameA) {
ptResult.ptA = userA.pt + 8; ptResult.ptA = +8;
ptResult.ptB = userB.pt - 8; ptResult.ptB = -8;
this.log.compatLog( this.log.compatLog(
userA.pt, userA.pt,
userB.pt, userB.pt,
...@@ -678,8 +678,8 @@ export class AppService { ...@@ -678,8 +678,8 @@ export class AppService {
} }
if (winner === usernameB) { if (winner === usernameB) {
ptResult.ptA = userA.pt - 15; ptResult.ptA = -15;
ptResult.ptB = userB.pt + 16; ptResult.ptB = +16;
this.log.compatLog( this.log.compatLog(
userA.pt, userA.pt,
userB.pt, userB.pt,
...@@ -691,8 +691,8 @@ export class AppService { ...@@ -691,8 +691,8 @@ export class AppService {
if (!pre_exit && userB.pt - userA.pt > 137) { if (!pre_exit && userB.pt - userA.pt > 137) {
if (winner === usernameA) { if (winner === usernameA) {
ptResult.ptA = userA.pt + 16; ptResult.ptA = +16;
ptResult.ptB = userB.pt - 15; ptResult.ptB = -15;
this.log.compatLog( this.log.compatLog(
userA.pt, userA.pt,
userB.pt, userB.pt,
...@@ -702,8 +702,8 @@ export class AppService { ...@@ -702,8 +702,8 @@ export class AppService {
} }
if (winner === usernameB) { if (winner === usernameB) {
ptResult.ptA = userA.pt - 8; ptResult.ptA = -8;
ptResult.ptB = userB.pt + 8; ptResult.ptB = +8;
this.log.compatLog( this.log.compatLog(
userA.pt, userA.pt,
userB.pt, userB.pt,
...@@ -717,7 +717,7 @@ export class AppService { ...@@ -717,7 +717,7 @@ export class AppService {
const isLess3Min = moment(start).add(1, 'm').isAfter(moment(end)); const isLess3Min = moment(start).add(1, 'm').isAfter(moment(end));
if (!pre_exit && isLess3Min) { if (!pre_exit && isLess3Min) {
if (winner === usernameA) { if (winner === usernameA) {
ptResult.ptA = userA.pt; ptResult.ptA = 0;
this.log.compatLog( this.log.compatLog(
usernameA, usernameA,
'当局有人存在早退,胜利不加分', '当局有人存在早退,胜利不加分',
...@@ -725,7 +725,7 @@ export class AppService { ...@@ -725,7 +725,7 @@ export class AppService {
); );
} }
if (winner === usernameB) { if (winner === usernameB) {
ptResult.ptB = userB.pt; ptResult.ptB = 0;
this.log.compatLog( this.log.compatLog(
usernameB, usernameB,
'当局有人存在早退,胜利不加分', '当局有人存在早退,胜利不加分',
...@@ -766,12 +766,12 @@ export class AppService { ...@@ -766,12 +766,12 @@ export class AppService {
battleHistory.usernameb = userB.username; battleHistory.usernameb = userB.username;
battleHistory.userscorea = userscoreA; battleHistory.userscorea = userscoreA;
battleHistory.userscoreb = userscoreB; battleHistory.userscoreb = userscoreB;
battleHistory.expa = expResult.expA; battleHistory.expa = expResult.expA + userA.exp;
battleHistory.expb = expResult.expB; battleHistory.expb = expResult.expB + userB.exp;
battleHistory.expa_ex = userA.exp; battleHistory.expa_ex = userA.exp;
battleHistory.expb_ex = userB.exp; battleHistory.expb_ex = userB.exp;
battleHistory.pta = ptResult.ptA; battleHistory.pta = ptResult.ptA + userA.pt;
battleHistory.ptb = ptResult.ptB; battleHistory.ptb = ptResult.ptB + userB.pt;
battleHistory.pta_ex = userA.pt; battleHistory.pta_ex = userA.pt;
battleHistory.ptb_ex = userB.pt; battleHistory.ptb_ex = userB.pt;
battleHistory.type = arena; battleHistory.type = arena;
...@@ -819,8 +819,9 @@ export class AppService { ...@@ -819,8 +819,9 @@ export class AppService {
.createQueryBuilder() .createQueryBuilder()
.update(UserInfo) .update(UserInfo)
.set({ .set({
exp: expResult.expA, exp: () =>
pt: ptResult.ptA, `exp ${this.eloService.getSqlString(expResult.expA)}`,
pt: () => `pt ${this.eloService.getSqlString(ptResult.ptA)}`,
athletic_win: () => `athletic_win + ${paramA.athletic_win}`, athletic_win: () => `athletic_win + ${paramA.athletic_win}`,
athletic_lose: () => `athletic_lose + ${paramA.athletic_lose}`, athletic_lose: () => `athletic_lose + ${paramA.athletic_lose}`,
athletic_draw: () => `athletic_draw + ${paramA.athletic_draw}`, athletic_draw: () => `athletic_draw + ${paramA.athletic_draw}`,
...@@ -832,8 +833,9 @@ export class AppService { ...@@ -832,8 +833,9 @@ export class AppService {
.createQueryBuilder() .createQueryBuilder()
.update(UserInfo) .update(UserInfo)
.set({ .set({
exp: expResult.expB, exp: () =>
pt: ptResult.ptB, `exp ${this.eloService.getSqlString(expResult.expB)}`,
pt: () => `pt ${this.eloService.getSqlString(ptResult.ptB)}`,
athletic_win: () => `athletic_win + ${paramB.athletic_win}`, athletic_win: () => `athletic_win + ${paramB.athletic_win}`,
athletic_lose: () => `athletic_lose + ${paramB.athletic_lose}`, athletic_lose: () => `athletic_lose + ${paramB.athletic_lose}`,
athletic_draw: () => `athletic_draw + ${paramB.athletic_draw}`, athletic_draw: () => `athletic_draw + ${paramB.athletic_draw}`,
...@@ -875,8 +877,8 @@ export class AppService { ...@@ -875,8 +877,8 @@ export class AppService {
battleHistory.usernameb = userB.username; battleHistory.usernameb = userB.username;
battleHistory.userscorea = userscoreA; battleHistory.userscorea = userscoreA;
battleHistory.userscoreb = userscoreB; battleHistory.userscoreb = userscoreB;
battleHistory.expa = expResult.expA; battleHistory.expa = expResult.expA + userA.exp;
battleHistory.expb = expResult.expB; battleHistory.expb = expResult.expB + userB.exp;
battleHistory.expa_ex = userA.exp; battleHistory.expa_ex = userA.exp;
battleHistory.expb_ex = userB.exp; battleHistory.expb_ex = userB.exp;
battleHistory.pta = userA.pt; battleHistory.pta = userA.pt;
...@@ -899,7 +901,8 @@ export class AppService { ...@@ -899,7 +901,8 @@ export class AppService {
.createQueryBuilder() .createQueryBuilder()
.update(UserInfo) .update(UserInfo)
.set({ .set({
exp: expResult.expA, exp: () =>
`exp ${this.eloService.getSqlString(expResult.expA)}`,
entertain_win: () => `entertain_win + ${paramA.entertain_win}`, entertain_win: () => `entertain_win + ${paramA.entertain_win}`,
entertain_lose: () => entertain_lose: () =>
`entertain_lose + ${paramA.entertain_lose}`, `entertain_lose + ${paramA.entertain_lose}`,
...@@ -913,7 +916,8 @@ export class AppService { ...@@ -913,7 +916,8 @@ export class AppService {
.createQueryBuilder() .createQueryBuilder()
.update(UserInfo) .update(UserInfo)
.set({ .set({
exp: expResult.expB, exp: () =>
`exp ${this.eloService.getSqlString(expResult.expB)}`,
entertain_win: () => `entertain_win + ${paramB.entertain_win}`, entertain_win: () => `entertain_win + ${paramB.entertain_win}`,
entertain_lose: () => entertain_lose: () =>
`entertain_lose + ${paramB.entertain_lose}`, `entertain_lose + ${paramB.entertain_lose}`,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment