Skip to content

Commit

Permalink
Refactor ArenaCharacter set stats
Browse files Browse the repository at this point in the history
  • Loading branch information
ipdae committed Feb 16, 2024
1 parent c8369b7 commit a5e7333
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
1 change: 1 addition & 0 deletions .Lib9c.Tests/Model/Skill/BuffFactoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void GetBuffs_Arena(bool setExtraValueBuffBeforeGetBuffs)
digest,
arenaSheets,
simulator.HpModifier,
new List<StatModifier>(),
setExtraValueBuffBeforeGetBuffs: setExtraValueBuffBeforeGetBuffs);
var buffs = BuffFactory.GetBuffs(
challenger.Stats,
Expand Down
20 changes: 2 additions & 18 deletions Lib9c/Arena/ArenaSimulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,33 +121,17 @@ private static SimplePriorityQueue<ArenaCharacter, decimal> SpawnPlayers(
challengerDigest,
simulatorSheets,
simulator.HpModifier,
challengerCollectionModifiers,
setExtraValueBuffBeforeGetBuffs: setExtraValueBuffBeforeGetBuffs);
if (challengerDigest.Runes != null)
{
challenger.SetRune(
challengerDigest.Runes,
simulatorSheets.RuneOptionSheet,
simulatorSheets.SkillSheet);
}

challenger.Stats.SetCollections(challengerCollectionModifiers);

var enemy = new ArenaCharacter(
simulator,
enemyDigest,
simulatorSheets,
simulator.HpModifier,
enemyCollectionModifiers,
isEnemy: true,
setExtraValueBuffBeforeGetBuffs: setExtraValueBuffBeforeGetBuffs);
if (enemyDigest.Runes != null)
{
enemy.SetRune(
enemyDigest.Runes,
simulatorSheets.RuneOptionSheet,
simulatorSheets.SkillSheet);
}

enemy.Stats.SetCollections(enemyCollectionModifiers);

challenger.Spawn(enemy);
enemy.Spawn(challenger);
Expand Down
10 changes: 10 additions & 0 deletions Lib9c/Model/Character/ArenaCharacter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ public ArenaCharacter(
ArenaPlayerDigest digest,
ArenaSimulatorSheets sheets,
long hpModifier,
List<StatModifier> collectionModifiers,
bool isEnemy = false,
bool setExtraValueBuffBeforeGetBuffs = false)
{
Expand Down Expand Up @@ -186,6 +187,15 @@ public ArenaCharacter(
_skills = GetSkills(digest.Equipments, sheets.SkillSheet);
_attackCountMax = AttackCountHelper.GetCountMax(digest.Level);
ResetCurrentHP();
if (digest.Runes != null)
{
SetRune(
digest.Runes,
sheets.RuneOptionSheet,
sheets.SkillSheet);
}

Stats.SetCollections(collectionModifiers);
}

private ArenaCharacter(ArenaCharacter value)
Expand Down

0 comments on commit a5e7333

Please sign in to comment.