예제 #1
0
 private void ApplyEquipmentBonuses(List <Affix> affixes)
 {
     foreach (Affix affix in affixes)
     {
         for (int i = 0; i < affix.Base.affixBonuses.Count; i++)
         {
             AffixBonusProperty b = affix.Base.affixBonuses[i];
             //ignore local mods
             if (b.bonusType >= (BonusType)0x700)
             {
                 continue;
             }
             else
             {
                 if (affix.GetAffixValue(i) != 0 || b.modifyType == ModifyType.FIXED_TO)
                 {
                     AddStatBonus(b.bonusType, b.restriction, b.modifyType, affix.GetAffixValue(i));
                 }
             }
         }
         for (int i = 0; i < affix.Base.triggeredEffects.Count; i++)
         {
             TriggeredEffectBonusProperty triggeredEffect = affix.Base.triggeredEffects[i];
             TriggeredEffect t = new TriggeredEffect(triggeredEffect, affix.GetEffectValue(i), affix.Base.idName);
             AddTriggeredEffect(triggeredEffect, t);
         }
     }
 }
예제 #2
0
 public AddTriggerPart(TargettingType target, TriggeredEffect effect, int maxTimesThisBattle = -1, int turnCooldown = -1, int maxActiveTurns = -1, int chance = 100) : base(target, chance)
 {
     this.effect             = effect;
     this.maxTimesThisBattle = maxTimesThisBattle;
     this.turnCooldown       = turnCooldown;
     this.maxActiveTurns     = maxActiveTurns;
 }
예제 #3
0
    protected void UpdateOnHitDataBonuses(ActorData data, IEnumerable <GroupType> tags)
    {
        string triggeredEffectSourceName = abilityBase.idName + abilitySlot;

        ClearTriggeredEffects(data, triggeredEffectSourceName);
        foreach (TriggeredEffectBonusProperty triggerProp in abilityBase.triggeredEffects)
        {
            TriggeredEffect triggeredEffect = new TriggeredEffect(triggerProp, triggerProp.effectMinValue + triggerProp.effectMaxValue * abilityLevel, triggeredEffectSourceName);
            triggeredEffects[triggerProp.triggerType].Add(triggeredEffect);

            if (!abilityBase.isSoulAbility && (abilityBase.abilityType == AbilityType.AURA || abilityBase.abilityType == AbilityType.SELF_BUFF))
            {
                data.TriggeredEffects[triggerProp.triggerType].Add(triggeredEffect);
            }
        }

        if (abilityBase.abilityType == AbilityType.AURA || abilityBase.abilityType == AbilityType.SELF_BUFF)
        {
            return;
        }

        abilityOnHitData.UpdateStatusEffectData(data, tags, abilityBonuses);

        StatBonus physicalNegate = data.GetMultiStatBonus(abilityBonuses, tags, BonusType.PHYSICAL_RESISTANCE_NEGATION);

        abilityOnHitData.SetNegation(ElementType.PHYSICAL, physicalNegate.CalculateStat(0));

        StatBonus fireNegate = data.GetMultiStatBonus(abilityBonuses, tags, BonusType.FIRE_RESISTANCE_NEGATION, BonusType.ELEMENTAL_RESISTANCE_NEGATION);

        abilityOnHitData.SetNegation(ElementType.FIRE, fireNegate.CalculateStat(0));

        StatBonus coldNegate = data.GetMultiStatBonus(abilityBonuses, tags, BonusType.COLD_RESISTANCE_NEGATION, BonusType.ELEMENTAL_RESISTANCE_NEGATION);

        abilityOnHitData.SetNegation(ElementType.COLD, coldNegate.CalculateStat(0));

        StatBonus lightningNegate = data.GetMultiStatBonus(abilityBonuses, tags, BonusType.LIGHTNING_RESISTANCE_NEGATION, BonusType.ELEMENTAL_RESISTANCE_NEGATION);

        abilityOnHitData.SetNegation(ElementType.LIGHTNING, lightningNegate.CalculateStat(0));

        StatBonus earthNegate = data.GetMultiStatBonus(abilityBonuses, tags, BonusType.EARTH_RESISTANCE_NEGATION, BonusType.ELEMENTAL_RESISTANCE_NEGATION);

        abilityOnHitData.SetNegation(ElementType.EARTH, earthNegate.CalculateStat(0));

        StatBonus divineNegate = data.GetMultiStatBonus(abilityBonuses, tags, BonusType.DIVINE_RESISTANCE_NEGATION, BonusType.PRIMORDIAL_RESISTANCE_NEGATION);

        abilityOnHitData.SetNegation(ElementType.DIVINE, divineNegate.CalculateStat(0));

        StatBonus voidNegate = data.GetMultiStatBonus(abilityBonuses, tags, BonusType.VOID_RESISTANCE_NEGATION, BonusType.PRIMORDIAL_RESISTANCE_NEGATION);

        abilityOnHitData.SetNegation(ElementType.VOID, voidNegate.CalculateStat(0));
    }
