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.
 
 
 
 
 

206 lines
5.1 KiB

  1. <template>
  2. <div id="app">
  3. <Header />
  4. <Explore v-if="mode === 'explore'" :world="world" />
  5. <Combat v-if="mode === 'combat'" :encounter="encounter" />
  6. </div>
  7. </template>
  8. <script lang="ts">
  9. import { Component, Vue, Prop, Emit } from 'vue-property-decorator'
  10. import Combat from './components/Combat.vue'
  11. import Header from './components/Header.vue'
  12. import Explore from './components/Explore.vue'
  13. import * as Creatures from '@/game/creatures'
  14. import * as Items from '@/game/items'
  15. import { Creature } from '@/game/creature'
  16. import { ProperNoun, TheyPronouns, FemalePronouns, MalePronouns, ImproperNoun, POV } from '@/game/language'
  17. import { Place, Direction, World, Choice } from '@/game/world'
  18. import { Encounter, Side } from './game/combat'
  19. import { LogLine, nilLog } from './game/interface'
  20. import { InstantKillEffect } from './game/combat/effects'
  21. @Component({
  22. components: {
  23. Combat, Header, Explore
  24. },
  25. data () {
  26. return {
  27. encounter: null,
  28. encounters: null,
  29. world: null,
  30. mode: 'explore'
  31. }
  32. }
  33. })
  34. export default class App extends Vue {
  35. constructor () {
  36. super()
  37. }
  38. @Emit('startFight')
  39. startFight (encounter: Encounter) {
  40. this.$data.encounter = encounter
  41. this.$data.mode = 'combat'
  42. }
  43. created () {
  44. this.$data.encounters = []
  45. this.$data.encounters.push(new Encounter({ name: 'Boss Fight' }, this.makeParty().concat([new Creatures.Withers(), new Creatures.Kenzie()])))
  46. this.$data.encounters.push(new Encounter({ name: 'Cafat' }, this.makeParty().concat([new Creatures.Cafat()])))
  47. this.$data.encounters.push(new Encounter({ name: 'Dragon' }, this.makeParty().concat([new Creatures.Dragon()])))
  48. this.$data.encounters.push(new Encounter({ name: 'Wolves' }, this.makeParty().concat([new Creatures.Wolf(), new Creatures.Wolf(), new Creatures.Wolf(), new Creatures.Wolf()])))
  49. this.$data.encounters.push(new Encounter({ name: 'Large Wah' }, this.makeParty().concat([new Creatures.Shingo()])))
  50. this.$data.encounter = this.$data.encounters[0]
  51. const home = new Place('Home', 'This is not not home')
  52. const street = new Place('Street', 'The street')
  53. home.biconnect(Direction.North, street)
  54. this.$data.encounters.forEach((encounter: Encounter) => home.choices.push(new Choice(
  55. encounter.desc.name,
  56. 'Fight time!',
  57. (world, executor) => {
  58. this.startFight(
  59. encounter
  60. )
  61. return nilLog
  62. }
  63. )))
  64. const bar = new Place('Bar', 'This is the bar')
  65. street.biconnect(Direction.East, bar)
  66. const player = new Creatures.Wolf()
  67. player.perspective = POV.Second
  68. player.side = Side.Heroes
  69. player.location = home
  70. this.$data.world = new World(player)
  71. }
  72. makeParty (): Creature[] {
  73. const fighter = new Creatures.Human(new ProperNoun("Redgar"), MalePronouns, {
  74. stats: {
  75. Toughness: 20,
  76. Power: 20,
  77. Speed: 15,
  78. Willpower: 15,
  79. Charm: 10
  80. }
  81. })
  82. fighter.title = "Lv. 6 Fighter"
  83. fighter.items.push(Items.Sword)
  84. const rogue = new Creatures.Human(new ProperNoun('Lidda'), FemalePronouns, {
  85. stats: {
  86. Toughness: 10,
  87. Power: 15,
  88. Speed: 20,
  89. Willpower: 15,
  90. Charm: 20
  91. }
  92. })
  93. rogue.title = "Lv. 5 Rogue"
  94. rogue.items.push(Items.Dagger)
  95. const wizard = new Creatures.Human(new ProperNoun('Mialee'), FemalePronouns, {
  96. stats: {
  97. Toughness: 10,
  98. Power: 10,
  99. Speed: 15,
  100. Willpower: 20,
  101. Charm: 25
  102. }
  103. })
  104. wizard.title = "Lv. 6 Wizard"
  105. wizard.items.push(Items.Wand)
  106. const cleric = new Creatures.Human(new ProperNoun('Jozan'), MalePronouns, {
  107. stats: {
  108. Toughness: 15,
  109. Power: 15,
  110. Speed: 10,
  111. Willpower: 20,
  112. Charm: 15
  113. }
  114. })
  115. cleric.title = "Lv. 5 Cleric"
  116. cleric.items.push(Items.Mace)
  117. return [fighter, cleric, rogue, wizard]
  118. }
  119. }
  120. </script>
  121. <style>
  122. body, html {
  123. background: #181818;
  124. width: 100%;
  125. height: 100%;
  126. overflow-x: hidden;
  127. }
  128. #app {
  129. font-family: Avenir, Helvetica, Arial, sans-serif;
  130. -webkit-font-smoothing: antialiased;
  131. -moz-osx-font-smoothing: grayscale;
  132. text-align: center;
  133. color: #ddd;
  134. background: #111;
  135. width: 100%;
  136. margin: auto;
  137. height: 100%;
  138. display: flex;
  139. flex-direction: column;
  140. }
  141. .tippy-box {
  142. text-align: center;
  143. border-radius: 10px;
  144. }
  145. .tippy-box .tooltip-title {
  146. font-size: 18pt;
  147. font-family: sans-serif;
  148. }
  149. .tippy-box .tooltip-body {
  150. font-size: 12pt;
  151. font-family: sans-serif;
  152. }
  153. *::-webkit-scrollbar {
  154. height: 12px;
  155. }
  156. *::-webkit-scrollbar-button {
  157. width: 0px;
  158. height: 0px;
  159. }
  160. *::-webkit-scrollbar-thumb {
  161. background: #e1e1e1;
  162. border: 0px none #ffffff;
  163. border-radius: 50px;
  164. }
  165. *::-webkit-scrollbar-thumb:hover {
  166. background: #ffffff;
  167. }
  168. *::-webkit-scrollbar-thumb:active {
  169. background: #000000;
  170. }
  171. *::-webkit-scrollbar-track {
  172. background: #00000000;
  173. border: 0px none #ffffff;
  174. border-radius: 50px;
  175. }
  176. *::-webkit-scrollbar-track:hover {
  177. background: #666666;
  178. }
  179. *::-webkit-scrollbar-track:active {
  180. background: #333333;
  181. }
  182. *::-webkit-scrollbar-corner {
  183. background: transparent;
  184. }
  185. </style>