public AttackInfo Attack(CharacterEntity target, float pAtkRate = 1f, float mAtkRate = 1f, int hitCount = 1, int fixDamage = 0) { if (target == null) { return(null); } self.ApplySkillAndBuff(CustomSkill.TriggerType.fight); var attributes = self.GetTotalAttributes(); AttackInfo info = target.ReceiveDamage(self, Mathf.CeilToInt(attributes.pAtk * pAtkRate), Mathf.CeilToInt(attributes.mAtk * mAtkRate), (int)attributes.acc, attributes.exp_critChance, attributes.exp_critDamageRate, hitCount, fixDamage); if (info.gedang) { self.ApplySkillAndBuff(CustomSkill.TriggerType.beigedang); } if (info.baoji) { self.ApplySkillAndBuff(CustomSkill.TriggerType.beibaoji); } if (info.shanbi) { self.ApplySkillAndBuff(CustomSkill.TriggerType.beimiss); } FriensAttack(); return(info); }
public void NewTurn() { if (ActiveCharacter != null) { ActiveCharacter.currentTimeCount = 0; } CharacterEntity activatingCharacter = null; var maxTime = int.MinValue; List <BaseCharacterEntity> characters = new List <BaseCharacterEntity>(); characters.AddRange(playerFormation.Characters.Values); characters.AddRange(foeFormation.Characters.Values); for (int i = 0; i < characters.Count; ++i) { CharacterEntity character = characters[i] as CharacterEntity; if (character != null) { if (character.Hp > 0) { int spd = (int)character.GetTotalAttributes().spd; if (spd <= 0) { spd = 1; } character.currentTimeCount += spd; if (character.currentTimeCount > maxTime) { maxTime = character.currentTimeCount; activatingCharacter = character; } } else { character.currentTimeCount = 0; } } } ActiveCharacter = activatingCharacter; bool isStun = activatingCharacter.IsStun(); ActiveCharacter.ApplySkillAndBuff(CustomSkill.TriggerType.beforeFight); ActiveCharacter.DecreaseBuffsTurn(); ActiveCharacter.DecreaseSkillsTurn(); ActiveCharacter.ResetStates(); if (ActiveCharacter.Hp > 0 && !isStun) { if (ActiveCharacter.IsPlayerCharacter) { if (IsAutoPlay) { ActiveCharacter.RandomAction(); } else { //RpguiCharacterActionManager.Show(); uiUseSkillManager.SetData(ActiveCharacter); } } else { ActiveCharacter.RandomAction(); } } else { ActiveCharacter.NotifyEndAction(); } }
// Update is called once per frame void ShowPlayInfo() { if (SelfEntity == null) { return; } if (AAttackText != null) { AAttackText.text = "物攻:" + SelfEntity.GetTotalAttributes().pAtk; } if (MAttackText != null) { MAttackText.text = "魔攻:" + SelfEntity.GetTotalAttributes().mAtk; } if (ADefText != null) { ADefText.text = "物御:" + SelfEntity.GetTotalAttributes().pDef; } if (MDefText != null) { MDefText.text = "魔防:" + SelfEntity.GetTotalAttributes().mDef; } if (CirText != null) { CirText.text = "暴击:" + SelfEntity.GetTotalAttributes().exp_critChance; } if (SpeedText != null) { SpeedText.text = "速度:" + SelfEntity.GetTotalAttributes().spd; } if (hp != null) { hp.text = "血量:" + SelfEntity.Hp + "/" + SelfEntity.MaxHp; } if (eva != null) { eva.text = "回避:" + SelfEntity.GetTotalAttributes().eva; } if (cirtchance != null) { cirtchance.text = "暴击:" + SelfEntity.GetTotalAttributes().acc; } if (cirtdamage != null) { cirtdamage.text = "爆伤:" + SelfEntity.GetTotalAttributes().exp_critDamageRate; } if (blockchance != null) { blockchance.text = "格挡:" + SelfEntity.GetTotalAttributes().exp_blockChance; } if (blockdamage != null) { blockdamage.text = "格挡伤害:" + SelfEntity.GetTotalAttributes().exp_blockDamageRate; } }