Advertisement
Guest User

Untitled

a guest
Aug 16th, 2019
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 2.00 KB | None | 0 0
  1. package me.amuxix.runes
  2.  
  3. import cats.data.EitherT
  4. import cats.effect.IO
  5. import me.amuxix.inventory.Item
  6. import me.amuxix.material.Material.{BlackWool, WhiteWool}
  7. import me.amuxix.pattern.{ActivationLayer, BaseLayer, Pattern, RunePattern}
  8. import me.amuxix.position.BlockPosition
  9. import me.amuxix.{=|>, Direction, Matrix4, Player}
  10.  
  11. import scala.util.Random.nextInt
  12.  
  13. object MagicEightBall extends RunePattern[MagicEightBall] {
  14.   override val runeCreator: RuneCreator = MagicEightBall.apply
  15.   override val activatesWith: Option[Item] =|> Boolean = {
  16.     case None => true
  17.   }
  18.   // format: off
  19.   override val layers: List[BaseLayer] = List(
  20.     ActivationLayer(
  21.       BlackWool, BlackWool,  BlackWool,
  22.       BlackWool, WhiteWool, BlackWool,
  23.       BlackWool, BlackWool,  BlackWool,
  24.     ),
  25.   )
  26.   // format: on
  27. }
  28.  
  29. case class MagicEightBall(
  30.   center: BlockPosition,
  31.   creator: Player,
  32.   direction: Direction,
  33.   rotation: Matrix4,
  34.   pattern: Pattern
  35. ) extends Rune {
  36.  
  37.   /**
  38.     * Internal activate method that should contain all code to activate a rune.
  39.     */
  40.   override protected def onActivate(activationItem: Option[Item]): EitherT[IO, String, Boolean] = EitherT.pure(true)
  41.  
  42.   activationMessage = {
  43.     val possibleResponses = List(
  44.       "It is certain.",
  45.       "It is decidedly so.",
  46.       "Without a doubt.",
  47.       "Yes - definitely.",
  48.       "You may rely on it.",
  49.       "As I see it, yes.",
  50.       "Most likely.",
  51.       "Outlook good.",
  52.       "Yes.",
  53.       "Signs point to yes.",
  54.       "Reply hazy, try again.",
  55.       "Ask again later.",
  56.       "Better not tell you now.",
  57.       "Cannot predict now.",
  58.       "Concentrate and ask again.",
  59.       "Don't count on it.",
  60.       "My reply is no.",
  61.       "My sources say no.",
  62.       "Outlook not so good.",
  63.       "Very doubtful.",
  64.     )
  65.     possibleResponses(nextInt(possibleResponses.size))
  66.   }
  67.  
  68.   /**
  69.     * Should this rune use a true name if the activator is wearing one?
  70.     */
  71.   override val shouldUseTrueName: Boolean = false
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement