Added stage loot to levels configuration, and implemented stage loot upon level completion.

pull/35/head
sigonasr2 10 months ago
parent 8a1689cb07
commit c021c531f7
  1. 4
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  2. 3
      Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
  3. 10
      Adventures in Lestoria/AdventuresInLestoria.cpp
  4. 47
      Adventures in Lestoria/ItemMapData.h
  5. 7
      Adventures in Lestoria/State_LevelComplete.cpp
  6. 2
      Adventures in Lestoria/State_OverworldMap.cpp
  7. 2
      Adventures in Lestoria/TMXParser.h
  8. 6
      Adventures in Lestoria/TODO.txt
  9. 2
      Adventures in Lestoria/Version.h
  10. 68
      Adventures in Lestoria/assets/config/levels.txt

@ -378,6 +378,10 @@
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="ItemMapData.h">
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="ItemMenuLabel.h">
<SubType>
</SubType>

@ -432,6 +432,9 @@
<ClInclude Include="ItemNameConverter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ItemMapData.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Player.cpp">

@ -1617,6 +1617,14 @@ void AiL::InitializeLevel(std::string mapFile,MapName map){
size_t slashMarker = mapFile.find_last_of('/');
std::string baseDir=mapFile.substr(0,slashMarker+1);
MAP_DATA[map]=level.GetData();
for(auto&[key,size]:DATA["Levels"][map]){
if(key.starts_with("Loot")){
datafile data=DATA["Levels"][map][key];
MAP_DATA[map].stageLoot.push_back(ItemMapData(data.GetString(0U),data.GetInt(1U),data.GetInt(2U)));
}
}
for(XMLTag&tag:MAP_DATA[map].TilesetData){
size_t slashMarkerSourceDir = tag.data["source"].find_last_of('/');
std::string baseSourceDir=tag.data["source"].substr(slashMarkerSourceDir+1);
@ -2303,7 +2311,7 @@ bool AiL::OnUserDestroy(){
void AiL::InitializeLevels(){
for(auto&[key,size]:DATA["Levels"]){
InitializeLevel("map_path"_S+operator""_S(("Levels."+key).c_str(),("Levels."+key).size()),key);
InitializeLevel("map_path"_S+DATA["Levels"][key]["Map File"].GetString(),key);
}
for(ConnectionPoint&cp:State_OverworldMap::connections){

@ -0,0 +1,47 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions or derivations of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce the above
copyright notice. This list of conditions and the following disclaimer must be
reproduced in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of this software are copyright © 2023 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#pragma once
#include "Item.h"
struct ItemMapData{
IT item;
uint8_t amt;
int chance;
inline ItemMapData(IT item,uint8_t amt,int chance)
:item(item),amt(amt),chance(chance){}
};

@ -51,6 +51,13 @@ void State_LevelComplete::OnStateChange(GameState*prevState){
}
Component<MenuLabel>(MenuType::LEVEL_COMPLETE,"Level EXP Gain Outline")->SetLabel(std::format("+{} Exp",game->GetPlayer()->GetAccumulatedXP()));
game->GetPlayer()->AddXP(game->GetPlayer()->GetAccumulatedXP());
for(const ItemMapData&data:game->GetCurrentMap().stageLoot){
for(uint8_t rolls=0;rolls<data.amt;rolls++){
if(util::random(1.0f)<data.chance/100.f){
Inventory::AddItem(data.item,1U);
}
}
}
game->GetPlayer()->SetState(State::NORMAL);
Menu::OpenMenu(LEVEL_COMPLETE);
};

@ -254,8 +254,8 @@ ConnectionPoint&State_OverworldMap::GetCurrentConnectionPoint(){
void State_OverworldMap::StartLevel(){
game->UpdateDiscordStatus(State_OverworldMap::GetCurrentConnectionPoint().name,game->GetPlayer()->GetClassName());
State_OverworldMap::GetCurrentConnectionPoint().SetVisited();
SaveFile::SaveGame();
State_OverworldMap::GetCurrentConnectionPoint().SetVisited();
if(State_OverworldMap::GetCurrentConnectionPoint().map.starts_with("STORY")){
VisualNovel::LoadVisualNovel(State_OverworldMap::GetCurrentConnectionPoint().map);
}else{

@ -43,6 +43,7 @@ All rights reserved.
#include "EnvironmentalAudio.h"
#include "DEFINES.h"
#include "safemap.h"
#include "ItemMapData.h"
using MapName=std::string;
using namespace olc;
@ -100,6 +101,7 @@ struct Map{
std::vector<XMLTag> TilesetData;
std::vector<LayerTag> LayerData;
std::vector<EnvironmentalAudio>environmentalAudioData;
std::vector<ItemMapData>stageLoot;
std::string mapType="";
std::string bgmSongName="";
BackdropName backdrop="";

@ -10,13 +10,13 @@ Settings Menu
remove that bind from the list. Up to two keys may be binded per action.
-We have to save keybinds to the save file.
- Fix Stage Completed screen, item displays can hit the scrollbar.
- Stage Loot Config
- Initial Crafting of Gear.
- XP Bar
- Fix reflections for rotated monsters.
January 31st
============
Make new unlocked nodes more obvious, made neighboring nodes more obvious
@ -32,6 +32,8 @@ Story proofreading/correcting/storyboarding
- Lock up unimplemented classes.
- Don't enable all stage plates normally.
- Add Death screen (Zoom in on fatal blow, slow time down... Display some game over text... Allow retry or return to world map.)
- Auto targeting for controller / keyboard.
A "Debug" version of the game that simply outputs all std::cout to a file as well (debug.log).

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 6234
#define VERSION_BUILD 6237
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -2,16 +2,64 @@ map_path = assets/Campaigns/
Levels
{
WORLD_MAP = World_Map.tmx
WORLD_MAP
{
Map File = World_Map.tmx
}
CAMPAIGN_1_1 = 1_1_v2.tmx
BOSS_1 = Boss_1_v2.tmx
CAMPAIGN_1_1
{
Map File = 1_1_v2.tmx
CAMPAIGN_1_2 = 1_2.tmx
CAMPAIGN_1_3 = 1_3.tmx
CAMPAIGN_1_4 = 1_4.tmx
CAMPAIGN_1_5 = 1_5.tmx
CAMPAIGN_1_6 = 1_6.tmx
CAMPAIGN_1_7 = 1_7.tmx
CAMPAIGN_1_8 = 1_8.tmx
# Specify item and number of items. Optionally specify a % drop chance per item.
Loot[0] = Berries, 5, 100%
Loot[1] = Minor Mana Potion, 1, 100%
}
BOSS_1
{
Map File = Boss_1_v2.tmx
}
CAMPAIGN_1_2
{
Map File = 1_2.tmx
# Specify item and number of items. Optionally specify a % drop chance per item.
# Loot[0] = Berries, 5, 100%
}
CAMPAIGN_1_3
{
Map File = 1_3.tmx
# Specify item and number of items. Optionally specify a % drop chance per item.
# Loot[0] = Berries, 5, 100%
}
CAMPAIGN_1_4
{
Map File = 1_4.tmx
# Specify item and number of items. Optionally specify a % drop chance per item.
# Loot[0] = Berries, 5, 100%
}
CAMPAIGN_1_5
{
Map File = 1_5.tmx
# Specify item and number of items. Optionally specify a % drop chance per item.
# Loot[0] = Berries, 5, 100%
}
CAMPAIGN_1_6
{
Map File = 1_6.tmx
# Specify item and number of items. Optionally specify a % drop chance per item.
# Loot[0] = Berries, 5, 100%
}
CAMPAIGN_1_7
{
Map File = 1_7.tmx
# Specify item and number of items. Optionally specify a % drop chance per item.
# Loot[0] = Berries, 5, 100%
}
CAMPAIGN_1_8
{
Map File = 1_8.tmx
# Specify item and number of items. Optionally specify a % drop chance per item.
# Loot[0] = Berries, 5, 100%
}
}
Loading…
Cancel
Save