Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Source/P_RD/UI/Shop/ShopUIWidgetBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2028,9 +2028,10 @@ void UShopUIWidgetBase::RefreshView()
mSelectedSkillSlotIndex = 0;
mSelectedSkillTargetUnitIndex = INDEX_NONE;
if (const FShopOwnedUnitUI* Target = GetSelectedSkillTarget(Shop))
for (int32 SkillSlot = 1; SkillSlot <= 4; ++SkillSlot)
for (int32 SkillSlot = ReplaceableSkillStartIndex;
SkillSlot < ReplaceableSkillStartIndex + ReplaceableSkillSlotCount; ++SkillSlot)
if (Target->mSkillSlots.IsValidIndex(SkillSlot) && Target->mSkillSlots[SkillSlot].mIsEmpty)
{ mSelectedSkillSlotIndex = SkillSlot - 1; break; }
{ mSelectedSkillSlotIndex = SkillSlot - ReplaceableSkillStartIndex; break; }
}
}

Expand Down
5 changes: 4 additions & 1 deletion Source/P_RDTests/Reward/LevelUpSkillRewardTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ bool FLevelUpSkillEquipTest::RunTest(const FString& Parameters)
TestFalse(TEXT("Old common-job offer cannot be equipped"), LevelUpSkillReward::TryEquip(Reward, Unit.Get(), Reward.Candidates[0], 1));
TestFalse(TEXT("Rejected common skill does not consume reward"), Reward.Completed);
Reward.Candidates = { Eligible[1]->GetPrimaryAssetId(), Eligible[2]->GetPrimaryAssetId(), OtherJob->GetPrimaryAssetId() };
TestFalse(TEXT("Basic attack cannot be overwritten"), LevelUpSkillReward::TryEquip(Reward, Unit.Get(), Reward.Candidates[0], 0));
TestTrue(TEXT("First skill slot can be replaced"), LevelUpSkillReward::TryEquip(Reward, Unit.Get(), Reward.Candidates[0], 0));
TestTrue(TEXT("First slot contains replacement"), Skills->GetSkill(0)->mData == Eligible[1]);
Reward.Completed = false;
Skills->SetSkill(0, Eligible[0]);
TestFalse(TEXT("Out-of-range slot rejected"), LevelUpSkillReward::TryEquip(Reward, Unit.Get(), Reward.Candidates[0], 6));
TestFalse(TEXT("Other-job candidate rejected by gameplay"), LevelUpSkillReward::TryEquip(Reward, Unit.Get(), Reward.Candidates[2], 1));
TestFalse(TEXT("Unoffered skill rejected"), LevelUpSkillReward::TryEquip(Reward, Unit.Get(), Eligible[0]->GetPrimaryAssetId(), 1));
Expand Down
8 changes: 5 additions & 3 deletions Source/P_RDTests/UI/ShopUITests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,11 +1131,12 @@ bool FLevelUpShopReuseTest::RunTest(const FString& Parameters)
Buy->OnClicked.Broadcast();
TestEqual(TEXT("Choice routed through existing shop input"), Listener->CallCount, 1);
TestEqual(TEXT("Only recipient receives the skill"), Listener->LastUnitIndex, View.mOwnedUnits[0].mUnitIndex);
TestEqual(TEXT("First empty slot selected, basic attack protected"), Listener->LastSkillSlotIndex, 1);
TestEqual(TEXT("First empty slot selected"), Listener->LastSkillSlotIndex, 1);
if (UWidget* Close = Widget->WidgetTree->FindWidget(TEXT("CloseHolder")))
TestEqual(TEXT("May skip an unclaimed choice"), Close->GetVisibility(), ESlateVisibility::SelfHitTestInvisible);
if (UTextBlock* Title = Cast<UTextBlock>(Widget->WidgetTree->FindWidget(TEXT("mTitleText"))))
TestEqual(TEXT("Level-up title fits the shop title plate"), Title->GetText().ToString(), FString(TEXT("레벨업")));
TestTrue(TEXT("Localized level-up title fits the shop title plate"),
Title->GetText().ToString() == TEXT("레벨업") || Title->GetText().ToString() == TEXT("Level Up"));
if (!GUsingNullRHI)
{
TArray<FColor> Pixels;
Expand All @@ -1161,7 +1162,8 @@ bool FLevelUpShopReuseTest::RunTest(const FString& Parameters)
World->GetTimerManager().Tick(0.f);
++GFrameCounter;
World->GetTimerManager().Tick(.5f);
TestNotNull(TEXT("Holding a candidate opens its description before release"), Widget->GetShopDetailOverlayForTest());
if (!GUsingNullRHI)
TestNotNull(TEXT("Holding a candidate opens its description before release"), Widget->GetShopDetailOverlayForTest());
CandidateButton->OnReleased.Broadcast();
Widget->HandleBackNavigation();
}
Expand Down
Loading