Bladeren bron

Show when vigors/stats are low

master
Fen Dweller 5 jaren geleden
bovenliggende
commit
08bdda2a1d
3 gewijzigde bestanden met toevoegingen van 26 en 3 verwijderingen
  1. +22
    -3
      src/components/Statblock.vue
  2. +3
    -0
      src/game/entity.ts
  3. +1
    -0
      src/game/vore.ts

+ 22
- 3
src/components/Statblock.vue Bestand weergeven

@@ -3,7 +3,7 @@
<h2 v-if="subject.perspective === firstperson">You</h2>
<h2 v-if="subject.perspective !== firstperson">{{subject.name.all.capital}}</h2>
<div class="stat-line">
<div class="stat-entry" v-for="vigor in Object.keys(subject.vigors)" v-bind:key="vigor">
<div :class="statClass(subject.vigors[vigor], subject.maxVigors[vigor])" v-for="vigor in Object.keys(subject.vigors)" v-bind:key="vigor">
<i :class="vigorIcons[vigor]" />
<div>{{subject.vigors[vigor]}}</div>
<div class="tooltip-template">
@@ -14,7 +14,7 @@
</div>
<br>
<div class="stat-line">
<div class="stat-entry" v-for="stat in Object.keys(subject.stats)" v-bind:key="stat">
<div :class="statClass(subject.stats[stat], subject.baseStats[stat])" v-for="stat in Object.keys(subject.stats)" v-bind:key="stat">
<i :class="statIcons[stat]" />
<div>{{subject.stats[stat]}}</div>
<div class="tooltip-template">
@@ -51,6 +51,17 @@ import 'tippy.js/dist/tippy.css'
@Component({
components: {
ContainerView
},
methods: {
statClass (value: number, max: number) {
if (value * 5 <= max) {
return 'stat-entry crit'
} else if (value * 3 <= max) {
return 'stat-entry low'
} else {
return 'stat-entry'
}
}
}
})
export default class Statblock extends Vue {
@@ -109,7 +120,7 @@ a {

.stat-entry {
position: relative;
font-size: 2vh;
font-size: 16pt;
padding-top: 4pt;
padding-bottom: 4pt;
display: flex;
@@ -117,6 +128,14 @@ a {
justify-content: space-evenly;
user-select: none;
}

.stat-entry.low {
color: yellow;
}

.stat-entry.crit {
color: red;
}
</style>

<style>


+ 3
- 0
src/game/entity.ts Bestand weergeven

@@ -18,6 +18,7 @@ export interface Mortal extends Entity {
resistances: Map<DamageType, number>;
takeDamage: (damage: Damage) => void;
stats: Stats;
baseStats: Stats;
status: string;
destroy: () => LogEntry;
}
@@ -35,6 +36,7 @@ export class Creature extends Vore implements Combatant {
[Vigor.Resolve]: 100
}

baseStats: Stats
voreStats: VoreStats

get disabled (): boolean {
@@ -56,6 +58,7 @@ export class Creature extends Vore implements Combatant {
constructor (public name: Noun, public pronouns: Pronoun, public stats: Stats, public preyPrefs: Set<VoreType>, public predPrefs: Set<VoreType>, mass: number) {
super()
const containers = this.containers
this.baseStats = stats

this.voreStats = {
get [VoreStat.Bulk] () {


+ 1
- 0
src/game/vore.ts Bestand weergeven

@@ -21,6 +21,7 @@ export abstract class Vore implements Mortal {
abstract resistances: Map<DamageType, number>;
abstract takeDamage (damage: Damage): LogEntry;
abstract stats: Stats;
abstract baseStats: Stats;
abstract status: string;
abstract preyPrefs: Set<VoreType>;
abstract voreStats: VoreStats;


Laden…
Annuleren
Opslaan