Ejemplo n.º 1
0
        public void OnEventAboutToTrigger(RuleCalculateDamage evt)
        {
            if (!apply_to_natural_attacks || !(evt.ParentRule?.AttackRoll?.Weapon?.Blueprint?.IsNatural).GetValueOrDefault())
            {
                MechanicsContext context = evt.Reason.Context;
                if (context?.SourceAbility == null || !context.SourceAbility.IsSpell)
                {
                    return;
                }

                if (!Helpers.checkSpellbook(spellbook, specific_class, context.SourceAbilityContext?.Ability?.Spellbook, evt.Initiator.Descriptor))
                {
                    return;
                }

                var attack_roll = evt.ParentRule?.AttackRoll;
                if (attack_roll == null)
                {
                    return;
                }
            }

            foreach (BaseDamage baseDamage in evt.DamageBundle)
            {
                baseDamage.AddBonus(baseDamage.Dice.Rolls);
            }
        }
Ejemplo n.º 2
0
        public void OnEventAboutToTrigger(RuleCalculateDamage evt)
        {
            MechanicsContext context = evt.Reason.Context;

            if (context?.SourceAbility == null || !context.SpellDescriptor.HasAnyFlag((Kingmaker.Blueprints.Classes.Spells.SpellDescriptor) this.SpellDescriptor) || !context.SourceAbility.IsSpell)
            {
                return;
            }


            if (!Helpers.checkSpellbook(spellbook, specific_class, context.SourceAbilityContext?.Ability?.Spellbook, context.MaybeCaster.Descriptor))
            {
                return;
            }

            if (!context.HasMetamagic((Metamagic)MetamagicFeats.MetamagicExtender.ForceFocus))
            {
                return;
            }

            foreach (BaseDamage baseDamage in evt.DamageBundle)
            {
                var dice_formula = baseDamage.Dice;
                if (dice_formula.Dice == DiceType.Zero || dice_formula.Rolls <= 0)
                {
                    continue;
                }

                var dice = dice_formula.Dice;
                switch (dice)
                {
                case DiceType.D4:
                {
                    dice = DiceType.D6;
                    break;
                }

                case DiceType.D6:
                {
                    dice = DiceType.D8;
                    break;
                }

                case DiceType.D8:
                {
                    dice = DiceType.D10;
                    break;
                }

                case DiceType.D10:
                {
                    dice = DiceType.D12;
                    break;
                }
                }

                baseDamage.ReplaceDice(new DiceFormula(dice_formula.Rolls, dice));
            }
        }
Ejemplo n.º 3
0
 public void OnEventAboutToTrigger(RuleCalculateDamage evt)
 {
     //will be applied to both: attacker and partner
     if (unit != null)
     {
         evt.DamageBundle.First?.AddBonusTargetRelated(damage);
     }
 }
Ejemplo n.º 4
0
        public void OnEventAboutToTrigger(RuleCalculateDamage evt)
        {
            var weaponDamage = evt.DamageBundle.WeaponDamage as PhysicalDamage;

            if (weaponDamage != null && (weaponDamage.MaterialsMask & PhysicalDamageMaterial.ColdIron) != 0)
            {
                weaponDamage.AddBonusTargetRelated(1);
            }
        }
Ejemplo n.º 5
0
        // Token: 0x060018F8 RID: 6392 RVA: 0x000A0F78 File Offset: 0x0009F178
        public new void OnEventAboutToTrigger(RuleCalculateDamage evt)
        {
            int classLevel = 0;

            foreach (var thisClass in this.Wizards)
            {
                classLevel += base.Owner.Progression.GetClassLevel(thisClass);
            }
            if (classLevel == 20)
            {
                foreach (BaseDamage baseDamage in evt.DamageBundle)
                {
                    EnergyDamage energyDamage = baseDamage as EnergyDamage;
                    if (energyDamage != null && energyDamage.EnergyType == this.Type)
                    {
                        baseDamage.Immune = true;
                    }
                }
            }
        }
Ejemplo n.º 6
0
        internal static bool Prefix(AddIncorporealDamageDivisor __instance, RuleCalculateDamage evt)
        {
            if (!(evt.Target.Get <UnitPartGhostbaneDirge>()?.active()).GetValueOrDefault())
            {
                return(true);
            }

            foreach (BaseDamage baseDamage in evt.DamageBundle)
            {
                if (baseDamage.Reality != DamageRealityType.Ghost)
                {
                    PhysicalDamage physicalDamage = baseDamage as PhysicalDamage;
                    if (physicalDamage != null)
                    {
                        if (physicalDamage.EnchantmentTotal == 0)
                        {
                            baseDamage.Half = true;
                        }
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 7
0
 public void OnEventDidTrigger(RuleCalculateDamage evt)
 {
 }
 public void OnEventAboutToTrigger(RuleCalculateDamage evt)
 {
 }