fix: 外勤医疗预置干员保留初始索敌顺序 (#315)
This commit is contained in:
1 parent
62eb113419
commit
3b57f72704
9 files changed
+96
-7
No files matched your search
@@ -41,6 +41,8 @@ export class BattleSummons {
|
||||
* skill, a summon that skill does not produce (producesToken) is refused unless `opts.anySource`: hand-authored kit
|
||||
* install hooks are written for the default skill and run under every skill (琳琅诗怀雅 S1/S3 would drop 香槟炸弹);
|
||||
* under the default skill the kit stays the authority.
|
||||
* `opts.preBattleAggro` is only for a prepared stage map character instantiated at battleStart after its variant
|
||||
* is chosen; its aggro precedes initial operators despite the later deploy event.
|
||||
*/
|
||||
spawnToken(owner, tokenId, row, col, opts = {}) {
|
||||
const ownerUnit = owner && typeof owner === 'object' ? owner : null;
|
||||
@@ -66,6 +68,9 @@ export class BattleSummons {
|
||||
this.offOwner(u);
|
||||
return null;
|
||||
}
|
||||
// A map character already visible in preparation may be instantiated at battleStart after the elite count is
|
||||
// known. [ASSUMED] Its replacement keeps the slot's pre-deployment aggro order; ordinary summons stay latest.
|
||||
if (opts.preBattleAggro) u.aggroSeq = -1; // aggroCmp falls back to deploySeq when aggroSeq is zero
|
||||
if (opts.hp != null && Number.isFinite(Number(opts.hp))) u.hp = Math.max(1, Math.min(u.s.maxHp, Number(opts.hp)));
|
||||
if (opts.duration > 0 && Number.isFinite(Number(opts.duration))) this.after(Number(opts.duration), () => { if (u.alive) this.retreat(u, { reason: 'expired', permanent: true }); }, { owner: u });
|
||||
return u;
|
||||
|
||||
@@ -241,7 +241,9 @@ function installMapChars(battle) {
|
||||
for (const ps of holders) {
|
||||
const elites = deployedOps(battle, ps.playerId).filter(isElite).length;
|
||||
for (const id of amedicCharsFor(elites, variants)) {
|
||||
const u = spawnMapChar(battle, ps.playerId, id);
|
||||
// The map character is visible before combat; Touch replaces it here once the elite count is known.
|
||||
// [ASSUMED] The replacement retains the stage slot's earlier aggro order.
|
||||
const u = spawnMapChar(battle, ps.playerId, id, { preBattle: true });
|
||||
if (u) fxOn(battle, 'summon', u, keyOf(AMEDIC_BAND), AMEDIC_BAND);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1564,9 +1564,11 @@ function touchKit(bb, raw, def) {
|
||||
|
||||
/**
|
||||
* Spawn a band map character (char_605_cmedic 预备干员-医疗 / char_613_acmedc Touch) at its stage position on the
|
||||
* player's half (data/stages.json `mapChars`; `_multi_only` positions only with a partner). Returns the unit or null.
|
||||
* player's half (data/stages.json `mapChars`; `_multi_only` positions only with a partner). `preBattle` preserves the
|
||||
* aggro order of a character already visible in preparation; ad-hoc mid-battle spawns keep ordinary summon order.
|
||||
* Returns the unit or null.
|
||||
*/
|
||||
export function spawnMapChar(battle, playerId, tokenId, { alias = null } = {}) {
|
||||
export function spawnMapChar(battle, playerId, tokenId, { alias = null, preBattle = false } = {}) {
|
||||
const list = battle.stage?.raw?.mapChars ?? battle.stage?.mapChars ?? [];
|
||||
const ps = battle.getPlayer(playerId);
|
||||
const multi = battle.players.length > 1;
|
||||
@@ -1583,7 +1585,7 @@ export function spawnMapChar(battle, playerId, tokenId, { alias = null } = {}) {
|
||||
for (const m of cands) {
|
||||
if (!tileFree(battle, m.pos[0], m.pos[1])) continue;
|
||||
// stage positions are field tiles: their direction is taken as it is (default RIGHT)
|
||||
const u = battle.spawnToken(playerId, tokenId, m.pos[0], m.pos[1], { dir: normDir(m.dir) });
|
||||
const u = battle.spawnToken(playerId, tokenId, m.pos[0], m.pos[1], { dir: normDir(m.dir), preBattleAggro: preBattle });
|
||||
if (u) return u;
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user