| @@ -201,7 +201,7 @@ export class ConstantDamageFormula implements DamageFormula { | |||||
| } | } | ||||
| explain (user: Creature): LogEntry { | explain (user: Creature): LogEntry { | ||||
| return new LogLine('Deal ', this.damage.renderShort(), ' damage') | |||||
| return new LogLine('Deal ', this.damage.renderShort(), '.') | |||||
| } | } | ||||
| } | } | ||||
| @@ -222,7 +222,7 @@ export class UniformRandomDamageFormula implements DamageFormula { | |||||
| } | } | ||||
| explain (user: Creature): LogEntry { | explain (user: Creature): LogEntry { | ||||
| return new LogLine('Deal between ', this.damage.scale(1 - this.variance).renderShort(), ' and ', this.damage.scale(1 + this.variance).renderShort(), ' damage.') | |||||
| return new LogLine('Deal between ', this.damage.scale(1 - this.variance).renderShort(), ' and ', this.damage.scale(1 + this.variance).renderShort(), '.') | |||||
| } | } | ||||
| } | } | ||||
| @@ -385,7 +385,9 @@ export class CompositionAction extends Action { | |||||
| } | } | ||||
| describe (user: Creature, target: Creature): LogEntry { | describe (user: Creature, target: Creature): LogEntry { | ||||
| return new LogLine(`No descriptions yet...`) | |||||
| return new LogLines( | |||||
| ...this.consequences.map(consequence => consequence.describePair(user, target)) | |||||
| ) | |||||
| } | } | ||||
| } | } | ||||
| @@ -635,5 +637,13 @@ export abstract class Consequence { | |||||
| return this.conditions.every(cond => cond.allowed(user, target)) | return this.conditions.every(cond => cond.allowed(user, target)) | ||||
| } | } | ||||
| describeSolo (user: Creature): LogEntry { | |||||
| return nilLog | |||||
| } | |||||
| describePair (user: Creature, target: Creature): LogEntry { | |||||
| return nilLog | |||||
| } | |||||
| abstract apply (user: Creature, target: Creature): LogEntry | abstract apply (user: Creature, target: Creature): LogEntry | ||||
| } | } | ||||
| @@ -10,6 +10,14 @@ export class ArbitraryConsequence extends Consequence { | |||||
| constructor (public apply: (user: Creature, target: Creature) => LogEntry, conditions: Condition[] = []) { | constructor (public apply: (user: Creature, target: Creature) => LogEntry, conditions: Condition[] = []) { | ||||
| super(conditions) | super(conditions) | ||||
| } | } | ||||
| describeSolo (user: Creature): LogEntry { | |||||
| return new LogLine(`It does...something`) | |||||
| } | |||||
| describePair (user: Creature): LogEntry { | |||||
| return new LogLine(`It does...something`) | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -57,6 +65,13 @@ export class HealingConsequence extends Consequence { | |||||
| target.takeDamage(damage) | target.takeDamage(damage) | ||||
| ) | ) | ||||
| } | } | ||||
| describePair (user: Creature, target: Creature): LogEntry { | |||||
| return new LogLine( | |||||
| `Heals for `, | |||||
| this.damageFormula.describe(user, target) | |||||
| ) | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1,5 +1,5 @@ | |||||
| import { TextLike, LiveText, DynText, Word, ImproperNoun, Verb } from './language' | import { TextLike, LiveText, DynText, Word, ImproperNoun, Verb } from './language' | ||||
| import { Actionable, Action, DamageFormula, ConstantDamageFormula, Damage, DamageType, Vigor, StatDamageFormula, Stat, Effective, CompositionAction, Condition } from './combat' | |||||
| import { Actionable, Action, DamageFormula, ConstantDamageFormula, Damage, DamageType, Vigor, StatDamageFormula, Stat, Effective, CompositionAction, Condition, CompositeDamageFormula } from './combat' | |||||
| import { AttackAction } from './combat/actions' | import { AttackAction } from './combat/actions' | ||||
| import { Resistances } from './entity' | import { Resistances } from './entity' | ||||
| import { DamageTypeResistanceEffect } from './combat/effects' | import { DamageTypeResistanceEffect } from './combat/effects' | ||||
| @@ -191,13 +191,20 @@ export class HealthPotion extends Consumable { | |||||
| (user, target) => new LogLine(`${user.name.capital} ${user.name.conjugate(new Verb('drink'))} a potion.`) | (user, target) => new LogLine(`${user.name.capital} ${user.name.conjugate(new Verb('drink'))} a potion.`) | ||||
| ), | ), | ||||
| new HealingConsequence( | new HealingConsequence( | ||||
| new ConstantDamageFormula( | |||||
| new Damage( | |||||
| { amount: 100, target: Vigor.Health, type: DamageType.Heal }, | |||||
| { amount: 100, target: Vigor.Stamina, type: DamageType.Heal }, | |||||
| { amount: 100, target: Vigor.Resolve, type: DamageType.Heal } | |||||
| ) | |||||
| ) | |||||
| new CompositeDamageFormula([ | |||||
| new ConstantDamageFormula( | |||||
| new Damage( | |||||
| { amount: 100, target: Vigor.Health, type: DamageType.Heal }, | |||||
| { amount: 100, target: Vigor.Stamina, type: DamageType.Heal }, | |||||
| { amount: 100, target: Vigor.Resolve, type: DamageType.Heal } | |||||
| ) | |||||
| ), | |||||
| new StatDamageFormula([ | |||||
| { fraction: 2, stat: Stat.Toughness, target: Vigor.Health, type: DamageType.Heal }, | |||||
| { fraction: 2, stat: Stat.Speed, target: Vigor.Stamina, type: DamageType.Heal }, | |||||
| { fraction: 2, stat: Stat.Willpower, target: Vigor.Resolve, type: DamageType.Heal } | |||||
| ]) | |||||
| ]) | |||||
| ) | ) | ||||
| ] | ] | ||||
| } | } | ||||