瀏覽代碼

Add a way to recruit allies; fix self-selection bug in combat

Eating an ally would wind up causing both the left and right
selections to be yourself, which caused duplicate keys
and broke the interface. Pair actions are now only checked if
the left and right selections are distinct.
master
Fen Dweller 5 年之前
父節點
當前提交
3131e8889d
共有 3 個檔案被更改,包括 22 行新增5 行删除
  1. +4
    -4
      src/components/Combat.vue
  2. +17
    -1
      src/game/maps/town.ts
  3. +1
    -0
      src/game/world.ts

+ 4
- 4
src/components/Combat.vue 查看文件

@@ -21,8 +21,8 @@
<div v-if="encounter.currentMove === left" class="vert-display">
<i class="action-label fas fa-users" v-if="left.validGroupActions(combatants).length > 0"></i>
<ActionButton @described="described" @executed="executedLeft" v-for="(action, index) in left.validGroupActions(combatants)" :key="'left-' + action.name + '-' + index" :action="action" :user="left" :target="right" :combatants="combatants" />
<i class="action-label fas fa-user-friends" v-if="left.validActions(right).length > 0"></i>
<ActionButton @described="described" @executed="executedLeft" v-for="(action, index) in left.validActions(right)" :key="'left-' + action.name + '-' + index" :action="action" :user="left" :target="right" :combatants="combatants" />
<i class="action-label fas fa-user-friends" v-if="left.validActions(right).length > 0 && left !== right"></i>
<ActionButton @described="described" @executed="executedLeft" v-for="(action, index) in left === right ? [] : left.validActions(right)" :key="'left-' + action.name + '-' + index" :action="action" :user="left" :target="right" :combatants="combatants" />
<i class="action-label fas fa-user" v-if="left.validActions(left).length > 0"></i>
<ActionButton @described="described" @executed="executedLeft" v-for="(action, index) in left.validActions(left)" :key="'left-' + action.name + '-' + index" :action="action" :user="left" :target="left" :combatants="combatants" />
</div>
@@ -34,8 +34,8 @@
<div v-if="encounter.currentMove === right" class="vert-display">
<i class="action-label fas fa-users" v-if="right.validGroupActions(combatants).length > 0"></i>
<ActionButton @described="described" @executed="executedRight" v-for="(action, index) in right.validGroupActions(combatants)" :key="'right-' + action.name + '-' + index" :action="action" :user="right" :target="left" :combatants="combatants" />
<i class="action-label fas fa-user-friends" v-if="right.validActions(left).length > 0"></i>
<ActionButton @described="described" @executed="executedRight" v-for="(action, index) in right.validActions(left)" :key="'right-' + action.name + '-' + index" :action="action" :user="right" :target="left" :combatants="combatants" />
<i class="action-label fas fa-user-friends" v-if="right.validActions(left).length > 0 && right !== left"></i>
<ActionButton @described="described" @executed="executedRight" v-for="(action, index) in right === left ? [] : right.validActions(left)" :key="'right-' + action.name + '-' + index" :action="action" :user="right" :target="left" :combatants="combatants" />
<i class="action-label fas fa-user" v-if="right.validActions(right).length > 0"></i>
<ActionButton @described="described" @executed="executedRight" v-for="(action, index) in right.validActions(right)" :key="'right-' + action.name + '-' + index" :action="action" :user="right" :target="right" :combatants="combatants" />
</div>


+ 17
- 1
src/game/maps/town.ts 查看文件

@@ -286,7 +286,7 @@ export const Town = (): Place => {
name: "Fight some tasty nerd",
intro: () => new LogLine(`You find some nerd to fight.`)
},
[world.player, enemy]
[world.player, enemy].concat(world.party)
)
world.encounter = encounter
return nilLog
@@ -294,6 +294,22 @@ export const Town = (): Place => {
)
)

westAve.choices.push(
new Choice(
"Recruit someone",
"Not ow",
(world) => {
const ally = new Creatures.Human(new ProperNoun("Ally"), TheyPronouns)
ally.side = Side.Heroes
ally.ai = new VoreAI()
ally.equip(new Items.Sword(), Items.EquipmentSlot.MainHand)
world.party.push(ally)

return new LogLine(`You recruit a nerd`)
}
)
)

square.choices.push(
new Choice(
"Fight Geta",


+ 1
- 0
src/game/world.ts 查看文件

@@ -92,6 +92,7 @@ export class World {
time: Moment
creatures: Creature[] = []
encounter: Encounter|null = null
party: Creature[] = []

constructor (public player: Creature) {
this.time = moment.utc([500, 1, 1, 9, 0, 0, 0])


Loading…
取消
儲存