-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3022 from planetarium/improve/issue-3020
Set Damage Reduction limit
- Loading branch information
Showing
9 changed files
with
139 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Lib9c.Tests.Action | ||
{ | ||
using Xunit; | ||
|
||
public class DamageHelperTest | ||
{ | ||
[Theory] | ||
[InlineData(long.MaxValue, 0.19)] | ||
[InlineData(4000L, 0.6)] | ||
[InlineData(long.MinValue, 0)] | ||
public void GetDamageReductionRate(long drr, decimal expected) | ||
{ | ||
Assert.Equal(expected, Nekoyume.Battle.DamageHelper.GetDamageReductionRate(drr)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace Nekoyume.Battle | ||
{ | ||
public static class DamageHelper | ||
{ | ||
/// <summary> | ||
/// calculate damage reduction rate. | ||
/// </summary> | ||
/// <param name="drr">enemy <see cref="Model.Stat.StatType.DRR"/> stats</param> | ||
/// <returns>damage reduction rate.</returns> | ||
public static decimal GetDamageReductionRate(long drr) | ||
{ | ||
switch (drr) | ||
{ | ||
case > 8100L: | ||
drr = 8100L; | ||
break; | ||
case < 0L: | ||
return 0m; | ||
} | ||
|
||
return 1 - drr / 10000m; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
group_id,percentage | ||
206000,-20 | ||
709000,-50 | ||
206003,-20 | ||
206009,-50 | ||
group_id,modify_type1,percentage | ||
206000,Percentage,-20 | ||
709000,Percentage,-50 | ||
206003,Percentage,-20 | ||
206009,Percentage,-50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters