diff --git a/Adventures in Lestoria Tests/EnchantTests.cpp b/Adventures in Lestoria Tests/EnchantTests.cpp index 5beca15d..128cc751 100644 --- a/Adventures in Lestoria Tests/EnchantTests.cpp +++ b/Adventures in Lestoria Tests/EnchantTests.cpp @@ -700,5 +700,26 @@ namespace EnchantTests Assert::AreEqual("Thief.Ability 2.Mana Cost"_I,Thief::ability2.manaCost,L"Deadly Dash's mana cost is back to normal."); Assert::AreEqual("Thief.Ability 2.Cooldown"_F-3.f,Thief::ability2.cooldown,L"Deadly Dash should now be on cooldown"); } + TEST_METHOD(AdrenalineStimCheck){ + testKey->bHeld=true; //Force the key to be held down for testing purposes. + game->ChangePlayerClass(THIEF); + player=game->GetPlayer(); + player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput); + Assert::AreEqual("Thief.Ability 3.Duration"_F,player->GetBuffs(BuffType::ADRENALINE_RUSH)[0].duration,L"Adrenaline Rush buff duration is normal."); + Assert::AreEqual(100,player->GetHealth(),L"Adrenaline Rush does not reduce health."); + Assert::AreEqual("Thief.Auto Attack.Cooldown"_F*"Thief.Ability 3.Attack Speed Increase"_F/100.f,player->GetAttackRecoveryRateReduction(),L"Adrenaline Rush boosts attack rate normally."); + Assert::AreEqual("Thief.Auto Attack.Range"_F,player->GetAttackRange(),L"Adrenaline Rush does not boost attack range."); + Thief::ability3.charges=1; + player->RestoreMana(100); + player->RemoveAllBuffs(); + std::weak_ptrnullRing{Inventory::AddItem("Null Ring"s)}; + Inventory::EquipItem(nullRing,EquipSlot::RING1); + nullRing.lock()->EnchantItem("Adrenaline Stim"); + player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput); + Assert::AreEqual("Adrenaline Stim"_ENC["NEW ADRENALINE RUSH DURATION"],player->GetBuffs(BuffType::ADRENALINE_RUSH)[0].duration,L"Adrenaline Stim enchant boosts the duration of Adrenaline Rush."); + Assert::AreEqual(80,player->GetHealth(),L"Adrenaline Stim reduces health."); + Assert::AreEqual("Thief.Auto Attack.Cooldown"_F*"Thief.Ability 3.Attack Speed Increase"_F/100.f,player->GetAttackRecoveryRateReduction(),L"Adrenaline Stim still boosts attack rate normally."); + Assert::AreEqual("Thief.Auto Attack.Range"_F+"Thief.Auto Attack.Range"_F*"Adrenaline Stim"_ENC["ATTACK RANGE INCREASE PCT"]/100.f,player->GetAttackRange(),L"Adrenaline Stim boosts attack range."); + } }; } \ No newline at end of file diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index bbd4ba55..e55f7bbf 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -2999,6 +2999,7 @@ void AiL::ChangePlayerClass(Class cl){ player->cooldownSoundInstance=cooldownSoundInstance; player->AddXP(totalXPEarned); player->AddAccumulatedXP(totalXPEarned); + player->base_attack_range=DATA.GetProperty(player->GetClassName()+".Auto Attack.Range").GetReal(); game->healthCounter.UpdateNumberPointer(&player->hp); game->manaCounter.UpdateNumberPointer(&player->mana); sig::Animation::SetupPlayerAnimations(); diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index ec597874..39aa1650 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -311,8 +311,11 @@ float Player::GetSizeMult()const{ return size; } -float Player::GetAttackRangeMult(){ - return attack_range*GetSizeMult(); +float Player::GetAttackRange(){ + float finalAttackRange{base_attack_range}; + if(HasEnchant("Adrenaline Stim")&&GetBuffs(BuffType::ADRENALINE_RUSH).size()>0)finalAttackRange+=base_attack_range*"Adrenaline Stim"_ENC["ATTACK RANGE INCREASE PCT"]/100.f; + finalAttackRange*=GetSizeMult(); + return finalAttackRange; } float Player::GetSpinAngle(){ diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h index 6bd63307..28b6e7d2 100644 --- a/Adventures in Lestoria/Player.h +++ b/Adventures in Lestoria/Player.h @@ -109,6 +109,7 @@ class Player{ public: enum class TimerType{ DEADLY_MIRAGE_SECOND_CAST, + ADRENALINE_STIM, }; Player(); @@ -146,7 +147,7 @@ public: const float GetDamageReductionPct()const; const float GetAttackRecoveryRateReduction()const; void SetSizeMult(float size); - float GetAttackRangeMult(); + float GetAttackRange(); //Returns the player's attack range in units. Divide by 100 for number of tiles. float GetSpinAngle(); State::State GetState(); Key GetFacingDirection()const; @@ -402,6 +403,7 @@ private: const vf2d GetAimingLocation(bool useWalkDir=false,bool invert=false); std::unordered_maptimers; void RunTimers(); + float base_attack_range="Warrior.Auto Attack.Range"_F/100.f; protected: const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F; const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F; @@ -417,7 +419,6 @@ protected: std::pair notificationDisplay={"",0.f}; bool upperLevel=false; vf2d vel={0,0}; - float attack_range="Warrior.Auto Attack.Range"_F/100.f; Key facingDirection=DOWN; float swordSwingTimer=0; void CastSpell(Ability&ability); diff --git a/Adventures in Lestoria/SwordSlash.cpp b/Adventures in Lestoria/SwordSlash.cpp index f7ad0244..e0cbb584 100644 --- a/Adventures in Lestoria/SwordSlash.cpp +++ b/Adventures in Lestoria/SwordSlash.cpp @@ -46,7 +46,7 @@ SwordSlash::SwordSlash(float lifetime, std::string imgFile,float damageMult, flo bool SwordSlash::Update(float fElapsedTime){ if(lifetime>0){ - game->HurtConeNotHit(game->GetPlayer()->GetPos(),game->GetPlayer()->GetAttackRangeMult()*12.f,rotation,util::degToRad(swordSweepAngle),game->GetPlayer()->GetAttack()*damageMult,hitList,game->GetPlayer()->OnUpperLevel(),game->GetPlayer()->GetZ(),HurtType::MONSTER,HurtFlag::PLAYER_ABILITY); + game->HurtConeNotHit(game->GetPlayer()->GetPos(),game->GetPlayer()->GetAttackRange()/100.f*12.f,rotation,util::degToRad(swordSweepAngle),game->GetPlayer()->GetAttack()*damageMult,hitList,game->GetPlayer()->OnUpperLevel(),game->GetPlayer()->GetZ(),HurtType::MONSTER,HurtFlag::PLAYER_ABILITY); } pos=game->GetPlayer()->GetPos(); diff --git a/Adventures in Lestoria/Thief.cpp b/Adventures in Lestoria/Thief.cpp index 7be05b0d..65838c1f 100644 --- a/Adventures in Lestoria/Thief.cpp +++ b/Adventures in Lestoria/Thief.cpp @@ -75,7 +75,7 @@ bool Thief::AutoAttack(){ float closest_dist=999999; for(std::shared_ptr&m:MONSTER_LIST){ if(m->IsAlive()&& - geom2d::overlaps(geom2d::circle(GetPos(),attack_range*GetSizeMult()*12),geom2d::circle(m->GetPos(),m->GetSizeMult()*12))&& + geom2d::overlaps(geom2d::circle(GetPos(),GetAttackRange()/100.f*12),geom2d::circle(m->GetPos(),m->GetSizeMult()*12))&& geom2d::line(GetWorldAimingLocation(),m->GetPos()).length()(GetWorldAimingLocation(),m->GetPos()).length(); closest=&*m; @@ -170,7 +170,21 @@ void Thief::InitializeClassAbilities(){ Thief::ability3.action= [](Player*p,vf2d pos={}){ SoundEffect::PlaySFX("Adrenaline Rush",SoundEffect::CENTERED); - p->AddBuff(BuffType::ADRENALINE_RUSH,"Thief.Ability 3.Duration"_F,0.f); + + float adrenalineRushDuration{"Thief.Ability 3.Duration"_F}; + if(p->HasEnchant("Adrenaline Stim"))adrenalineRushDuration="Adrenaline Stim"_ENC["NEW ADRENALINE RUSH DURATION"]; + + p->AddBuff(BuffType::ADRENALINE_RUSH,adrenalineRushDuration,0.f); + p->AddTimer(TimerType::ADRENALINE_STIM,Timer{"Adrenaline Stim Extra Sound Timer",0.3f,[](){SoundEffect::PlaySFX("Adrenaline Rush High Pitch",SoundEffect::CENTERED);},Timer::MANUAL}); + + int healthCost{}; + if(p->HasEnchant("Adrenaline Stim"))healthCost=p->GetMaxHealth()*("Adrenaline Stim"_ENC["HEALTH PCT COST"]/100.f); + if(healthCost>0){ + if(p->GetHealth()GetHealth()-1; + p->Hurt(healthCost,p->OnUpperLevel(),p->GetZ(),TrueDamageFlag::IGNORE_DAMAGE_RULES,HurtFlag::PLAYER_ABILITY); + } + + for(int i:std::ranges::iota_view(0,50)){ float size{util::random_range(0.4f,0.8f)}; game->AddEffect(std::make_unique(p->GetPos()+vf2d{8,util::random(2*PI)}.cart(),util::random_range(0.1f,0.4f),"circle.png",p->OnUpperLevel(),vf2d{size,size},0.3f,vf2d{util::random_range(-6.f,6.f),util::random_range(-8.f,-1.f)},PixelLerp(WHITE,GREEN,util::random(1)))); diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 9cfcec20..fac08010 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define VERSION_PATCH 3 -#define VERSION_BUILD 10971 +#define VERSION_BUILD 10977 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/Warrior.cpp b/Adventures in Lestoria/Warrior.cpp index fcb4d30b..c6a4d19c 100644 --- a/Adventures in Lestoria/Warrior.cpp +++ b/Adventures in Lestoria/Warrior.cpp @@ -72,7 +72,7 @@ bool Warrior::AutoAttack(){ float closest_dist=999999; for(std::shared_ptr&m:MONSTER_LIST){ if(m->IsAlive()&& - geom2d::overlaps(geom2d::circle(GetPos(),attack_range*GetSizeMult()*12),geom2d::circle(m->GetPos(),m->GetSizeMult()*12))&& + geom2d::overlaps(geom2d::circle(GetPos(),GetAttackRange()/100.f*12),geom2d::circle(m->GetPos(),m->GetSizeMult()*12))&& geom2d::line(GetWorldAimingLocation(),m->GetPos()).length()(GetWorldAimingLocation(),m->GetPos()).length(); closest=&*m; @@ -94,7 +94,7 @@ bool Warrior::AutoAttack(){ attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction(); swordSwingTimer="Warrior.Auto Attack.SwordAnimationSwingTime"_F; - game->AddEffect(std::make_unique(0.125f,"swordslash.png"s,"Warrior.Auto Attack.DamageMult"_F,"Warrior.Auto Attack.SwordSlashSweepAngle"_F,vf2d{0.9f,0.9f}*"Warrior.Auto Attack.Range"_F/100.f,0.1f,vf2d{0.f,0.f},WHITE,targetDirection)); + game->AddEffect(std::make_unique(0.125f,"swordslash.png"s,"Warrior.Auto Attack.DamageMult"_F,"Warrior.Auto Attack.SwordSlashSweepAngle"_F,vf2d{0.9f,0.9f}*GetAttackRange()/100.f,0.1f,vf2d{0.f,0.f},WHITE,targetDirection)); SetState(State::SWING_SWORD); SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED); diff --git a/Adventures in Lestoria/assets/config/audio/events.txt b/Adventures in Lestoria/assets/config/audio/events.txt index 1adc4be3..4c28863b 100644 --- a/Adventures in Lestoria/assets/config/audio/events.txt +++ b/Adventures in Lestoria/assets/config/audio/events.txt @@ -14,6 +14,12 @@ Events # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) File[0] = adrenaline_rush.ogg, 70% } + Adrenaline Rush High Pitch + { + CombatSound = True + # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) + File[0] = adrenaline_rush.ogg, 50%, 110%, 120% + } Bear Slam Attack { CombatSound = True diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 134f20d7..2a961ba0 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