Explorar el Código

Add a way to check if a noun/pronoun is plural

master
Fen Dweller hace 5 años
padre
commit
95b45510f9
Se han modificado 2 ficheros con 15 adiciones y 7 borrados
  1. +2
    -2
      src/game/creatures/cafat.ts
  2. +13
    -5
      src/game/language.ts

+ 2
- 2
src/game/creatures/cafat.ts Ver fichero

@@ -56,8 +56,8 @@ class BelchAction extends AttackAction {
class CrushAction extends EatenAction {
lines: POVPair<Entity, Entity> = new POVPair([
[[POV.First, POV.Third], (user, target) => new LogLine(`You crush ${target.name} `, new FAElem('fas fa-skull'))],
[[POV.Third, POV.First], (user, target) => new CompositeLog(new LogLine(`${user.name.capital} crushes you; ${user.pronouns.subjective} belches as ${user.pronouns.possessive} gut lets out a fatal CRUNCH `, new FAElem('fas fa-skull')), new ImgElem('./media/cafat/images/crunch.webp'))],
[[POV.Third, POV.Third], (user, target) => new LogLine(`${user.name.capital} crushes ${target.name}; ${user.pronouns.subjective} belches as ${user.pronouns.possessive} gut lets out a fatal CRUNCH `, new FAElem('fas fa-skull'))]
[[POV.Third, POV.First], (user, target) => new CompositeLog(new LogLine(`${user.name.capital} crushes you; ${user.pronouns.subjective} ${user.pronouns.isPlural ? 'belch' : 'belches'} as ${user.pronouns.possessive} gut lets out a fatal CRUNCH `, new FAElem('fas fa-skull')), new ImgElem('./media/cafat/images/crunch.webp'))],
[[POV.Third, POV.Third], (user, target) => new LogLine(`${user.name.capital} crushes ${target.name}; ${user.pronouns.subjective} ${user.pronouns.isPlural ? 'belch' : 'belches'} as ${user.pronouns.possessive} gut lets out a fatal CRUNCH `, new FAElem('fas fa-skull'))]
])

private damage: Damage = new Damage(


+ 13
- 5
src/game/language.ts Ver fichero

@@ -60,6 +60,10 @@ enum VowelSound {
NonVowel
}

export interface Pluralizable {
isPlural: boolean;
}

interface WordOptions {
plural: boolean;
capital: boolean;
@@ -92,7 +96,7 @@ export class DynText {
return (this.parts.map(part => part.toString())).join('')
}
}
export class Noun {
export class Noun implements Pluralizable {
constructor (private singularNoun: string, private pluralNoun: string|null = null, private options: WordOptions = { plural: false, capital: false, proper: false, kind: NounKind.Specific, vowel: VowelSound.Default, count: true }) {

}
@@ -145,6 +149,10 @@ export class Noun {
return new Noun(this.singularNoun, this.pluralNoun, opts)
}

get isPlural (): boolean {
return this.options.plural
}

toString (): string {
let result: string

@@ -207,8 +215,8 @@ interface PronounDict {
reflexive: string;
}

export class Pronoun {
constructor (private pronouns: PronounDict, private capitalize: boolean = false) {
export class Pronoun implements Pluralizable {
constructor (private pronouns: PronounDict, private capitalize: boolean = false, public isPlural: boolean = false) {

}

@@ -260,14 +268,14 @@ export const TheyPronouns = new Pronoun({
objective: 'them',
possessive: 'their',
reflexive: 'themself'
})
}, false, true)

export const TheyPluralPronouns = new Pronoun({
subjective: 'they',
objective: 'them',
possessive: 'their',
reflexive: 'themselves'
})
}, false, true)

export const ObjectPronouns = new Pronoun({
subjective: 'it',


Cargando…
Cancelar
Guardar