|  |  | @@ -1,7 +1,7 @@ | 
		
	
		
			
			|  |  |  | import { Condition, Vigor } from "../combat" | 
		
	
		
			
			|  |  |  | import { Condition, Stat, Vigor, VoreStat } from "../combat" | 
		
	
		
			
			|  |  |  | import { Creature } from "../creature" | 
		
	
		
			
			|  |  |  | import { Container } from '../vore' | 
		
	
		
			
			|  |  |  | import { LogEntry, LogLine, PropElem } from '../interface' | 
		
	
		
			
			|  |  |  | import { FAElem, LogEntry, LogLine, PropElem } from '../interface' | 
		
	
		
			
			|  |  |  | import { ToBe, Verb } from '../language' | 
		
	
		
			
			|  |  |  | import * as Words from '../words' | 
		
	
		
			
			|  |  |  | 
 | 
		
	
	
		
			
				|  |  | @@ -275,3 +275,33 @@ export class MassRatioCondition implements Condition { | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | export class StatCondition implements Condition { | 
		
	
		
			
			|  |  |  | constructor (private stat: Stat | VoreStat, private amount: number) { | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | allowed (user: Creature, target: Creature): boolean { | 
		
	
		
			
			|  |  |  | if (this.stat in Stat) { | 
		
	
		
			
			|  |  |  | return user.stats[this.stat as Stat] >= this.amount | 
		
	
		
			
			|  |  |  | } else if (this.stat in VoreStat) { | 
		
	
		
			
			|  |  |  | return user.voreStats[this.stat as VoreStat] >= this.amount | 
		
	
		
			
			|  |  |  | } else { | 
		
	
		
			
			|  |  |  | return false | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | explain (user: Creature, target: Creature): LogEntry { | 
		
	
		
			
			|  |  |  | if (this.allowed(user, target)) { | 
		
	
		
			
			|  |  |  | return new LogLine( | 
		
	
		
			
			|  |  |  | `${user.name.capital} ${user.name.conjugate(Words.Have)} at least ${this.amount} `, | 
		
	
		
			
			|  |  |  | new PropElem(this.stat) | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | } else { | 
		
	
		
			
			|  |  |  | return new LogLine( | 
		
	
		
			
			|  |  |  | `${user.name.capital} must ${user.name.conjugate(Words.Have)} at least ${this.amount} `, | 
		
	
		
			
			|  |  |  | new PropElem(this.stat) | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } |