Beispiel #1
0
        public void OnEventDidTrigger(RuleAttackRoll evt)
        {
            if (did_swap)
            {
                ThrowAnything.toggleThrown(base.Owner.Body.PrimaryHand.Weapon, evt.Initiator);
            }
            did_swap = false;
            RuleAttackRoll.ParryData parry = evt.Parry;
            if (((parry != null) ? parry.Initiator : null) != base.Owner.Unit)
            {
                return;
            }

            if (!evt.Parry.IsTriggered)
            {
                return;
            }

            evt.Target.Descriptor.Resources.Spend(resource, cost);

            if (evt.Result == AttackResult.Parried && evt.Target.Descriptor.Resources.GetResourceAmount(resource) >= cost)
            {
                Game.Instance.CombatEngagementController.ForceAttackOfOpportunity(base.Owner.Unit, evt.Initiator);
            }

            //base.Owner.RemoveFact(base.Fact); Unsure what this does in context of original parry

            IFactContextOwner factContextOwner = base.Fact as IFactContextOwner;

            if (factContextOwner != null)
            {
                factContextOwner.RunActionInContext(CreateActionList(Create <ContextActionRemoveSelf>()), evt.Initiator);
            }
        }
Beispiel #2
0
        public override void OnEventDidTrigger(RuleAttackRoll evt)
        {
            if (evt.Initiator.Descriptor.Resources.GetResourceAmount(resource) < need_resource)
            {
                return;
            }

            var flying_blade_flag = (evt.Weapon.Blueprint.Category == WeaponCategory.Dagger || evt.Weapon.Blueprint.Category == WeaponCategory.Starknife) && evt.Initiator.Descriptor.HasFact(FlyingBlade.bleeding_wound_deed);

            if (!isSwashbucklerWeapon(evt.Weapon.Blueprint, evt.Initiator.Descriptor) && !flying_blade_flag)
            {
                return;
            }

            if (evt.ImmuneToSneakAttack)
            {
                return;
            }

            if (!evt.IsHit)
            {
                return;
            }

            evt.Initiator.Descriptor.Resources.Spend(resource, need_resource);

            IFactContextOwner factContextOwner = base.Fact as IFactContextOwner;

            if (factContextOwner != null)
            {
                factContextOwner.RunActionInContext(this.Action, evt.Target);
            }
        }
        public override void OnEventDidTrigger(RuleAttackRoll evt)
        {
            if (evt.Initiator.Descriptor.Resources.GetResourceAmount(resource) < need_resource)
            {
                return;
            }

            if (evt.Initiator.CombatState.Cooldown.SwiftAction != 0.0f)
            {
                return;
            }

            if (!isSwashbucklerWeapon(evt.Weapon.Blueprint, evt.Initiator.Descriptor))
            {
                return;
            }

            if (!evt.IsHit)
            {
                return;
            }

            IFactContextOwner factContextOwner = base.Fact as IFactContextOwner;
            if (factContextOwner != null)
            {
                evt.Initiator.CombatState.Cooldown.SwiftAction = 6.0f;
                factContextOwner.RunActionInContext(CreateActionList(demoralize_action), evt.Target);
            }
        }
Beispiel #4
0
        public override void OnEventDidTrigger(RuleDealDamage evt)
        {
            IFactContextOwner factContextOwner = base.Fact as IFactContextOwner;

            if (factContextOwner != null)
            {
                factContextOwner.RunActionInContext(CreateActionList(Create <ContextActionRemoveSelf>()), evt.Initiator);
            }
        }
Beispiel #5
0
        public override void OnEventDidTrigger(RuleAttackRoll evt)
        {
            if (is_passive)
            {
                return;
            }
            IFactContextOwner factContextOwner = base.Fact as IFactContextOwner;

            if (factContextOwner != null)
            {
                factContextOwner.RunActionInContext(CreateActionList(Create <ContextActionRemoveSelf>()), evt.Initiator);
            }
        }
Beispiel #6
0
        public override void OnEventDidTrigger(RuleAttackWithWeapon evt)
        {
            if (will_spend > 0)
            {
                evt.Target.Descriptor.Resources.Spend(resource, will_spend);
            }
            IFactContextOwner factContextOwner = base.Fact as IFactContextOwner;

            if (factContextOwner != null)
            {
                factContextOwner.RunActionInContext(this.ActionOnSelf, evt.Initiator);
            }
            will_spend = 0;
        }
Beispiel #7
0
        private void TryRunActions(RuleAttackWithWeapon rule, RuleAttackWithWeaponResolve evt)
        {
            var valid_target = this.CheckValidTarget(rule);

            if ((this.CheckCondition(rule) && valid_target) || ((IsRanged && CheckProjectile(evt)) && valid_target))
            {
                using (new ContextAttackData(rule.AttackRoll, null))
                {
                    IFactContextOwner factContextOwner2 = base.Fact as IFactContextOwner;
                    if (factContextOwner2 != null)
                    {
                        factContextOwner2.RunActionInContext(this.Action, rule.Initiator);
                    }
                }
            }
        }
Beispiel #8
0
        public override void OnEventDidTrigger(RuleAttackWithWeapon evt)
        {
            if (will_spend > 0 && evt.AttackRoll.IsHit)
            {
                evt.Initiator.Descriptor.Resources.Spend(Swashbuckler.panache_resource, will_spend);
            }

            will_spend = 0;

            IFactContextOwner factContextOwner = base.Fact as IFactContextOwner;

            if (factContextOwner != null)
            {
                factContextOwner.RunActionInContext(CreateActionList(Create <ContextActionRemoveSelf>()), evt.Initiator);
            }
        }