Implemented Battle Shout enchant.

pull/65/head
sigonasr2 6 months ago
parent ad02c7b59f
commit 2129f3a4ff
  1. 23
      Adventures in Lestoria Tests/EnchantTests.cpp
  2. 2
      Adventures in Lestoria/Version.h
  3. 1
      Adventures in Lestoria/Warrior.cpp

@ -1012,9 +1012,9 @@ namespace EnchantTests
Assert::AreEqual(size_t(0),BULLET_LIST.size(),L"Explosive Trap detonates later.");
}
TEST_METHOD(SwordEnchantmentNoEnchantCheck){
Assert::AreEqual(1.5f,player->GetAttackRange(),L"Attack range of Warrior is normal");
Assert::AreEqual(150.f,player->GetAttackRange(),L"Attack range of Warrior is normal");
player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput);
Assert::AreEqual(1.5f,player->GetAttackRange(),L"Attack range of Warrior remains the untouched.");
Assert::AreEqual(150.f,player->GetAttackRange(),L"Attack range of Warrior remains the untouched.");
}
TEST_METHOD(SwordEnchantmentEnchantCheck){
testKey->bHeld=true; //Force the key to be held down for testing purposes.
@ -1022,10 +1022,10 @@ namespace EnchantTests
Inventory::EquipItem(nullRing,EquipSlot::RING1);
nullRing.lock()->EnchantItem("Sword Enchantment");
player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput);
Assert::AreEqual(3.f,player->GetAttackRange(),L"Attack range of Warrior doubled.");
Assert::AreEqual(300.f,player->GetAttackRange(),L"Attack range of Warrior doubled.");
game->SetElapsedTime(8.f);
game->OnUserUpdate(8.f);
Assert::AreEqual(1.5f,player->GetAttackRange(),L"Attack range of Warrior is normal again.");
Assert::AreEqual(150.f,player->GetAttackRange(),L"Attack range of Warrior is normal again.");
}
TEST_METHOD(ImprovedGroundSlamNoEnchantCheck){
testKey->bHeld=true; //Force the key to be held down for testing purposes.
@ -1089,5 +1089,20 @@ namespace EnchantTests
game->OnUserUpdate(9.f);
Assert::AreEqual(0U,player->GetShield(),L"The Advance Shield enchant shield lasts 9 seconds. It should have worn off after that time.");
}
TEST_METHOD(BattleShoutNoEnchantCheck){
testKey->bHeld=true; //Force the key to be held down for testing purposes.
Monster&newMonster{game->SpawnMonster({},MONSTER_DATA["TestName"])};
player->CheckAndPerformAbility(player->GetAbility1(),testKeyboardInput);
Assert::AreEqual(newMonster.GetHealth(),newMonster.GetMaxHealth(),L"Monster does not take damage from Battlecry normally.");
}
TEST_METHOD(BattleShoutEnchantCheck){
testKey->bHeld=true; //Force the key to be held down for testing purposes.
std::weak_ptr<Item>nullRing{Inventory::AddItem("Null Ring"s)};
Inventory::EquipItem(nullRing,EquipSlot::RING1);
nullRing.lock()->EnchantItem("Battle Shout");
Monster&newMonster{game->SpawnMonster({},MONSTER_DATA["TestName"])};
player->CheckAndPerformAbility(player->GetAbility1(),testKeyboardInput);
Assert::AreEqual(newMonster.GetHealth()-player->GetDefense(),newMonster.GetMaxHealth(),L"Monster takes damage from Battlecry with the Battle Shout enchant equal to 100% of the player's Defense.");
}
};
}

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 3
#define VERSION_BUILD 11074
#define VERSION_BUILD 11075
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -130,6 +130,7 @@ void Warrior::InitializeClassAbilities(){
for(std::shared_ptr<Monster>&m:MONSTER_LIST){
if(m->GetSizeMult()>="Warrior.Ability 1.AffectedSizeRange"_f[0]&&m->GetSizeMult()<="Warrior.Ability 1.AffectedSizeRange"_f[1]&&geom2d::overlaps(geom2d::circle<float>(p->GetPos(),12*"Warrior.Ability 1.Range"_I/100.f),geom2d::circle<float>(m->GetPos(),m->GetSizeMult()*12))){
m->AddBuff(BuffType::SLOWDOWN,"Warrior.Ability 1.SlowdownDuration"_F,"Warrior.Ability 1.SlowdownAmt"_F);
if(p->HasEnchant("Battle Shout"))m->Hurt(p->GetDefense()*"Battle Shout"_ENC["DEFENSE DAMAGE"]/100.f,p->OnUpperLevel(),p->GetZ());
}
}
SoundEffect::PlaySFX("Warrior Battlecry",SoundEffect::CENTERED);

Loading…
Cancel
Save