bug修复

'odds'统一返回数值;
Math.log考虑非正数
This commit is contained in:
157 2024-01-06 19:53:50 +08:00
parent 0a0fa7e023
commit 9a2bf07ab4
1 changed files with 7 additions and 3 deletions

View File

@ -8048,6 +8048,7 @@ export class Player extends HTMLDivElement {
let count = 0;
if ((this.hp > 2 || !this.isZhu && this.hp > 1) && this.hasSkillTag('respondSha', true, type, true)) {
if (rvt === 'count') count++;
else if (rvt === 'odds') return 1;
else return true;
}
if (get.itemtype(viewer) !== 'player') viewer = _status.event.player;
@ -8067,17 +8068,18 @@ export class Player extends HTMLDivElement {
return false;
});
count += cards.length;
if (count && rvt !== 'count') return true;
if (count && rvt !== 'count') return rvt === 'odds' ? 1 : true;
let hs = this.getCards('hs').filter(i => !cards.includes(i)).length;
if (!hs) {
if (rvt === 'count') return count;
else if (rvt === 'odds') return 0;
return false;
}
if (rvt === 'count') {
if (this.isPhaseUsing()) return count + hs / 4;
return count + hs / 4.8;
}
if (this.isPhaseUsing()) count += Math.pow(2 + hs, 2) / 40;
if (hs > 9 || this.isPhaseUsing()) count += Math.pow(2 + hs, 2) / 40;
else count += -1.5 * Math.log(1 - hs / 10);
if (rvt === 'odds') return Math.min(1, count);
return count > _status.event.getRand('mayHaveSha' + hs + this.playerid);
@ -8091,6 +8093,7 @@ export class Player extends HTMLDivElement {
let count = 0;
if ((this.hp > 2 || !this.isZhu && this.hp > 1) && this.hasSkillTag('respondShan', true, type, true)) {
if (rvt === 'count') count++;
else if (rvt === 'odds') return 1;
else return true;
}
if (get.itemtype(viewer) !== 'player') viewer = _status.event.player;
@ -8110,10 +8113,11 @@ export class Player extends HTMLDivElement {
return false;
});
count += cards.length;
if (count && rvt !== 'count') return true;
if (count && rvt !== 'count') return rvt === 'odds' ? 1 : true;
let hs = this.getCards('hs').filter(i => !cards.includes(i)).length;
if (!hs) {
if (rvt === 'count') return count;
else if (rvt === 'odds') return 0;
return false;
}
if (rvt === 'count') {