예제 #1
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.tempest);
        base.Awake();
        AbilityEventListener ael = AbilityEventListener.GetOrAdd(gameObject);

        ael.onHitEvent  += OnHit;
        aoc              = GetComponent <AbilityObjectConstructor>();
        weaponInfoHolder = GetComponent <WeaponInfoHolder>();
    }
예제 #2
0
    public static AbilityObjectConstructor GetOrAdd(GameObject _gameObject)
    {
        if (!_gameObject)
        {
            return(null);
        }
        AbilityObjectConstructor aoc = _gameObject.GetComponent <AbilityObjectConstructor>();

        if (aoc)
        {
            return(aoc);
        }
        return(_gameObject.AddComponent <AbilityObjectConstructor>());
    }
예제 #3
0
 public void Start()
 {
     if (damageGainOnNearbyDeath != 0 || areaGainOnNearbyDeath != 0)
     {
         GlobalActorEventManager.instance.newDyingCreatedEvent += newDying;
         foreach (Dying dying in Dying.all)
         {
             dying.deathEvent += onNearbyDeath;
             subbed.Add(dying);
         }
     }
     increasedArea = Mathf.Pow(increasedRadius + 1, 2) - 1;
     aoc           = GetComponent <AbilityObjectConstructor>();
 }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        AbilityObjectConstructor constructor = GetComponent <AbilityObjectConstructor>();

        if (constructor)
        {
            for (int i = 0; i < casts; i++)
            {
                Vector3 point         = transform.position + Vector3.Normalize(targetPoint - transform.position) * distancePerCast * (i + 1);
                Vector3 pointOnGround = new Vector3(point.x, getY(point), point.z);
                constructor.constructAbilityObject(ability, pointOnGround, transform.position + Vector3.Normalize(targetPoint - transform.position) * distancePerCast * (i + 3));
            }
        }
    }
예제 #5
0
 public void whenHit(int damage, List <HitEvents> hitEvents)
 {
     if (castWhenHitChance > 0 && hitEvents.Contains(HitEvents.Hit))
     {
         float rand = Random.Range(0f, 1f);
         if (rand < castWhenHitChance)
         {
             if (!aoc)
             {
                 aoc = GetComponent <AbilityObjectConstructor>();
             }
             aoc.constructAbilityObject(ability, transform.position + new Vector3(0f, 1.1f, 0f), transform.position + transform.forward + new Vector3(0f, 1.1f, 0f));
         }
     }
 }
예제 #6
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.ripBlood);
        AbilityEventListener listener = Comp <AbilityEventListener> .GetOrAdd(gameObject);

        listener.onHitEvent  += OnHit;
        listener.onKillEvent += OnKill;
        statBuffs             = Comp <StatBuffs> .GetOrAdd(gameObject);

        tracker = Comp <SummonTracker> .GetOrAdd(gameObject);

        aoc = Comp <AbilityObjectConstructor> .GetOrAdd(gameObject);

        mana      = GetComponent <BaseMana>();
        baseStats = GetComponent <BaseStats>();
        base.Awake();
    }
예제 #7
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.abyssalEchoes);
        base.Awake();
        AbilityEventListener ael = GetComponent <AbilityEventListener>();

        if (ael)
        {
            ael.onKillEvent += onKill;
        }
        aoc       = GetComponent <AbilityObjectConstructor>();
        statBuffs = Comp <StatBuffs> .GetOrAdd(gameObject);

        if (statBuffs == null)
        {
            statBuffs = gameObject.AddComponent <StatBuffs>();
        }
    }
