示例#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);
            }
        }
示例#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);
            }
        }
示例#3
0
        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);
            }
        }
示例#4
0
        public override void OnEventDidTrigger(RuleDealDamage evt)
        {
            IFactContextOwner factContextOwner = base.Fact as IFactContextOwner;

            if (factContextOwner != null)
            {
                factContextOwner.RunActionInContext(CreateActionList(Create <ContextActionRemoveSelf>()), evt.Initiator);
            }
        }
示例#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);
            }
        }
示例#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;
        }
示例#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);
                    }
                }
            }
        }
示例#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);
            }
        }