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.
 
 
 
 
 

120 lines
2.8 KiB

  1. import { Condition, Vigor } from "../combat"
  2. import { Creature } from "../creature"
  3. import { Container } from '../vore'
  4. export class InverseCondition implements Condition {
  5. constructor (private condition: Condition) {
  6. }
  7. allowed (user: Creature, target: Creature): boolean {
  8. return !this.condition.allowed(user, target)
  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. constructor (private vigor: Vigor) {
  18. }
  19. allowed (user: Creature, target: Creature): boolean {
  20. return user.vigors[this.vigor] <= 0
  21. }
  22. }
  23. export class TargetDrainedVigorCondition implements Condition {
  24. constructor (private vigor: Vigor) {
  25. }
  26. allowed (user: Creature, target: Creature): boolean {
  27. return target.vigors[this.vigor] <= 0
  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 HasRoomCondition implements Condition {
  46. constructor (private container: Container) {
  47. }
  48. allowed (user: Creature, target: Creature): boolean {
  49. return this.container.capacity > this.container.fullness + target.voreStats.Bulk
  50. }
  51. }
  52. export class ContainedByCondition implements Condition {
  53. constructor (private container: Container) {
  54. }
  55. allowed (user: Creature, target: Creature): boolean {
  56. return user.containedIn === this.container && this.container.owner === target
  57. }
  58. }
  59. export class ContainsCondition implements Condition {
  60. constructor (private container: Container) {
  61. }
  62. allowed (user: Creature, target: Creature): boolean {
  63. return target.containedIn === this.container
  64. }
  65. }
  66. export class AllyCondition implements Condition {
  67. allowed (user: Creature, target: Creature): boolean {
  68. return user.side === target.side
  69. }
  70. }
  71. export class EnemyCondition implements Condition {
  72. allowed (user: Creature, target: Creature): boolean {
  73. return user.side !== target.side
  74. }
  75. }
  76. export class ContainerFullCondition implements Condition {
  77. constructor (private container: Container) {
  78. }
  79. allowed (user: Creature, target: Creature): boolean {
  80. return this.container.contents.length > 0
  81. }
  82. }
  83. export class MassRatioCondition implements Condition {
  84. constructor (private ratio: number) {
  85. }
  86. allowed (user: Creature, target: Creature): boolean {
  87. return user.voreStats.Mass / target.voreStats.Mass > this.ratio
  88. }
  89. }