Skip to content

Commit

Permalink
Merge branch 'release/1.10.0' into bugfix/world-8-skills
Browse files Browse the repository at this point in the history
  • Loading branch information
U-lis committed Mar 19, 2024
2 parents 08917d6 + ed26c1b commit b3ef852
Show file tree
Hide file tree
Showing 42 changed files with 243 additions and 1,077 deletions.
3 changes: 2 additions & 1 deletion .Lib9c.Tests/Action/Scenario/AuraScenarioTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ public void Arena()
enemyArenaPlayerDigest,
_tableSheets.GetArenaSimulatorSheets(),
new List<StatModifier>(),
new List<StatModifier>());
new List<StatModifier>(),
_tableSheets.DeBuffLimitSheet);
// Check player, enemy equip aura
foreach (var spawn in log.OfType<ArenaSpawnCharacter>())
{
Expand Down
13 changes: 7 additions & 6 deletions .Lib9c.Tests/Model/ArenaSimulatorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public void Simulate()
{
new (StatType.DEF, StatModifier.OperationType.Add, 1),
new (StatType.HP, StatModifier.OperationType.Add, 100),
}
},
_tableSheets.DeBuffLimitSheet
);
CharacterSheet.Row row =
_tableSheets.CharacterSheet[GameConfig.DefaultAvatarCharacterId];
Expand Down Expand Up @@ -133,7 +134,7 @@ public void HpIncreasingModifier(int? modifier)
var myDigest = new ArenaPlayerDigest(_avatarState1, _arenaAvatarState1);
var enemyDigest = new ArenaPlayerDigest(_avatarState2, _arenaAvatarState2);
var arenaSheets = _tableSheets.GetArenaSimulatorSheets();
var log = simulator.Simulate(myDigest, enemyDigest, arenaSheets, new List<StatModifier>(), new List<StatModifier>());
var log = simulator.Simulate(myDigest, enemyDigest, arenaSheets, new List<StatModifier>(), new List<StatModifier>(), _tableSheets.DeBuffLimitSheet);
var expectedHpModifier = modifier ?? 2;

Assert.Equal(_random, simulator.Random);
Expand Down Expand Up @@ -178,7 +179,7 @@ public void TestSpeedModifierBySkill()
var myDigest = new ArenaPlayerDigest(_avatarState1, arenaAvatarState1);
var enemyDigest = new ArenaPlayerDigest(_avatarState2, arenaAvatarState2);
var arenaSheets = _tableSheets.GetArenaSimulatorSheets();
var unskilledLog = simulator.Simulate(myDigest, enemyDigest, arenaSheets, new List<StatModifier>(), new List<StatModifier>());
var unskilledLog = simulator.Simulate(myDigest, enemyDigest, arenaSheets, new List<StatModifier>(), new List<StatModifier>(), _tableSheets.DeBuffLimitSheet);
// foreach (var log in unskilledLog)
// {
// _testOutputHelper.WriteLine($"{log.Character.Id} :: {log}");
Expand Down Expand Up @@ -231,7 +232,7 @@ public void TestSpeedModifierBySkill()
myDigest = new ArenaPlayerDigest(_avatarState1, arenaAvatarState1);
enemyDigest = new ArenaPlayerDigest(_avatarState2, arenaAvatarState2);
arenaSheets = _tableSheets.GetArenaSimulatorSheets();
var skilledLog = simulator.Simulate(myDigest, enemyDigest, arenaSheets, new List<StatModifier>(), new List<StatModifier>());
var skilledLog = simulator.Simulate(myDigest, enemyDigest, arenaSheets, new List<StatModifier>(), new List<StatModifier>(), _tableSheets.DeBuffLimitSheet);
// foreach (var log in skilledLog)
// {
// _testOutputHelper.WriteLine($"{log.Character.Id} :: {log}");
Expand Down Expand Up @@ -273,7 +274,7 @@ public void Thorns()
var myDigest = new ArenaPlayerDigest(avatarState1, arenaAvatarState1);
var enemyDigest = new ArenaPlayerDigest(avatarState2, arenaAvatarState2);
var arenaSheets = _tableSheets.GetArenaSimulatorSheets();
var log = simulator.Simulate(myDigest, enemyDigest, arenaSheets, new List<StatModifier>(), new List<StatModifier>(), true);
var log = simulator.Simulate(myDigest, enemyDigest, arenaSheets, new List<StatModifier>(), new List<StatModifier>(), _tableSheets.DeBuffLimitSheet, true);
var ticks = log.Events
.OfType<ArenaTickDamage>()
.ToList();
Expand Down Expand Up @@ -335,7 +336,7 @@ public void Bleed()
var enemyDigest = new ArenaPlayerDigest(avatarState2, arenaAvatarState2);
enemyDigest.Runes.Add(rune);
var arenaSheets = _tableSheets.GetArenaSimulatorSheets();
var log = simulator.Simulate(myDigest, enemyDigest, arenaSheets, modifiers, modifiers, true);
var log = simulator.Simulate(myDigest, enemyDigest, arenaSheets, modifiers, modifiers, _tableSheets.DeBuffLimitSheet, true);
var spawns = log.Events.OfType<ArenaSpawnCharacter>().ToList();
Assert.All(spawns, spawn => Assert.Equal(totalAtk, spawn.Character.ATK));
var ticks = log.Events
Expand Down
138 changes: 0 additions & 138 deletions .Lib9c.Tests/Model/ArenaSimulatorV1Test.cs

This file was deleted.

3 changes: 2 additions & 1 deletion .Lib9c.Tests/Model/BattleLogTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public void IsClearBeforeSimulate()
_random,
_tableSheets.StageSheet[1],
_tableSheets.MaterialItemSheet),
new List<StatModifier>()
new List<StatModifier>(),
_tableSheets.DeBuffLimitSheet
);
Assert.False(simulator.Log.IsClear);
}
Expand Down
42 changes: 42 additions & 0 deletions .Lib9c.Tests/Model/CharacterStatsTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace Lib9c.Tests.Model
{
using Nekoyume;
using Nekoyume.Model.Buff;
using Nekoyume.Model.Stat;
using Nekoyume.TableData;
using Xunit;

public class CharacterStatsTest
{
private readonly TableSheets _tableSheets;

public CharacterStatsTest()
{
_tableSheets = new TableSheets(TableSheetsImporter.ImportSheets());
}

[Fact]
public void DeBuffLimit()
{
var stats =
new CharacterStats(
_tableSheets.CharacterSheet[GameConfig.DefaultAvatarCharacterId],
1);
var deBuffLimitSheet = new DeBuffLimitSheet();
// -100% def but limit -50% stats
var deBuff = new StatBuff(_tableSheets.StatBuffSheet[503012]);
var groupId = deBuff.RowData.GroupId;
deBuffLimitSheet.Set($"group_id,percentage\n{groupId},-50");
var def = stats.DEF;
stats.AddBuff(deBuff, deBuffLimitSheet: deBuffLimitSheet);
var modifier = deBuffLimitSheet[groupId].GetModifier(deBuff.RowData.StatType);
Assert.Equal(modifier.GetModifiedAll(def), stats.DEF);

// -500% critical with no limit
var deBuff2 = new StatBuff(_tableSheets.StatBuffSheet[204003]);
Assert.True(stats.CRI > 0);
stats.AddBuff(deBuff2, deBuffLimitSheet: deBuffLimitSheet);
Assert.Equal(0, stats.CRI);
}
}
}
Loading

0 comments on commit b3ef852

Please sign in to comment.