예제 #8
0
    public void MakeExtraProjectiles()
    {
        // get references to necessary components and locations
        CreationReferences       creationReferences   = GetComponent <CreationReferences>();
        Ability                  thisAbility          = creationReferences.thisAbility;
        AbilityObjectConstructor constructor          = GetComponent <AbilityObjectConstructor>();
        Vector3                  targetLocation       = GetComponent <LocationDetector>().targetLocation;
        Vector3                  projectileStartPoint = GetComponent <LocationDetector>().startLocation;
        Vector3                  startDirection       = targetLocation - projectileStartPoint;

        // create the other projectile
        List <GameObject> newProjectiles = new List <GameObject>();

        Vector3 direction = Quaternion.Euler(0, -angle, 0) * startDirection;
        Ability ability   = thisAbility;

        if (extraProjectileIsDifferentAbility && otherAbility != null)
        {
            ability = otherAbility;
        }
        GameObject newProjectile = constructor.constructAbilityObject(ability, projectileStartPoint, projectileStartPoint + direction);

        // move the projectile to make it catch up
        if (newProjectile.GetComponent <AbilityMover>())
        {
            newProjectile.transform.position += newProjectile.GetComponent <AbilityMover>().positionDelta *Vector3.Distance(transform.position, GetComponent <LocationDetector>().startLocation);
        }
        // don't endlessly loop, silly
        Destroy(newProjectile.GetComponent <SplitProjectiles>());
        // add the projectile to the list
        newProjectiles.Add(newProjectile);

        direction = Quaternion.Euler(0, angle, 0) * startDirection;
        // change the angle of this projectile
        GetComponent <AbilityMover>().SetDirection(direction);

        // destroy this component
        if (GetComponent <SelfDestroyer>())
        {
            GetComponent <SelfDestroyer>().deathEvent -= MakeExtraProjectiles;
        }
        Destroy(this);
    }
예제 #9
0
    protected void chainTo(GameObject target, GameObject from)
    {
        AbilityObjectConstructor aoc = GetComponent <AbilityObjectConstructor>();
        GameObject newAbilityObject  = aoc.constructAbilityObject(abilityToChain, transform.position, target.transform.position + offset);

        // reduce the chains remaining
        if (limitNumberOfChains)
        {
            ChainOnHit newChain = newAbilityObject.GetComponent <ChainOnHit>();
            if (!newChain)
            {
                newChain = newAbilityObject.AddComponent <ChainOnHit>();
            }
            newChain.chainsRemaining          = chainsRemaining - 1;
            newChain.abilityToChain           = abilityToChain;
            newChain.range                    = range;
            newChain.destroyAfterChainAttempt = destroyAfterChainAttempt;
            newChain.cannotHitSame            = cannotHitSame;
            newChain.offset                   = offset;
        }

        if (cannotHitSame)
        {
            HitDetector detector = newAbilityObject.GetComponent <HitDetector>();
            if (hitsAllies)
            {
                detector.alliesHit.Add(from);
                if (detector.sharedHitDetector)
                {
                    detector.sharedHitDetector.alliesHit.Add(from);
                }
            }
            else
            {
                detector.enemiesHit.Add(from);
                if (detector.sharedHitDetector)
                {
                    detector.sharedHitDetector.enemiesHit.Add(from);
                }
            }
        }
    }
예제 #10
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.manaStrike);
        base.Awake();
        mana = GetComponent <BaseMana>();
        AbilityEventListener ael = GetComponent <AbilityEventListener>();

        if (ael)
        {
            ael.onHitEvent  += onHit;
            ael.onKillEvent += onKill;
            ael.onCritEvent += onCrit;
        }
        aoc = GetComponent <AbilityObjectConstructor>();
        lightningDisplacement = new Vector3(0f, 1f, 0f);
        statBuffs             = GetComponent <StatBuffs>();
        if (statBuffs == null)
        {
            statBuffs = gameObject.AddComponent <StatBuffs>();
        }
    }
예제 #11
0
    // Use this for initialization
    void Start()
    {
        abilityObjectConstructor = Comp <AbilityObjectConstructor> .GetOrAdd(gameObject);

        // calculate scaling
        if (scalingProperty != Tags.Properties.None)
        {
            CreationReferences references = GetComponent <CreationReferences>();
            if (references && references.creator)
            {
                BaseStats stats = references.creator.GetComponent <BaseStats>();
                if (stats)
                {
                    float scaler = stats.GetStatValue(scalingProperty);
                    if (scaler != 0)
                    {
                        interval /= scaler;
                    }
                }
            }
        }
        // get creator components if necessery
        if (castFromCreatorCastPoint || castAtCreatorTargetLocation)
        {
            CreationReferences references = GetComponent <CreationReferences>();
            if (references && references.creator)
            {
                if (castFromCreatorCastPoint)
                {
                    creatorSizeManager = references.creator.GetComponent <SizeManager>();
                }

                if (castAtCreatorTargetLocation)
                {
                    creatorUsingAbility = references.creator.GetComponent <UsingAbility>();
                }
            }
        }
    }
