Feast 2.0!
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

178 строки
4.0 KiB

  1. <template>
  2. <div id="app">
  3. <Header :version="version" />
  4. <div id="main-area">
  5. <transition name="component-fade" mode='out-in'>
  6. <component @profile="$data.profileOn = true" @exit="$data.profileOn = false" @give-in="gameOver()" @leave-combat="$data.world.encounter = null" v-bind:is="mode" :world="$data.world" :encounter="$data.world.encounter" />
  7. </transition>
  8. </div>
  9. </div>
  10. </template>
  11. <script lang="ts">
  12. import { Component, Vue, Prop, Emit } from 'vue-property-decorator'
  13. import Header from './components/Header.vue'
  14. import Combat from './components/Combat.vue'
  15. import Explore from './components/Explore.vue'
  16. import Profile from './components/Profile.vue'
  17. import * as Creatures from '@/game/creatures'
  18. import * as Items from '@/game/items'
  19. import { Creature } from '@/game/creature'
  20. import { ProperNoun, TheyPronouns, FemalePronouns, MalePronouns, ImproperNoun, POV } from '@/game/language'
  21. import { Place, Direction, World, Choice } from '@/game/world'
  22. import { Encounter, Side } from './game/combat'
  23. import { LogLine, nilLog } from './game/interface'
  24. import { InstantKillEffect } from './game/combat/effects'
  25. import moment from 'moment'
  26. import { Town } from './game/maps/town'
  27. @Component({
  28. components: {
  29. Combat, Header, Explore, Profile
  30. },
  31. data () {
  32. return {
  33. world: null,
  34. home: null,
  35. profileOn: false,
  36. props: {
  37. Explore: {
  38. world: this
  39. }
  40. },
  41. version: "pre-alpha"
  42. }
  43. }
  44. })
  45. export default class App extends Vue {
  46. constructor () {
  47. super()
  48. }
  49. get mode () {
  50. if (this.$data.world.encounter !== null) {
  51. return "Combat"
  52. } else if (this.$data.profileOn) {
  53. return "Profile"
  54. } else {
  55. return "Explore"
  56. }
  57. }
  58. @Emit('startFight')
  59. startFight (encounter: Encounter) {
  60. this.$data.world.encounter = encounter
  61. }
  62. created () {
  63. const player = new Creatures.Player()
  64. player.perspective = POV.Second
  65. player.side = Side.Heroes
  66. player.equipment[Items.EquipmentSlot.MainHand] = new Items.Sword()
  67. player.equipment[Items.EquipmentSlot.Head] = new Items.Helmet()
  68. player.items.push(new Items.HealthPotion())
  69. player.items.push(new Items.Mace())
  70. player.items.push(new Items.Dagger())
  71. this.$data.world = new World(player)
  72. this.$data.home = Town()
  73. player.location = this.$data.home
  74. }
  75. gameOver () {
  76. this.$data.world.encounter = null
  77. this.$data.world.player.location = this.$data.home
  78. }
  79. }
  80. </script>
  81. <style>
  82. body, html {
  83. background: #181818;
  84. width: 100%;
  85. height: 100%;
  86. overflow-x: hidden;
  87. }
  88. html {
  89. font-size: calc(0.75em + 1vmin);
  90. }
  91. #app {
  92. position: relative;
  93. font-family: Avenir, Helvetica, Arial, sans-serif;
  94. -webkit-font-smoothing: antialiased;
  95. -moz-osx-font-smoothing: grayscale;
  96. text-align: center;
  97. color: #ddd;
  98. background: #111;
  99. width: 100%;
  100. margin: auto;
  101. height: 100%;
  102. display: flex;
  103. flex-direction: column;
  104. }
  105. #main-area {
  106. position: relative;
  107. flex: 10;
  108. overflow-x: hidden;
  109. overflow-y: hidden;
  110. }
  111. .tippy-box {
  112. text-align: center;
  113. border-radius: 10px;
  114. }
  115. .tippy-box .tooltip-title {
  116. font-size: 18pt;
  117. font-family: sans-serif;
  118. }
  119. .tippy-box .tooltip-body {
  120. font-size: 12pt;
  121. font-family: sans-serif;
  122. }
  123. *::-webkit-scrollbar {
  124. height: 12px;
  125. }
  126. *::-webkit-scrollbar-button {
  127. width: 0px;
  128. height: 0px;
  129. }
  130. *::-webkit-scrollbar-thumb {
  131. background: #e1e1e1;
  132. border: 0px none #ffffff;
  133. border-radius: 50px;
  134. }
  135. *::-webkit-scrollbar-thumb:hover {
  136. background: #ffffff;
  137. }
  138. *::-webkit-scrollbar-thumb:active {
  139. background: #000000;
  140. }
  141. *::-webkit-scrollbar-track {
  142. background: #00000000;
  143. border: 0px none #ffffff;
  144. border-radius: 50px;
  145. }
  146. *::-webkit-scrollbar-track:hover {
  147. background: #666666;
  148. }
  149. *::-webkit-scrollbar-track:active {
  150. background: #333333;
  151. }
  152. *::-webkit-scrollbar-corner {
  153. background: transparent;
  154. }
  155. .component-fade-enter-active, .component-fade-leave-active {
  156. transition: opacity .3s ease;
  157. }
  158. .component-fade-enter, .component-fade-leave-to
  159. /* .component-fade-leave-active below version 2.1.8 */ {
  160. opacity: 0;
  161. }
  162. </style>