mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-08 09:08:26 +00:00
Grim LU
Wincent's attempt at making LU into something it isn't supposed to be, an ARPG.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "DestroyableComponent.h"
|
||||
#include "BehaviorContext.h"
|
||||
#include "eBasicAttackSuccessTypes.h"
|
||||
#include "DamageProfile.h"
|
||||
|
||||
void BasicAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||
if (context->unmanaged) {
|
||||
@@ -101,6 +102,17 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
||||
totalDamageDealt = this->m_MinDamage;
|
||||
}
|
||||
|
||||
auto* source = EntityManager::Instance()->GetEntity(context->originator);
|
||||
|
||||
auto* damageProfile = DamageProfile::FindDamageProfile(context->skillID);
|
||||
|
||||
auto damageMap = destroyableComponent->ComputeDamage(totalDamageDealt, source, damageProfile);
|
||||
|
||||
// Apply a standard diviation of (+/-)20%
|
||||
for (auto& damage : damageMap) {
|
||||
damage.second = static_cast<uint32_t>(damage.second * (1.0f + (static_cast<float>(rand() % 40) / 100.0f) - 0.2f));
|
||||
}
|
||||
|
||||
bool died{};
|
||||
if (!bitStream->Read(died)) {
|
||||
Game::logger->Log("BasicAttackBehavior", "Unable to read died");
|
||||
@@ -109,7 +121,8 @@ void BasicAttackBehavior::DoHandleBehavior(BehaviorContext* context, RakNet::Bit
|
||||
auto previousArmor = destroyableComponent->GetArmor();
|
||||
auto previousHealth = destroyableComponent->GetHealth();
|
||||
PlayFx(u"onhit", targetEntity->GetObjectID());
|
||||
destroyableComponent->Damage(totalDamageDealt, context->originator, context->skillID);
|
||||
destroyableComponent->Damage(damageMap, context->originator, context->skillID);
|
||||
//destroyableComponent->Damage(totalDamageDealt, context->originator, context->skillID);
|
||||
}
|
||||
|
||||
uint8_t successState{};
|
||||
@@ -191,10 +204,28 @@ void BasicAttackBehavior::DoBehaviorCalculation(BehaviorContext* context, RakNet
|
||||
const uint32_t previousHealth = destroyableComponent->GetHealth();
|
||||
const uint32_t previousArmor = destroyableComponent->GetArmor();
|
||||
|
||||
const auto damage = this->m_MinDamage;
|
||||
auto damage = this->m_MinDamage;
|
||||
|
||||
auto* source = EntityManager::Instance()->GetEntity(context->originator);
|
||||
|
||||
auto* damageProfile = DamageProfile::FindDamageProfile(context->skillID);
|
||||
|
||||
if (damageProfile != nullptr) {
|
||||
Game::logger->Log("BasicAttackBehavior", "Found damage profile for skill %i, originator %i", context->skillID, source->GetLOT());
|
||||
}
|
||||
else {
|
||||
Game::logger->Log("BasicAttackBehavior", "No damage profile found for skill %i, originator %i", context->skillID, source->GetLOT());
|
||||
}
|
||||
|
||||
auto damageMap = destroyableComponent->ComputeDamage(damage, source, damageProfile);
|
||||
|
||||
// Apply a standard diviation of (+/-)20%
|
||||
for (auto& damage : damageMap) {
|
||||
damage.second = static_cast<uint32_t>(damage.second * (1.0f + (static_cast<float>(rand() % 40) / 100.0f) - 0.2f));
|
||||
}
|
||||
|
||||
PlayFx(u"onhit", targetEntity->GetObjectID(), 1);
|
||||
destroyableComponent->Damage(damage, context->originator, context->skillID, false);
|
||||
destroyableComponent->Damage(damageMap, context->originator, context->skillID, false);
|
||||
context->ScheduleUpdate(branch.target);
|
||||
|
||||
const uint32_t armorDamageDealt = previousArmor - destroyableComponent->GetArmor();
|
||||
|
||||
@@ -361,7 +361,7 @@ void Behavior::PlayFx(std::u16string type, const LWOOBJID target, const LWOOBJID
|
||||
"SELECT effectName FROM BehaviorEffect WHERE effectType = ? AND effectID = ?;");
|
||||
|
||||
auto idQuery = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT effectName, effectType FROM BehaviorEffect WHERE effectID = ?;");
|
||||
"SELECT effectName, effectType FROM BehaviorEffect WHERE effectID = ? AND effectType IS NOT NULL;");
|
||||
|
||||
if (!type.empty()) {
|
||||
typeQuery.bind(1, typeString.c_str());
|
||||
|
||||
@@ -78,6 +78,8 @@ struct BehaviorContext
|
||||
|
||||
LWOOBJID caster = LWOOBJID_EMPTY;
|
||||
|
||||
LWOOBJID itemID = LWOOBJID_EMPTY;
|
||||
|
||||
uint32_t GetUniqueSkillId() const;
|
||||
|
||||
void UpdatePlayerSyncs(float deltaTime);
|
||||
|
||||
@@ -26,9 +26,16 @@ void BuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
|
||||
return;
|
||||
}
|
||||
|
||||
component->AddStat(StatProperty(eStatTypes::Health, eStatModifier::Absolute, this->m_health * BASE_MULTIPLIER));
|
||||
component->AddStat(StatProperty(eStatTypes::Armor, eStatModifier::Absolute, this->m_armor * BASE_MULTIPLIER));
|
||||
//component->AddStat(StatProperty(eStatTypes::Imagination, eStatModifier::Absolute, this->m_imagination * BASE_MULTIPLIER));
|
||||
|
||||
/*
|
||||
component->SetMaxHealth(component->GetMaxHealth() + this->m_health);
|
||||
component->SetMaxArmor(component->GetMaxArmor() + this->m_armor);
|
||||
component->SetMaxImagination(component->GetMaxImagination() + this->m_imagination);
|
||||
*/
|
||||
component->SetMaxImagination(component->GetMaxImagination() + this->m_imagination);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
|
||||
@@ -60,9 +67,16 @@ void BuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch
|
||||
return;
|
||||
}
|
||||
|
||||
component->RemoveStat(StatProperty(eStatTypes::Health, eStatModifier::Absolute, this->m_health * BASE_MULTIPLIER));
|
||||
component->RemoveStat(StatProperty(eStatTypes::Armor, eStatModifier::Absolute, this->m_armor * BASE_MULTIPLIER));
|
||||
//component->RemoveStat(StatProperty(eStatTypes::Imagination, eStatModifier::Absolute, this->m_imagination * BASE_MULTIPLIER));
|
||||
|
||||
/*
|
||||
component->SetMaxHealth(component->GetMaxHealth() - this->m_health);
|
||||
component->SetMaxArmor(component->GetMaxArmor() - this->m_armor);
|
||||
component->SetMaxImagination(component->GetMaxImagination() - this->m_imagination);
|
||||
*/
|
||||
component->SetMaxImagination(component->GetMaxImagination() - this->m_imagination);
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void DamageAbsorptionBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
|
||||
return;
|
||||
}
|
||||
|
||||
destroyable->SetDamageToAbsorb(static_cast<uint32_t>(destroyable->GetDamageToAbsorb()) + this->m_absorbAmount);
|
||||
destroyable->SetDamageToAbsorb(static_cast<uint32_t>(destroyable->GetDamageToAbsorb()) + this->m_absorbAmount * 50);
|
||||
|
||||
destroyable->SetIsShielded(true);
|
||||
|
||||
@@ -50,7 +50,7 @@ void DamageAbsorptionBehavior::Timer(BehaviorContext* context, BehaviorBranchCon
|
||||
|
||||
const auto present = static_cast<uint32_t>(destroyable->GetDamageToAbsorb());
|
||||
|
||||
const auto toRemove = std::min(present, this->m_absorbAmount);
|
||||
const auto toRemove = std::min(present, this->m_absorbAmount * 50);
|
||||
|
||||
destroyable->SetDamageToAbsorb(present - toRemove);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "DestroyableComponent.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "LevelProgressionComponent.h"
|
||||
|
||||
|
||||
void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
@@ -24,7 +25,18 @@ void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_strea
|
||||
return;
|
||||
}
|
||||
|
||||
destroyable->Heal(this->m_health);
|
||||
int32_t toApply = this->m_health * 5;
|
||||
|
||||
auto* levelProgressComponent = entity->GetComponent<LevelProgressionComponent>();
|
||||
|
||||
if (levelProgressComponent != nullptr) {
|
||||
toApply *= levelProgressComponent->GetLevel();
|
||||
}
|
||||
|
||||
// Apply a standard deviations of 20%
|
||||
toApply = static_cast<uint32_t>(toApply * (1.0f + (static_cast<float>(rand() % 40) / 100.0f) - 0.2f));
|
||||
|
||||
destroyable->Heal(toApply);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "dLogger.h"
|
||||
#include "Game.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "LevelProgressionComponent.h"
|
||||
|
||||
void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(branch.target);
|
||||
@@ -24,7 +25,18 @@ void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_str
|
||||
return;
|
||||
}
|
||||
|
||||
destroyable->Repair(this->m_armor);
|
||||
int32_t toApply = this->m_armor * 5;
|
||||
|
||||
auto* levelProgressComponent = entity->GetComponent<LevelProgressionComponent>();
|
||||
|
||||
if (levelProgressComponent != nullptr) {
|
||||
toApply *= levelProgressComponent->GetLevel();
|
||||
}
|
||||
|
||||
// Apply a standard deviations of 20%
|
||||
toApply = static_cast<uint32_t>(toApply * (1.0f + (static_cast<float>(rand() % 40) / 100.0f) - 0.2f));
|
||||
|
||||
destroyable->Repair(toApply);
|
||||
}
|
||||
|
||||
void RepairBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
|
||||
|
||||
@@ -39,7 +39,7 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
|
||||
return;
|
||||
}
|
||||
|
||||
combatAiComponent->Stun(branch.duration);
|
||||
combatAiComponent->Stun(branch.duration / 2.0f);
|
||||
}
|
||||
|
||||
void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
|
||||
|
||||
Reference in New Issue
Block a user