コード例 #1
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        if (increasedRadius != 0)
        {
            foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>())
            {
                cod.increasedRadius = increasedRadius;
                cod.increasedHeight = increasedRadius;
            }
            foreach (CapsuleCollider col in abilityObject.GetComponents <CapsuleCollider>())
            {
                col.height *= (1 + increasedRadius);
                col.radius *= (1 + increasedRadius);
            }
        }

        if (damageBuff != 0)
        {
            BuffOnAllyHit boah = abilityObject.AddComponent <BuffOnAllyHit>();
            boah.addBuffToList(Tags.Properties.Damage, 0, damageBuff, null, null, 4 * (1 + increasedBuffDuration), null, "Entangling Roots Damage Buff");
        }

        if (poisonChanceToWolves != 0)
        {
            BuffOnAllyHit boah = abilityObject.AddComponent <BuffOnAllyHit>();
            boah.onlyApplyToMinionFromAbility = true;
            boah.requiredAbility = AbilityIDList.getAbility(AbilityID.summonWolf);
            boah.addBuffToList(Tags.Properties.PoisonChance, 0, poisonChanceToWolves, null, null, 4 * (1 + increasedBuffDuration), null, "Entangling Roots Poison Buff");
        }

        if (bleedchanceToBears != 0)
        {
            BuffOnAllyHit boah = abilityObject.AddComponent <BuffOnAllyHit>();
            boah.onlyApplyToMinionFromAbility = true;
            boah.requiredAbility = AbilityIDList.getAbility(AbilityID.summonBear);
            boah.addBuffToList(Tags.Properties.BleedChance, 0, bleedchanceToBears, null, null, 4 * (1 + increasedBuffDuration), null, "Entangling Roots Bleed Buff");

            BuffOnAllyHit boah2 = abilityObject.AddComponent <BuffOnAllyHit>();
            boah2.onlyApplyToMinionFromAbility = true;
            boah2.requiredAbility = AbilityIDList.getAbility(AbilityID.summonSerpent);
            boah2.addBuffToList(Tags.Properties.BleedChance, 0, bleedchanceToBears, null, null, 4 * (1 + increasedBuffDuration), null, "Entangling Roots Bleed Buff");
        }

        if (castSpeedToSpriggans != 0)
        {
            BuffOnAllyHit boah = abilityObject.AddComponent <BuffOnAllyHit>();
            boah.onlyApplyToMinionFromAbility = true;
            boah.requiredAbility = AbilityIDList.getAbility(AbilityID.summonSpriggan);
            boah.addBuffToList(Tags.Properties.CastSpeed, 0, castSpeedToSpriggans, null, null, 4 * (1 + increasedBuffDuration), null, "Entangling Roots Cast Buff");
        }

        if (healSpriggans)
        {
            HealAlliesOnHit component = abilityObject.AddComponent <HealAlliesOnHit>();
            component.onlyApplyToMinionFromAbility = true;
            component.requiredAbility = AbilityIDList.getAbility(AbilityID.summonSpriggan);
            component.healAmount      = 100000;
        }

        // initial melee hit
        if (!meleeScalingInitialHit)
        {
            foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>())
            {
                cod.objectsToCreateOnDeath.Clear();
            }
            foreach (DamageEnemyOnHit damage in abilityObject.GetComponents <DamageEnemyOnHit>())
            {
                damage.baseDamageStats.damage.Clear();
                damage.baseDamageStats.addedDamageScaling = 0;
                Destroy(damage);
                abilityObject.AddComponent <CannotApplyAdditionalStatuses>();
            }
        }
        else
        {
            if (increasedDamage != 0)
            {
                foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
                {
                    holder.increaseAllDamage(increasedDamage);
                }
            }

            if (chanceToPoison > 0)
            {
                ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
                newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Poison);
                newComponent.chance       = chanceToPoison;
            }
            if (alwaysStuns)
            {
                StunEnemyOnHit component = abilityObject.AddComponent <StunEnemyOnHit>();
                component.duration = 0.8f;
            }
        }


        return(abilityObject);
    }
