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

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