예제 #12
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.sacrifice);
        dotTag.Add(Tags.AbilityTags.DoT);
        AbilityEventListener listener = Comp <AbilityEventListener> .GetOrAdd(gameObject);

        listener.onKillEvent += OnKill;
        BaseHealth health = GetComponent <BaseHealth>();

        if (health)
        {
            statBuffs = Comp <StatBuffs> .GetOrAdd(gameObject);

            tracker = Comp <SummonTracker> .GetOrAdd(gameObject);
        }
        aoc = Comp <AbilityObjectConstructor> .GetOrAdd(gameObject);

        mana           = GetComponent <BaseMana>();
        baseStats      = GetComponent <BaseStats>();
        boneNovaOffset = new Vector3(0f, 1.2f, 0f);
        base.Awake();
    }
예제 #13
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.marrowShards);
        physTag.Add(Tags.AbilityTags.Physical);
        AbilityEventListener listener = Comp <AbilityEventListener> .GetOrAdd(gameObject);

        listener.onKillEvent += OnKill;
        listener.onCritEvent += OnCrit;
        health = GetComponent <BaseHealth>();
        if (health)
        {
            statBuffs = Comp <StatBuffs> .GetOrAdd(gameObject);

            tracker = Comp <SummonTracker> .GetOrAdd(gameObject);
        }
        aoc = Comp <AbilityObjectConstructor> .GetOrAdd(gameObject);

        mana               = GetComponent <BaseMana>();
        baseStats          = GetComponent <BaseStats>();
        boneNovaOffset     = new Vector3(0f, 1.2f, 0f);
        spiritEscapeOffset = new Vector3(0f, 1.1f, 0f);
        spiritEscapePrefab = PrefabList.getPrefab("spiritEscape");
        base.Awake();
    }
예제 #14
0
    public void MakeExtraProjectiles()
    {
        // get references to necessary components and locations
        CreationReferences       creationReferences   = GetComponent <CreationReferences>();
        Ability                  thisAbility          = creationReferences.thisAbility;
        AbilityObjectConstructor constructor          = GetComponent <AbilityObjectConstructor>();
        Vector3                  targetLocation       = GetComponent <LocationDetector>().targetLocation;
        Vector3                  projectileStartPoint = GetComponent <LocationDetector>().startLocation;
        Vector3                  startDirection       = targetLocation - projectileStartPoint;

        // reduce the intensity of any lights
        if (numberOfExtraProjectiles != 0)
        {
            foreach (Light light in GetComponentsInChildren <Light>())
            {
                light.intensity /= numberOfExtraProjectiles;
            }
        }

        // setup angle calculations
        float   angleBetweenProjectiles = 2 * angle / numberOfExtraProjectiles;
        Vector3 direction;

        if (randomAngles)
        {
            angleOfNextProjectile = UnityEngine.Random.Range(-angle, angle);
        }
        else
        {
            angleOfNextProjectile = -angle;
        }

        // create the projectiles
        List <GameObject> newProjectiles = new List <GameObject>();

        for (int i = 0; i <= numberOfExtraProjectiles; i++)
        {
            if (i != numberOfExtraProjectiles / 2)
            {
                direction = Quaternion.Euler(0, angleOfNextProjectile, 0) * startDirection;
                GameObject newProjectile = constructor.constructAbilityObject(thisAbility, projectileStartPoint, projectileStartPoint + direction, gameObject);
                // move the projectile to make it catch up
                if (newProjectile.GetComponent <AbilityMover>())
                {
                    newProjectile.transform.position += newProjectile.GetComponent <AbilityMover>().positionDelta *Vector3.Distance(transform.position, GetComponent <LocationDetector>().startLocation);
                }
                // don't endlessly loop, silly
                Destroy(newProjectile.GetComponent <ExtraProjectiles>());
                // add the projectile to the list
                newProjectiles.Add(newProjectile);
                // disable sound for new projectiles
                foreach (PlayOneShotSound playSound in newProjectile.GetComponents <PlayOneShotSound>())
                {
                    if (playSound.playEvent == PlayOneShotSound.PlayEvent.start)
                    {
                        playSound.active = false;
                    }
                }
            }
            if (randomAngles)
            {
                angleOfNextProjectile = UnityEngine.Random.Range(-angle, angle);
            }
            else
            {
                angleOfNextProjectile += angleBetweenProjectiles;
            }
        }


        // delay projectiles if necessary
        if (delayExtraProjectiles)
        {
            float      delay = 0f;
            GameObject delayer;
            EnablesChildrenAfterDelay enabler;
            for (int i = 0; i < newProjectiles.Count; i++)
            {
                // calculate the delay
                if (!randomiseDelay)
                {
                    delay += (delayWindow / newProjectiles.Count);
                }
                else
                {
                    delay = UnityEngine.Random.Range(0f, delayWindow);
                }

                // create the delayer
                delayer       = new GameObject();
                enabler       = delayer.AddComponent <EnablesChildrenAfterDelay>();
                enabler.delay = delay;

                // set the parent of the new projectile to the delay
                newProjectiles[i].transform.SetParent(delayer.transform);
                newProjectiles[i].SetActive(false);
            }
        }


        // destroy this component
        if (GetComponent <SelfDestroyer>())
        {
            GetComponent <SelfDestroyer>().deathEvent -= MakeExtraProjectiles;
        }
        Destroy(this);
    }
