Feast 2.0!
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 

100 行
2.3 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 ContainedByCondition implements Condition {
  46. constructor (private container: Container) {
  47. }
  48. allowed (user: Creature, target: Creature): boolean {
  49. return user.containedIn === this.container && this.container.owner === target
  50. }
  51. }
  52. export class ContainsCondition implements Condition {
  53. constructor (private container: Container) {
  54. }
  55. allowed (user: Creature, target: Creature): boolean {
  56. return target.containedIn === this.container
  57. }
  58. }
  59. export class AllyCondition implements Condition {
  60. allowed (user: Creature, target: Creature): boolean {
  61. return user.side === target.side
  62. }
  63. }
  64. export class EnemyCondition implements Condition {
  65. allowed (user: Creature, target: Creature): boolean {
  66. return user.side !== target.side
  67. }
  68. }
  69. export class ContainerFullCondition implements Condition {
  70. constructor (private container: Container) {
  71. }
  72. allowed (user: Creature, target: Creature): boolean {
  73. return this.container.contents.length > 0
  74. }
  75. }