Merge branch 'worktree-playable-slice-0.5-first-upgrade'
# Conflicts: # apps/web/src/app/core/api/game-api.service.ts # apps/web/src/app/features/combat/combat-page/combat-page.component.html # apps/web/src/app/features/combat/combat-page/combat-page.component.scss # apps/web/src/app/features/combat/combat-page/combat-page.component.spec.ts # apps/web/src/app/features/combat/combat-page/combat-page.component.ts
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
import { DEMO_CHARACTER_ID } from '../../demo/demo-character.constants';
|
||||
import {
|
||||
DEMO_CHARACTER_ID,
|
||||
DEMO_CHARACTER_STARTING_WEAPON_EQUIPMENT_ID,
|
||||
DEMO_CHARACTER_STARTING_WEAPON_ITEM_ID,
|
||||
} from '../../demo/demo-character.constants';
|
||||
import { Character } from '../../characters/entities/character.entity';
|
||||
import { CharacterEquipment } from '../../equipment/entities/character-equipment.entity';
|
||||
import { CharacterItem } from '../../items/entities/character-item.entity';
|
||||
import { EquipmentSlot } from '../../items/equipment-slot.enum';
|
||||
import { ItemDefinition } from '../../items/entities/item-definition.entity';
|
||||
import { LootTableEntry } from '../../loot/entities/loot-table-entry.entity';
|
||||
import { LootTable } from '../../loot/entities/loot-table.entity';
|
||||
@@ -12,6 +19,7 @@ import { LocationDefinition } from '../../world/entities/location-definition.ent
|
||||
import { ITEM_DEFINITIONS, LOOT_TABLES, LOOT_TABLE_ENTRIES } from './item-content';
|
||||
import {
|
||||
ASH_RAT_LOOT_TABLE_ID,
|
||||
ITEM_IDS,
|
||||
ROAD_BANDIT_LOOT_TABLE_ID,
|
||||
} from './item.constants';
|
||||
import {
|
||||
@@ -238,4 +246,42 @@ export async function seedVisibleVerticalSlice(
|
||||
currentLocationId: southGateId,
|
||||
});
|
||||
}
|
||||
|
||||
const characterItemRepository = dataSource.getRepository(CharacterItem);
|
||||
const characterEquipmentRepository = dataSource.getRepository(CharacterEquipment);
|
||||
|
||||
// Starting loadout is weapon-only -- no starter armor piece exists in
|
||||
// content yet -- so the demo character's effective armor (sum of equipped
|
||||
// bonusArmor) is 0 until the player loots and equips bandit-hood (+3
|
||||
// armor). This is a deliberate tradeoff, not a bug: Slice 0.5 spec §19
|
||||
// says to preserve the existing demo balance "as closely as the
|
||||
// implemented content allows" and explicitly forbids fabricating a full
|
||||
// starter gear set just to hit the old hardcoded TEMPORARY_ARMOR = 6.
|
||||
const existingStartingSword = await characterItemRepository.findOneBy({
|
||||
characterId: DEMO_CHARACTER_ID,
|
||||
itemDefinitionId: ITEM_IDS['worn-short-sword'],
|
||||
});
|
||||
const startingSwordItemId =
|
||||
existingStartingSword?.id ?? DEMO_CHARACTER_STARTING_WEAPON_ITEM_ID;
|
||||
if (!existingStartingSword) {
|
||||
await characterItemRepository.insert({
|
||||
id: DEMO_CHARACTER_STARTING_WEAPON_ITEM_ID,
|
||||
characterId: DEMO_CHARACTER_ID,
|
||||
itemDefinitionId: ITEM_IDS['worn-short-sword'],
|
||||
quantity: 1,
|
||||
});
|
||||
}
|
||||
|
||||
const existingWeaponEquipment = await characterEquipmentRepository.findOneBy({
|
||||
characterId: DEMO_CHARACTER_ID,
|
||||
slot: EquipmentSlot.WEAPON,
|
||||
});
|
||||
if (!existingWeaponEquipment) {
|
||||
await characterEquipmentRepository.insert({
|
||||
id: DEMO_CHARACTER_STARTING_WEAPON_EQUIPMENT_ID,
|
||||
characterId: DEMO_CHARACTER_ID,
|
||||
slot: EquipmentSlot.WEAPON,
|
||||
characterItemId: startingSwordItemId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user