Implemented Improved Ground Slam Enchant.

pull/65/head
sigonasr2 6 months ago
parent 97453baf61
commit ea752c14c6
  1. 25
      Adventures in Lestoria Tests/EnchantTests.cpp
  2. 12
      Adventures in Lestoria/Player.cpp
  3. 2
      Adventures in Lestoria/Version.h

@ -1028,5 +1028,30 @@ namespace EnchantTests
game->OnUserUpdate(8.f);
Assert::AreEqual(1.5f,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.
player->CheckAndPerformAbility(player->GetAbility2(),testKeyboardInput);
Monster&newMonster{game->SpawnMonster({},MONSTER_DATA["TestName"])};
game->OnUserUpdate(0.f);
game->SetElapsedTime(1.f);
game->OnUserUpdate(1.f);
game->OnUserUpdate(0.f);
Assert::AreEqual(975,newMonster.GetHealth(),L"Monsters take normal damage from Ground Slam.");
}
TEST_METHOD(ImprovedGroundSlamEnchantCheck){
testKey->bHeld=true; //Force the key to be held down for testing purposes.
std::weak_ptr<Item>nullRing{Inventory::AddItem("Null Ring"s)};
std::weak_ptr<Item>leatherArmor{Inventory::AddItem("Leather Armor"s)};
Inventory::EquipItem(nullRing,EquipSlot::RING1);
Inventory::EquipItem(leatherArmor,EquipSlot::ARMOR);
nullRing.lock()->EnchantItem("Improved Ground Slam");
player->CheckAndPerformAbility(player->GetAbility2(),testKeyboardInput);
Monster&newMonster{game->SpawnMonster({},MONSTER_DATA["TestName"])};
game->OnUserUpdate(0.f);
game->SetElapsedTime(1.f);
game->OnUserUpdate(1.f);
game->OnUserUpdate(0.f);
Assert::AreEqual(973,newMonster.GetHealth(),L"Monsters take extra damage from defense from Improved Ground Slam.");
}
};
}

@ -465,7 +465,15 @@ void Player::Update(float fElapsedTime){
spin_angle=0;
z=0;
float numb=4;
const HurtList&hitEnemies=game->Hurt(pos,"Warrior.Ability 2.Range"_F/100*12,int(GetAttack()*"Warrior.Ability 2.DamageMult"_F),OnUpperLevel(),0,HurtType::MONSTER,HurtFlag::PLAYER_ABILITY);
float groundSlamVisualRange{"Warrior.Ability 2.Range"_F/300*1.33f};
float groundSlamRange{"Warrior.Ability 2.Range"_F/100*12};
int groundSlamDamage{int(GetAttack()*"Warrior.Ability 2.DamageMult"_F)};
if(HasEnchant("Improved Ground Slam")){
groundSlamVisualRange+=groundSlamVisualRange*"Improved Ground Slam"_ENC["GROUND SLAM RADIUS INCREASE"]/100.f;
groundSlamRange+=groundSlamRange*"Improved Ground Slam"_ENC["GROUND SLAM RADIUS INCREASE"]/100.f;
groundSlamDamage+=GetDefense()*"Improved Ground Slam"_ENC["DEFENSE DAMAGE"]/100.f;
}
const HurtList&hitEnemies=game->Hurt(pos,groundSlamRange,groundSlamDamage,OnUpperLevel(),0,HurtType::MONSTER,HurtFlag::PLAYER_ABILITY);
#pragma region Knockback effect
for(auto&[targetPtr,wasHurt]:hitEnemies){
if(!std::holds_alternative<Monster*>(targetPtr))ERR("WARNING! A hurt request list was expecting only monster pointers, but got another type instead! THIS SHOULD NOT BE HAPPENING!");
@ -483,7 +491,7 @@ void Player::Update(float fElapsedTime){
monsterPtr->Knockback(vf2d{knockbackAmt,knockbackDir}.cart());
}
#pragma endregion
game->AddEffect(std::make_unique<Effect>(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"ground-slam-attack-front.png",upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F),std::make_unique<Effect>(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"ground-slam-attack-back.png",upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F));
game->AddEffect(std::make_unique<Effect>(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"ground-slam-attack-front.png",upperLevel,groundSlamVisualRange,"Warrior.Ability 2.EffectFadetime"_F),std::make_unique<Effect>(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"ground-slam-attack-back.png",upperLevel,groundSlamVisualRange,"Warrior.Ability 2.EffectFadetime"_F));
SoundEffect::PlaySFX("Warrior Ground Slam",SoundEffect::CENTERED);
}
if(lastAnimationFlip>0){

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

Loading…
Cancel
Save