Skip to content

Commit

Permalink
v0.3.1 release
Browse files Browse the repository at this point in the history
v0.3.1 release

Fixed a bug related to stats weights (Weapon Skill and Weapon damage were stacking at each new stat sim)
  • Loading branch information
Zwyk committed Jan 29, 2020
1 parent a12aeb2 commit 18290a9
Show file tree
Hide file tree
Showing 25 changed files with 573 additions and 1,231 deletions.
44 changes: 31 additions & 13 deletions ClassicCraft/Entities/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,23 +1130,23 @@ public void CalculateAttributes()
{
Attributes += e.Attributes;
}

double wbonus = Attributes.GetValue(Attribute.WeaponDamage);
double wbonusMH = Attributes.GetValue(Attribute.WeaponDamageMH);
double wbonusOH = Attributes.GetValue(Attribute.WeaponDamageOH);
MH.DamageMin += wbonus + wbonusMH;
MH.DamageMax += wbonus + wbonusMH;
MH.DamageMin = MH.BaseMin + wbonus + wbonusMH;
MH.DamageMax = MH.BaseMax + wbonus + wbonusMH;
if (OH != null)
{
OH.DamageMin += wbonus + wbonusOH;
OH.DamageMax += wbonus + wbonusOH;
OH.DamageMin = OH.BaseMin + wbonus + wbonusOH;
OH.DamageMax = OH.BaseMax + wbonus + wbonusOH;
}

if (Class == Classes.Warrior)
{
Attributes.SetValue(Attribute.CritChance, Attributes.GetValue(Attribute.CritChance)
+ 0.01 * GetTalentPoints("Cruelty")
+ 0.03); // Berserker Stance, move elsewhere for stance dancing ?
+ 0.03); // Berserker Stance, should be a spell for stance dancing
}
else if (Class == Classes.Druid)
{
Expand Down Expand Up @@ -1196,16 +1196,34 @@ public void CalculateAttributes()
Attributes.SetValue(Attribute.CritChance, Attributes.GetValue(Attribute.CritChance) + Attributes.GetValue(Attribute.Agility) * AgiToCritRatio(Class));
Attributes.SetValue(Attribute.SpellCritChance, Attributes.GetValue(Attribute.SpellCritChance) + BaseCrit(Class) + Attributes.GetValue(Attribute.Intellect) * IntToCritRatio(Class));

WeaponSkill[Weapon.WeaponType.Axe] += (int)Attributes.GetValue(Attribute.SkillAxe);
int baseSkill = Level * 5;
WeaponSkill = new Dictionary<Weapon.WeaponType, int>();
foreach (Weapon.WeaponType type in (Weapon.WeaponType[])Enum.GetValues(typeof(Weapon.WeaponType)))
{
int skill = baseSkill;

if (Race == Races.Orc && type == Weapon.WeaponType.Axe)
{
skill += 5;
}
else if (Race == Races.Human && (type == Weapon.WeaponType.Mace || type == Weapon.WeaponType.Sword))
{
skill += 5;
}

WeaponSkill[type] = skill;
}

WeaponSkill[Weapon.WeaponType.Axe] += (int)Attributes.GetValue(Attribute.SkillAxe) + (int)Attributes.GetValue(Attribute.Skill1H) + (int)Attributes.GetValue(Attribute.Skill2H);
WeaponSkill[Weapon.WeaponType.Bow] += (int)Attributes.GetValue(Attribute.SkillBow);
WeaponSkill[Weapon.WeaponType.Crossbow] += (int)Attributes.GetValue(Attribute.SkillCrossbow);
WeaponSkill[Weapon.WeaponType.Dagger] += (int)Attributes.GetValue(Attribute.SkillDagger);
WeaponSkill[Weapon.WeaponType.Fist] += (int)Attributes.GetValue(Attribute.SkillFist);
WeaponSkill[Weapon.WeaponType.Dagger] += (int)Attributes.GetValue(Attribute.SkillDagger) + (int)Attributes.GetValue(Attribute.Skill1H);
WeaponSkill[Weapon.WeaponType.Fist] += (int)Attributes.GetValue(Attribute.SkillFist) + (int)Attributes.GetValue(Attribute.Skill1H);
WeaponSkill[Weapon.WeaponType.Gun] += (int)Attributes.GetValue(Attribute.SkillGun);
WeaponSkill[Weapon.WeaponType.Mace] += (int)Attributes.GetValue(Attribute.SkillMace);
WeaponSkill[Weapon.WeaponType.Polearm] += (int)Attributes.GetValue(Attribute.SkillPolearm);
WeaponSkill[Weapon.WeaponType.Staff] += (int)Attributes.GetValue(Attribute.SkillStaff);
WeaponSkill[Weapon.WeaponType.Sword] += (int)Attributes.GetValue(Attribute.SkillSword);
WeaponSkill[Weapon.WeaponType.Mace] += (int)Attributes.GetValue(Attribute.SkillMace) + (int)Attributes.GetValue(Attribute.Skill1H) + (int)Attributes.GetValue(Attribute.Skill2H);
WeaponSkill[Weapon.WeaponType.Polearm] += (int)Attributes.GetValue(Attribute.SkillPolearm) + (int)Attributes.GetValue(Attribute.Skill2H);
WeaponSkill[Weapon.WeaponType.Staff] += (int)Attributes.GetValue(Attribute.SkillStaff) + (int)Attributes.GetValue(Attribute.Skill2H);
WeaponSkill[Weapon.WeaponType.Sword] += (int)Attributes.GetValue(Attribute.SkillSword) + (int)Attributes.GetValue(Attribute.Skill1H) + (int)Attributes.GetValue(Attribute.Skill2H);
WeaponSkill[Weapon.WeaponType.Throwable] += (int)Attributes.GetValue(Attribute.SkillThrowable);

HasteMod = CalcHaste();
Expand Down
5 changes: 5 additions & 0 deletions ClassicCraft/Items/Attribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public static string ToString(Attribute a)
default: throw new Exception("Attribute not found");
}
}

