DamageTypeChanges
This commit is contained in:
@@ -273,16 +273,13 @@ public class DungeonSimulation
|
||||
|
||||
private void MobAttackPlayer(MobInstance mob, PlayerInstance player)
|
||||
{
|
||||
// Determine damage type (physical if mob has no magic damage)
|
||||
var damageType = mob.Stats.MagicDamage > mob.Stats.PhysicalDamage
|
||||
? DataServer.Data.Enums.DamageType.Fire // Use fire for magic mobs (could be configured per mob)
|
||||
: DataServer.Data.Enums.DamageType.Physical;
|
||||
|
||||
// Use mob's configured damage type key
|
||||
string damageTypeKey = mob.Stats.DamageTypeKey ?? "physical";
|
||||
int baseDamage = mob.Stats.PhysicalDamage + mob.Stats.MagicDamage;
|
||||
|
||||
// Calculate damage with resistances
|
||||
var result = CombatCalculator.CalculateMobToPlayerDamage(
|
||||
mob, player, damageType, baseDamage, player.Resistances);
|
||||
mob, player, damageTypeKey, baseDamage, player.Resistances);
|
||||
|
||||
player.Health -= result.FinalDamage;
|
||||
player.IsInCombat = true;
|
||||
@@ -295,6 +292,7 @@ public class DungeonSimulation
|
||||
TargetType = EntityType.Player,
|
||||
TargetId = (int)player.CharacterId,
|
||||
Damage = result.FinalDamage,
|
||||
DamageTypeKey = damageTypeKey,
|
||||
WasResisted = result.WasResisted,
|
||||
WasWeakness = result.WasWeakness
|
||||
});
|
||||
@@ -359,13 +357,13 @@ public class DungeonSimulation
|
||||
float dist = Distance(player.X, player.Y, mob.X, mob.Y);
|
||||
if (dist > 60) return; // Out of range
|
||||
|
||||
// Base damage from stats (would be enhanced by equipped weapon in full implementation)
|
||||
// Use player's weapon damage type (set when loading equipped weapon)
|
||||
string damageTypeKey = player.WeaponDamageTypeKey ?? "physical";
|
||||
int baseDamage = 10 + (int)(player.Strength * 0.5f);
|
||||
var damageType = DataServer.Data.Enums.DamageType.Physical;
|
||||
|
||||
// Calculate damage with mob resistances
|
||||
var result = CombatCalculator.CalculatePlayerToMobDamage(
|
||||
player, mob, damageType, baseDamage);
|
||||
player, mob, damageTypeKey, baseDamage);
|
||||
|
||||
if (result.WasImmune)
|
||||
{
|
||||
@@ -377,6 +375,7 @@ public class DungeonSimulation
|
||||
TargetType = EntityType.Mob,
|
||||
TargetId = mob.Id,
|
||||
Damage = 0,
|
||||
DamageTypeKey = damageTypeKey,
|
||||
WasImmune = true
|
||||
});
|
||||
return;
|
||||
@@ -393,6 +392,7 @@ public class DungeonSimulation
|
||||
TargetType = EntityType.Mob,
|
||||
TargetId = mob.Id,
|
||||
Damage = result.FinalDamage,
|
||||
DamageTypeKey = damageTypeKey,
|
||||
WasResisted = result.WasResisted,
|
||||
WasWeakness = result.WasWeakness
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user