|
- import { TextLike, LiveText, DynText, Word, ImproperNoun, Verb } from './language'
- import { Actionable, Action, DamageFormula, ConstantDamageFormula, Damage, DamageType, Vigor, StatDamageFormula, Stat } from './combat'
- import { AttackAction } from './combat/actions'
-
- export interface Item extends Actionable {
- name: Word;
- desc: TextLike;
- }
-
- export class Weapon implements Actionable {
- actions: Array<Action> = []
-
- constructor (public name: Word, public desc: TextLike, damageFormula: DamageFormula, verb: Verb) {
- const attack = new AttackAction(damageFormula, verb)
- attack.desc = new DynText(`Attack with your `, this.name.all)
- this.actions.push(attack)
- }
- }
-
- export const Sword = new Weapon(
- new ImproperNoun('sword', 'swords'),
- 'An arming sword',
- new StatDamageFormula([
- { fraction: 0.35, stat: Stat.Power, target: Vigor.Health, type: DamageType.Slash },
- { fraction: 0.25, stat: Stat.Power, target: Vigor.Health, type: DamageType.Pierce }
- ]),
- new Verb('slash', 'slashes')
- )
-
- export const Dagger = new Weapon(
- new ImproperNoun('dagger', 'daggers'),
- 'A pointy dagger',
- new StatDamageFormula([
- { fraction: 0.50, stat: Stat.Speed, target: Vigor.Health, type: DamageType.Pierce },
- { fraction: 0.05, stat: Stat.Speed, target: Vigor.Health, type: DamageType.Slash }
- ]),
- new Verb('stab', 'stabs', 'stabbing', 'stabbed')
- )
-
- export const Wand = new Weapon(
- new ImproperNoun('wand', 'wands'),
- 'A magical wand',
- new StatDamageFormula([
- { fraction: 0.25, stat: Stat.Charm, target: Vigor.Health, type: DamageType.Crush },
- { fraction: 0.25, stat: Stat.Willpower, target: Vigor.Health, type: DamageType.Crush }
- ]),
- new Verb('zap', 'zaps', 'zapping', 'zapped')
- )
-
- export const Mace = new Weapon(
- new ImproperNoun('mace', 'maces'),
- 'A heavy mace',
- new StatDamageFormula([
- { fraction: 0.4, stat: Stat.Power, target: Vigor.Health, type: DamageType.Crush },
- { fraction: 0.2, stat: Stat.Power, target: Vigor.Health, type: DamageType.Pierce }
- ]),
- new Verb('bash', 'bashes', 'bashing', 'bashed')
- )
|