diff --git a/Adventures in Lestoria Tests/EnchantTests.cpp b/Adventures in Lestoria Tests/EnchantTests.cpp index 8431626e..7d149d11 100644 --- a/Adventures in Lestoria Tests/EnchantTests.cpp +++ b/Adventures in Lestoria Tests/EnchantTests.cpp @@ -1136,5 +1136,30 @@ namespace EnchantTests game->OnUserUpdate(5.f); Assert::IsTrue(newMonster.CanMove(),L"Monster should no longer be stunned."); } + TEST_METHOD(SonicUpgradeNoEnchantCheck){ + testKey->bHeld=true; //Force the key to be held down for testing purposes. + Monster&newMonster{game->SpawnMonster({},MONSTER_DATA["TestName"])}; + Assert::AreEqual("Warrior.Ability 3.Cooldown"_F,player->GetAbility3().GetCooldownTime(),L"Player's Sonic Slash cooldown time is normal."); + Assert::AreEqual("Warrior.Ability 3.Mana Cost"_I,player->GetAbility3().manaCost,L"Player's Sonic Slash mana cost is normal."); + testGame->OnUserUpdate(0.f); + player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput); + testGame->SetElapsedTime(0.5f); + testGame->OnUserUpdate(0.5f); + Assert::AreEqual(920,newMonster.GetHealth(),L"Monster has taken the normal amount of 80 health."); + } + TEST_METHOD(SonicUpgradeEnchantCheck){ + testKey->bHeld=true; //Force the key to be held down for testing purposes. + Monster&newMonster{game->SpawnMonster({},MONSTER_DATA["TestName"])}; + std::weak_ptrnullRing{Inventory::AddItem("Null Ring"s)}; + Inventory::EquipItem(nullRing,EquipSlot::RING1); + nullRing.lock()->EnchantItem("Sonic Upgrade"); + Assert::AreEqual("Warrior.Ability 3.Cooldown"_F*0.85f,player->GetAbility3().GetCooldownTime(),L"Player's Sonic Slash cooldown time is normal."); + Assert::AreEqual(int("Warrior.Ability 3.Mana Cost"_I*0.85f),player->GetAbility3().manaCost,L"Player's Sonic Slash mana cost is normal."); + testGame->OnUserUpdate(0.f); + player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput); + testGame->SetElapsedTime(0.5f); + testGame->OnUserUpdate(0.5f); + Assert::AreEqual(910,newMonster.GetHealth(),L"Monster now takes 90 health with the Sonic Upgrade (10% of player's Max HP)."); + } }; } diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index f09d818c..ecdb8711 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -478,7 +478,7 @@ void Monster::Draw()const{ const float finalSpriteRot=HasFourWaySprites()?0.f:spriteRot; //Prevent 4-way sprites from being rotated. vf2d imageScale{vf2d(GetSizeMult()*(!HasFourWaySprites()&&GetFacingDirection()==Direction::EAST?-1:1),GetSizeMult())}; - if(GetRemainingStunDuration()>0.f)imageScale*=abs(sin(3*PI*game->GetRunTime()))*0.2f+0.8f; + if(GetRemainingStunDuration()>0.f)imageScale*=abs(sin(3*PI*game->GetRunTime()))*0.15f+0.85f; const vf2d glowPurpleImageScale{imageScale*1.1f}; const auto DrawBaseMonster=[&](vf2d scale={1.f,1.f},Pixel col=WHITE){ diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 056b296f..e084c5d4 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -1507,6 +1507,13 @@ void Player::RecalculateEquipStats(){ } } + if(GetClass()&WARRIOR){ + if(HasEnchant("Sonic Upgrade")){ + GetAbility3().COOLDOWN_TIME-=GetAbility3().COOLDOWN_TIME*"Sonic Upgrade"_ENC["REDUCTION PCT"]/100.f; + GetAbility3().manaCost-=GetAbility3().manaCost*"Sonic Upgrade"_ENC["REDUCTION PCT"]/100.f; + } + } + for(const std::reference_wrapper&a:GetAbilities()){ if(a.get().itemAbility)continue; if(a.get().chargesUpdateAnimation("WARRIOR_SWINGSONICSWORD_S",WARRIOR); }break; } - BULLET_LIST.push_back(std::make_unique(p->GetPos(),bulletVel,"Warrior.Ability 3.Radius"_F,p->GetAttack()*"Warrior.Ability 3.DamageMult"_F,"sonicslash.png",p->upperLevel,true,"Warrior.Ability 3.Lifetime"_F,true,true,WHITE,vf2d{"Warrior.Ability 3.Radius"_F/30,"Warrior.Ability 3.Radius"_F/30})); + int sonicSlashDamage{int(p->GetAttack()*"Warrior.Ability 3.DamageMult"_F)}; + if(p->HasEnchant("Sonic Upgrade"))sonicSlashDamage+=p->GetMaxHealth()*"Sonic Upgrade"_ENC["ADDITIONAL DMG PCT"]/100.f; + BULLET_LIST.emplace_back(std::make_unique(p->GetPos(),bulletVel,"Warrior.Ability 3.Radius"_F,sonicSlashDamage,"sonicslash.png",p->upperLevel,true,"Warrior.Ability 3.Lifetime"_F,true,true,WHITE,vf2d{"Warrior.Ability 3.Radius"_F/30,"Warrior.Ability 3.Radius"_F/30})); game->SetupWorldShake("Warrior.Ability 3.ShakeTime"_F); if(p->HasEnchant("Sword Enchantment"))p->AddBuff(BuffType::SWORD_ENCHANTMENT,"Sword Enchantment"_ENC["INCREASE DURATION"],1); SoundEffect::PlaySFX("Warrior Sonic Slash",SoundEffect::CENTERED);