Fix bug where the player would craft up to N^2 requested consumable items instead of the amount requested. Made Sound Effect for crafting a consumable play only once, instead of layer per quantity of item crafted. Added crafting sound effect to equipment that is crafted. Fix enhancement [+] display not updating on blacksmith enhancing window (visual bug), only show "MAX" on stats when the gear is at +10. Clear any scattered/remaining item drops after completing a stage. Fix menus crashing when enhanced gear reach +10 (array overflow). Added a Stay here button for Sherman.
This commit is contained in:
parent
0aea7beb83
commit
fc7e135aa4
@ -1767,6 +1767,7 @@ void AiL::LoadLevel(MapName map){
|
||||
upperForegroundTileGroups.clear();
|
||||
MONSTER_LIST.clear();
|
||||
ZONE_LIST.clear();
|
||||
ItemDrop::drops.clear();
|
||||
GameEvent::events.clear();
|
||||
worldColor=WHITE;
|
||||
worldColorFunc=[&](vi2d pos){return game->worldColor;};
|
||||
|
||||
@ -90,11 +90,10 @@ void Menu::InitializeConsumableCraftItemWindow(){
|
||||
const std::weak_ptr<Item>item=Component<RequiredMaterialsList>(CONSUMABLE_CRAFT_ITEM,"Required Materials List")->GetItem();
|
||||
uint8_t qty=stoi(Component<MenuLabel>(CONSUMABLE_CRAFT_ITEM,"Amount to Craft Amount Label")->GetLabel());
|
||||
|
||||
for(uint8_t i=0;i<qty;i++){
|
||||
if(item.lock()->CanEnhanceItem(qty)){
|
||||
item.lock()->EnhanceItem(qty);
|
||||
}
|
||||
if(item.lock()->CanEnhanceItem(qty)){
|
||||
item.lock()->EnhanceItem(qty);
|
||||
}
|
||||
|
||||
data.component.lock()->SetGrayedOut(!item.lock()->CanEnhanceItem(qty));
|
||||
return true;
|
||||
})END;
|
||||
|
||||
@ -39,6 +39,7 @@ All rights reserved.
|
||||
#include "Menu.h"
|
||||
#include "EnhancementStatsLabel.h"
|
||||
#include "RequiredMaterialsList.h"
|
||||
#include "SoundEffect.h"
|
||||
|
||||
void Menu::InitializeCraftItemWindow(){
|
||||
Menu*craftItemWindow=CreateMenu(CRAFT_ITEM,CENTERED,{240,120});
|
||||
@ -63,6 +64,7 @@ void Menu::InitializeCraftItemWindow(){
|
||||
Component<EnhancementStatsLabel>(CRAFT_ITEM,"Enhancement Stats Label")->SetItem(item);
|
||||
Component<RequiredMaterialsList>(CRAFT_ITEM,"Required Materials List")->SetItem(item); //Update the item refs in the enhancement level screen to now display the correct item.
|
||||
Inventory::UpdateBlacksmithInventoryLists();
|
||||
SoundEffect::PlaySFX("Craft Equip",SoundEffect::CENTERED);
|
||||
}else{ //Since we already own this equipment, just enhance it.
|
||||
item.lock()->EnhanceItem();
|
||||
}
|
||||
@ -71,6 +73,7 @@ void Menu::InitializeCraftItemWindow(){
|
||||
if(item.lock()->EnhancementIsPossible()&&item.lock()->GetEnhancementInfo().size()>item.lock()->EnhancementLevel()+1){
|
||||
label=std::format("Level {} ->#00AA00 {}",item.lock()->EnhancementLevel(),item.lock()->EnhancementLevel()+1);
|
||||
}
|
||||
Component<MenuLabel>(CRAFT_ITEM,"Item Name Header")->SetLabel(std::format("Enhancing {}",item.lock()->DisplayName()));
|
||||
Component<MenuLabel>(data.menu.GetType(),"Enhancement Level Header")->SetLabel(label);
|
||||
data.component.lock()->SetGrayedOut(!item.lock()->CanEnhanceItem());
|
||||
return true;
|
||||
|
||||
@ -96,7 +96,7 @@ protected:
|
||||
}else{ //This item is getting enhanced to the next level.
|
||||
window.DrawShadowStringDecal(drawPos+vf2d{maxAttributeLabelSize+4+24,yOffset},std::format("{:>5} ->#00AA00 {:<5}",
|
||||
attr.ShowAsDecimal()?std::format("{:>4.2f}{}",value,percentageSign):std::format("{}{}",value,percentageSign),
|
||||
nextEnhanceLevel!="Item.Item Max Enhancement Level"_I?
|
||||
nextEnhanceLevel<="Item.Item Max Enhancement Level"_I?
|
||||
attr.ShowAsDecimal()?std::format("{:<4.2f}{}",nextStageValue,percentageSign):std::format("{}{}",nextStageValue,percentageSign)
|
||||
:"MAX"),
|
||||
WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x,1.0f);
|
||||
|
||||
@ -679,7 +679,7 @@ const std::string Item::Description(CompactText compact)const{
|
||||
if(compact==CRAFTING_INFO){
|
||||
description+="\n\nCrafting Requirements:\n---------\n";
|
||||
if(IsCraftable()){
|
||||
size_t enhanceIndex=EnhancementLevel()+1;
|
||||
size_t enhanceIndex=std::min(EnhancementLevel()+1,"Item.Item Max Enhancement Level"_I);
|
||||
if(IsEquippable()&&Inventory::GetItemCount(ActualName())==0)enhanceIndex=0;
|
||||
|
||||
const EnhancementLevelInfo&info=GetEnhancementInfo()[enhanceIndex];
|
||||
@ -931,10 +931,9 @@ void Item::EnhanceItem(uint8_t qty){
|
||||
Inventory::RemoveItem(Inventory::GetItem(name)[0],amt);
|
||||
}
|
||||
game->GetPlayer()->SetMoney(game->GetPlayer()->GetMoney()-consumedResources.GetCost());
|
||||
|
||||
SoundEffect::PlaySFX("Craft Item",SoundEffect::CENTERED);
|
||||
}
|
||||
}
|
||||
SoundEffect::PlaySFX("Craft Item",SoundEffect::CENTERED);
|
||||
};
|
||||
|
||||
const std::vector<std::pair<int,Stats>>&ItemSet::GetSetBonusBreakpoints()const{
|
||||
@ -1079,7 +1078,7 @@ const bool Item::CanEnhanceItem(uint8_t qty)const{
|
||||
if(ISBLANK(std::make_shared<Item>(*this)))return false;
|
||||
if(!GetEnhancementInfo().CanBeEnhanced())return false;
|
||||
if(GetEnhancementInfo().AvailableChapter()<game->GetCurrentChapter())return false;
|
||||
size_t enhanceIndex=EnhancementLevel()+1;
|
||||
size_t enhanceIndex=std::min(EnhancementLevel()+1,"Item.Item Max Enhancement Level"_I);
|
||||
if(IsEquippable()&&Inventory::GetItemCount(ActualName())==0)enhanceIndex=0;//Equipment we don't have we need to first craft.
|
||||
const EnhancementLevelInfo&enhanceInfo=GetEnhancementInfo()[enhanceIndex];
|
||||
if(GetEnhancementInfo().size()>2){ //If the item has exactly 2 enhancement levels, then it's an item that can only simply be crafted. Therefore, don't do the max enhancement level check.
|
||||
|
||||
@ -70,7 +70,7 @@ protected:
|
||||
}
|
||||
|
||||
if(itemRef.lock()->EnhancementIsPossible()){
|
||||
size_t enhancementIndex=itemRef.lock()->EnhancementLevel()+1;
|
||||
size_t enhancementIndex=std::min(itemRef.lock()->EnhancementLevel()+1,"Item.Item Max Enhancement Level"_I);
|
||||
if(itemRef.lock()->IsEquippable()&&Inventory::GetItemCount(itemRef.lock()->ActualName())==0)enhancementIndex=0;//If we don't have the item, use the initial crafting list instead. But only for equipment!
|
||||
float drawWidth=rect.size.x/3;
|
||||
int index=0;
|
||||
|
||||
@ -41,7 +41,7 @@ All rights reserved.
|
||||
#include "GameState.h"
|
||||
|
||||
void Menu::InitializeShermanWindow(){
|
||||
Menu*shermanWindow=CreateMenu(SHERMAN,CENTERED,vi2d{144,60});
|
||||
Menu*shermanWindow=CreateMenu(SHERMAN,CENTERED,vi2d{144,88});
|
||||
|
||||
shermanWindow->ADD("Leave Button",MenuComponent)(geom2d::rect<float>{{0.f,4.f},{144.f,24.f}},"Leave",MenuType::ENUM_END,[](MenuFuncData data){
|
||||
GameState::ChangeState(States::OVERWORLD_MAP,0.3f);
|
||||
@ -52,4 +52,8 @@ void Menu::InitializeShermanWindow(){
|
||||
return true;
|
||||
},vf2d{2.f,2.f},ButtonAttr::FIT_TO_LABEL)END
|
||||
->SetGrayedOut(true);
|
||||
shermanWindow->ADD("Stay Button",MenuComponent)(geom2d::rect<float>{{0.f,60.f},{144.f,24.f}},"Stay Here",MenuType::ENUM_END,[](MenuFuncData data){
|
||||
Menu::CloseMenu();
|
||||
return true;
|
||||
},vf2d{2.f,2.f},ButtonAttr::FIT_TO_LABEL)END;
|
||||
}
|
||||
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 6677
|
||||
#define VERSION_BUILD 6687
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
||||
@ -27,6 +27,16 @@ Events
|
||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||
File[0] = consume_item.ogg, 60%
|
||||
}
|
||||
Craft Item
|
||||
{
|
||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||
File[0] = item_craft.ogg, 70%
|
||||
}
|
||||
Craft Equip
|
||||
{
|
||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||
File[0] = craft_equip.ogg, 70%
|
||||
}
|
||||
Equip Armor
|
||||
{
|
||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||
@ -63,11 +73,6 @@ Events
|
||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||
File[0] = item_sell.ogg, 80%
|
||||
}
|
||||
Craft Item
|
||||
{
|
||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||
File[0] = item_craft.ogg, 70%
|
||||
}
|
||||
Enhance Item
|
||||
{
|
||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||
|
||||
BIN
Adventures in Lestoria/assets/sounds/craft_equip.ogg
Normal file
BIN
Adventures in Lestoria/assets/sounds/craft_equip.ogg
Normal file
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user