commit
f714945d5d
|
@ -1306,7 +1306,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
|
|||
},
|
||||
filterTarget:function(card,player,target){
|
||||
if(player==target) return false;
|
||||
return target.hasCard(card=>lib.filter.canBeGained(card,target,player),get.is.single()?'he':'hej');
|
||||
return target.hasCard(card=>lib.filter.canBeGained(card,player,target),get.is.single()?'he':'hej');
|
||||
},
|
||||
content:function(){
|
||||
let pos=get.is.single()?'he':'hej';
|
||||
|
@ -1563,7 +1563,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
|
|||
},
|
||||
filterTarget:function(card,player,target){
|
||||
if(player==target) return false;
|
||||
return target.hasCard(card=>lib.filter.canBeDiscarded(card,target,player),get.is.single()?'he':'hej');
|
||||
return target.hasCard(card=>lib.filter.canBeDiscarded(card,player,target),get.is.single()?'he':'hej');
|
||||
},
|
||||
defaultYingbianEffect:'add',
|
||||
content:function(){
|
||||
|
|
|
@ -305,10 +305,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
},
|
||||
position:'h',
|
||||
check:(card)=>{
|
||||
let player=_status.event.player;
|
||||
let targets=game.filterPlayer(target=>target!=player&&lib.skill.dcweiwan.ai.result.target(player,target)!=0);
|
||||
targets.sort((a,b)=>Math.abs(lib.skill.dcweiwan.ai.result.target(player,b))-Math.abs(lib.skill.dcweiwan.ai.result.target(player,a)));
|
||||
return lib.skill.dcweiwan.getWeiWanEffect(player,card,targets[0]);
|
||||
const player=_status.event.player;
|
||||
const target = game.players.reduce((result, current) => {
|
||||
if (current === player) return result;
|
||||
const effect = Math.abs(lib.skill.dcweiwan.ai.result.target(player, current));
|
||||
return effect > result[1] ? [current, effect] : result;
|
||||
}, [null, 0])[0];
|
||||
return target?lib.skill.dcweiwan.getWeiWanEffect(player,card,target):0;
|
||||
},
|
||||
usable:1,
|
||||
content:function*(event,map){
|
||||
|
@ -352,35 +355,29 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
order:9,
|
||||
result:{
|
||||
target:(player,target)=>{
|
||||
let att=get.sgn(get.attitude(player,target))-1;
|
||||
let cards=player.getCards(lib.skill.dcweiwan.position,card=>{
|
||||
return lib.skill.dcweiwan.filterCard(card,player);
|
||||
});
|
||||
cards.sort((a,b)=>lib.skill.dcweiwan.getWeiWanEffect(player,b,target)-lib.skill.dcweiwan.getWeiWanEffect(player,a,target));
|
||||
return att*lib.skill.dcweiwan.getWeiWanEffect(player,cards[0],target);
|
||||
const att=get.sgn(get.attitude(player,target))-1;
|
||||
const cards=player.getCards(lib.skill.dcweiwan.position,card=>lib.skill.dcweiwan.filterCard(card,player));
|
||||
return att * cards.reduce((result, card) => {
|
||||
const effect = lib.skill.dcweiwan.getWeiWanEffect(player, card, target);
|
||||
return effect > result ? effect : result;
|
||||
},0);
|
||||
},
|
||||
},
|
||||
},
|
||||
getWeiWanEffect:(player,cardx,target)=>{
|
||||
let suit=get.suit(cardx,player);
|
||||
let cards=target.getCards('hej',card=>get.suit(card,target)!=suit&&lib.filter.canBeGained(card,player,target));
|
||||
if(!cards.length) return 0;
|
||||
let suits=lib.suit.slice();
|
||||
suits.reverse();
|
||||
suits.add('none');
|
||||
let num=suits.filter(suit2=>cards.some(card=>get.suit(card,target)==suit2)).length;
|
||||
const suit=get.suit(cardx,player);
|
||||
const cards=target.getCards('hej',card=>get.suit(card,target)!==suit&&lib.filter.canBeGained(card,player,target));
|
||||
const num=lib.suits.filter(suit=>cards.some(card=>get.suit(card,target)===suit)).length;
|
||||
switch(num){
|
||||
case 1:
|
||||
num+=Math.max(0,get.sgn(get.effect(target,{name:'losehp'},player,player)));
|
||||
break;
|
||||
return num+Math.max(0,get.sgn(get.effect(target,{name:'losehp'},player,player)));
|
||||
case 2:
|
||||
num+=player.countCards('he',card=>player.canUse(card,target,false)&&get.effect(target,card,player,player)>0);
|
||||
break;
|
||||
return num+player.countCards('he',card=>player.canUse(card,target,false)&&get.effect(target,card,player,player)>0);
|
||||
case 3:
|
||||
num=Math.ceil(num/2);
|
||||
break;
|
||||
return Math.ceil(num / 2);
|
||||
default:
|
||||
return num;
|
||||
}
|
||||
return num;
|
||||
},
|
||||
},
|
||||
//董昭
|
||||
|
@ -421,7 +418,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
const player=map.player;
|
||||
let result;
|
||||
result=yield player.chooseTarget(get.prompt2('dcdingji')).set('ai',target=>{
|
||||
const att=get.attitude(get.player(),target)/2;
|
||||
let att=get.attitude(get.player(),target)/2;
|
||||
const delta=5-target.countCards('h');
|
||||
let fix=1;
|
||||
const hs=target.getCards('h');
|
||||
|
|
|
@ -5737,7 +5737,7 @@ export class Game extends Uninstantable {
|
|||
* @param { GameEventPromise } [event]
|
||||
*/
|
||||
static check(event) {
|
||||
let i, j, range;
|
||||
let i, range;
|
||||
if (event == undefined) event = _status.event;
|
||||
event._checked = true;
|
||||
let custom = event.custom || {};
|
||||
|
@ -5986,10 +5986,9 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
}
|
||||
if (!event.skill && get.noSelected() && !_status.noconfirm) {
|
||||
let skills = [], enable, info;
|
||||
let skills2;
|
||||
const skills = [];
|
||||
if (event._skillChoice) {
|
||||
skills2 = event._skillChoice;
|
||||
let skills2 = event._skillChoice;
|
||||
for (let i = 0; i < skills2.length; i++) {
|
||||
if (event.isMine() || !event._aiexclude.includes(skills2[i])) {
|
||||
skills.push(skills2[i]);
|
||||
|
@ -6007,9 +6006,10 @@ export class Game extends Uninstantable {
|
|||
skills2 = game.filterSkills(skills2.concat(lib.skill.global), player, player.getSkills('e').concat(lib.skill.global));
|
||||
event._skillChoice = [];
|
||||
game.expandSkills(skills2);
|
||||
for (i = 0; i < skills2.length; i++) {
|
||||
info = get.info(skills2[i]);
|
||||
enable = false;
|
||||
for (let i = 0; i < skills2.length; i++) {
|
||||
const info = get.info(skills2[i]);
|
||||
if (!info) throw new ReferenceError(`Cannot find ${skills2[i]} in lib.skill`);
|
||||
let enable = false;
|
||||
if (typeof info.enable == 'function') enable = info.enable(event);
|
||||
else if (Array.isArray(info.enable)) enable = info.enable.includes(event.name);
|
||||
else if (info.enable == 'phaseUse') enable = (event.type == 'phase');
|
||||
|
|
|
@ -2017,10 +2017,7 @@ export const Content = {
|
|||
event.doing = doingList.shift();
|
||||
while(true){
|
||||
if (trigger.filterStop && trigger.filterStop()) return;
|
||||
const usableSkills = event.doing.todoList.filter(info => {
|
||||
if (!lib.filter.filterTrigger(trigger, info.player, event.triggername, info.skill)) return false;
|
||||
return lib.skill.global.includes(info.skill) || info.player.hasSkill(info.skill, true);
|
||||
});
|
||||
const usableSkills = event.doing.todoList.filter(info => lib.filter.filterTrigger(trigger, info.player, event.triggername, info.skill));
|
||||
if (usableSkills.length == 0){
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2096,9 +2096,6 @@ export class Player extends HTMLDivElement {
|
|||
}
|
||||
}
|
||||
uninit() {
|
||||
this.expandedSlots = {};
|
||||
this.disabledSlots = {};
|
||||
|
||||
delete this.name;
|
||||
delete this.name1;
|
||||
delete this.tempname;
|
||||
|
@ -2107,21 +2104,14 @@ export class Player extends HTMLDivElement {
|
|||
delete this.hp;
|
||||
delete this.maxHp;
|
||||
delete this.hujia;
|
||||
this.clearSkills(true);
|
||||
|
||||
if (this.name2) {
|
||||
delete this.singleHp;
|
||||
delete this.name2;
|
||||
}
|
||||
for (var mark in this.marks) {
|
||||
this.marks[mark].remove();
|
||||
}
|
||||
ui.updatem(this);
|
||||
|
||||
this.skipList = [];
|
||||
this.skills = this.skills.filter(skill => {
|
||||
return lib.skill[skill] && lib.skill[skill].superCharlotte;
|
||||
});
|
||||
this.clearSkills(true);
|
||||
this.initedSkills = [];
|
||||
this.additionalSkills = {};
|
||||
this.disabledSkills = {};
|
||||
|
@ -2133,6 +2123,8 @@ export class Player extends HTMLDivElement {
|
|||
this.tempSkills = {};
|
||||
this.storage = {};
|
||||
this.marks = {};
|
||||
this.expandedSlots = {};
|
||||
this.disabledSlots = {};
|
||||
this.ai = { friend: [], enemy: [], neutral: [] };
|
||||
|
||||
this.$uninit();
|
||||
|
@ -2140,18 +2132,18 @@ export class Player extends HTMLDivElement {
|
|||
return this;
|
||||
}
|
||||
$uninit() {
|
||||
this.$syncExpand();
|
||||
this.$syncDisable();
|
||||
if (this.isDisabledJudge()) {
|
||||
game.broadcastAll(function (player) {
|
||||
player.storage._disableJudge = false;
|
||||
for (var i = 0; i < player.node.judges.childNodes.length; i++) {
|
||||
if (player.node.judges.childNodes[i].name == 'disable_judge') {
|
||||
player.node.judges.removeChild(player.node.judges.childNodes[i]);
|
||||
break;
|
||||
}
|
||||
game.broadcastAll(function (player) {
|
||||
delete player.storage._disableJudge;
|
||||
for (var i = 0; i < player.node.judges.childNodes.length; i++) {
|
||||
if (player.node.judges.childNodes[i].name == 'disable_judge') {
|
||||
player.node.judges.removeChild(player.node.judges.childNodes[i]);
|
||||
break;
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.node.avatar.hide();
|
||||
this.node.count.hide();
|
||||
if (this.node.wuxing) {
|
||||
|
|
|
@ -9703,7 +9703,7 @@ export class Library extends Uninstantable {
|
|||
console.error(new ReferenceError('缺少info的技能:', skill));
|
||||
return false;
|
||||
}
|
||||
if (!game.expandSkills(player.getSkills(true).concat(lib.skill.global)).includes(skill)) return false;
|
||||
if (!game.expandSkills(player.getSkills('invisible').concat(lib.skill.global)).includes(skill)) return false;
|
||||
if (!game.expandSkills(player.getSkills(false).concat(lib.skill.global)).includes(skill)) {//hiddenSkills
|
||||
if (get.mode() != 'guozhan') return false;
|
||||
if (info.noHidden) return false;
|
||||
|
|
Loading…
Reference in New Issue