Skip to content

Commit

Permalink
Merge branch 'release/v1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
kobalab committed Oct 18, 2024
2 parents 171ec32 + cb3c2dd commit 82b8b87
Show file tree
Hide file tree
Showing 6 changed files with 886 additions and 810 deletions.
9 changes: 9 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## v1.3.0 / 2024-10-19

- Majiang.Board にメソッド last() を追加
- 脆弱性警告に対処
- braces 3.0.2 → 3.0.3
- パッケージを最新化
- mocha 10.2.0 → 10.7.3
- nyc 15.1.0 → 17.1.0

### v1.2.1 / 2024-02-25

- String の非推奨のメソッドを変更: substr() → slice()
Expand Down
23 changes: 21 additions & 2 deletions lib/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ module.exports = class Board {

this._lizhi;
this._fenpei;
this._lianzhuang;
this._changbang;
this._lizhibang;
}

menfeng(id) {
Expand All @@ -64,8 +67,10 @@ module.exports = class Board {
}
this.lunban = -1;

this._lizhi = false;
this._fenpei = null;
this._lizhi = false;
this._fenpei = null;
this._changbang = qipai.changbang;
this._lizhibang = qipai.lizhibang;
}

lizhi() {
Expand Down Expand Up @@ -118,6 +123,8 @@ module.exports = class Board {
}
this.shan.fubaopai = hule.fubaopai;
this._fenpei = hule.fenpei;
this._lizhibang = 0;
if (hule.l == 0) this._lianzhuang = true;
}

pingju(pingju) {
Expand All @@ -126,6 +133,18 @@ module.exports = class Board {
if (pingju.shoupai[l])
this.shoupai[l].fromString(pingju.shoupai[l]);
}
this._fenpei = pingju.fenpei;
this._lizhibang = this.lizhibang;
this._lianzhuang = true;
}

last() {
if (! this._fenpei) return;
this.changbang = this._lianzhuang ? this._changbang + 1 : 0;
this.lizhibang = this._lizhibang;
for (let l = 0; l < 4; l++) {
this.defen[this.player_id[l]] += this._fenpei[l];
}
}

jieju(paipu) {
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* @kobalab/majiang-core v1.2.1
* @kobalab/majiang-core v1.3.0
*
* Copyright(C) 2021 Satoshi Kobayashi
* Released under the MIT license
Expand Down
Loading

0 comments on commit 82b8b87

Please sign in to comment.