Implement Bloodlust enchant. Fix crash that occurs if the player class is not Warrior or Thief. Release Build 10981.

This commit is contained in:
sigonasr2 2024-08-12 12:27:53 -05:00
parent c017c353db
commit 012f5de2a1
14 changed files with 51 additions and 9 deletions

View File

@ -721,5 +721,34 @@ namespace EnchantTests
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.");
}
TEST_METHOD(BloodlustCheck){
testKey->bHeld=true; //Force the key to be held down for testing purposes.
game->ChangePlayerClass(THIEF);
player=game->GetPlayer();
player->SetBaseStat("Attack",100);
player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput);
MonsterData testMonsterData{"TestName","Test Monster",30,10,5,{MonsterDropData{"Health Potion",100.f,1,1}},200.f};
MONSTER_DATA["TestName"]=testMonsterData;
for(int i:std::ranges::iota_view(0,10)){
Monster testMonster{{},MONSTER_DATA["TestName"]};
testMonster.Hurt(1000,testMonster.OnUpperLevel(),testMonster.GetZ());
}
Assert::AreEqual(100,player->GetAttack(),L"Bloodlust's bonus attack should not be applying here.");
Assert::AreEqual("Thief.Ability 3.Duration"_F,player->GetBuffs(BuffType::ADRENALINE_RUSH)[0].duration,L"Bloodlust's duration increase should not be applying here.");
player->RestoreMana(100);
player->RemoveAllBuffs();
Thief::ability3.charges=1;
std::weak_ptr<Item>nullRing{Inventory::AddItem("Null Ring"s)};
Inventory::EquipItem(nullRing,EquipSlot::RING1);
nullRing.lock()->EnchantItem("Bloodlust");
player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput);
for(int i:std::ranges::iota_view(0,30)){
Monster testMonster{{},MONSTER_DATA["TestName"]};
testMonster.Hurt(1000,testMonster.OnUpperLevel(),testMonster.GetZ());
}
Assert::AreEqual(110,player->GetAttack(),L"Bloodlust's bonus attacks stack only to 10.");
Assert::AreEqual("Thief.Ability 3.Duration"_F+"Bloodlust"_ENC["BUFF TIMER INCREASE"]*30,player->GetBuffs(BuffType::ADRENALINE_RUSH)[0].duration,L"Bloodlust's duration increases per kill.");
}
};
}

View File

@ -50,7 +50,7 @@ enum BuffType{
FIXED_COLLISION_DMG, //Does a fixed amount of collision damage based on intensity of this buff.
COLLISION_KNOCKBACK_STRENGTH, //Causes an amount of knockback based on intensity when hit via collision with this buff
SELF_INFLICTED_SLOWDOWN, //Used for monsters and can't be applied by any player abilities.
ADRENALINE_RUSH,
ADRENALINE_RUSH, //Intensity indicates the stack count (used by the Bloodlust enchant) this buff gives which in turn increases attack.
TRAPPER_MARK,
OVER_TIME,
ONE_OFF,

View File

@ -53,7 +53,7 @@ void EnergyBolt::Update(float fElapsedTime){
lastParticleSpawn="Wizard.Auto Attack.ParticleFrequency"_F;
game->AddEffect(std::make_unique<Effect>(pos,"Wizard.Auto Attack.ParticleLifetimeRange"_FRange,"energy_particle.png",upperLevel,"Wizard.Auto Attack.ParticleSizeRange"_FRange,"Wizard.Auto Attack.ParticleFadeoutTime"_F,vf2d{"Wizard.Auto Attack.ParticleSpeedRange"_FRange,"Wizard.Auto Attack.ParticleSpeedRange"_FRange}));
}
if(distanceTraveled>"Wizard.Auto Attack.Max Range"_F&&IsActivated()){
if(distanceTraveled>"Wizard.Auto Attack.Range"_F&&IsActivated()){
fadeOutTime="Wizard.Auto Attack.BulletHitFadeoutTime"_F;
}
}

View File

@ -55,7 +55,7 @@ void FireBolt::Update(float fElapsedTime){
lastParticleSpawn="Wizard.Ability 1.ParticleFrequency"_F;
game->AddEffect(std::make_unique<Effect>(pos,"Wizard.Ability 1.ParticleLifetimeRange"_FRange,"energy_particle.png",upperLevel,"Wizard.Ability 1.ParticleSizeRange"_FRange,"Wizard.Ability 1.ParticleFadeoutTime"_F,vf2d{"Wizard.Ability 1.ParticleXSpeedRange"_FRange,"Wizard.Ability 1.ParticleYSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.ParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.ParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.ParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.ParticleAlphaRange"_FRange)}));
}
if(distanceTraveled>"Wizard.Ability 1.Max Range"_F&&IsActivated()){
if(distanceTraveled>"Wizard.Ability 1.Range"_F&&IsActivated()){
fadeOutTime="Wizard.Ability 1.BulletHitFadeoutTime"_F;
for(int i=0;i<"Wizard.Ability 1.BulletHitExplosionParticleCount"_I;i++){
game->AddEffect(std::make_unique<Effect>(pos,"Wizard.Ability 1.BulletHitExplosionParticleLifetimeRange"_FRange,"circle.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionParticleSizeRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.BulletHitExplosionParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleAlphaRange"_FRange)}));

View File

@ -72,7 +72,7 @@ void LightningBolt::Update(float fElapsedTime){
}break;
}
}
if(distanceTraveled>"Wizard.Ability 2.Max Range"_F&&IsActivated()){
if(distanceTraveled>"Wizard.Ability 2.Range"_F&&IsActivated()){
fadeOutTime="Wizard.Ability 2.BulletFadeoutTime"_F;
}
}

