From acaf1bc3bf04ecb7546dfc29e62959cc702cc64e Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 14 Jan 2024 12:53:40 -0600 Subject: [PATCH] Attack recovery time on frogs were being ignored. Made move speed stats implementations consistent across both monsters and players. Added shooting sound effects. Begin wolf behavior implementation. --- .../Adventures in Lestoria.vcxproj | 1 + .../Adventures in Lestoria.vcxproj.filters | 3 + Adventures in Lestoria/Buff.h | 2 + Adventures in Lestoria/Frog.cpp | 8 ++- Adventures in Lestoria/Monster.cpp | 12 +++- Adventures in Lestoria/Monster.h | 1 + Adventures in Lestoria/MonsterData.cpp | 2 +- Adventures in Lestoria/Player.cpp | 13 +++- Adventures in Lestoria/RUN_STRATEGY.cpp | 23 +++--- Adventures in Lestoria/ShootAfar.cpp | 2 + Adventures in Lestoria/TODO.txt | 5 -- Adventures in Lestoria/Version.h | 2 +- Adventures in Lestoria/Wolf.cpp | 70 +++++++++++++++++++ .../assets/Campaigns/1_1_v2.tmx | 4 +- .../assets/config/MonsterStrategies.txt | 14 ++++ .../assets/config/audio/events.txt | 2 +- 16 files changed, 137 insertions(+), 27 deletions(-) create mode 100644 Adventures in Lestoria/Wolf.cpp diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index 2f4fa101..c5fa7bb2 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -667,6 +667,7 @@ + diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters index a8465a61..9e119809 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters @@ -719,6 +719,9 @@ Source Files\Monster Strategies + + Source Files\Monster Strategies + diff --git a/Adventures in Lestoria/Buff.h b/Adventures in Lestoria/Buff.h index d433b7ad..4f756e26 100644 --- a/Adventures in Lestoria/Buff.h +++ b/Adventures in Lestoria/Buff.h @@ -46,6 +46,8 @@ enum BuffType{ BLOCK_SLOWDOWN, RESTORATION, RESTORATION_DURING_CAST, + LOCKON_SPEEDBOOST, //Specifically used for wolves. + SPEEDBOOST, }; class AiL; diff --git a/Adventures in Lestoria/Frog.cpp b/Adventures in Lestoria/Frog.cpp index 607ee79d..4ecf33a5 100644 --- a/Adventures in Lestoria/Frog.cpp +++ b/Adventures in Lestoria/Frog.cpp @@ -41,6 +41,7 @@ All rights reserved. #include "MonsterStrategyHelpers.h" #include "util.h" #include "BulletTypes.h" +#include "SoundEffect.h" INCLUDE_game INCLUDE_BULLET_LIST @@ -94,7 +95,7 @@ void Monster::STRATEGY::FROG(Monster&m,float fElapsedTime,std::string strategy){ if(m.F(A::LOCKON_WAITTIME)==0.0f){ m.F(A::LOCKON_WAITTIME)=ConfigFloat("Attack Duration"); vf2d tongueMaxRangePos=geom2d::line(m.GetPos(),m.V(A::LOCKON_POS)).upoint(ConfigFloat("Tongue Max Range")/ConfigFloat("Range")); - + SoundEffect::PlaySFX("Slime Shoot",m.pos); CreateBullet(FrogTongue)(m.pos,tongueMaxRangePos,ConfigFloat("Attack Duration"),m.GetAttack(),m.OnUpperLevel(),ConfigFloat("Tongue Knockback Strength"),false,ConfigPixel("Tongue Color"))EndBullet; m.PerformShootAnimation(); m.I(A::PHASE)=2; @@ -104,6 +105,11 @@ void Monster::STRATEGY::FROG(Monster&m,float fElapsedTime,std::string strategy){ case 2:{ if(m.F(A::LOCKON_WAITTIME)==0.0f){ m.F(A::LOCKON_WAITTIME)=ConfigFloat("Attack Recovery Time"); + m.I(A::PHASE)=3; + } + }break; + case 3:{ + if(m.F(A::LOCKON_WAITTIME)==0.0f){ m.I(A::PHASE)=0; } }break; diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index abc93539..e550f147 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -89,9 +89,17 @@ int Monster::GetAttack(){ return int(mod_atk); } float Monster::GetMoveSpdMult(){ - float mod_moveSpd=stats.A("Move Spd %"); + float moveSpdPct=stats.A("Move Spd %")/100.f; + + float mod_moveSpd=moveSpdPct; for(Buff&b:GetBuffs(SLOWDOWN)){ - mod_moveSpd-=stats.A("Move Spd %")*b.intensity; + mod_moveSpd-=moveSpdPct*b.intensity; + } + for(Buff&b:GetBuffs(LOCKON_SPEEDBOOST)){ + mod_moveSpd+=moveSpdPct*b.intensity; + } + for(Buff&b:GetBuffs(SPEEDBOOST)){ + mod_moveSpd+=moveSpdPct*b.intensity; } return mod_moveSpd; } diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h index 1e04c4a1..569693e5 100644 --- a/Adventures in Lestoria/Monster.h +++ b/Adventures in Lestoria/Monster.h @@ -235,6 +235,7 @@ private: static void SLIMEKING(Monster&m,float fElapsedTime,std::string strategy); static void RUN_AWAY(Monster&m,float fElapsedTime,std::string strategy); static void FROG(Monster&m,float fElapsedTime,std::string strategy); + static void WOLF(Monster&m,float fElapsedTime,std::string strategy); }; }; diff --git a/Adventures in Lestoria/MonsterData.cpp b/Adventures in Lestoria/MonsterData.cpp index 3dde9ff6..c1142201 100644 --- a/Adventures in Lestoria/MonsterData.cpp +++ b/Adventures in Lestoria/MonsterData.cpp @@ -166,7 +166,7 @@ void MonsterData::InitializeMonsterData(){ DATA["Monsters"][MonsterName]["XP"].GetInt(), animations, drops, - float(DATA["Monsters"][MonsterName]["MoveSpd"].GetReal())/100, + float(DATA["Monsters"][MonsterName]["MoveSpd"].GetReal()), float(DATA["Monsters"][MonsterName]["Size"].GetReal())/100, strategyName, DATA["Monsters"][MonsterName]["CollisionDmg"].GetInt() diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 07cc7144..cdabf6b4 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -232,13 +232,20 @@ const int Player::GetAttack(){ } float Player::GetMoveSpdMult(){ - float mod_moveSpd=GetStat("Move Spd %")/100.f; + float moveSpdPct=GetStat("Move Spd %")/100.f; + float mod_moveSpd=moveSpdPct; mod_moveSpd+=ItemAttribute::Get("Move Spd %",this); for(const Buff&b:GetBuffs(BuffType::SLOWDOWN)){ - mod_moveSpd-=mod_moveSpd*b.intensity; + mod_moveSpd-=moveSpdPct*b.intensity; } for(const Buff&b:GetBuffs(BuffType::BLOCK_SLOWDOWN)){ - mod_moveSpd-=mod_moveSpd*b.intensity; + mod_moveSpd-=moveSpdPct*b.intensity; + } + for(const Buff&b:GetBuffs(LOCKON_SPEEDBOOST)){ + mod_moveSpd+=moveSpdPct*b.intensity; + } + for(const Buff&b:GetBuffs(SPEEDBOOST)){ + mod_moveSpd+=moveSpdPct*b.intensity; } return mod_moveSpd; } diff --git a/Adventures in Lestoria/RUN_STRATEGY.cpp b/Adventures in Lestoria/RUN_STRATEGY.cpp index 1707023d..74efb48f 100644 --- a/Adventures in Lestoria/RUN_STRATEGY.cpp +++ b/Adventures in Lestoria/RUN_STRATEGY.cpp @@ -42,6 +42,18 @@ All rights reserved. INCLUDE_DATA INCLUDE_STRATEGY_DATA +void Monster::InitializeStrategies(){ + STRATEGY_DATA.insert("Run Towards",Monster::STRATEGY::RUN_TOWARDS); + STRATEGY_DATA.insert("Shoot Afar",Monster::STRATEGY::SHOOT_AFAR); + STRATEGY_DATA.insert("Turret",Monster::STRATEGY::TURRET); + STRATEGY_DATA.insert("Slime King",Monster::STRATEGY::SLIMEKING); + STRATEGY_DATA.insert("Run Away",Monster::STRATEGY::RUN_AWAY); + STRATEGY_DATA.insert("Frog",Monster::STRATEGY::FROG); + STRATEGY_DATA.insert("Wolf",Monster::STRATEGY::WOLF); + + STRATEGY_DATA.SetInitialized(); +} + int Monster::STRATEGY::_GetInt(Monster&m,std::string param,std::string strategy,int index){ if(DATA["Monsters"][m.name].HasProperty(param)){ return DATA["Monsters"][m.name].GetProperty(param).GetInt(index); @@ -73,15 +85,4 @@ Pixel Monster::STRATEGY::_GetPixel(Monster&m,std::string param,std::string strat void Monster::STRATEGY::RUN_STRATEGY(Monster&m,float fElapsedTime){ m.GetStrategy()(m,fElapsedTime,m.strategy); -} - -void Monster::InitializeStrategies(){ - STRATEGY_DATA.insert("Run Towards",Monster::STRATEGY::RUN_TOWARDS); - STRATEGY_DATA.insert("Shoot Afar",Monster::STRATEGY::SHOOT_AFAR); - STRATEGY_DATA.insert("Turret",Monster::STRATEGY::TURRET); - STRATEGY_DATA.insert("Slime King",Monster::STRATEGY::SLIMEKING); - STRATEGY_DATA.insert("Run Away",Monster::STRATEGY::RUN_AWAY); - STRATEGY_DATA.insert("Frog",Monster::STRATEGY::FROG); - - STRATEGY_DATA.SetInitialized(); } \ No newline at end of file diff --git a/Adventures in Lestoria/ShootAfar.cpp b/Adventures in Lestoria/ShootAfar.cpp index 2b664ed2..cb20bf94 100644 --- a/Adventures in Lestoria/ShootAfar.cpp +++ b/Adventures in Lestoria/ShootAfar.cpp @@ -40,6 +40,7 @@ All rights reserved. #include "AdventuresInLestoria.h" #include "MonsterStrategyHelpers.h" #include "util.h" +#include "SoundEffect.h" INCLUDE_BULLET_LIST INCLUDE_game @@ -52,6 +53,7 @@ void Monster::STRATEGY::SHOOT_AFAR(Monster&m,float fElapsedTime,std::string stra if(m.queueShotTimer<0){ m.queueShotTimer=0; { + SoundEffect::PlaySFX("Slime Shoot",m.pos + vf2d{ 0,-4 }); BULLET_LIST.push_back(std::make_unique(Bullet(m.pos + vf2d{ 0,-4 }, geom2d::line(m.pos + vf2d{ 0,-4 }, game->GetPlayer()->GetPos()).vector().norm() * 24.f * float(ConfigInt("BulletSpeed"))/100.f, 12.f*ConfigInt("BulletSize")/100.f, m.GetAttack(),m.upperLevel,false, { uint8_t(ConfigIntArr("BulletColor",0)),uint8_t(ConfigIntArr("BulletColor",1)),uint8_t(ConfigIntArr("BulletColor",2)),uint8_t(ConfigIntArr("BulletColor",3) )},{ConfigInt("BulletSize")/100.f*8,ConfigInt("BulletSize")/100.f*8}))); } } diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 72d3c35e..66377dbd 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -9,10 +9,6 @@ Settings Menu -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. -We have to save keybinds to the save file. --Smooth Movement --Click on title screen should not process as input immediately. - --Investigate why frame rate matters for intro screen. January 31st ============ @@ -28,7 +24,6 @@ Implement the rest of the enemy types: - Blue Frog Implement Ursule, Mother of Bears Boss Story proofreading/correcting/storyboarding -- Add a command to play sound effects/music. - Fix Keyboard/Controller Menu Navigation (Need clearly defined rules) - Game Controller Support - Should use the Keybind structure that already exists. diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 5123e947..c23d2973 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 5760 +#define VERSION_BUILD 5761 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/Wolf.cpp b/Adventures in Lestoria/Wolf.cpp new file mode 100644 index 00000000..40fbc2e1 --- /dev/null +++ b/Adventures in Lestoria/Wolf.cpp @@ -0,0 +1,70 @@ +#pragma region License +/* +License (OLC-3) +~~~~~~~~~~~~~~~ + +Copyright 2024 Joshua Sigona + +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 + +#include "Monster.h" +#include "AdventuresInLestoria.h" +#include "MonsterStrategyHelpers.h" +#include "util.h" +#include "BulletTypes.h" +#include "SoundEffect.h" + +INCLUDE_game +INCLUDE_BULLET_LIST + +using A=Attribute; + +void Monster::STRATEGY::WOLF(Monster&m,float fElapsedTime,std::string strategy){ + switch(m.I(A::PHASE)){ + case 0:{ //Run towards the player. + float distToPlayer = geom2d::line(game->GetPlayer()->GetPos(),m.GetPos()).length(); + if(distToPlayer<=ConfigFloat("Lockon Range")){ + m.I(A::PHASE)=1; + m.V(A::LOCKON_POS)=game->GetPlayer()->GetPos(); + m.AddBuff(BuffType::) + } + + RUN_TOWARDS(m,fElapsedTime,"Run Towards"); + }break; + case 1:{ //Charge the player. + + }break; + case 3:{ + + }break; + } +} \ No newline at end of file diff --git a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx index 639004ad..0117442c 100644 --- a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx +++ b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx @@ -1716,14 +1716,14 @@ - + - + diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 224f460e..41adec49 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -190,4 +190,18 @@ MonsterStrategy # A multiplier for the knockback strength of the tongue. (1 is quite small) Tongue Knockback Strength = 2 } + Wolf + { + # How close the wolf has to be to lock on and charge the player. + Lockon Range = 400 + + # The speed boost percentage to increase by during the charge. + Lockon Speed Boost = 15% + + # The speed boost percentage to increase by and the duration while disengaging. + Disengage Speed Boost = 30%, 3s + + # The distance to disengage the player. + Disengage Range = 800 + } } \ No newline at end of file diff --git a/Adventures in Lestoria/assets/config/audio/events.txt b/Adventures in Lestoria/assets/config/audio/events.txt index 2b2e7419..f683bfaf 100644 --- a/Adventures in Lestoria/assets/config/audio/events.txt +++ b/Adventures in Lestoria/assets/config/audio/events.txt @@ -125,7 +125,7 @@ Events { # Specify file names, followed by volume % File[0] = slime_shoot.ogg, 100% - File[1] = slime_shoot2.ogg, 100% + File[1] = slime_shoot2.ogg, 80% } Slime Walk {