修改机器人选择法术或随从的逻辑
This commit is contained in:
parent
54fc69d9ef
commit
517e622fa6
@ -152,26 +152,39 @@ let assistantUtil = {
|
|||||||
let result: Card;
|
let result: Card;
|
||||||
let effectMap: Map<number, EffectCardCfg> = global.$cfg.get(BaseConst.EFFECTCARD);
|
let effectMap: Map<number, EffectCardCfg> = global.$cfg.get(BaseConst.EFFECTCARD);
|
||||||
let spellCards: Card[] = [];
|
let spellCards: Card[] = [];
|
||||||
|
let petCards: Card[] = [];
|
||||||
|
|
||||||
// 优先取随从
|
// 优先取随从
|
||||||
let petCount = 0;
|
let petCount = 0;
|
||||||
for (let [,pet] of dstPlayer.pets) {
|
for (let [,pet] of dstPlayer.pets) {
|
||||||
if (pet.state == 1 && !pet.isHero) petCount ++;
|
if (pet.state == 1 && !pet.isHero) petCount ++;
|
||||||
}
|
}
|
||||||
let noMorePet = petCount >= new GameEnv().maxPlayerPetCount;
|
let noMorePet = petCount >= new GameEnv().maxPlayerPetCount;
|
||||||
|
|
||||||
let noPet = Math.random2(0, 100) > 70;
|
let noPet = Math.random2(0, 100) > 70;
|
||||||
|
|
||||||
for (let card of cards) {
|
for (let card of cards) {
|
||||||
let effect = effectMap.get(card.effect);
|
if (card.type == CardType.variable_unit) {
|
||||||
// if (effect.type_id == EffectType.unit && dstPlayer.unitCfgs.has(card.effect + '')) {
|
petCards.push(card);
|
||||||
if (card.type == CardType.variable_unit && !noMorePet && !noPet) {
|
} else if (card.type == CardType.general) {
|
||||||
result = card;
|
|
||||||
break;
|
|
||||||
} else if (effect.type_id == EffectType.skill) {
|
|
||||||
spellCards.push(card);
|
spellCards.push(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!result) {
|
if (!noMorePet && !noPet && petCards.length > 0) {
|
||||||
|
result = petCards.randomOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result && spellCards.length > 0) {
|
||||||
result = spellCards.randomOne();
|
result = spellCards.randomOne();
|
||||||
}
|
}
|
||||||
|
let oldpos = -1;
|
||||||
|
if (!result && petCards.length > 0) {
|
||||||
|
result = petCards.randomOne();
|
||||||
|
if (noMorePet) {
|
||||||
|
oldpos = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
error(`无法选择随从或法术, 随从数: ${petCount}, 法术牌数量: ${spellCards.length}`);
|
error(`无法选择随从或法术, 随从数: ${petCount}, 法术牌数量: ${spellCards.length}`);
|
||||||
return null;
|
return null;
|
||||||
@ -228,7 +241,8 @@ let assistantUtil = {
|
|||||||
card: result.id,
|
card: result.id,
|
||||||
player: targetPlayer?.id,
|
player: targetPlayer?.id,
|
||||||
pos: targetPos,
|
pos: targetPos,
|
||||||
effCards
|
effCards,
|
||||||
|
oldpos
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user