View File

@ -1011,6 +1011,11 @@ void Monster::OnDeath(){
if(strategyDeathFunc)GameEvent::AddEvent(std::make_unique<MonsterStrategyGameEvent>(strategyDeathFunc,*this,MONSTER_DATA[name].GetAIStrategy()));
if(game->GetPlayer()->HasEnchant("Reaper of Souls"))game->AddEffect(std::make_unique<MonsterSoul>(GetPos(),0.3f,GetSizeMult(),vf2d{},WHITE,0.f,0.f,false));
if(game->GetPlayer()->HasEnchant("Bloodlust")&&game->GetPlayer()->GetBuffs(BuffType::ADRENALINE_RUSH).size()>0){
Buff&adrenalineRushBuff{game->GetPlayer()->EditBuff(BuffType::ADRENALINE_RUSH,0)};
adrenalineRushBuff.duration+="Bloodlust"_ENC["BUFF TIMER INCREASE"];
adrenalineRushBuff.intensity=std::min(int("Bloodlust"_ENC["MAX ATTACK BUFF STACKS"]),int(adrenalineRushBuff.intensity)+1);
}
SpawnDrops();

View File

@ -274,8 +274,10 @@ const int Player::GetMaxMana()const{
}
const int Player::GetAttack()const{
int finalAtk{int(round(GetModdedStatBonuses("Attack")))};
const int originalAtk{int(round(GetModdedStatBonuses("Attack")))};
int finalAtk{originalAtk};
finalAtk+=LastReserveEnchantConditionsMet()?round(GetBaseStat("Attack")*"Last Reserve"_ENC["ATTACK PCT"]/100.f):0;
if(GetBuffs(BuffType::ADRENALINE_RUSH).size()>0)finalAtk+="Bloodlust"_ENC["ATTACK BUFF PCT INCREASE"]/100.f*originalAtk*int(GetBuffs(ADRENALINE_RUSH)[0].intensity);
return finalAtk;
}

View File

@ -62,7 +62,7 @@ void PurpleEnergyBall::Update(float fElapsedTime){
homingTarget.reset();
}
}else homingTarget=Monster::GetNearestMonster(pos,"Witch.Auto Attack.Homing Range"_F,OnUpperLevel(),GetZ());
if(distanceTraveled>"Witch.Auto Attack.Max Range"_F&&IsActivated()){
if(distanceTraveled>"Witch.Auto Attack.Range"_F&&IsActivated()){
fadeOutTime="Witch.Auto Attack.BulletHitFadeoutTime"_F;
}
const vf2d energyBallScale{initialScale.lerp(initialScale*0.9f,cos(12*PI*game->GetRunTime())/2.f+0.5f)};

View File

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

View File

@ -23,6 +23,9 @@ Ranger
ArrowSpd = 275
Sound = Ranger Auto Attack
# NOTE: The Range property is not actually used for Rangers! This just silences an error where the game expects this value to exist!
Range = 100
}
Right Click Ability
{

View File

@ -23,6 +23,9 @@ Trapper
ArrowSpd = 275
Sound = Ranger Auto Attack
# NOTE: The Range property is not actually used for Trappers! This just silences an error where the game expects this value to exist!
Range = 100
}
Right Click Ability

View File

@ -26,7 +26,7 @@ Witch
Homing Turning Radius = 225deg/sec
# Maximum distance this attack will travel before it becomes deactivated.
Max Range = 1200
Range = 1200
# When bullet makes contact, how fast the bullet will fade out.
BulletHitFadeoutTime = 0.2s

View File

@ -22,7 +22,7 @@ Wizard
CancelCast = 0
# Maximum distance this attack will travel before it becomes deactivated.
Max Range = 1000
Range = 1000
# When bullet makes contact, how fast the bullet will fade out.
BulletHitFadeoutTime = 0.2