I'm building a Diablo clone using Unreal Engine 4 and have been having trouble wrapping my head around how the combat calculations should work. I copied a lot of the core stats from the original diablo game as a starting point.
Visited Websites:
How to develop RPG Damage Formulas?
http://diablo.blizzpro.com/2014/05/17/basic-theorycrafting-damage-formula/
https://diablo.fandom.com/wiki/Damage
http://diablo3blog.blogspot.com/p/diablo-3-damage-explanation-and-guides.html
So for the data model, I'm storing the character stats in a struct called PlayerStatsStruct.h. I also set some limits for how high the stats could go.
PlayerStatsStruct.h:
USTRUCT()
struct FPlayerStatsStruct {
GENERATED_USTRUCT_BODY()
FPlayerStatsStruct();
UPROPERTY(EditAnywhere)
FString Name;
UPROPERTY(EditAnywhere)
float TotalExperience;
UPROPERTY(EditAnywhere)
int32 Strength; // MAX OF 99
UPROPERTY(EditAnywhere)
int32 Dexterity; // MAX OF 99
UPROPERTY(EditAnywhere)
int32 Vitality; // MAX OF 99
UPROPERTY(EditAnywhere)
int32 Magic; // MAX OF 99
UPROPERTY(EditAnywhere)
int32 Agility; // MAX OF 99
UPROPERTY(EditAnywhere)
float Health; // MAX OF 1000
UPROPERTY(EditAnywhere)
float Mana; // MAX OF 1000
UPROPERTY(EditAnywhere)
bool Invulnerable;
};
Here is the struct I'm using for every monster.
MonsterStatsStruct.h
USTRUCT()
struct FMonsterStatsStruct {
GENERATED_USTRUCT_BODY()
FMonsterStatsStruct();
UPROPERTY(EditAnywhere)
FString Name;
UPROPERTY(EditAnywhere)
int32 Level;
UPROPERTY(EditAnywhere)
float Health; // MAX OF 1000
UPROPERTY(EditAnywhere)
float Defense;
UPROPERTY(EditAnywhere)
float AttackSpeed;
UPROPERTY(EditAnywhere)
float AttackDamageMin;
UPROPERTY(EditAnywhere)
float AttackDamageMax;
UPROPERTY(EditAnywhere)
float MovementSpeeed;
};
I made these formulas for determining the current Max Mana and Max Health like so:
MaxHealth = 218.f * FMath::Loge(Stats->Vitality) // MAX OF 1000 when Vitality is 99
MaxMana = 218.f * FMath::Loge(Stats->Magic) // MAX OF 1000 when Magic is 99
The main things that I'm stuck on are:
- How do I determine the net damage inflicted on an enemy given both the Player Stats and the Enemy stats?
- What exactly does defense do in combat?
- How is dexterity related to defense?
I think at large the concept is this right?: TotalDamageToEnemy = PlayerAttack - Enemy Defense
The problem is that the concept of defense is really abstract to me right now.
Thanks for your help.