//just to make the previous shorter protected void CalculateDerivedShorten(bool randomNpcMonster, DerivedStatTypes statType, byte createrType) { if (!randomNpcMonster) { //collect all the stats GetGear(statType, createrType); } GetBuffs(statType, createrType); }
//gear for none randoms private void GetGear(DerivedStatTypes statType, byte createrType) { if (createrType == 0) { GetGearPlayer(statType); } else if (createrType == 1) { GetGearNpc(statType); } else if (createrType == 2) { } }
protected void GetBuffsMonster(DerivedStatTypes statType) { switch (statType) { case (DerivedStatTypes.AttackPower): case (DerivedStatTypes.Speed): case (DerivedStatTypes.PhyDmgNeg): case (DerivedStatTypes.HealthPoints): case (DerivedStatTypes.ManaPoints): case (DerivedStatTypes.MagicPower): case (DerivedStatTypes.MagDmgNeg): break; } }
//acts as gear for the randoms and monsters protected void GetRndBuffs(byte level, DerivedStatTypes statType) { switch (statType) { case (DerivedStatTypes.AttackPower): case (DerivedStatTypes.MagicPower): case (DerivedStatTypes.PhyDmgNeg): case (DerivedStatTypes.MagDmgNeg): modifer = (long)Random.Range(modifer - .75f * level, modifer + 1.5f * level); if (modifer > 255) { modifer = 255; } break; case (DerivedStatTypes.Speed): modifer = (long)Random.Range(modifer - .15f * level, modifer + .3f * level); if (modifer > 255) { modifer = 255; } break; case (DerivedStatTypes.HealthPoints): case (DerivedStatTypes.ManaPoints): modifer = (long)Random.Range(modifer - 5 * level, modifer + 10 * level); if (modifer > 9999) { modifer = 9999; } break; } if (modifer < 1) { modifer = 1; } }
public ushort CalculateRndDerivedStatUshort(byte statValSta, byte level, byte createrType, DerivedStatTypes statType) { CalculateDerivedShorten(true, statType, createrType); CalcDerived(statValSta, statType); GetRndBuffs(level, statType); return((ushort)modifer); }
//max health public ushort CalculateDerivedStatUshort(byte statValSta, byte createrType, DerivedStatTypes statType) { CalculateDerivedShorten(false, statType, createrType); CalcDerived(statValSta, statType); return((ushort)modifer); }
//other derived stats public byte CalculateDerivedStatByte(byte statVal, byte createrType, DerivedStatTypes statType) { CalculateDerivedShorten(false, statType, createrType); CalcDerived(statVal, statType); return((byte)modifer); }
public byte CalculateRndDerivedStatByte(byte statVal, byte level, byte createrType, DerivedStatTypes statType) { CalculateDerivedShorten(true, statType, createrType); CalcDerived(statVal, statType); GetRndBuffs(level, statType); return((byte)modifer); }
//deriving other stats protected void CalcDerived(byte statVal, DerivedStatTypes statType) { byte low = 5, high = 100, mod = 1; bool isHP = false; int stats = 0, deriv = 0; switch (statType) { case (DerivedStatTypes.AttackPower): stats = statVal + gearStr + gearStr; deriv = gearAttPow + buffAttPow; low = 5; high = 100; mod = 1; break; case (DerivedStatTypes.MagicPower): stats = statVal + gearInt + buffInt; deriv = gearMagPow + buffMagPow; low = 5; high = 100; mod = 1; break; case (DerivedStatTypes.Speed): stats = statVal + gearAgi + buffAgi; deriv = gearSpe + buffSpe; low = 40; high = 100; mod = 1; break; case (DerivedStatTypes.PhyDmgNeg): stats = statVal + gearVit + buffVit; deriv = gearPhyDmgNeg + buffPhyDmgNeg; low = 20; high = 100; mod = 1; break; case (DerivedStatTypes.MagDmgNeg): stats = statVal + gearSpi + buffSpi; deriv = gearMagDmgNeg + buffMagDmgNeg; low = 20; high = 100; mod = 1; break; case (DerivedStatTypes.HealthPoints): stats = statVal + gearSta + buffSta; deriv = gearHP + buffHP; low = 6; high = 100; mod = 10; isHP = true; break; } if (stats < 1) { stats = 1; //just a safety net 2 * -10 + stats, might be lower } modifer = (long)(Mathf.Round(((1 - stats) / high * low + stats)) * mod) + deriv; if (modifer < 1) { modifer = 1; } if (isHP) { if (modifer > 9999) { modifer = 9999; } } else if (modifer > 255) { modifer = 255; } }
//buffs for all //need to work on this, but not sure how to do it yet protected void GetBuffs(DerivedStatTypes statType, byte createrType) { }