public static Attribute FromWeaponType(Weapon.WeaponType w)
{
return FromString(Weapon.TypeToString(w));
}
}

public class Attributes
Expand Down
14 changes: 12 additions & 2 deletions ClassicCraft/Items/Weapons/Weapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ public static WeaponType StringToType(string s)
}
}

public static WeaponType FromAttribute(Attribute a)
{
return StringToType(AttributeUtil.ToString(a));
}

public double BaseMin { get; set; }
public double BaseMax { get; set; }
public double DamageMin { get; set; }
public double DamageMax { get; set; }
public double Speed { get; set; }
Expand All @@ -71,7 +78,7 @@ public double Dps
{
get
{
return ((double)DamageMin + DamageMax) / 2 * Speed;
return (DamageMin + DamageMax) / 2 * Speed;
}
}

Expand All @@ -87,10 +94,13 @@ public Weapon(double min = 1, double max = 2, double speed = 1, bool twoHanded =

if (Buff != null && Buff.Attributes.GetValue(Attribute.WeaponDamage) > 0)
{
int bonus = (int)Math.Round(Buff.Attributes.GetValue(Attribute.WeaponDamage));
double bonus = Buff.Attributes.GetValue(Attribute.WeaponDamage);
DamageMin += bonus;
DamageMax += bonus;
}

BaseMin = DamageMin;
BaseMax = DamageMax;
}

public override string ToString()
Expand Down
64 changes: 55 additions & 9 deletions ClassicCraft/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,15 @@ class Program
private static List<double> ErrorList = new List<double>();

public static string logs = "";

public static string lastDebug = "";

public static List<string> simOrder = new List<string>(){ "Base", "+50 AP", /*"+1% Hit", "+1% Crit", "+1% Haste", "+50 Int", "+50 Spi",*/ "+10 DPS MH", "+10 DPS OH" };
public static List<string> simOrder = new List<string>(){
"Base",
"+50 AP",
"+1% Hit","+1% Crit", "+1% Haste", "+50 Int", "+50 Spi",
"+10 DPS MH", "+10 DPS OH",
"+5 MH Skill", "+5 OH Skill"
//"1","2","3","4","5","6","7","8","9",
};
public static Dictionary<string, Attributes> simBonusAttribs = new Dictionary<string, Attributes>()
{
{ "Base", new Attributes() },
Expand All @@ -101,7 +106,7 @@ class Program
})},
{ "+50 AP", new Attributes(new Dictionary<Attribute, double>()
{
{ Attribute.AP, 0 }
{ Attribute.AP, 50 }
})},
{ "+50 Int", new Attributes(new Dictionary<Attribute, double>()
{
Expand All @@ -113,12 +118,25 @@ class Program
})},
{ "+10 DPS MH", new Attributes(new Dictionary<Attribute, double>()
{
{ Attribute.WeaponDamageMH, 0 }
{ Attribute.WeaponDamageMH, 10 }
})},
{ "+10 DPS OH", new Attributes(new Dictionary<Attribute, double>()
{
{ Attribute.WeaponDamageOH, 0 }
{ Attribute.WeaponDamageOH, 10 }
})},
{ "+5 MH Skill", new Attributes(new Dictionary<Attribute, double>()) },
{ "+5 OH Skill", new Attributes(new Dictionary<Attribute, double>()) },
/*
{ "1", new Attributes(new Dictionary<Attribute, double>()) },
{ "2", new Attributes(new Dictionary<Attribute, double>()) },
{ "3", new Attributes(new Dictionary<Attribute, double>()) },
{ "4", new Attributes(new Dictionary<Attribute, double>()) },
{ "5", new Attributes(new Dictionary<Attribute, double>()) },
{ "6", new Attributes(new Dictionary<Attribute, double>()) },
{ "7", new Attributes(new Dictionary<Attribute, double>()) },
{ "8", new Attributes(new Dictionary<Attribute, double>()) },
{ "9", new Attributes(new Dictionary<Attribute, double>()) },
*/
};

