Merge pull request #985 from PZ157/PR-Branch

调整缩进、修复描述、ai修复和优化
This commit is contained in:
Spmario233 2024-02-24 12:12:24 +08:00 committed by GitHub
commit 6ed10f19e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 201 additions and 77 deletions

View File

@ -308,12 +308,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
if(status*get.attitude(viewer,player._trueMe||player)>0 || target.hasSkillTag('nodamage') || target.hasSkillTag('nofire') || target.hasSkillTag('nothunder') || get.attitude(viewer,player)>0 || (1+target.countCards('hs'))*_status.event.getRand()>1.57) return 0;
},
basic:{
order:(item,player)=>{
if(player.hasCard(card=>{
return get.tag(card,'damage')&&game.hasNature(card)&&player.hasValueTarget(card);
},'hs')) return 7.3;
return 4.1;
},
order:7.3,
useful:1.2,
value:4
},

View File

@ -155,7 +155,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
next.set('useShan',(()=>{
if(target.hasSkillTag('noShan',null,event)) return false;
if(target.hasSkillTag('useShan',null,event)) return true;
if(event.baseDamage+event.extraDamage<=0 || get.attitude(target,player._trueMe||player)>0) return false;
if(event.baseDamage+event.extraDamage<=0 || target.isLink()&&game.hasNature(event.card)&&get.attitude(target,player._trueMe||player)>0) return false;
if(event.shanRequired>1&&target.mayHaveShan(target,'use',null,'count')<event.shanRequired-(event.shanIgnored||0)) return false;
if(event.baseDamage+event.extraDamage>=target.hp+
((player.hasSkillTag('jueqing',false,target)||target.hasSkill('gangzhi'))?target.hujia:0)) return true;
@ -1271,33 +1271,39 @@ game.import('card',function(lib,game,ui,get,ai,_status){
value:5.5
},
result:{
target:-1.5,
player:function(player,target,card){
if(player.hasSkillTag('directHit_ai',true,{
target:target,
card:card,
},true)){
return 0;
}
if(get.damageEffect(target,player,target)>0&&get.attitude(player,target)>0&&get.attitude(target,player)>0){
return 0;
}
var hs1=target.getCards('h','sha');
var hs2=player.getCards('h','sha');
if(hs1.length>hs2.length+1){
player(player, target, card) {
if (player.hasSkillTag('directHit_ai', true, {
target: target,
card: card
}, true)) return 0;
if (get.damageEffect(target, player, target) >= 0) return 0;
let pd = get.damageEffect(player, target, player), att = get.attitude(player, target);
if (att > 0 && get.damageEffect(target, player, player) > pd) return 0;
let ts = target.mayHaveSha(player, 'respond', null, 'count'), ps = player.mayHaveSha(player, 'respond', null, 'count');
if (ts < 1 && ts << 3 < Math.pow(player.hp, 2)) return 0;
if (att > 0) {
if (ts < 1) return 0;
return -2;
}
var hsx=target.getCards('h');
if(hsx.length>2&&hs2.length==0&&hsx[0].number<6){
return -2;
}
if(hsx.length>3&&hs2.length==0){
return -2;
}
if(hs1.length>hs2.length&&(!hs2.length||hs1[0].number>hs2[0].number)){
return -2;
}
return -0.5;
if (ts - ps + Math.exp(0.8 - player.hp) < 1) return -ts;
if (pd >= 0) return pd / get.attitude(player, player);
return -2 - ts;
},
target(player, target, card) {
if (player.hasSkillTag('directHit_ai', true, {
target: target,
card: card
}, true)) return -2;
let td = get.damageEffect(target, player, target);
if (td >= 0) return td / get.attitude(target, target);
let pd = get.damageEffect(player, target, player), att = get.attitude(player, target);
if (att > 0 && get.damageEffect(target, player, player) > pd) return -2;
let ts = target.mayHaveSha(player, 'respond', null, 'count'), ps = player.mayHaveSha(player, 'respond', null, 'count');
if (ts < 1) return -1.5;
if (att > 0) return -2;
if (ts - ps < 1) return -2 - ts;
if (pd >= 0) return -1;
return -ts;
}
},
tag:{

View File

@ -7454,6 +7454,42 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
jsrgtushe:{
audio:'xinfu_tushe',
mod: {
aiOrder(player, card, num) {
if (get.tag(card, 'multitarget')) {
if (player.countCards('h', { type: 'basic' })) return num / 10;
return num * 10;
}
if (get.type(card) === 'basic') return num + 10;
},
aiValue(player, card, num) {
if (card.name === 'zhangba') {
let fact = (n) => {
if (n > 1) return n * fact(n - 1);
return 1;
}, basic = 0;
return fact(Math.min(player.countCards('hs', i => {
if (get.tag(i, 'multitarget')) return 2;
if (!['shan', 'tao', 'jiu'].includes(card.name)) return 1;
basic++;
}) / (1 + basic), player.getCardUsable('sha')));
}
if (['shan', 'tao', 'jiu'].includes(card.name)) {
if (player.getEquip('zhangba') && player.countCards('hs') > 1) return 0.01;
return num / 2;
}
if (get.tag(card, 'multitarget')) return num + game.players.length;
},
aiUseful(player, card, num) {
if (get.name(card, player) === 'shan') {
if (player.countCards('hs', i => {
if (card === i || card.cards && card.cards.includes(i)) return false;
return get.name(i, player) === 'shan';
})) return -1;
return num / Math.pow(Math.max(1, player.hp), 2);
}
}
},
trigger:{
player:'useCardToPlayered',
},
@ -7465,6 +7501,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
check:function(event,player){
return !player.countCards('h',{type:'basic'});
},
locked: false,
content:function (){
'step 0'
player.showHandcards();
@ -7480,7 +7517,22 @@ game.import('character',function(lib,game,ui,get,ai,_status){
presha:true,
pretao:true,
threaten:1.8,
},
effect: {
player(card, player, target) {
if (typeof card === 'object' && card.name !== 'shan' && get.type(card) !== 'equip' && !player.countCards('h', i => {
if (card === i || card.cards && card.cards.includes(i)) return false;
return get.type(i) === 'basic';
})) {
let targets = [], evt = _status.event.getParent('useCard');
targets.addArray(ui.selected.targets);
if (evt && evt.card == card) targets.addArray(evt.targets);
if (targets.length) return [1, targets.length];
if (get.tag(card, 'multitarget')) return [1, game.players.length - 1];
return [1, 1];
}
}
}
}
},
jsrgtongjue:{
audio:2,

View File

@ -904,7 +904,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(card.name=='sha'&&typeof player.storage.sbwusheng_effect[target.playerid]=='number') return true;
},
cardUsableTarget:function(card,player,target){
if(card.name=='sha'&&typeof player.storage.sbwusheng_effect[target.playerid]=='number') return true;
if(card.name!=='sha'||typeof player.storage.sbwusheng_effect[target.playerid]!=='number') return;
return player.storage.sbwusheng_effect[target.playerid]<3;
},
playerEnabled:function(card,player,target){
if(card.name!='sha'||typeof player.storage.sbwusheng_effect[target.playerid]!='number') return;

View File

@ -9768,7 +9768,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
gxianyin_info:'出牌阶段限一次,你可以选择一种花色,将你的手牌中该花色的牌移至弃牌堆,然后选择另一种花色,从牌堆中获得等量的该花色的牌。',
// gxianyin_info_alter:'',
cyxianjiang:'仙匠',
cyxianjiang_info:'每当你使用一张牌指定一目标时,你可以复制对方装备区内的一张你没有的牌,并置入你的装备区,每回合对一名角色最多发动一次。',
cyxianjiang_info:'每当你使用一张牌指定一目标时,你可以复制对方装备区内的一张你没有的牌,并置入你的装备区,每回合对一名角色最多发动一次。',
cyqiaoxie:'巧械',
cyqiaoxie_info:'每当你失去一张装备牌(使用除外),你可以随机观看三张机关牌,并使用其中一张。',
cyqiaoxie_info_alter:'每当你装备一件装备若你的手牌数不大于体力值你可以摸一张牌每当你失去一件装备牌你可以随机观看2张机关牌并使用其中一张。',
@ -9923,7 +9923,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
pingshen2:'凭神',
pingshen_info:'锁定技,受到过你的伤害的角色可在回合内对你发动一次【离魂】(每局限发动一次)。',
xingzhui:'星坠',
xingzhui_info:'出牌阶段限一次,你可以弃置一张牌,并令一名有牌的其他角色弃置一张类别相同的牌,则受到1点伤害。',
xingzhui_info:'出牌阶段限一次,你可以弃置一张牌,并令一名有牌的其他角色弃置一张类别相同的牌,则受到1点伤害。',
lingxian:'凌仙',
lingxian_info:'每当你于回合外使用或打出一张手牌,你可以选择攻击范围外的一名其他角色与你各摸一张牌。',
shouyin:'守印',
@ -9965,7 +9965,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
xiaomoyu:'魔愈',
xiaomoyu_info:'锁定技每当你于一个回合内首次造成伤害你回复1点体力若你没有受伤则改为摸一张牌。',
yihua:'移花',
yihua_info:'每当你成为其他角色的某张卡牌的一目标时,你可以弃置两张手牌,将使用者与目标对调。',
yihua_info:'每当你成为其他角色的某张卡牌的一目标时,你可以弃置两张手牌,将使用者与目标对调。',
youyin:'游吟',
youyin_info:'每当有其他角色弃置卡牌时若其中有非基本牌且你的手牌数不超过5你可以摸一张牌。',
rexue:'热血',

View File

@ -3374,7 +3374,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var choices=['选项二'];
var choiceList=[
'令'+get.translation(target)+'回复1点体力',
'你'+get.translation(target)+'各摸一张牌'
'你'+get.translation(target)+'各摸一张牌'
];
if(target.isDamaged()) choices.unshift('选项一');
else choiceList[0]='<span style="opacity:0.5">'+choiceList[0]+'</span>';

View File

@ -4194,8 +4194,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
chengxin2_bg:'心',
chengxin_info:'每四轮限一次当一名角色进入濒死状态时你可以令其将体力值回复至1然后该角色防止一切伤害直到下一回合结束。',
tianwu:'天舞',
tianwu_info:'每当你使用卡牌指定一名敌方角色为一目标,你可以对其施加一个随机的负面效果。',
tianwu_info_alter:'每当你使用卡牌指定一名敌方角色为一目标,你可以对其施加一个随机的负面效果,每回合限发动一次。',
tianwu_info:'每当你使用卡牌指定一名敌方角色为一目标,你可以对其施加一个随机的负面效果。',
tianwu_info_alter:'每当你使用卡牌指定一名敌方角色为一目标,你可以对其施加一个随机的负面效果,每回合限发动一次。',
liguang:'离光',
liguang_info:'结束阶段,你可以弃置一张手牌并将场上的一张牌移动到另一个合理的位置。',
shiying:'逝影',

View File

@ -1490,9 +1490,46 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
"xinfu_tushe":{
audio:2,
mod: {
aiOrder(player, card, num) {
if (get.tag(card, 'multitarget')) {
if (player.countCards('h', { type: 'basic' })) return num / 10;
return num * 10;
}
if (get.type(card) === 'basic') return num + 10;
},
aiValue(player, card, num) {
if (card.name === 'zhangba') {
let fact = (n) => {
if (n > 1) return n * fact(n - 1);
return 1;
}, basic = 0;
return fact(Math.min(player.countCards('hs', i => {
if (get.tag(i, 'multitarget')) return 2;
if (!['shan', 'tao', 'jiu'].includes(card.name)) return 1;
basic++;
}) / (1 + basic), player.getCardUsable('sha')));
}
if (['shan', 'tao', 'jiu'].includes(card.name)) {
if (player.getEquip('zhangba') && player.countCards('hs') > 1) return 0.01;
return num / 2;
}
if (get.tag(card, 'multitarget')) return num + game.players.length;
},
aiUseful(player, card, num) {
if (get.name(card, player) === 'shan') {
if (player.countCards('hs', i => {
if (card === i || card.cards && card.cards.includes(i)) return false;
return get.name(i, player) === 'shan';
})) return -1;
return num / Math.pow(Math.max(1, player.hp), 2);
}
}
},
trigger:{
player:"useCardToPlayered",
},
locked: false,
frequent:true,
filter:function (event,player){
if(get.type(event.card)=='equip') return false;
@ -1506,7 +1543,22 @@ game.import('character',function(lib,game,ui,get,ai,_status){
presha:true,
pretao:true,
threaten:1.8,
},
effect: {
player(card, player, target) {
if (typeof card === 'object' && card.name !== 'shan' && get.type(card) !== 'equip' && !player.countCards('h', i => {
if (card === i || card.cards && card.cards.includes(i)) return false;
return get.type(i) === 'basic';
})) {
let targets = [], evt = _status.event.getParent('useCard');
targets.addArray(ui.selected.targets);
if (evt && evt.card == card) targets.addArray(evt.targets);
if (targets.length) return [1, targets.length];
if (get.tag(card, 'multitarget')) return [1, game.players.length - 1];
return [1, 1];
}
}
}
}
},
"xinfu_limu":{
mod:{
@ -1518,11 +1570,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
cardUsableTarget:function(card,player,target){
if(player.countCards('j')&&player.inRange(target)) return true;
},
aiValue:function(player,card,num){
if(card.name=='zhangba') return 15;
if(player.getEquip('zhangba')&&player.countCards('hs')>1&&['shan','tao'].includes(card.name)) return 0;
if(card.name=='shan'||card.name=='tao') return num/2;
},
aiOrder(player, card, num) {
if (get.type(card, 'delay') && player.canUse(card, player) && player.canAddJudge(card)) return 15;
}
},
locked:false,
audio:2,
@ -1542,21 +1592,22 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filterTarget:function (card,player,target){
return player==target;
},
check:function(card){
var player=_status.event.player;
if(!player.getEquip('zhangba')&&player.countCards('hs','sha')<2){
if(player.countCards('h',function(cardx){
return cardx!=card&&cardx.name=='shan';
})>0) return 0;
var damaged=player.maxHp-player.hp-1;
var ts=player.countCards('h',function(cardx){
return cardx!=card&&cardx.name=='tao';
});
if(ts>0&&ts>damaged) return 0;
check(card) {
var player = _status.event.player;
if (!player.getEquip('zhangba')) {
let damaged = player.maxHp - player.hp - 1;
if (player.countCards('h', function (cardx) {
if (cardx == card) return false;
if (cardx.name == 'tao') {
if (damaged < 1) return true;
damaged--;
}
if(card.name=='shan') return 15;
if(card.name=='tao') return 10;
return 9-get.value(card);
return ['shan', 'jiu'].includes(cardx.name);
}) > 0) return 0;
}
if (card.name == 'shan') return 15;
if (card.name == 'tao' || card.name == 'jiu') return 10;
return 9 - get.value(card);
},
onuse:function (links,player){
var next=game.createEvent('limu_recover',false,_status.event.getParent());
@ -1564,10 +1615,29 @@ game.import('character',function(lib,game,ui,get,ai,_status){
next.setContent(function(){player.recover()});
},
ai:{
result:{
target:1,
result: {
target(player, target) {
let res = lib.card.lebu.ai.result.target(player, target);
if (target.isDamaged()) return res + 2 * Math.abs(get.recoverEffect(target, player, target));
return res;
},
order:12,
ignoreStatus: true
},
order(item, player) {
if (player.hp > 1 && player.countCards('j')) return 0;
return 12;
},
effect: {
target(card, player, target) {
if (target.isPhaseUsing() && typeof card === 'object' && get.type(card, target) === 'delay' && !target.countCards('j')) {
let shas = target.getCards('hs', i => {
if (card === i || card.cards && card.cards.includes(i)) return false;
return get.name(i, target) === 'sha' && target.getUseValue(i) > 0;
}) - target.getCardUsable('sha');
if (shas > 0) return [1, 1.5 * shas];
}
}
}
},
},
},