//执行一次攻击,一般的攻击。proc-触发 public void PerformAttack(BaseNPC target, bool useCastAttackOrb, bool prcoessProcs, bool skipCooldown, bool ignoreInvis = false, bool useProjectile = false, bool fakeAttack = false, bool neverMiss = false) { int hitChance = 0; if (neverMiss) { hitChance = 100; } if (!this.GetModifierState(Modifier_State.MODIFIER_STATE_INVULNERABLE)) //无敌状态 { //Miss chance = 1 - [Π^n (1 - evasionn) x (1 - Min(sum of all sources of blind, 100%)) x (1 - uphill miss chance)] hitChance = (1 - EntityAttribute.CalcAndUpdateValue(target, EntityAttributeType.Evasion) / 100) * (1 - Math.Min(EntityAttribute.CalcAndUpdateValue(this, EntityAttributeType.MissRate), 100) / 100); if (hitChance < UnityEngine.Random.Range(0f, 1f)) //击中 { //Damage = { [Main Damage × (1 + Percentage Bonuses) + FlatBonuses] × Crit Multiplier - Blocked Damage } × Armor Multipliers × General Damage Multipliers int damage = (EntityAttribute.CalcAndUpdateValue(this, EntityAttributeType.AttackDamage) - EntityAttribute.CalcAndUpdateValue(target, EntityAttributeType.DamageBlock)) * EntityAttribute.CalcAndUpdateValue(this, EntityAttributeType.AttackOutgoModifier) / 100 * EntityAttribute.CalcAndUpdateValue(target, EntityAttributeType.AttackIncomeModifier) / 100; target.TakeDamage(DamageType.DAMAGE_TYPE_PHYSICAL, damage); this.TriggerModifierEvent(ModifierEventType.OnDealDamage); target.TriggerModifierEvent(ModifierEventType.OnTakeDamage); } else { } } // if(!fakeAttack) // { // TriggerModifierEvent(ModifierEventType.OnAttack); // } }
public override void Update(float deltaTime) { if (m_castPoint < -1f) //达到了castPoint之后 { if (isChannel) { if (m_channelTime < -1f) { } else if (m_channelTime < 0f) { m_channelTime = -2f; caster.TriggerAbilityEvent(AbilityEventType.OnChannelFinish); caster.TriggerAbilityEvent(AbilityEventType.OnChannelSucceeded); //引导技能完毕之后 EndChannel(); } else //引导中 { m_channelTime -= deltaTime; m_channelInterval -= deltaTime; if (m_channelInterval < 0f) { m_channelInterval = abilityParams.channelThink; OnChannelThink(); } } } } else if (m_castPoint < 0f) //开始释放技能之后,m_castPoint之前 { m_castPoint = -2f; caster.TriggerAbilityEvent(AbilityEventType.OnSpellStart); caster.TriggerModifierEvent(ModifierEventType.OnAbilityStart); if (isChannel) { m_channelTime = abilityParams.channelTime; } } else { m_castPoint -= deltaTime; } if (duration < -1f) //没有在释放技能的过程中 { if (coolDown < -1f) //没有在冷却中 { } else if (coolDown < 0f) //刚刚冷却完成 { coolDown = -2f; } //开始冷却 else { coolDown -= deltaTime; } } else if (duration < 0f) //技能刚刚释放完毕 { duration = -2f; coolDown = abilityParams.coolDown; } //开始冷却 else { duration -= deltaTime; } }