Bladeren bron

Don't allow the items of enemies to be touched

master
Fen Dweller 5 jaren geleden
bovenliggende
commit
2371c33888
3 gewijzigde bestanden met toevoegingen van 24 en 12 verwijderingen
  1. +7
    -1
      src/components/EquipmentView.vue
  2. +16
    -11
      src/components/Profile.vue
  3. +1
    -0
      src/game/maps/town.ts

+ 7
- 1
src/components/EquipmentView.vue Bestand weergeven

@@ -10,6 +10,7 @@ import { Creature } from '@/game/creature'
import { POV } from '@/game/language'
import { Stats, Stat } from '@/game/combat'
import { Item, ItemKindIcons, ItemKind, EquipmentSlot } from '@/game/items'
import { World } from '@/game/world'

@Component({
data () {
@@ -21,11 +22,16 @@ import { Item, ItemKindIcons, ItemKind, EquipmentSlot } from '@/game/items'
})

export default class ItemView extends Vue {
@Prop()
world!: World

@Prop({ required: true })
subject!: Creature

unequip (slot: EquipmentSlot) {
this.subject.unequip(slot)
if (this.subject.side === this.world.player.side) {
this.subject.unequip(slot)
}
}

equipmentClass (slot: EquipmentSlot) {


+ 16
- 11
src/components/Profile.vue Bestand weergeven

@@ -22,7 +22,7 @@
</div>
</div>

<EquipmentView class="character-equipment" :subject="subject" />
<EquipmentView class="character-equipment" :world="world" :subject="subject" />
</div>
</template>

@@ -44,20 +44,25 @@ import { Item, ItemKind, Equipment } from '@/game/items'
})

export default class Profile extends Vue {
@Prop()
world!: World

@Prop()
subject!: Creature

useItem (item: Item): void {
switch (item.kind) {
case ItemKind.Key:
break
case ItemKind.Consumable:
item.actions[0].execute(this.subject, this.subject)
break
case ItemKind.Equipment:
this.subject.equip(item as Equipment, (item as Equipment).slot)
this.subject.items = this.subject.items.filter(i => item !== i)
break
if (this.subject.side === this.world.player.side) {
switch (item.kind) {
case ItemKind.Key:
break
case ItemKind.Consumable:
item.actions[0].execute(this.subject, this.subject)
break
case ItemKind.Equipment:
this.subject.equip(item as Equipment, (item as Equipment).slot)
this.subject.items = this.subject.items.filter(i => item !== i)
break
}
}
}
}


+ 1
- 0
src/game/maps/town.ts Bestand weergeven

@@ -264,6 +264,7 @@ export const Town = (): Place => {
const enemy = new Creatures.Human(new ProperNoun("Nerd"), TheyPronouns)
enemy.side = Side.Monsters
enemy.ai = new VoreAI()
enemy.equip(new Items.Sword(), Items.EquipmentSlot.MainHand)
const encounter = new Encounter(
{
name: "Fight some nerd",


Laden…
Annuleren
Opslaan