import { Event } from './Event' ; import { Player } from '../../../../shared/models/entity' ; import { AdventureLogEventType , Stat , EventMessageType } from '../../../../shared/interfaces' ; export class BlessXPParty extends Event { public static readonly WEIGHT = 0 ; public operateOn ( player ) { if ( ! player . $party ) return ; const baseXPGain = this . rng . numberInRange ( 10 + player . getStat ( Stat . LUK ) , player . level . total * 25 ) ; const intermediateXPGain = Math . min ( player . xp . maximum / 20 , baseXPGain ) ; const totalXPGain = player . gainXP ( intermediateXPGain ) ; const eventText = this . eventText ( EventMessageType . BlessXPParty , player , { xp : totalXPGain , partyName : player . $party . name } ) ; const allText = `${ eventText } [+${ totalXPGain . toLocaleString ( ) } xp]` ; player . $$game . eventManager . emitStatGainsToPlayers ( player . $party . members , { xp : totalXPGain } ) ; this . emitMessageToNames ( player . $party . members , allText , AdventureLogEventType . XP ) ; } }