コード例 #1
0
 public override void ApplyEffect(AbilityCaster caster,
                                  EventHandler[] targets, AbilityData data)
 {
     for (int i = 0; i < targets.Length; i++)
     {
         DamageInstance.Damage(this, caster, targets[i], data.SecondaryValue, data.SecondaryType);
     }
 }
コード例 #2
0
        public static DamageInstance Damage(AbilityEffect origin, AbilityCaster dealer, EventHandler target,
                                            float amount, DamageType type, bool isCrit = false, bool isDefended = false)
        {
            DamageInstance dmgInst = new DamageInstance(origin, dealer, target,
                                                        amount, type, isCrit, isDefended);

            dmgInst.Deal();
            return(dmgInst);
        }
コード例 #3
0
ファイル: Frozen.cs プロジェクト: whztt07/AbilitySystem
        public override void OnApply(BuffInstance instance)
        {
            instance.Target.GetComponent <AbilityCaster>().AddDisabler();

            instance.ApplyBuffMod(AttackModHandler.Generate(EventFlag.HIT_BY_ATTACK,
                                                            (atkInst) =>
            {
                DamageInstance.Damage(instance.OriginEffect, instance.Caster, instance.Target,
                                      instance.Data.MainValue * (atkInst.IsCrit ? 2 : 1), instance.Data.MainType);
                instance.Remove();
            }));
        }
コード例 #4
0
        void Execute()
        {
            Attacker.EventHandler.AttackEvents.Trigger(EventFlag.ATTACK, this);
            Target.AttackEvents.Trigger(EventFlag.ATTACKED, this);

            if (IsDefended)
            {
                Attacker.EventHandler.AttackEvents.Trigger(EventFlag.DEFEND, this);
                Target.AttackEvents.Trigger(EventFlag.DEFENDED, this);
            }

            if (UnityEngine.Random.Range(0, 1) < HitChance)
            {
                IsHit = true;
                if (OriginEffect.SFXOverride != null)
                {
                    OriginEffect.SFXOverride.Spawn(Target.transform);
                }
                else if (SFX != null)
                {
                    SFX.Spawn(Target.transform);
                }

                float critDeter = UnityEngine.Random.Range(0, 1f);
                if (critDeter < CritChance)
                {
                    IsCrit  = true;
                    Damage *= CritMultiplier;
                }
                Attacker.EventHandler.AttackEvents.Trigger(EventFlag.HIT_WITH_ATTACK, this);
                Target.AttackEvents.Trigger(EventFlag.HIT_BY_ATTACK, this);
                if (IsCrit)
                {
                    Attacker.EventHandler.AttackEvents.Trigger(EventFlag.CRIT, this);
                    Target.AttackEvents.Trigger(EventFlag.CRITTED, this);
                }
                DamageInstance.Damage(OriginEffect, Attacker, Target, Damage, Type, IsCrit, IsDefended);
            }
            else
            {
                Attacker.EventHandler.AttackEvents.Trigger(EventFlag.MISS, this);
                Target.AttackEvents.Trigger(EventFlag.MISSED, this);
            }
        }
コード例 #5
0
ファイル: Burning.cs プロジェクト: whztt07/AbilitySystem
 public override void OnTick(BuffInstance instance)
 {
     DamageInstance.Damage(instance.OriginEffect, instance.Caster, instance.Target,
                           instance.Data.SecondaryValue, instance.Data.SecondaryType);
 }