Add Xu Province recruit sortie flow
This commit is contained in:
@@ -68,6 +68,8 @@ const unitTextureByClass: Partial<Record<UnitClassKey, string>> = {
|
||||
infantry: 'unit-guan-yu',
|
||||
spearman: 'unit-zhang-fei',
|
||||
archer: 'unit-rebel-archer',
|
||||
strategist: 'unit-liu-bei',
|
||||
quartermaster: 'unit-liu-bei',
|
||||
cavalry: 'unit-rebel-cavalry',
|
||||
bandit: 'unit-rebel',
|
||||
yellowTurban: 'unit-rebel',
|
||||
@@ -470,17 +472,22 @@ const usableCatalog: Record<string, BattleUsable> = {
|
||||
const unitStrategyIds: Record<string, string[]> = {
|
||||
'liu-bei': ['aid', 'encourage'],
|
||||
'guan-yu': ['fireTactic'],
|
||||
'zhang-fei': ['roar']
|
||||
'zhang-fei': ['roar'],
|
||||
'jian-yong': ['aid', 'encourage', 'fireTactic'],
|
||||
'mi-zhu': ['aid', 'encourage']
|
||||
};
|
||||
|
||||
const initialItemStocks: Record<string, Record<string, number>> = {
|
||||
'liu-bei': { bean: 2, salve: 1 },
|
||||
'guan-yu': { bean: 1 },
|
||||
'zhang-fei': { bean: 1, wine: 1 }
|
||||
'zhang-fei': { bean: 1, wine: 1 },
|
||||
'jian-yong': { bean: 1 },
|
||||
'mi-zhu': { bean: 2, salve: 1 }
|
||||
};
|
||||
|
||||
const attackRangeByClass: Partial<Record<UnitClassKey, number>> = {
|
||||
archer: 2
|
||||
archer: 2,
|
||||
strategist: 2
|
||||
};
|
||||
|
||||
const enemyAiByUnitId: Record<string, EnemyAiBehavior> = {
|
||||
@@ -846,7 +853,7 @@ export class BattleScene extends Phaser.Scene {
|
||||
private drawUnits() {
|
||||
battleUnits.forEach((unit) => {
|
||||
const sizeRatio = unit.faction === 'ally' ? 1.16 : 1.1;
|
||||
const textureBase = unitTexture[unit.id] ?? unitTextureByClass[unit.classKey] ?? 'unit-rebel';
|
||||
const textureBase = this.unitTextureKey(unit);
|
||||
const sprite = this.add.sprite(this.tileCenterX(unit.x), this.tileCenterY(unit.y), textureBase, this.unitFrameIndex('south'));
|
||||
sprite.setName(`unit-${unit.id}`);
|
||||
sprite.setDisplaySize(this.layout.tileSize * sizeRatio, this.layout.tileSize * sizeRatio);
|
||||
@@ -4257,7 +4264,7 @@ export class BattleScene extends Phaser.Scene {
|
||||
attackerSprite.setDisplaySize(126, 126);
|
||||
|
||||
const defenderSprite = this.trackCombatObject(
|
||||
this.add.sprite(defenderX, groundY, unitTexture[result.defender.id] ?? 'unit-rebel', this.unitFrameIndex(defenderDirection))
|
||||
this.add.sprite(defenderX, groundY, this.unitTextureKey(result.defender), this.unitFrameIndex(defenderDirection))
|
||||
);
|
||||
defenderSprite.setDepth(depth + 6);
|
||||
defenderSprite.setDisplaySize(126, 126);
|
||||
@@ -4361,7 +4368,7 @@ export class BattleScene extends Phaser.Scene {
|
||||
userSprite.setDepth(depth + 3);
|
||||
userSprite.setDisplaySize(112, 112);
|
||||
|
||||
const targetSprite = this.trackCombatObject(this.add.sprite(left + panelWidth - 160, top + 146, unitTexture[result.target.id] ?? 'unit-rebel', this.unitFrameIndex('west')));
|
||||
const targetSprite = this.trackCombatObject(this.add.sprite(left + panelWidth - 160, top + 146, this.unitTextureKey(result.target), this.unitFrameIndex('west')));
|
||||
targetSprite.setDepth(depth + 3);
|
||||
targetSprite.setDisplaySize(112, 112);
|
||||
|
||||
@@ -4423,7 +4430,7 @@ export class BattleScene extends Phaser.Scene {
|
||||
portrait.setDepth(85);
|
||||
portrait.setDisplaySize(58, 80);
|
||||
} else {
|
||||
const unitIcon = this.trackCombatObject(this.add.sprite(x + 38, y + 58, unitTexture[unit.id] ?? 'unit-rebel', this.unitFrameIndex('south')));
|
||||
const unitIcon = this.trackCombatObject(this.add.sprite(x + 38, y + 58, this.unitTextureKey(unit), this.unitFrameIndex('south')));
|
||||
unitIcon.setDepth(85);
|
||||
unitIcon.setDisplaySize(64, 64);
|
||||
}
|
||||
@@ -5586,8 +5593,12 @@ export class BattleScene extends Phaser.Scene {
|
||||
return unitFrameRows[direction] * 4 + frame;
|
||||
}
|
||||
|
||||
private unitTextureKey(unit: UnitData) {
|
||||
return unitTexture[unit.id] ?? unitTextureByClass[unit.classKey] ?? 'unit-rebel';
|
||||
}
|
||||
|
||||
private unitActionTexture(unit: UnitData) {
|
||||
const base = unitTexture[unit.id] ?? 'unit-rebel';
|
||||
const base = this.unitTextureKey(unit);
|
||||
const actionKey = `${base}-actions`;
|
||||
return this.textures.exists(actionKey) ? actionKey : base;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user