コード例 #2
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        if (increasedRadius != 0)
        {
            foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>())
            {
                cod.increasedRadius = increasedRadius;
                cod.increasedHeight = increasedRadius;
            }
            foreach (CapsuleCollider col in abilityObject.GetComponents <CapsuleCollider>())
            {
                col.height *= (1 + increasedRadius);
                col.radius *= (1 + increasedRadius);
            }
        }

        if (necrotic)
        {
            // replace vfx
            CreateOnDeath cod = abilityObject.GetComponent <CreateOnDeath>();
            if (cod && cod.objectsToCreateOnDeath != null && cod.objectsToCreateOnDeath.Count > 0)
            {
                cod.objectsToCreateOnDeath[0] = new CreateOnDeath.GameObjectHolder(PrefabList.getPrefab("NecroticBloodSplatterOnDeathVFX"));
            }

            // convert damage
            foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>())
            {
                damage.convertAllDamageOfType(DamageType.PHYSICAL, DamageType.NECROTIC);
            }
        }

        if (chanceToPoison > 0)
        {
            ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Poison);
            newComponent.chance       = chanceToPoison;
        }

        if (armourReductionChance > 0 && Random.Range(0f, 1f) < armourReductionChance)
        {
            DebuffOnEnemyHit component = abilityObject.AddComponent <DebuffOnEnemyHit>();
            if (reducesDarkProtectionInstead)
            {
                if (armourReductionStacks)
                {
                    component.addDebuffToList(Tags.Properties.DarkProtection, armourReduction, 0f, null, null, 4f * (1 + increasedArmourDebuffDuration));
                }
                else
                {
                    component.addDebuffToList(Tags.Properties.DarkProtection, armourReduction, 0f, null, null, 4f * (1 + increasedArmourDebuffDuration), null, "blood splatter armour reduction");
                }
            }
            else
            {
                if (armourReductionStacks)
                {
                    component.addDebuffToList(Tags.Properties.Armour, armourReduction, 0f, null, null, 4f * (1 + increasedArmourDebuffDuration));
                }
                else
                {
                    component.addDebuffToList(Tags.Properties.Armour, armourReduction, 0f, null, null, 4f * (1 + increasedArmourDebuffDuration), null, "blood splatter armour reduction");
                }
            }
        }

        if (minionBuffs != null && minionBuffs.Count > 0)
        {
            string        buffName  = "blood splatter buff";
            BuffOnAllyHit component = abilityObject.AddComponent <BuffOnAllyHit>();
            component.onlyApplyToCreatorsMinions = true;
            for (int i = 0; i < minionBuffs.Count; i++)
            {
                string fullBuffName = buffName + minionBuffs[i].property;
                foreach (Tags.AbilityTags _tag in minionBuffs[i].tagList)
                {
                    fullBuffName += _tag;
                }
                component.addBuffToList(minionBuffs[i].property, minionBuffs[i].addedValue, minionBuffs[i].increasedValue, minionBuffs[i].moreValues,
                                        minionBuffs[i].quotientValues, 4f, minionBuffs[i].tagList, fullBuffName);
            }
        }


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


        // increase damage based on the number of minions
        float realIncreasedDamage = increasedDamage;

        if (increasedDamagePerMinion != 0)
        {
            if (references && references.creator)
            {
                SummonTracker tracker = references.creator.GetComponent <SummonTracker>();
                if (tracker && tracker.summons != null)
                {
                    realIncreasedDamage += increasedDamagePerMinion * tracker.summons.Count;
                }
            }
        }


        if (realIncreasedDamage != 0)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.increaseAllDamage(realIncreasedDamage);
            }
        }

        if (moreDamageInstances != null && moreDamageInstances.Count > 0)
        {
            float moreDamage = 1f;
            foreach (float instance in moreDamageInstances)
            {
                moreDamage *= 1 + instance;
            }

            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.increaseAllDamage(moreDamage - 1);
            }
        }

        return(abilityObject);
    }