예제 #4
0
    private void LoadNodeLevelsFromSave(ArchetypeSkillNode node, int initalLevel, int setLevel)
    {
        if (node == null)
        {
            return;
        }
        if (initalLevel == setLevel)
        {
            return;
        }

        hero.ModifyArchetypePoints(-(setLevel - initalLevel));

        if (node.type == NodeType.ABILITY && setLevel >= 1)
        {
            AvailableAbilityList.Add(node.GetAbility());
        }

        foreach (var bonus in node.bonuses)
        {
            float bonusValue = 0f;
            if (setLevel > initalLevel)
            {
                if (setLevel == 1 && node.maxLevel == 1)
                {
                    bonusValue = bonus.growthValue;
                }
                else if (setLevel == node.maxLevel)
                {
                    int difference = setLevel - initalLevel - 1;
                    bonusValue = bonus.growthValue * difference + bonus.finalLevelValue;
                }
                else
                {
                    int difference = setLevel - initalLevel;
                    bonusValue = bonus.growthValue * difference;
                }
                hero.AddArchetypeStatBonus(bonus.bonusType, bonus.restriction, bonus.modifyType, bonusValue);
            }
        }

        foreach (TriggeredEffectBonusProperty triggeredEffectBonus in node.triggeredEffects)
        {
            TriggeredEffect t = new TriggeredEffect(triggeredEffectBonus, triggeredEffectBonus.effectMinValue, node.idName);
            hero.AddTriggeredEffect(triggeredEffectBonus, t);
        }

        nodeLevels[node.id] = setLevel;
        AllocatedPoints    += setLevel;
    }
예제 #5
0
        public void ConvertToXml_MapsCorrectly()
        {
            //Arrange
            var triggeredEffectMapper = new TriggeredEffectMapper(_effectRequirementMapper.Object);
            var triggeredEffect       = new TriggeredEffect()
            {
                Action    = "action",
                Buff      = "buff",
                CVar      = "cvar",
                Event     = "event",
                Operation = "operation",
                Target    = "target",
                Trigger   = "trigger",
                Value     = "value"
            };

            triggeredEffect.SetRequirements(new List <EffectRequirement>()
            {
                new EffectRequirement("test")
            });

            //Act
            var xml = triggeredEffectMapper.Convert(triggeredEffect);

            //Assert
            Assert.IsInstanceOfType(xml, typeof(entity_classesEntity_classEffect_groupTriggered_effect));
            Assert.AreEqual("action", xml.action);
            Assert.AreEqual("buff", xml.buff);
            Assert.AreEqual("cvar", xml.cvar);
            Assert.AreEqual("event", xml.@event);
            Assert.AreEqual("operation", xml.operation);
            Assert.AreEqual(1, xml.requirement.Length);
            Assert.AreEqual("test", xml.requirement.First().name);
            Assert.AreEqual("target", xml.target);
            Assert.AreEqual("trigger", xml.trigger);
            Assert.AreEqual("value", xml.value);
        }
예제 #6
0
 /// <summary>
 /// Adds an effect that only exists for this battle with certain limitations on its triggering
 /// </summary>
 /// <param name="effect">The effect to add</param>
 /// <param name="maxTimesThisBattle">How many times this effect can be triggered this battle</param>
 /// <param name="turnCooldown">How long has to pass before the effect can be triggered again</param>
 /// <param name="maxActiveTurns">After how many turns can this effect no longer be triggered</param>
 public void AddTemporaryTrigger(TriggeredEffect effect, int maxTimesThisBattle, int turnCooldown, int maxActiveTurns)
 {
     Debug.Log("Adding a temporary effect");
     temporaryEffectList.Add(new Pair <TriggeredEffect, TemporaryEffectData>(effect, new TemporaryEffectData(maxTimesThisBattle, turnCooldown, maxActiveTurns)));
 }
