Feast 2.0!
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

59 строки
2.0 KiB

  1. import { TextLike, LiveText, DynText, Word, ImproperNoun, Verb } 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, verb: Verb) {
  11. const attack = new AttackAction(damageFormula, verb)
  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. new Verb('slash', 'slashes')
  24. )
  25. export const Dagger = new Weapon(
  26. new ImproperNoun('dagger', 'daggers'),
  27. 'A pointy dagger',
  28. new StatDamageFormula([
  29. { fraction: 0.50, stat: Stat.Speed, target: Vigor.Health, type: DamageType.Pierce },
  30. { fraction: 0.05, stat: Stat.Speed, target: Vigor.Health, type: DamageType.Slash }
  31. ]),
  32. new Verb('stab', 'stabs', 'stabbing', 'stabbed')
  33. )
  34. export const Wand = new Weapon(
  35. new ImproperNoun('wand', 'wands'),
  36. 'A magical wand',
  37. new StatDamageFormula([
  38. { fraction: 0.25, stat: Stat.Charm, target: Vigor.Health, type: DamageType.Crush },
  39. { fraction: 0.25, stat: Stat.Willpower, target: Vigor.Health, type: DamageType.Crush }
  40. ]),
  41. new Verb('zap', 'zaps', 'zapping', 'zapped')
  42. )
  43. export const Mace = new Weapon(
  44. new ImproperNoun('mace', 'maces'),
  45. 'A heavy mace',
  46. new StatDamageFormula([
  47. { fraction: 0.4, stat: Stat.Power, target: Vigor.Health, type: DamageType.Crush },
  48. { fraction: 0.2, stat: Stat.Power, target: Vigor.Health, type: DamageType.Pierce }
  49. ]),
  50. new Verb('bash', 'bashes', 'bashing', 'bashed')
  51. )