public override void RegisterAILogic() { TimerSev.Instance.AddTimerTask((tid) => { TickAILogic(); }, checkTime - UTools.RDInt(100, 500), 0); }
public string GetRDNameData(bool man = true) { System.Random rd = new System.Random(); string rdName = surnameAr[UTools.RDInt(0, surnameAr.Length - 1)]; if (man) { rdName += manAr[UTools.RDInt(0, manAr.Length - 1)]; } else { rdName += womanAr[UTools.RDInt(0, womanAr.Length - 1)]; } return(rdName); }
private void CalcDamage(EntityBase send, EntityBase recive, int damage, int type) { int curDmg = damage; BattleProps sendProp = send.Props; BattleProps reciveProp = recive.Props; bool critical = false; if (type == 1) // Ad { // 计算闪避 int c = resSev.GetPRD_C(reciveProp.dodge); int p = c * reciveProp.dodgeN; int cur = UTools.RDInt(1, 1000); if (cur <= p) { reciveProp.dodgeN = 1; recive.SetDodge(); return; } else { ++reciveProp.dodgeN; } // 计算属性加成 curDmg += sendProp.ad; // 计算暴击 c = resSev.GetPRD_C(sendProp.critical); p = c * sendProp.criticalN; cur = UTools.RDInt(1, 1000); if (cur <= p) { sendProp.criticalN = 1; curDmg *= 2; critical = true; } else { ++sendProp.criticalN; } // 计算穿甲 int addef = (int)((1f - sendProp.pierce * 1f / 100f) * reciveProp.addef); curDmg -= addef; } else if (type == 2) // AP { // 计算属性加成 curDmg += sendProp.ap; // 计算魔法抗性 curDmg -= reciveProp.apdef; } if (curDmg <= 0) { return; } if (critical) { recive.SetCritical(curDmg); } else { recive.SetDamage(curDmg); } if (recive.Hp < curDmg) { recive.Hp = 0; recive.Die(); recive.BattleMgr.RemoveMonster(recive._gameObject.name); } else { recive.Hp -= curDmg; if (recive.entityState != EntityState.BatiState && recive.GetBreakState()) { recive.Hit(); } } }