예제 #15
0
    public override void updateMutator()
    {
        VolatileReversalMutator mutator = PlayerFinder.getPlayer().GetComponent <VolatileReversalMutator>();
        float increasedDamage           = 0f;
        float increasedArea             = 0f;
        float timeRotChance             = 0f;
        float increasesDamageTaken      = 0f;
        float increasesDoTDamageTaken   = 0f;
        float increasedStunChance       = 0f;

        bool voidRiftAtStart = false;
        bool voidRiftAtEnd   = false;

        List <TaggedStatsHolder.TaggableStat> statsWhileOnCooldown = new List <TaggedStatsHolder.TaggableStat>();
        List <TaggedStatsHolder.TaggableStat> statOnUse            = new List <TaggedStatsHolder.TaggableStat>();

        float percentCooldownRecoveredOnKill = 0f;
        float additionalSecondsBack          = 0f;

        bool noHealthRestoration = false;
        bool noManaRestoration   = false;

        bool  healsOrDamagesAtRandom         = false;
        float healOrDamagePercent            = 0f;
        float increasedCooldownRecoverySpeed = 0f;

        AbilityObjectConstructor aoc           = null;
        ChargeManager            chargeManager = null;

        foreach (SkillTreeNode node in GetComponentsInChildren <SkillTreeNode>())
        {
            if (node.name == "Volatile Reversal Tree Rift At Start")
            {
                if (node.GetComponent <SkillTreeNode>().pointsAllocated > 0)
                {
                    voidRiftAtStart = true;
                }
            }
            if (node.name == "Volatile Reversal Tree Increased Damage")
            {
                increasedDamage += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.22f;
            }
            if (node.name == "Volatile Reversal Tree Dot Damage Taken")
            {
                increasesDoTDamageTaken += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.2f;
            }
            if (node.name == "Volatile Reversal Tree Stun Chance")
            {
                increasedStunChance += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.4f;
            }
            if (node.name == "Volatile Reversal Tree Rift At End")
            {
                if (node.GetComponent <SkillTreeNode>().pointsAllocated > 0)
                {
                    voidRiftAtStart = true;
                }
            }
            if (node.name == "Volatile Reversal Tree Increased Area")
            {
                increasedArea += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.4f;
            }
            if (node.name == "Volatile Reversal Tree Damage Taken")
            {
                increasesDoTDamageTaken += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.1f;
            }
            if (node.name == "Volatile Reversal Tree Time Rot")
            {
                timeRotChance += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.25f;
            }
            if (node.name == "Volatile Reversal Tree Reduced Cooldown On Kill")
            {
                percentCooldownRecoveredOnKill += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.03f;
            }
            if (node.name == "Volatile Reversal Tree Movespeed")
            {
                if (node.GetComponent <SkillTreeNode>().pointsAllocated > 0)
                {
                    TaggedStatsHolder.TaggableStat stat = new TaggedStatsHolder.TaggableStat(Tags.Properties.Movespeed, new List <Tags.AbilityTags>());
                    stat.increasedValue += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.12f;
                    statOnUse.Add(stat);
                }
            }
            if (node.name == "Volatile Reversal Tree Attack and Cast Speed")
            {
                if (node.GetComponent <SkillTreeNode>().pointsAllocated > 0)
                {
                    TaggedStatsHolder.TaggableStat stat = new TaggedStatsHolder.TaggableStat(Tags.Properties.AttackSpeed, new List <Tags.AbilityTags>());
                    stat.increasedValue += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.12f;
                    statOnUse.Add(stat);
                    TaggedStatsHolder.TaggableStat stat2 = new TaggedStatsHolder.TaggableStat(Tags.Properties.CastSpeed, new List <Tags.AbilityTags>());
                    stat2.increasedValue += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.12f;
                    statOnUse.Add(stat2);
                }
            }
            if (node.name == "Volatile Reversal Tree No Health Restored")
            {
                if (node.GetComponent <SkillTreeNode>().pointsAllocated > 0)
                {
                    noHealthRestoration             = true;
                    increasedCooldownRecoverySpeed += 2f;
                }
            }
            if (node.name == "Volatile Reversal Tree Random Heal")
            {
                if (node.GetComponent <SkillTreeNode>().pointsAllocated > 0)
                {
                    healsOrDamagesAtRandom = true;
                    healOrDamagePercent    = node.GetComponent <SkillTreeNode>().pointsAllocated * 0.2f;
                }
            }
            if (node.name == "Volatile Reversal Tree Cooldown vs Regen")
            {
                if (node.GetComponent <SkillTreeNode>().pointsAllocated > 0)
                {
                    increasedCooldownRecoverySpeed += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.25f;
                    TaggedStatsHolder.TaggableStat stat = new TaggedStatsHolder.TaggableStat(Tags.Properties.HealthRegen, new List <Tags.AbilityTags>());
                    stat.increasedValue += node.GetComponent <SkillTreeNode>().pointsAllocated * -0.1f;
                    statsWhileOnCooldown.Add(stat);
                }
            }
            if (node.name == "Volatile Reversal Tree Goes Back Further")
            {
                additionalSecondsBack += node.GetComponent <SkillTreeNode>().pointsAllocated * 1f;
            }
            if (node.name == "Volatile Reversal Tree Cooldown vs Damage Taken")
            {
                if (node.GetComponent <SkillTreeNode>().pointsAllocated > 0)
                {
                    increasedCooldownRecoverySpeed += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.3f;
                    TaggedStatsHolder.TaggableStat stat = new TaggedStatsHolder.TaggableStat(Tags.Properties.DamageTaken, new List <Tags.AbilityTags>());
                    stat.increasedValue += node.GetComponent <SkillTreeNode>().pointsAllocated * 0.1f;
                    statsWhileOnCooldown.Add(stat);
                }
            }
            if (node.name == "Volatile Reversal Tree No Mana Restored")
            {
                if (node.GetComponent <SkillTreeNode>().pointsAllocated > 0)
                {
                    noManaRestoration = true;
                    increasedCooldownRecoverySpeed += 4f;
                }
            }
            if (node.name == "Volatile Reversal Tree Dodge On Cooldown")
            {
                if (node.GetComponent <SkillTreeNode>().pointsAllocated > 0)
                {
                    TaggedStatsHolder.TaggableStat stat = new TaggedStatsHolder.TaggableStat(Tags.Properties.DodgeRating, new List <Tags.AbilityTags>());
                    stat.addedValue += node.GetComponent <SkillTreeNode>().pointsAllocated * 50f;
                    statsWhileOnCooldown.Add(stat);
                }
            }
        }

        mutator.increasedDamage         = increasedDamage;
        mutator.increasedRadius         = Mathf.Sqrt(increasedArea + 1) - 1;
        mutator.timeRotChance           = timeRotChance;
        mutator.increasesDamageTaken    = increasesDamageTaken;
        mutator.increasesDoTDamageTaken = increasesDoTDamageTaken;
        mutator.increasedStunChance     = increasedStunChance;

        mutator.voidRiftAtStart = voidRiftAtStart;
        mutator.voidRiftAtEnd   = voidRiftAtEnd;

        mutator.statsWhileOnCooldown = statsWhileOnCooldown;
        mutator.statOnUse            = statOnUse;

        mutator.percentCooldownRecoveredOnKill = percentCooldownRecoveredOnKill;
        mutator.additionalSecondsBack          = additionalSecondsBack;

        mutator.noHealthRestoration = noHealthRestoration;
        mutator.noManaRestoration   = noManaRestoration;

        mutator.healsOrDamagesAtRandom = healsOrDamagesAtRandom;
        mutator.healOrDamagePercent    = healOrDamagePercent;
        mutator.addedChargeRegen       = ability.chargesGainedPerSecond * increasedCooldownRecoverySpeed;
    }
