Fix applied buffs bug, older calls to create buffs/debuffs resulted in the wrong value getting set, leading to the intensity of buffs being completely wrong. Increased fade range.

This commit is contained in:
sigonasr2 2023-12-23 14:06:39 -06:00
parent 7852aa7209
commit 51cbf81204
11 changed files with 34 additions and 7 deletions

View File

@ -55,4 +55,8 @@ struct Buff{
float intensity=1; float intensity=1;
float nextTick=0; float nextTick=0;
std::function<void(Crawler*,int)>repeatAction; std::function<void(Crawler*,int)>repeatAction;
inline Buff(BuffType type,float duration,float intensity)
:type(type),duration(duration),intensity(intensity){}
inline Buff(BuffType type,float duration,float intensity,float timeBetweenTicks,std::function<void(Crawler*,int)>repeatAction)
:type(type),duration(duration),intensity(intensity),nextTick(duration-timeBetweenTicks),timeBetweenTicks(timeBetweenTicks),repeatAction(repeatAction){}
}; };

View File

@ -1708,7 +1708,6 @@ void Crawler::LoadLevel(MapName map){
SplitUp(upperForegroundTileGroups); SplitUp(upperForegroundTileGroups);
#pragma endregion #pragma endregion
#pragma region Bridge Layer Setup #pragma region Bridge Layer Setup
bridgeLayerIndex=-1; bridgeLayerIndex=-1;
for(int counter=0;LayerTag&layer:MAP_DATA[map].LayerData){ for(int counter=0;LayerTag&layer:MAP_DATA[map].LayerData){

View File

@ -581,6 +581,7 @@
<Text Include="assets\config\story\Chapter 1.txt" /> <Text Include="assets\config\story\Chapter 1.txt" />
<Text Include="Crawler_Story_Chapter_1 (2).txt" /> <Text Include="Crawler_Story_Chapter_1 (2).txt" />
<Text Include="Crawler_System_Overview.txt" /> <Text Include="Crawler_System_Overview.txt" />
<Text Include="ItemStats.txt" />
<Text Include="NewClasses.txt" /> <Text Include="NewClasses.txt" />
<Text Include="InitialConcept.txt" /> <Text Include="InitialConcept.txt" />
<Text Include="Slime_King_Encounter.txt" /> <Text Include="Slime_King_Encounter.txt" />

View File

@ -725,6 +725,9 @@
<Text Include="TODO.txt"> <Text Include="TODO.txt">
<Filter>Documentation</Filter> <Filter>Documentation</Filter>
</Text> </Text>
<Text Include="ItemStats.txt">
<Filter>Configurations\Items</Filter>
</Text>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="assets\heart.ico"> <Image Include="assets\heart.ico">

13
Crawler/ItemStats.txt Normal file
View File

@ -0,0 +1,13 @@
# Provide any stat name followed by its increase amount to add it to the set. Valid stat names and value examples are below:
#
# Defense = 5 # Adds 5 defense
# Health = 3 # Adds 3 Health
# Attack = 7 # Adds 7 attack
# Move Spd = 10% # Grants 10% more movement speed.
# CDR = 14% # Grants 14% cooldown reduction.
# Crit Rate = 5% # Grants 5% crit rate.
# Crit Dmg = 25% # Grants 25% bonus crit damage.
# Health % = 30% # Grants 30% Max health
# HP6 Recovery % = 4% # Grants 4% HP recovery every 6 seconds.
# HP4 Recovery % = 2% # Grants 2% HP recovery every 4 seconds.
# Damage Reduction = 2% # Grants 2% direct damage reduction

View File

@ -79,7 +79,7 @@ geom2d::rect<int>TileGroup::GetRange(){
} }
geom2d::rect<int>TileGroup::GetFadeRange(){ geom2d::rect<int>TileGroup::GetFadeRange(){
return {range.pos+vi2d{-24,-24},range.size+vi2d{48,24}}; return {range.pos+vi2d{-120,-24},range.size+vi2d{240,24}};
} }
std::vector<TileRenderData>&TileGroup::GetTiles(){ std::vector<TileRenderData>&TileGroup::GetTiles(){

View File

@ -717,10 +717,10 @@ void Player::UpdateIdleAnimation(Key direction){
} }
void Player::AddBuff(BuffType type,float duration,float intensity){ void Player::AddBuff(BuffType type,float duration,float intensity){
buffList.push_back(Buff{.type=type,.duration=duration,.intensity=intensity}); buffList.push_back(Buff{type,duration,intensity});
} }
void Player::AddBuff(BuffType type,float duration,float intensity,float timeBetweenTicks,std::function<void(Crawler*,int)>repeatAction){ void Player::AddBuff(BuffType type,float duration,float intensity,float timeBetweenTicks,std::function<void(Crawler*,int)>repeatAction){
buffList.push_back(Buff{.type=type,.duration=duration,.timeBetweenTicks=timeBetweenTicks,.intensity=intensity,.nextTick=duration-timeBetweenTicks,.repeatAction=repeatAction}); buffList.push_back(Buff{type,duration,intensity,timeBetweenTicks,repeatAction});
} }
bool Player::OnUpperLevel(){ bool Player::OnUpperLevel(){

View File

@ -23,7 +23,6 @@ Settings Menu
- Key Configuration - Key Configuration
-Upon pressing a key, check if the key is bound to another option, if so, -Upon pressing a key, check if the key is bound to another option, if so,
remove that bind from the list. Up to two keys may be binded per action. remove that bind from the list. Up to two keys may be binded per action.
Tile Groups per object instead of all adjacent tiles
January 31st January 31st
@ -43,3 +42,4 @@ Story proofreading/correcting/storyboarding
- Add a command to play sound effects/music. - Add a command to play sound effects/music.
- Game Controller Support - Game Controller Support
- Should use the Keybind structure that already exists. - Should use the Keybind structure that already exists.
- Loading Screen

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 1 #define VERSION_PATCH 1
#define VERSION_BUILD 4568 #define VERSION_BUILD 4574
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

View File

@ -20,7 +20,14 @@ ItemScript
# Parameter 2: Duration that this stat will be increased for. # Parameter 2: Duration that this stat will be increased for.
Buff Buff
{ {
Attack = 0,0.0
Attack % = 0,0.0 Attack % = 0,0.0
Defense = 0,0.0
Defense % = 0,0.0
Health = 0,0.0
Health % = 0,0.0
Move Spd = 0,0.0
Move Spd % = 0,0.0
} }
# Unlike an item or ability that requires a cast to perform, this applies a buff immediately and then moving cancels the buff mid-application. # Unlike an item or ability that requires a cast to perform, this applies a buff immediately and then moving cancels the buff mid-application.

Binary file not shown.