res.send(Alert.ErrorAlert(`You are currently in a fight with a ${fight.name}`));
}
+function exponentialExp(exp: number, monsterLevel: number, playerLevel: number): number {
+ let finalExp = exp;
+
+ if((monsterLevel+3) < playerLevel) {
+ finalExp = Math.floor(exp * Math.pow(Math.E, ((monsterLevel + 3) - playerLevel)/5));
+ }
+ else if(monsterLevel > (playerLevel + 3)) {
+ finalExp = Math.floor(exp * Math.pow(Math.E, ((playerLevel + 3) - monsterLevel)/5));
+ }
+
+ return Math.floor(finalExp);
+}
+
export async function fightRound(player: Player, monster: MonsterWithFaction, data: {action: 'attack' | 'cast' | 'flee', target: 'head' | 'body' | 'arms' | 'legs'}) {
const playerSkills = await getPlayerSkillsAsObject(player.id);
const roundData: FightRound = {
roundData.monster.hp = 0;
roundData.winner = 'player';
- roundData.rewards.exp = monster.exp;
+ const expGained = exponentialExp(monster.exp, monster.level, player.level);
+
+ roundData.rewards.exp = expGained;
roundData.rewards.gold = monster.gold;
player.gold += monster.gold;
- player.exp += monster.exp;
+ player.exp += expGained;
if(player.exp >= expToLevel(player.level + 1)) {
player.exp -= expToLevel(player.level + 1)