static void Main(string[] args)
Expand Down Expand Up @@ -168,10 +186,16 @@ static void Main(string[] args)
if(!playerBase.DualWielding)
{
simOrder.Remove("+10 DPS OH");
simOrder.Remove("+5 OH Skill");
}
else if(playerBase.MH.Type == playerBase.OH.Type)
{
simOrder.Remove("+5 OH Skill");
}
if(playerBase.Class == Player.Classes.Druid)
{
simOrder.Remove("+10 DPS MH");
simOrder.Remove("+5 MH Skill");
}

if (simOrder.Contains("+10 DPS MH"))
Expand All @@ -182,6 +206,14 @@ static void Main(string[] args)
{
simBonusAttribs["+10 DPS OH"].SetValue(Attribute.WeaponDamageOH, simBonusAttribs["+10 DPS OH"].GetValue(Attribute.WeaponDamageOH) / playerBase.OH.Speed);
}
if (simOrder.Contains("+5 MH Skill"))
{
simBonusAttribs["+5 MH Skill"].SetValue(AttributeUtil.FromWeaponType(playerBase.MH.Type), 5);
}
if (simOrder.Contains("+5 OH Skill"))
{
simBonusAttribs["+5 OH Skill"].SetValue(AttributeUtil.FromWeaponType(playerBase.OH.Type), 5);
}

// Talents
playerBase.Talents = new Dictionary<string, int>();
Expand Down Expand Up @@ -421,7 +453,7 @@ static void Main(string[] args)
ErrorList.Add(Stats.ErrorPct(CurrentDpsList.ToArray(), CurrentDpsList.Average()));
ResultsList.Add(simOrder[done], CurrentResults);
DamagesList.Add(simOrder[done], CurrentDpsList);
Log(simOrder[done] + " : " + CurrentDpsList.Average());
//Log(simOrder[done] + " : " + CurrentDpsList.Average());
}

