private bool CanHit(ActorController target) { if (target == null) { return false; } if (this.IsFriendlyTo(target)) { return true; } int num = 90 + this.GetAtt(EAttID.EAID_Hit) / 100 + (int)((this.Level - target.Level) * 20u / target.Level) - target.GetAtt(EAttID.EAID_Dodge) / 100; return num > 0 && UtilFunc.RangeRandom(0, 100) <= num; }
public int CalculateDamage(int value1, int value2, ActorController target) { int attackType = this.GetAttackType(); long num = 0L; if (this.ignoreDefense != null && Time.time >= this.ignoreDefense.Cooldown && UtilFunc.RangeRandom(0, 10000) < this.ignoreDefense.Value1) { this.ignoreDefense.Cooldown = Time.time + (float)this.ignoreDefense.Value3; num = (long)this.GetAtt(EAttID.EAID_Attack); } else if (attackType == 1) { num = (long)(this.GetAtt(EAttID.EAID_Attack) - target.GetAtt(EAttID.EAID_PhysicDefense)); } else if (attackType == 3) { num = (long)(this.GetAtt(EAttID.EAID_Attack) - target.GetAtt(EAttID.EAID_MagicDefense)); } else { num += (long)(this.GetAtt(EAttID.EAID_Attack) - target.GetAtt(EAttID.EAID_MagicDefense)); num += (long)(this.GetAtt(EAttID.EAID_Attack) - target.GetAtt(EAttID.EAID_PhysicDefense)); num /= 2L; } int num2 = this.GetAtt(EAttID.EAID_DamagePlus) - target.GetAtt(EAttID.EAID_DamageMinus); if (num2 < -8000) { num2 = -8000; } num = num * (long)(10000 + num2) / 10000L; num = num * (long)value1 / 10000L; num += (long)value2; if (num < 1L) { num = 1L; } return (int)num; }
public bool CanCrit(ActorController target) { if (target == null) { return false; } int num = this.GetAtt(EAttID.EAID_Crit) / 100 + (int)((this.Level - target.Level) * 10u / this.Level) - target.GetAtt(EAttID.EAID_CritResis) / 100; return num > 0 && UtilFunc.RangeRandom(0, 100) <= num; }