diff --git a/src/arena/actions/__snapshots__/protect.test.ts.snap b/src/arena/actions/__snapshots__/protect.test.ts.snap index c51409e..0e471fc 100644 --- a/src/arena/actions/__snapshots__/protect.test.ts.snap +++ b/src/arena/actions/__snapshots__/protect.test.ts.snap @@ -2,7 +2,7 @@ exports[`protect should not get exp if protect enemy 1`] = ` "*corporis* пытался атаковать *quisquam*, но у него не получилось -_Защита_ *quisquam*: 📖43,*corporis*: 📖0" +_Защита_ *quisquam*: 📖33,*corporis*: 📖0" `; exports[`protect should protect player 1`] = ` diff --git a/src/arena/actions/protect.test.ts b/src/arena/actions/protect.test.ts index f82cc95..3708c2e 100644 --- a/src/arena/actions/protect.test.ts +++ b/src/arena/actions/protect.test.ts @@ -34,8 +34,7 @@ describe('protect', () => { it('should protect player', () => { game.players.players[0].proc = 1; - game.players.players[0].stats.set('pdef', 100); - game.players.players[1].proc = 0.1; + game.players.players[1].proc = 1; protect.cast(game.players.players[0], game.players.players[0], game); attack.cast(game.players.players[1], game.players.players[0], game); @@ -45,8 +44,7 @@ describe('protect', () => { it('should not get exp if protect enemy', () => { game.players.players[0].proc = 1; - game.players.players[0].stats.set('pdef', 10); - game.players.players[1].proc = 0.1; + game.players.players[1].proc = 1; protect.cast(game.players.players[0], game.players.players[0], game); protect.cast(game.players.players[1], game.players.players[0], game); diff --git a/src/arena/actions/protect.ts b/src/arena/actions/protect.ts index f03174e..fca3272 100644 --- a/src/arena/actions/protect.ts +++ b/src/arena/actions/protect.ts @@ -49,10 +49,9 @@ class Protect extends AffectableAction implements PreAffect { const attackValue = initiator.stats.val('patk') * initiator.proc; const protectValue = target.flags.isProtected.length > 0 ? target.stats.val('pdef') : 0.1; const ratio = floatNumber(Math.round(attackValue / protectValue)); - console.log('at', ratio); const randomValue = MiscService.rndm('1d100'); - const chance = 20 * ratio + 50; + const chance = Math.round(Math.sqrt(ratio) + (10 * ratio) + 5); const result = chance > randomValue; console.log('chance', chance, 'random', randomValue, 'result', result); @@ -82,7 +81,7 @@ class Protect extends AffectableAction implements PreAffect { } const protect = Math.floor(flag.val * 100) / pdef; - const exp = Math.round(expMultiplier * 0.8 * protect); + const exp = Math.round(expMultiplier * 0.08 * protect); defender.stats.up('exp', exp); return {