Compare commits
3 Commits
1e17309168
...
ca6a401148
| Author | SHA1 | Date | |
|---|---|---|---|
| ca6a401148 | |||
| a27e45a024 | |||
| bce0c3a79b |
1
CUsers华为.sshknown_hosts
Normal file
1
CUsers华为.sshknown_hosts
Normal file
@ -0,0 +1 @@
|
||||
hblu.top ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKysWvs0o99Qgtl5RFw4wyINkIu8WRcxOBlwlV9r41l3
|
||||
111
game.js
111
game.js
@ -1128,6 +1128,11 @@ class Game {
|
||||
this.addLog(`${player.character.name} 对 ${target.character.name} 使用了【火攻】`);
|
||||
this.showCardUseAnimation();
|
||||
|
||||
if (target.hand.length === 0) {
|
||||
this.addLog('目标没有手牌,火攻无效');
|
||||
return false;
|
||||
}
|
||||
|
||||
const randomCardIndex = Math.floor(Math.random() * target.hand.length);
|
||||
const randomCard = target.hand[randomCardIndex];
|
||||
this.addLog(`${target.character.name} 展示了一张 ${randomCard.name}`);
|
||||
@ -1492,27 +1497,31 @@ class Game {
|
||||
}
|
||||
|
||||
aiPlayCards(player) {
|
||||
const targets = this.players.filter(p => p.isAlive && p.index !== player.index);
|
||||
const canUseMultipleAttacks = this.hasWeaponWithEffect('zhugeliannu') || player.character.name === '张飞';
|
||||
|
||||
const cardPriority = [
|
||||
{ type: 'peach', condition: () => player.currentHp < player.maxHp, target: null },
|
||||
{ type: 'attack', condition: () => this.attackCount === 0 || canUseMultipleAttacks, target: 'selectTarget', skillCheck: true },
|
||||
{ type: 'duel', condition: () => true, target: 'selectDuelTarget' },
|
||||
{ type: 'attack', condition: () => this.attackCount === 0 || canUseMultipleAttacks, target: 'aiSelectTarget', skillCheck: true },
|
||||
{ type: 'duel', condition: () => true, target: 'aiSelectDuelTarget' },
|
||||
{ type: 'barbarian', condition: () => true, target: null },
|
||||
{ type: 'arrow', condition: () => true, target: null },
|
||||
{ type: 'fireAttack', condition: () => true, target: 'selectFireAttackTarget' },
|
||||
{ type: 'dismantlement', condition: () => true, target: 'selectDismantleTarget' },
|
||||
{ type: 'steal', condition: () => true, target: 'selectStealTarget' },
|
||||
{ type: 'chain', condition: () => true, target: 'selectChainTarget' },
|
||||
{ type: 'happy', condition: () => true, target: 'selectHappyTarget' },
|
||||
{ type: 'starvation', condition: () => true, target: 'selectStarvationTarget' },
|
||||
{ type: 'lightning', condition: () => true, target: 'selectLightningTarget' },
|
||||
{ type: 'fireAttack', condition: () => true, target: 'aiSelectFireAttackTarget' },
|
||||
{ type: 'dismantlement', condition: () => true, target: 'aiSelectDismantleTarget' },
|
||||
{ type: 'steal', condition: () => true, target: 'aiSelectStealTarget' },
|
||||
{ type: 'chain', condition: () => true, target: 'aiSelectChainTarget' },
|
||||
{ type: 'happy', condition: () => true, target: 'aiSelectHappyTarget' },
|
||||
{ type: 'starvation', condition: () => true, target: 'aiSelectStarvationTarget' },
|
||||
{ type: 'lightning', condition: () => true, target: 'aiSelectLightningTarget' },
|
||||
{ type: 'draw', condition: () => true, target: null },
|
||||
{ type: 'equip', condition: () => true, target: 'selectEquipCard', isEquip: true }
|
||||
{ type: 'equip', condition: () => true, target: 'aiSelectEquipCard', isEquip: true }
|
||||
];
|
||||
|
||||
const playNextCard = () => {
|
||||
if (this.gameOver || this.getCurrentPlayer().index !== player.index) {
|
||||
return;
|
||||
}
|
||||
|
||||
const targets = this.players.filter(p => p.isAlive && p.index !== player.index);
|
||||
let cardsUsed = false;
|
||||
|
||||
if (player.character.name === '刘备' && player.hand.length >= 2) {
|
||||
@ -1577,9 +1586,11 @@ class Game {
|
||||
targetIndex = this[priority.target](player, targets);
|
||||
}
|
||||
|
||||
if (targetIndex !== -1 || !priority.target) {
|
||||
this.playCard(cardIndex, targetIndex);
|
||||
cardsUsed = true;
|
||||
if (targetIndex !== -1 || !priority.target || priority.isEquip) {
|
||||
const result = this.playCard(cardIndex, targetIndex);
|
||||
if (result) {
|
||||
cardsUsed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1607,26 +1618,7 @@ class Game {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (player.identity === 'lord') {
|
||||
const rebel = inRangeTargets.find(t => t.identity === 'rebel');
|
||||
if (rebel) return rebel.index;
|
||||
const spy = inRangeTargets.find(t => t.identity === 'spy');
|
||||
if (spy) return spy.index;
|
||||
} else if (player.identity === 'loyalist') {
|
||||
const rebel = inRangeTargets.find(t => t.identity === 'rebel');
|
||||
if (rebel) return rebel.index;
|
||||
} else if (player.identity === 'rebel') {
|
||||
const lord = inRangeTargets.find(t => t.identity === 'lord');
|
||||
if (lord) return lord.index;
|
||||
const loyalist = inRangeTargets.find(t => t.identity === 'loyalist');
|
||||
if (loyalist) return loyalist.index;
|
||||
} else if (player.identity === 'spy') {
|
||||
const weakTarget = inRangeTargets.reduce((weakest, t) =>
|
||||
t.currentHp < weakest.currentHp ? t : weakest, inRangeTargets[0]);
|
||||
if (weakTarget) return weakTarget.index;
|
||||
}
|
||||
|
||||
return inRangeTargets.length > 0 ? inRangeTargets[0].index : -1;
|
||||
return this.selectTargetByIdentity(player, inRangeTargets);
|
||||
}
|
||||
|
||||
useLiuBeiSkillAI(player, ally, cardIndex) {
|
||||
@ -1676,43 +1668,43 @@ class Game {
|
||||
}
|
||||
|
||||
aiSelectDismantleTarget(player, targets) {
|
||||
const targetWithCards = targets.filter(t => t.hand.length > 0);
|
||||
const targetWithCards = targets.filter(t => t.hand.length > 0 || t.equipment.weapon || t.equipment.armor || t.equipment.horsePlus || t.equipment.horseMinus);
|
||||
if (targetWithCards.length > 0) {
|
||||
return this.aiSelectTarget(player, targetWithCards);
|
||||
return this.selectTargetByIdentity(player, targetWithCards);
|
||||
}
|
||||
return this.aiSelectTarget(player, targets);
|
||||
return this.selectTargetByIdentity(player, targets);
|
||||
}
|
||||
|
||||
aiSelectStealTarget(player, targets) {
|
||||
const targetWithCards = targets.filter(t => t.hand.length > 0);
|
||||
if (targetWithCards.length > 0) {
|
||||
return this.aiSelectTarget(player, targetWithCards);
|
||||
return this.selectTargetByIdentity(player, targetWithCards);
|
||||
}
|
||||
return this.aiSelectTarget(player, targets);
|
||||
return this.selectTargetByIdentity(player, targets);
|
||||
}
|
||||
|
||||
aiSelectChainTarget(player, targets) {
|
||||
const unchainedTargets = targets.filter(t => !t.statusEffects.chain);
|
||||
if (unchainedTargets.length > 0) {
|
||||
return this.aiSelectTarget(player, unchainedTargets);
|
||||
return this.selectTargetByIdentity(player, unchainedTargets);
|
||||
}
|
||||
return this.aiSelectTarget(player, targets);
|
||||
return this.selectTargetByIdentity(player, targets);
|
||||
}
|
||||
|
||||
aiSelectHappyTarget(player, targets) {
|
||||
const dangerousTargets = targets.filter(t => t.hand.length >= 3);
|
||||
if (dangerousTargets.length > 0) {
|
||||
return this.aiSelectTarget(player, dangerousTargets);
|
||||
return this.selectTargetByIdentity(player, dangerousTargets);
|
||||
}
|
||||
return this.aiSelectTarget(player, targets);
|
||||
return this.selectTargetByIdentity(player, targets);
|
||||
}
|
||||
|
||||
aiSelectStarvationTarget(player, targets) {
|
||||
const inRangeTargets = targets.filter(t => this.isInRange(t.index));
|
||||
if (inRangeTargets.length > 0) {
|
||||
return this.aiSelectTarget(player, inRangeTargets);
|
||||
return this.selectTargetByIdentity(player, inRangeTargets);
|
||||
}
|
||||
return -1;
|
||||
return this.selectTargetByIdentity(player, targets);
|
||||
}
|
||||
|
||||
aiSelectLightningTarget(player, targets) {
|
||||
@ -1727,9 +1719,34 @@ class Game {
|
||||
});
|
||||
|
||||
if (enemyTargets.length > 0) {
|
||||
return this.aiSelectTarget(player, enemyTargets);
|
||||
return this.selectTargetByIdentity(player, enemyTargets);
|
||||
}
|
||||
return this.aiSelectTarget(player, targets);
|
||||
return this.selectTargetByIdentity(player, targets);
|
||||
}
|
||||
|
||||
selectTargetByIdentity(player, targets) {
|
||||
if (targets.length === 0) return -1;
|
||||
|
||||
if (player.identity === 'lord') {
|
||||
const rebel = targets.find(t => t.identity === 'rebel');
|
||||
if (rebel) return rebel.index;
|
||||
const spy = targets.find(t => t.identity === 'spy');
|
||||
if (spy) return spy.index;
|
||||
} else if (player.identity === 'loyalist') {
|
||||
const rebel = targets.find(t => t.identity === 'rebel');
|
||||
if (rebel) return rebel.index;
|
||||
} else if (player.identity === 'rebel') {
|
||||
const lord = targets.find(t => t.identity === 'lord');
|
||||
if (lord) return lord.index;
|
||||
const loyalist = targets.find(t => t.identity === 'loyalist');
|
||||
if (loyalist) return loyalist.index;
|
||||
} else if (player.identity === 'spy') {
|
||||
const weakTarget = targets.reduce((weakest, t) =>
|
||||
t.currentHp < weakest.currentHp ? t : weakest, targets[0]);
|
||||
if (weakTarget) return weakTarget.index;
|
||||
}
|
||||
|
||||
return targets.length > 0 ? targets[0].index : -1;
|
||||
}
|
||||
|
||||
aiSelectEquipCard(player) {
|
||||
|
||||
3
push.ps1
Normal file
3
push.ps1
Normal file
@ -0,0 +1,3 @@
|
||||
= "12345678"
|
||||
= Start-Process -FilePath "git" -ArgumentList "push" -NoNewWindow -PassThru -RedirectStandardInput "stdin.txt"
|
||||
| Out-File -FilePath "stdin.txt" -Encoding ascii
|
||||
15
push3.ps1
Normal file
15
push3.ps1
Normal file
@ -0,0 +1,15 @@
|
||||
$psi = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$psi.FileName = "git"
|
||||
$psi.Arguments = "push"
|
||||
$psi.UseShellExecute = $false
|
||||
$psi.RedirectStandardInput = $true
|
||||
$psi.RedirectStandardOutput = $true
|
||||
$psi.RedirectStandardError = $true
|
||||
$p = [System.Diagnostics.Process]::Start($psi)
|
||||
$p.StandardInput.WriteLine("12345678")
|
||||
$p.StandardInput.Flush()
|
||||
$p.WaitForExit()
|
||||
$output = $p.StandardOutput.ReadToEnd()
|
||||
$error = $p.StandardError.ReadToEnd()
|
||||
Write-Host $output
|
||||
Write-Host $error
|
||||
15
push4.ps1
Normal file
15
push4.ps1
Normal file
@ -0,0 +1,15 @@
|
||||
$psi = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$psi.FileName = "git"
|
||||
$psi.Arguments = "push"
|
||||
$psi.UseShellExecute = $false
|
||||
$psi.RedirectStandardInput = $true
|
||||
$psi.RedirectStandardOutput = $true
|
||||
$psi.RedirectStandardError = $true
|
||||
$p = [System.Diagnostics.Process]::Start($psi)
|
||||
$p.StandardInput.WriteLine("12345678")
|
||||
$p.StandardInput.Flush()
|
||||
$p.WaitForExit()
|
||||
$output = $p.StandardOutput.ReadToEnd()
|
||||
$err = $p.StandardError.ReadToEnd()
|
||||
Write-Host $output
|
||||
Write-Host $err
|
||||
Loading…
Reference in New Issue
Block a user