Added flamethrower with buring effects
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import type {
|
||||
ConsumableItem,
|
||||
MeleeWeaponItem,
|
||||
RangedWeaponItem,
|
||||
ArmourItem,
|
||||
AmmoItem
|
||||
import type {
|
||||
ConsumableItem,
|
||||
MeleeWeaponItem,
|
||||
RangedWeaponItem,
|
||||
ArmourItem,
|
||||
AmmoItem,
|
||||
FlamethrowerItem
|
||||
} from "../types";
|
||||
import { GAME_CONFIG } from "../config/GameConfig";
|
||||
|
||||
// =============================================================================
|
||||
// Per-Type Template Lists (Immutable)
|
||||
@@ -100,28 +102,28 @@ export type ItemTemplateId = keyof typeof ALL_TEMPLATES;
|
||||
// Factory Functions
|
||||
// =============================================================================
|
||||
|
||||
import {
|
||||
ALL_VARIANTS,
|
||||
import {
|
||||
ALL_VARIANTS,
|
||||
type ArmourVariantId,
|
||||
type WeaponVariantId,
|
||||
type ConsumableVariantId
|
||||
} from "./ItemVariants";
|
||||
|
||||
export function createConsumable(
|
||||
id: ConsumableId,
|
||||
quantity = 1,
|
||||
id: ConsumableId,
|
||||
quantity = 1,
|
||||
variant?: ConsumableVariantId
|
||||
): ConsumableItem {
|
||||
const t = CONSUMABLES[id];
|
||||
const v = variant ? ALL_VARIANTS[variant] : null;
|
||||
|
||||
|
||||
// Apply effect multiplier for consumables
|
||||
const effectMult = v?.statModifiers.effectMultiplier ?? 1;
|
||||
const baseHealAmount = "healAmount" in t ? t.healAmount : undefined;
|
||||
const finalHealAmount = baseHealAmount ? Math.floor(baseHealAmount * effectMult) : undefined;
|
||||
|
||||
|
||||
const name = v ? `${v.prefix} ${t.name}` : t.name;
|
||||
|
||||
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
@@ -140,15 +142,15 @@ export function createConsumable(
|
||||
}
|
||||
|
||||
export function createRangedWeapon(
|
||||
id: RangedWeaponId,
|
||||
id: RangedWeaponId,
|
||||
variant?: WeaponVariantId
|
||||
): RangedWeaponItem {
|
||||
const t = RANGED_WEAPONS[id];
|
||||
const v = variant ? ALL_VARIANTS[variant] : null;
|
||||
|
||||
|
||||
const name = v ? `${v.prefix} ${t.name}` : t.name;
|
||||
const attackBonus = (v?.statModifiers as { attack?: number })?.attack ?? 0;
|
||||
|
||||
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
@@ -176,10 +178,10 @@ export function createMeleeWeapon(
|
||||
): MeleeWeaponItem {
|
||||
const t = MELEE_WEAPONS[id];
|
||||
const v = variant ? ALL_VARIANTS[variant] : null;
|
||||
|
||||
|
||||
const name = v ? `${v.prefix} ${t.name}` : t.name;
|
||||
const attackBonus = (v?.statModifiers as { attack?: number })?.attack ?? 0;
|
||||
|
||||
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
@@ -209,15 +211,15 @@ export function createAmmo(id: AmmoId, quantity = 10): AmmoItem {
|
||||
}
|
||||
|
||||
export function createArmour(
|
||||
id: ArmourId,
|
||||
id: ArmourId,
|
||||
variant?: ArmourVariantId
|
||||
): ArmourItem {
|
||||
const t = ARMOUR[id];
|
||||
const v = variant ? ALL_VARIANTS[variant] : null;
|
||||
|
||||
|
||||
const name = v ? `${v.prefix} ${t.name}` : t.name;
|
||||
const defenseBonus = v?.statModifiers.defense ?? 0;
|
||||
|
||||
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
@@ -244,6 +246,24 @@ export function createUpgradeScroll(quantity = 1): ConsumableItem {
|
||||
};
|
||||
}
|
||||
|
||||
export function createFlamethrower(): FlamethrowerItem {
|
||||
const config = GAME_CONFIG.gameplay.flamethrower;
|
||||
return {
|
||||
id: "flamethrower",
|
||||
name: "Flamethrower",
|
||||
type: "Weapon",
|
||||
weaponType: "flamethrower",
|
||||
textureKey: "weapons",
|
||||
spriteIndex: 5,
|
||||
charges: config.maxCharges,
|
||||
maxCharges: config.maxCharges,
|
||||
lastRechargeTurn: 0,
|
||||
stats: {
|
||||
attack: config.initialDamage,
|
||||
range: config.range,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Legacy export for backward compatibility during migration
|
||||
export const ITEMS = ALL_TEMPLATES;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user