if (!logFight)
Expand Down Expand Up @@ -521,14 +553,28 @@ static void Main(string[] args)
double mhDps = DamagesList["+10 DPS MH"].Average();
double mhDif = (mhDps - baseDps) / simBonusAttribs["+10 DPS MH"].GetValue(Attribute.WeaponDamageMH);
if (mhDif < 0) mhDif = 0;
Log(string.Format("1 MH DPS = {0:N4} DPS = {1:N4} AP", mhDif, mhDif / apDif));
Log(string.Format("+1 MH DPS = {0:N4} DPS = {1:N4} AP", mhDif, mhDif / apDif));
}
if (simOrder.Contains("+10 DPS OH"))
{
double ohDps = DamagesList["+10 DPS OH"].Average();
double ohDif = (ohDps - baseDps) / simBonusAttribs["+10 DPS OH"].GetValue(Attribute.WeaponDamageOH);
if (ohDif < 0) ohDif = 0;
Log(string.Format("1 OH DPS = {0:N4} DPS = {1:N4} AP", ohDif, ohDif / apDif));
Log(string.Format("+1 OH DPS = {0:N4} DPS = {1:N4} AP", ohDif, ohDif / apDif));
}
if (simOrder.Contains("+5 MH Skill"))
{
double mhSkillDps = DamagesList["+5 MH Skill"].Average();
double mhSkillDif = mhSkillDps - baseDps;
if (mhSkillDif < 0) mhSkillDif = 0;
Log(string.Format("+5 MH Skill = {0:N4} DPS = {1:N4} AP", mhSkillDif, mhSkillDif / apDif));
}
if (simOrder.Contains("+5 OH Skill"))
{
double ohSkillDps = DamagesList["+5 OH Skill"].Average();
double ohSkillDif = ohSkillDps - baseDps;
if (ohSkillDif < 0) ohSkillDif = 0;
Log(string.Format("+5 OH Skill = {0:N4} DPS = {1:N4} AP", ohSkillDif, ohSkillDif / apDif));
}
}
else if (nbSim >= 1)
Expand Down
10 changes: 2 additions & 8 deletions ClassicCraft/Simulation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ public Simulation(Player player, Boss boss, double fightLength, bool autoBossLif

public void StartSim()
{
if (Program.lastDebug != Player.ToString())
{
Program.lastDebug = Player.ToString();
Program.Debug(Player.ToString());
}

switch (Player.Class)
{
case Player.Classes.Warrior: Warrior(); break;
Expand All @@ -75,7 +69,7 @@ public void StartSim()
private void Rogue()
{
autos.Add(new AutoAttack(Player, Player.MH, true));
if (Player.OH != null)
if (Player.DualWielding)
{
autos.Add(new AutoAttack(Player, Player.OH, false));
}
Expand Down Expand Up @@ -324,7 +318,7 @@ private void Druid()
private void Warrior()
{
autos.Add(new AutoAttack(Player, Player.MH, true));
if (Player.OH != null)
if (Player.DualWielding)
{
autos.Add(new AutoAttack(Player, Player.OH, false));
}
Expand Down
Binary file modified ClassicCraft/bin/Debug/ClassicCraft.exe
Binary file not shown.
Binary file modified ClassicCraft/bin/Debug/ClassicCraft.pdb
Binary file not shown.
28 changes: 13 additions & 15 deletions ClassicCraft/logs.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
Date : 2020/01/16 22:51:01
Date : 2020/01/29 17:39:18

Fight length : 120 seconds (±20%)

Player :
Undead Rogue level 60 | Stats : [Strength:227][Agility:460][Stamina:76][Intellect:37][Spirit:59][Health:2103][Mana:0][CritChance:31,86][HitChance:10][Haste:0][SpellHitChance:0][SpellCritChance:0][AP:1130][SkillSword:5][SkillDagger:5][RangedAP:2050]
Undead Rogue level 60 | Stats : [Strength:227][Agility:460][Stamina:76][Intellect:37][Spirit:59][Health:2103][Mana:0][AP:1230][RangedAP:2150][CritChance:31,86][HitChance:10][Haste:0][SpellHitChance:0][SpellCritChance:0][SkillSword:5][SkillDagger:5]
Main weapon : Sword with 305 skill

Boss (after raid debuffs) :
Level 63, 336 Armor (5,76% mitigation)

Base : 635,099716423339
+50 AP : 640,73618641566
+10 DPS MH : 645,364797285606
+10 DPS OH : 652,637477147914

24387 simulations done in 19 189,62 ms, for 0,79 ms by sim
50015 simulations done in 39 816,94 ms, for 0,80 ms by sim
Overall accuracy of results : ±0,17%

Base : 635,10 DPS
Base : 641,83 DPS

Weights by DPS :
635,099716423339 -> 640,73618641566
1 AP = 0,1127 DPS
1 Str = 0,1127 DPS = 1,0000 AP
635,099716423339 -> 645,364797285606
1 MH DPS = ∞ DPS = ∞ AP
635,099716423339 -> 652,637477147914
1 OH DPS = ∞ DPS = ∞ AP
1 AP = 0,2516 DPS
1 Str = 0,2516 DPS = 1,0000 AP
1 Agi = 0,4798 DPS = 1,9066 AP
1% Crit = 6,6158 DPS = 26,2924 AP
1% Hit = 4,5856 DPS = 18,2241 AP
1% Haste = 3,3652 DPS = 13,3739 AP
+1 MH DPS = 0,9036 DPS = 3,5912 AP
+1 OH DPS = 0,1185 DPS = 0,4711 AP
+5 MH Skill = 5,0750 DPS = 20,1693 AP
Binary file modified ClassicCraft/obj/Debug/ClassicCraft.exe
Binary file not shown.
Binary file modified ClassicCraft/obj/Debug/ClassicCraft.pdb
Binary file not shown.
Binary file modified releases/v0.3.1/ClassicCraft/ClassicCraft.exe
Binary file not shown.
40 changes: 0 additions & 40 deletions releases/v0.3.1/ClassicCraft/Logs/Example log - Rogue Dagger.txt

This file was deleted.

Loading

0 comments on commit 18290a9

Please sign in to comment.