|  |  | @@ -1,7 +1,7 @@ | 
		
	
		
			
			|  |  |  | import { StatusEffect, Damage, DamageType } from '../combat' | 
		
	
		
			
			|  |  |  | import { StatusEffect, Damage, DamageType, Action } from '../combat' | 
		
	
		
			
			|  |  |  | import { DynText, LiveText, ToBe, Verb } from '../language' | 
		
	
		
			
			|  |  |  | import { Creature } from '../entity' | 
		
	
		
			
			|  |  |  | import { LogLine, LogEntry, LogLines, FAElem } from '../interface' | 
		
	
		
			
			|  |  |  | import { LogLine, LogEntry, LogLines, FAElem, nilLog } from '../interface' | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | export class InstantKillEffect extends StatusEffect { | 
		
	
		
			
			|  |  |  | constructor () { | 
		
	
	
		
			
				|  |  | @@ -74,3 +74,24 @@ export class ShieldEffect extends StatusEffect { | 
		
	
		
			
			|  |  |  | return damage.scale(this.amount) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | export class PredatorCounterEffect extends StatusEffect { | 
		
	
		
			
			|  |  |  | constructor (private devour: Action, private chance: number) { | 
		
	
		
			
			|  |  |  | super('Predatory Counter', 'Eat them back', 'fas fa-redo') | 
		
	
		
			
			|  |  |  | this.desc = new DynText(new LiveText(this, x => (x.chance * 100).toFixed(0)), '% chance to devour your attackers') | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | preAttack (creature: Creature, attacker: Creature) { | 
		
	
		
			
			|  |  |  | if (this.devour.allowed(creature, attacker) && Math.random() < this.chance) { | 
		
	
		
			
			|  |  |  | return { | 
		
	
		
			
			|  |  |  | prevented: true, | 
		
	
		
			
			|  |  |  | log: new LogLines( | 
		
	
		
			
			|  |  |  | `${creature.name.capital} ${creature.name.conjugate(new Verb('surprise'))} ${attacker.name.objective} and ${creature.name.conjugate(new Verb('try', 'tries'))} to devour ${attacker.pronouns.objective}!`, | 
		
	
		
			
			|  |  |  | this.devour.execute(creature, attacker) | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } else { | 
		
	
		
			
			|  |  |  | return { prevented: false, log: nilLog } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } |