Skip to content

Commit

Permalink
Merge pull request #2428 from planetarium/release/1.9.1
Browse files Browse the repository at this point in the history
Release/1.9.1
  • Loading branch information
ipdae authored Feb 28, 2024
2 parents 96c88ed + 7941519 commit ff2c8ae
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .Lib9c.Tests/Model/ArenaSimulatorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Lib9c.Tests
using Lib9c.Tests.Action;
using Libplanet.Action;
using Libplanet.Crypto;
using Nekoyume;
using Nekoyume.Action;
using Nekoyume.Arena;
using Nekoyume.Model;
Expand All @@ -14,6 +15,7 @@ namespace Lib9c.Tests
using Nekoyume.Model.Skill;
using Nekoyume.Model.Stat;
using Nekoyume.Model.State;
using Nekoyume.TableData;
using Xunit;
using Xunit.Abstractions;

Expand Down Expand Up @@ -70,12 +72,17 @@ public void Simulate()
new List<StatModifier>
{
new (StatType.ATK, StatModifier.OperationType.Add, 1),
new (StatType.HP, StatModifier.OperationType.Add, 100),
},
new List<StatModifier>
{
new (StatType.DEF, StatModifier.OperationType.Add, 1),
new (StatType.HP, StatModifier.OperationType.Add, 100),
}
);
CharacterSheet.Row row =
_tableSheets.CharacterSheet[GameConfig.DefaultAvatarCharacterId];
var expectedHp = (new CharacterStats(row, myDigest.Level).HP + 100) * simulator.HpModifier;

Assert.Equal(_random, simulator.Random);

Expand All @@ -88,6 +95,8 @@ public void Simulate()
{
if (player.Character is ArenaCharacter arenaCharacter)
{
Assert.Equal(expectedHp, arenaCharacter.HP);
Assert.Equal(expectedHp, arenaCharacter.CurrentHP);
arenaCharacters.Add(arenaCharacter);
}
}
Expand Down
5 changes: 4 additions & 1 deletion .Lib9c.Tests/Model/PlayerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -873,25 +873,28 @@ public void IncreaseHpForArena()
// RuneStats 520
// Assert.Equal(879, player.HP);
var runeLayerHp = player.HP;
Assert.Equal(player.CurrentHP, runeLayerHp);

// Update costume stats
player.SetCostumeStat(_tableSheets.CostumeStatSheet);
Assert.Equal(runeLayerHp + costumeStatRow.Stat, player.HP);
// CostumeStats 26990
// Assert.Equal(27869, player.HP);
var costumeLayerHp = player.HP;
Assert.Equal(player.CurrentHP, costumeLayerHp);

// Update collection stat
var modifiers = new List<StatModifier>();
var addModifier = new StatModifier(StatType.HP, StatModifier.OperationType.Add, 100);
modifiers.Add(new StatModifier(StatType.HP, StatModifier.OperationType.Percentage, 200));
modifiers.Add(addModifier);
modifiers.Add(new StatModifier(StatType.HP, StatModifier.OperationType.Percentage, -100));
player.Stats.SetCollections(modifiers);
player.SetCollections(modifiers);
Assert.Equal(costumeLayerHp + addModifier.Value + costumeLayerHp, player.HP);
// CollectionStats 100 + 27869(100%)
// Assert.Equal(55838, player.HP);
var collectionLayerHp = player.HP;
Assert.Equal(player.CurrentHP, collectionLayerHp);

// Arena
player.Stats.IsArenaCharacter = true;
Expand Down
2 changes: 1 addition & 1 deletion Lib9c/Model/Character/ArenaCharacter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ public ArenaCharacter(
hpModifier);
_skills = GetSkills(digest.Equipments, sheets.SkillSheet);
_attackCountMax = AttackCountHelper.GetCountMax(digest.Level);
ResetCurrentHP();
if (digest.Runes != null)
{
SetRune(
Expand All @@ -196,6 +195,7 @@ public ArenaCharacter(
}

Stats.SetCollections(collectionModifiers);
ResetCurrentHP();
}

private ArenaCharacter(ArenaCharacter value)
Expand Down
8 changes: 7 additions & 1 deletion Lib9c/Model/Character/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,12 @@ public void SetRune(
}
}

public void SetCollections(IEnumerable<StatModifier> statModifiers)
{
Stats.SetCollections(statModifiers);
ResetCurrentHP();
}

public void ConfigureStats(CostumeStatSheet costumeStatSheet, List<RuneState> runeStates, RuneOptionSheet runeOptionSheet, SkillSheet skillSheet, List<StatModifier> collectionModifiers)
{
SetCostumeStat(costumeStatSheet);
Expand All @@ -612,7 +618,7 @@ public void ConfigureStats(CostumeStatSheet costumeStatSheet, List<RuneState> ru
SetRune(runeStates, runeOptionSheet, skillSheet);
}

Stats.SetCollections(collectionModifiers);
SetCollections(collectionModifiers);
}

[Obsolete("Use SetRune")]
Expand Down

0 comments on commit ff2c8ae

Please sign in to comment.