Feast 2.0!
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.
 
 
 
 
 

55 lines
1.8 KiB

  1. import { TextLike, LiveText, DynText, Word, ImproperNoun } from './language'
  2. import { Actionable, Action, DamageFormula, ConstantDamageFormula, Damage, DamageType, Vigor, StatDamageFormula, Stat } from './combat'
  3. import { AttackAction } from './combat/actions'
  4. export interface Item extends Actionable {
  5. name: Word;
  6. desc: TextLike;
  7. }
  8. export class Weapon implements Actionable {
  9. actions: Array<Action> = []
  10. constructor (public name: Word, public desc: TextLike, damageFormula: DamageFormula) {
  11. const attack = new AttackAction(damageFormula)
  12. attack.desc = new DynText(`Attack with your `, this.name.all)
  13. this.actions.push(attack)
  14. }
  15. }
  16. export const Sword = new Weapon(
  17. new ImproperNoun('sword', 'swords'),
  18. 'An arming sword',
  19. new StatDamageFormula([
  20. { fraction: 0.35, stat: Stat.Power, target: Vigor.Health, type: DamageType.Slash },
  21. { fraction: 0.25, stat: Stat.Power, target: Vigor.Health, type: DamageType.Pierce }
  22. ])
  23. )
  24. export const Dagger = new Weapon(
  25. new ImproperNoun('dagger', 'daggers'),
  26. 'A pointy dagger',
  27. new StatDamageFormula([
  28. { fraction: 0.50, stat: Stat.Speed, target: Vigor.Health, type: DamageType.Pierce },
  29. { fraction: 0.05, stat: Stat.Speed, target: Vigor.Health, type: DamageType.Slash }
  30. ])
  31. )
  32. export const Wand = new Weapon(
  33. new ImproperNoun('wand', 'wands'),
  34. 'A magical wand',
  35. new StatDamageFormula([
  36. { fraction: 0.25, stat: Stat.Charm, target: Vigor.Health, type: DamageType.Crush },
  37. { fraction: 0.25, stat: Stat.Willpower, target: Vigor.Health, type: DamageType.Crush }
  38. ])
  39. )
  40. export const Mace = new Weapon(
  41. new ImproperNoun('mace', 'maces'),
  42. 'A heavy mace',
  43. new StatDamageFormula([
  44. { fraction: 0.4, stat: Stat.Power, target: Vigor.Health, type: DamageType.Crush },
  45. { fraction: 0.2, stat: Stat.Power, target: Vigor.Health, type: DamageType.Pierce }
  46. ])
  47. )