예제 #16
0
 public void Start()
 {
     aoc = GetComponent <AbilityObjectConstructor>();
 }
예제 #17
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        // increasedDamageToFirstEnemyHit is removed for additional chains, so it can be applied without checks
        if (increasedDamage != 0 || increasedDamageToFirstEnemyHit != 0)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.increaseAllDamage(increasedDamage + increasedDamageToFirstEnemyHit);
            }
        }

        if (chains > 0)
        {
            ChainOnHit chain = abilityObject.AddComponent <ChainOnHit>();
            chain.chainsRemaining = chains;
            chain.abilityToChain  = ability;

            // add a copy of this mutator to the ability object, but remove the chains (because it will chain anyway), the increased damage to first enemy hit, and the on cast stuff
            LightningBlastMutator newMutator = abilityObject.AddComponent <LightningBlastMutator>();
            newMutator.chains = 0;
            increasedDamageToFirstEnemyHit   = 0;
            newMutator.increasedDamage       = increasedDamage;
            newMutator.lightningStrikeChance = lightningStrikeChance;
            newMutator.chanceToBlind         = chanceToBlind;

            // add the increased damage per chain
            newMutator.increasedDamage += increasedDamagePerChain;

            // add increased damage to last enemy hit if appropriate
            if (chain.chainsRemaining == 0)
            {
                newMutator.increasedDamage += increasedDamageToLastEnemy;
            }
        }


        // on cast stuff
        if (lightningProtectionOnCast != 0 || elementalProtectionOnCast != 0)
        {
            Buff buff = new Buff();
            TaggedStatsHolder.Stat stat = new TaggedStatsHolder.Stat(Tags.Properties.LightningProtection);
            stat.addedValue        = (lightningProtectionOnCast + elementalProtectionOnCast) * (1 + increasedProtectionOnCast);
            buff.stat              = stat;
            buff.remainingDuration = 3 * (1 + increasedProtectionDuration);
            statBuffs.addBuff(buff);
        }

        if (elementalProtectionOnCast != 0)
        {
            Buff buff = new Buff();
            TaggedStatsHolder.Stat stat = new TaggedStatsHolder.Stat(Tags.Properties.ColdProtection);
            stat.addedValue        = (elementalProtectionOnCast) * (1 + increasedProtectionOnCast);
            buff.stat              = stat;
            buff.remainingDuration = 3 * (1 + increasedProtectionDuration);
            statBuffs.addBuff(buff);
        }

        if (elementalProtectionOnCast != 0)
        {
            Buff buff = new Buff();
            TaggedStatsHolder.Stat stat = new TaggedStatsHolder.Stat(Tags.Properties.FireProtection);
            stat.addedValue        = (elementalProtectionOnCast) * (1 + increasedProtectionOnCast);
            buff.stat              = stat;
            buff.remainingDuration = 3 * (1 + increasedProtectionDuration);
            statBuffs.addBuff(buff);
        }

        if (wardOnCast != 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < wardOnCastChance)
            {
                protectionClass.currentWard += wardOnCast;
            }
        }

        if (lightningDamageOnCast != 0)
        {
            List <Tags.AbilityTags> tags = new List <Tags.AbilityTags>();
            tags.Add(Tags.AbilityTags.Lightning);
            TaggedStatsHolder.TaggableStat stat = new TaggedStatsHolder.TaggableStat(Tags.Properties.Damage, tags);
            stat.increasedValue = lightningDamageOnCast;
            TaggedBuff buff = new TaggedBuff();
            buff.stat = stat;
            buff.remainingDuration = 3 * (1 + increasedDamageBuffDuration);
            statBuffs.addTaggedBuff(buff);
        }

        if (increasedStunChance != 0)
        {
            foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>())
            {
                damage.baseDamageStats.increasedStunChance += increasedStunChance;
            }
        }


        // maybe cast lightning too
        if (lightningStrikeChance > 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand <= lightningStrikeChance)
            {
                AbilityObjectConstructor aoc = GetComponent <AbilityObjectConstructor>();
                if (aoc)
                {
                    aoc.constructAbilityObject(AbilityIDList.getAbility(AbilityID.lightning), targetLocation, targetLocation);
                }
            }
        }

        // maybe blind
        if (chanceToBlind > 0)
        {
            ChanceToApplyStatusOnEnemyHit ctasoeh = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            ctasoeh.chance       = chanceToBlind;
            ctasoeh.statusEffect = StatusEffectList.getEffect(StatusEffectID.Blind);
        }


        return(abilityObject);
    }
예제 #18
0
 // Use this for initialization
 void Start()
 {
     GetComponent <AbilityEventListener>().onKillEvent += Cast;
     constructor = GetComponent <AbilityObjectConstructor>();
 }