You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.7 KiB
49 lines
1.7 KiB
|
3 weeks ago
|
import type { BattleGamePassiveSkillHost } from './BattleGamePassiveSkillHost';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* functiontype=9 化龙铲:CD 结束优先产铲入背包空槽;背包满(或空槽已被广告铲预留)则随机挖未开挖格。
|
||
|
|
*/
|
||
|
|
export class BattleGamePassiveShovelSpawn {
|
||
|
|
/**
|
||
|
|
* 尝试产铲并播放飞行动画。
|
||
|
|
* @param slotIndex 被动槽下标(同 buff 多槽各自独立触发)
|
||
|
|
* @returns 是否已受理(含异步飞行;无目标时重启 CD 也返回 true)
|
||
|
|
*/
|
||
|
|
static trySpawn(row: ITableBattlebuff, host: BattleGamePassiveSkillHost, slotIndex: number): boolean {
|
||
|
|
if (slotIndex < 0) return false;
|
||
|
|
|
||
|
|
const battle = host.battle;
|
||
|
|
const bagView = host.bagView;
|
||
|
|
const bagSession = battle?.bagSession;
|
||
|
|
if (!bagSession || !bagView) {
|
||
|
|
console.log('[PassiveSkill] 化龙铲产铲失败:bag 未就绪');
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (!bagSession.merge.prepActive) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
const fromWorld = host.getIconWorldPosition(slotIndex);
|
||
|
|
if (!fromWorld) {
|
||
|
|
console.log('[PassiveSkill] 化龙铲产铲失败:被动图标坐标缺失', slotIndex);
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
host.setPassiveSpawnInflight(slotIndex, true);
|
||
|
|
|
||
|
|
const started = bagView.playPassiveShovelSpawnFlight({
|
||
|
|
fromWorld,
|
||
|
|
onComplete: () => {
|
||
|
|
host.setPassiveSpawnInflight(slotIndex, false);
|
||
|
|
host.restartPassiveCd(slotIndex);
|
||
|
|
},
|
||
|
|
});
|
||
|
|
if (!started) {
|
||
|
|
host.setPassiveSpawnInflight(slotIndex, false);
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
}
|