Sonic Upgrade Enchant implemented.
This commit is contained in:
parent
beb8e38b36
commit
220bf9d655
@ -1136,5 +1136,30 @@ namespace EnchantTests
|
|||||||
game->OnUserUpdate(5.f);
|
game->OnUserUpdate(5.f);
|
||||||
Assert::IsTrue(newMonster.CanMove(),L"Monster should no longer be stunned.");
|
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_ptr<Item>nullRing{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).");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ void Monster::Draw()const{
|
|||||||
const float finalSpriteRot=HasFourWaySprites()?0.f:spriteRot; //Prevent 4-way sprites from being rotated.
|
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())};
|
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 vf2d glowPurpleImageScale{imageScale*1.1f};
|
||||||
|
|
||||||
const auto DrawBaseMonster=[&](vf2d scale={1.f,1.f},Pixel col=WHITE){
|
const auto DrawBaseMonster=[&](vf2d scale={1.f,1.f},Pixel col=WHITE){
|
||||||
|
@ -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<Ability>&a:GetAbilities()){
|
for(const std::reference_wrapper<Ability>&a:GetAbilities()){
|
||||||
if(a.get().itemAbility)continue;
|
if(a.get().itemAbility)continue;
|
||||||
if(a.get().charges<a.get().MAX_CHARGES&&a.get().cooldown==0.f)a.get().cooldown=a.get().GetCooldownTime();
|
if(a.get().charges<a.get().MAX_CHARGES&&a.get().cooldown==0.f)a.get().cooldown=a.get().GetCooldownTime();
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 3
|
#define VERSION_PATCH 3
|
||||||
#define VERSION_BUILD 11094
|
#define VERSION_BUILD 11097
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -173,7 +173,9 @@ void Warrior::InitializeClassAbilities(){
|
|||||||
p->UpdateAnimation("WARRIOR_SWINGSONICSWORD_S",WARRIOR);
|
p->UpdateAnimation("WARRIOR_SWINGSONICSWORD_S",WARRIOR);
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
BULLET_LIST.push_back(std::make_unique<Bullet>(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<Bullet>(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);
|
game->SetupWorldShake("Warrior.Ability 3.ShakeTime"_F);
|
||||||
if(p->HasEnchant("Sword Enchantment"))p->AddBuff(BuffType::SWORD_ENCHANTMENT,"Sword Enchantment"_ENC["INCREASE DURATION"],1);
|
if(p->HasEnchant("Sword Enchantment"))p->AddBuff(BuffType::SWORD_ENCHANTMENT,"Sword Enchantment"_ENC["INCREASE DURATION"],1);
|
||||||
SoundEffect::PlaySFX("Warrior Sonic Slash",SoundEffect::CENTERED);
|
SoundEffect::PlaySFX("Warrior Sonic Slash",SoundEffect::CENTERED);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user