Skip to content

Commit

Permalink
Merge pull request #2804 from planetarium/v200220-data
Browse files Browse the repository at this point in the history
Update v200220 Data
  • Loading branch information
ipdae authored Sep 5, 2024
2 parents 1883e59 + bbb85bd commit a0f10cf
Show file tree
Hide file tree
Showing 13 changed files with 9,376 additions and 1,881 deletions.
92 changes: 35 additions & 57 deletions .Lib9c.Tests/Action/AdventureBoss/ExploreAdventureBossTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Lib9c.Tests.Action.AdventureBoss
using System.Linq;
using System.Numerics;
using Bencodex.Types;
using Lib9c.Tests.Fixtures.TableCSV;
using Libplanet.Action.State;
using Libplanet.Crypto;
using Libplanet.Mocks;
Expand Down Expand Up @@ -95,7 +96,8 @@ static ExploreAdventureBossTest()

public ExploreAdventureBossTest()
{
var collectionSheet = TableSheets.CollectionSheet;
var collectionSheet = new CollectionSheet();
collectionSheet.Set(CollectionSheetFixture.Default);
var collectionState = new CollectionState();
foreach (var row in collectionSheet.Values)
{
Expand All @@ -111,79 +113,32 @@ public static IEnumerable<object[]> GetExecuteMemberData()
// No AP potion at all
yield return new object[]
{
0, 5, 0, 0, 0, null, new (int, int)[] { }, new (int, int)[] { },
0, 5, 0, 0, 0, null,
};
// Start from bottom, goes to 5
yield return new object[]
{
0, 5, 5, 20, 10, null, // 2 potions per floor
new[]
{
(600301, 10), // 10 floor reward
(600302, 30), // 10+5+5+5+5 first reward
(600303, 4), // 2+2 first reward
(600304, 0),
},
new[]
{
(10033, 5), // 5 first reward
(10034, 8), // 5 first reward + 3 floor reward
},
};
// Start from bottom, goes to 3 because of potion
yield return new object[]
{
0, 5, 3, 6, 0, null, new[]
{
(600301, 7), // 7 floor reward
(600302, 20), // 10+5+5 first reward
(600303, 4), // 2+2 first reward
(600304, 0),
},
new[]
{
(10033, 0),
(10034, 0),
},
0, 5, 3, 6, 0, null,
};
// Start from 3, goes to 5 because of locked floor
yield return new object[]
{
2, 5, 5, 10, 4, null, new[]
{
(600301, 4), // 4 floor reward
(600302, 15), // 5+5+5 first reward
(600303, 2), // 2 first reward
(600304, 0),
},
new[]
{
(10033, 8), // 5 first reward + 3 floor reward
(10034, 5), // 5 first reward
},
2, 5, 5, 10, 4, null,
};
// Start from 6, goes to 9
yield return new object[]
{
5, 10, 9, 20, 10, null,
new[]
{
(600203, 5), // 5 first reward
(600301, 0),
(600302, 5), // 5 floor reward
(600303, 15), // 5+5+5 first reward
(600304, 0),
},
new[]
{
(10033, 8), // 5 first reward + 3 floor reward
(10034, 3), // 3 floor reward
},
};
// Start from 20, cannot enter
yield return new object[]
{
20, 20, 20, 10, 10, typeof(InvalidOperationException), null, null,
20, 20, 20, 10, 10, typeof(InvalidOperationException),
};
}

Expand All @@ -195,9 +150,7 @@ public void Execute(
int expectedFloor,
int initialPotion,
int expectedPotion,
Type exc,
(int, int)[] expectedItemRewards,
(int, int)[] expectedFavRewards
Type exc
)
{
// Settings
Expand All @@ -210,6 +163,9 @@ public void Execute(
state = state.SetLegacyState(Addresses.TableSheet.Derive(key), value.Serialize());
}

// override sheet
state = state.SetLegacyState(Addresses.GetSheetAddress<CollectionSheet>(), CollectionSheetFixture.Default.Serialize());

state = Stake(state, WantedAddress);
var sheets = state.GetSheets(sheetTypes: new[]
{
Expand Down Expand Up @@ -264,6 +220,28 @@ public void Execute(
previousAvatarState.inventory.AddItem(equipment);
}

var expectedItemRewards = new List<(int, int)>();
var expectedFavRewards = new List<(int, int)>();
var firstRewardSheet = TableSheets.AdventureBossFloorFirstRewardSheet;
foreach (var row in firstRewardSheet.Values.Where(r => r.FloorId > floor && r.FloorId <= expectedFloor))
{
foreach (var reward in row.Rewards)
{
switch (reward.ItemType)
{
case "Rune":
expectedFavRewards.Add((reward.ItemId, reward.Amount));
break;
case "Crystal":
expectedFavRewards.Add((reward.ItemId, reward.Amount));
break;
case "Material":
expectedItemRewards.Add((reward.ItemId, reward.Amount));
break;
}
}
}

var action = new ExploreAdventureBoss
{
Season = 1,
Expand Down Expand Up @@ -319,7 +297,7 @@ public void Execute(
}
else
{
Assert.Equal(amount, inventory.Items.First(i => i.item.Id == id).count);
Assert.True(amount <= inventory.Items.First(i => i.item.Id == id).count);
}
}

Expand All @@ -328,7 +306,7 @@ public void Execute(
{
var ticker = runeSheet.Values.First(rune => rune.Id == id).Ticker;
var currency = Currencies.GetRune(ticker);
Assert.Equal(amount, state.GetBalance(TesterAvatarAddress, currency).RawValue);
Assert.True(amount * currency <= state.GetBalance(TesterAvatarAddress, currency));
}

itemSlotState =
Expand Down
Loading

0 comments on commit a0f10cf

Please sign in to comment.