예제 #7
0
 public void AddTriggeredEffect(TriggeredEffectBonusProperty triggeredEffect, TriggeredEffect effectInstance)
 {
     TriggeredEffects[triggeredEffect.triggerType].Add(effectInstance);
 }
예제 #8
0
    public bool LevelUpNode(ArchetypeSkillNode node)
    {
        if (nodeLevels[node.id] == node.maxLevel)
        {
            return(false);
        }
        nodeLevels[node.id]++;
        AllocatedPoints++;
        if (node.type == NodeType.ABILITY)
        {
            AvailableAbilityList.Add(node.GetAbility());
        }
        foreach (var bonus in node.bonuses)
        {
            float bonusValue = 0f;
            if (bonus.modifyType != ModifyType.MULTIPLY)
            {
                if (nodeLevels[node.id] == 1)
                {
                    bonusValue = bonus.growthValue;
                }
                else if (nodeLevels[node.id] == node.maxLevel)
                {
                    bonusValue = bonus.finalLevelValue;
                }
                else
                {
                    bonusValue = bonus.growthValue;
                }

                hero.AddArchetypeStatBonus(bonus.bonusType, bonus.restriction, bonus.modifyType, bonusValue);
            }
            else
            {
                if (nodeLevels[node.id] == 1)
                {
                    bonusValue = bonus.growthValue;
                }
                else if (nodeLevels[node.id] == node.maxLevel)
                {
                    bonusValue = bonus.growthValue * (nodeLevels[node.id] - 1) + bonus.finalLevelValue;
                    hero.RemoveArchetypeStatBonus(bonus.bonusType, bonus.restriction, bonus.modifyType, bonus.growthValue * (nodeLevels[node.id] - 1));
                }
                else
                {
                    bonusValue = bonus.growthValue * nodeLevels[node.id];
                    hero.RemoveArchetypeStatBonus(bonus.bonusType, bonus.restriction, bonus.modifyType, bonus.growthValue * (nodeLevels[node.id] - 1));
                }

                hero.AddArchetypeStatBonus(bonus.bonusType, bonus.restriction, bonus.modifyType, bonusValue);
            }
        }

        if (nodeLevels[node.id] == 1)
        {
            foreach (TriggeredEffectBonusProperty triggeredEffectBonus in node.triggeredEffects)
            {
                TriggeredEffect t = new TriggeredEffect(triggeredEffectBonus, triggeredEffectBonus.effectMinValue, node.idName);
                hero.AddTriggeredEffect(triggeredEffectBonus, t);
            }
        }

        hero.UpdateActorData();

        return(true);
    }
예제 #9
0
 public CappedEffect(TriggeredEffect e)
 {
     onCapEffect = e;
     //* Another extension idea: adding in a min/max/exact length for the capture.
     //* Pente is an example of a game with this rule - you can only cap lines of 2.
 }
예제 #10
0
 /// <summary>
 /// Adds a triggered effect to the effect list
 /// </summary>
 /// <param name="effect"></param>
 /// <param name="maxTimesThisBattle"></param>
 /// <param name="turnCooldown"></param>
 /// <param name="maxActiveTurns"></param>
 public void AddEffect(TriggeredEffect effect, int maxTimesThisBattle = -1, int turnCooldown = -1, int maxActiveTurns = -1)
 {
     effects.Add(new AddTriggerPart(TargettingType.Self, effect, maxTimesThisBattle, turnCooldown, maxActiveTurns));
 }
    public override void OnApply()
    {
        TriggeredEffect t = new TriggeredEffect(bonus, EffectPower, EffectName);

        target.Data.AddTriggeredEffect(bonus, t);
    }
예제 #12
0
 //Note for this one we just always use checkDirection.LINE here, you can extend it if you like!
 public InARowEffect(TriggeredEffect e, int n)
 {
     onTriggerEffect = e;
     rowLength       = n;
     checkDirection  = Direction.LINE;
 }