Feast 2.0!
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 

80 řádky
1.8 KiB

  1. import { Condition, Vigor } from "../combat"
  2. import { Creature } from "../entity"
  3. import { Container } from '../vore'
  4. export class InverseCondition implements Condition {
  5. allowed (user: Creature, target: Creature): boolean {
  6. return !this.condition.allowed(user, target)
  7. }
  8. constructor (private condition: Condition) {
  9. }
  10. }
  11. export class CapableCondition implements Condition {
  12. allowed (user: Creature, target: Creature): boolean {
  13. return !user.disabled
  14. }
  15. }
  16. export class UserDrainedVigorCondition implements Condition {
  17. allowed (user: Creature, target: Creature): boolean {
  18. return user.vigors[this.vigor] <= 0
  19. }
  20. constructor (private vigor: Vigor) {
  21. }
  22. }
  23. export class TargetDrainedVigorCondition implements Condition {
  24. allowed (user: Creature, target: Creature): boolean {
  25. return target.vigors[this.vigor] <= 0
  26. }
  27. constructor (private vigor: Vigor) {
  28. }
  29. }
  30. export class SoloCondition implements Condition {
  31. allowed (user: Creature, target: Creature): boolean {
  32. return user === target
  33. }
  34. }
  35. export class PairCondition implements Condition {
  36. allowed (user: Creature, target: Creature): boolean {
  37. return user !== target
  38. }
  39. }
  40. export class TogetherCondition implements Condition {
  41. allowed (user: Creature, target: Creature): boolean {
  42. return user.containedIn === target.containedIn && user !== target
  43. }
  44. }
  45. export class ContainerCondition implements Condition {
  46. allowed (user: Creature, target: Creature): boolean {
  47. return target.containedIn === this.container
  48. }
  49. constructor (private container: Container) {
  50. }
  51. }
  52. export class AllyCondition implements Condition {
  53. allowed (user: Creature, target: Creature): boolean {
  54. return user.side === target.side
  55. }
  56. }
  57. export class EnemyCondition implements Condition {
  58. allowed (user: Creature, target: Creature): boolean {
  59. return user.side !== target.side
  60. }
  61. }