Bladeren bron

Add a chew action for Withers

master
Fen Dweller 5 jaren geleden
bovenliggende
commit
ee4440a71a
7 gewijzigde bestanden met toevoegingen van 71 en 10 verwijderingen
  1. +1
    -1
      src/App.vue
  2. +1
    -0
      src/components/ActionButton.vue
  3. +2
    -2
      src/components/Combat.vue
  4. +1
    -1
      src/game/combat/actions.ts
  5. +11
    -0
      src/game/combat/conditions.ts
  6. +53
    -5
      src/game/creatures/withers.ts
  7. +2
    -1
      src/game/entity.ts

+ 1
- 1
src/App.vue Bestand weergeven

@@ -108,7 +108,7 @@ body, html {
}

*::-webkit-scrollbar {
height: 2px;
height: 12px;
}
*::-webkit-scrollbar-button {
width: 0px;


+ 1
- 0
src/components/ActionButton.vue Bestand weergeven

@@ -57,6 +57,7 @@ export default class ActionButton extends Vue {
background: #333;
border-color: #666;
border-style: outset;
user-select: none;
}

.action-button:hover {


+ 2
- 2
src/components/Combat.vue Bestand weergeven

@@ -287,13 +287,13 @@ div.right-move {
div.left-move {
text-align: start;
margin-right: 25%;
margin-left: 5%;
margin-left: 2%;
}

div.right-move {
text-align: end;
margin-left: 25%;
margin-right: 5%;
margin-right: 2%;
}

#log img {


+ 1
- 1
src/game/combat/actions.ts Bestand weergeven

@@ -176,7 +176,7 @@ export abstract class EatenAction extends PairAction {
}
}

constructor (public container: VoreContainer, name: TextLike, desc: string) {
constructor (public container: Container, name: TextLike, desc: string) {
super(new DynText(name, ' (', new LiveText(container, x => x.name.all), ')'), desc, [new CapableCondition()])
}
}


+ 11
- 0
src/game/combat/conditions.ts Bestand weergeven

@@ -1,5 +1,6 @@
import { Condition, Vigor } from "../combat"
import { Creature } from "../entity"
import { Container } from '../vore'

export class InverseCondition implements Condition {
allowed (user: Creature, target: Creature): boolean {
@@ -31,3 +32,13 @@ export class TogetherCondition implements Condition {
return user.containedIn === target.containedIn
}
}

export class ContainerCondition implements Condition {
allowed (user: Creature, target: Creature): boolean {
return target.containedIn === this.container
}

constructor (private container: Container) {

}
}

+ 53
- 5
src/game/creatures/withers.ts Bestand weergeven

@@ -1,12 +1,13 @@
import { Creature, POV } from '../entity'
import { Damage, DamageType, ConstantDamageFormula, Vigor, Side, GroupAction } from '../combat'
import { Damage, DamageType, ConstantDamageFormula, Vigor, Side, GroupAction, CombatTest, Stat, Action } from '../combat'
import { ImproperNoun, POVPair, ProperNoun, FemalePronouns, RandomWord, Adjective, POVPairArgs, POVSoloArgs, Verb } from '../language'
import { LogLine, LogLines, LogEntry, Newline } from '../interface'
import { VoreType, Stomach, VoreContainer, Vore, NormalContainer } from '../vore'
import { AttackAction, FeedAction, TransferAction } from '../combat/actions'
import { TogetherCondition } from '../combat/conditions'
import { VoreType, Stomach, VoreContainer, Vore, NormalContainer, Container } from '../vore'
import { AttackAction, FeedAction, TransferAction, EatenAction } from '../combat/actions'
import { TogetherCondition, ContainerCondition } from '../combat/conditions'
import { InstantKill } from '../combat/effects'
import * as Words from '../words'
import { StatVigorTest } from '../combat/tests'

class MawContainer extends NormalContainer {
consumeVerb = new Verb('grab', 'grabs', 'grabbing', 'grabbed')
@@ -54,6 +55,44 @@ class BiteAction extends AttackAction {
}
}

class ChewAction extends GroupAction {
lines: POVPairArgs<Creature, Creature, { damage: Damage }> = new POVPairArgs([
[[POV.First, POV.Third], (user, target, args: { damage: Damage }) => new LogLine(`You chew on ${target.name} for `, args.damage.renderShort(), `!`)],
[[POV.Third, POV.First], (user, target, args: { damage: Damage }) => new LogLine(`${user.name.capital} chews on you for `, args.damage.renderShort(), `!`)],
[[POV.Third, POV.Third], (user, target, args: { damage: Damage }) => new LogLine(`${user.name.capital} chews on ${target.name} for `, args.damage.renderShort(), `!`)]
])

describeGroup (user: Creature, targets: Creature[]): LogEntry {
return new LogLine('CRUNCH')
}

execute (user: Creature, target: Creature): LogEntry {
const results: Array<LogEntry> = []
results.push(this.lines.run(user, target, { damage: this.damage }))
results.push(new LogLine(' '))
results.push(target.takeDamage(this.damage))

if (target.vigors.Health <= 0) {
if (this.killAction.allowed(user, target)) {
results.push(new Newline())
results.push(this.killAction.execute(user, target))
}
}

return new LogLine(...results)
}

describe (user: Creature, target: Creature): LogEntry {
return new LogLine('Do the crunch')
}

constructor (private damage: Damage, container: Container, private killAction: Action) {
super('Chew', 'Give them the big chew', [
new ContainerCondition(container)
])
}
}

class StompAction extends GroupAction {
lines: POVPair<Creature, Creature> = new POVPair([
[[POV.First, POV.Third], (user: Creature, target: Creature) => new LogLine(`You flatten ${target.name} under your foot!`)],
@@ -102,7 +141,7 @@ class DevourAllAction extends GroupAction {
}

executeGroup (user: Creature, targets: Array<Creature>): LogEntry {
return new LogLines(...targets.map(target => this.execute(user, target)).concat(
return new LogLines(...targets.filter(target => this.test.test(user, target)).map(target => this.execute(user, target)).concat(
[
new Newline(),
this.groupLines.run(user, { count: targets.length })
@@ -114,10 +153,13 @@ class DevourAllAction extends GroupAction {
return new LogLine('Eat all ', targets.length.toString(), ' of \'em!')
}

private test: CombatTest

constructor (private container: VoreContainer) {
super('Devour All', 'GULP!', [
new TogetherCondition()
])
this.test = new StatVigorTest(Stat.Power)
}
}

@@ -163,5 +205,11 @@ export class Withers extends Creature {
const grapple = new MawContainer(this, stomach)

this.otherContainers.push(grapple)

this.actions.push(new ChewAction(new Damage(
{ target: Vigor.Health, type: DamageType.Crush, amount: 10000 }
),
grapple,
new TransferAction(grapple, stomach)))
}
}

+ 2
- 1
src/game/entity.ts Bestand weergeven

@@ -106,6 +106,7 @@ export class Creature extends Vore implements Combatant {
}

takeDamage (damage: Damage): LogEntry {
const startHealth = this.vigors.Health
damage.damages.forEach(instance => {
const resistance: number|undefined = this.resistances.get(instance.type)
if (resistance !== undefined) {
@@ -123,7 +124,7 @@ export class Creature extends Vore implements Combatant {
}
})

if (this.vigors.Health <= 0) {
if (this.vigors.Health <= 0 && startHealth > 0) {
return this.destroy()
} else {
return new LogLine()


Laden…
Annuleren
Opslaan