예제 #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 void OnEventAboutToTrigger(RuleAttackRoll evt)
        {
            if (evt.Target.Descriptor.Resources.GetResourceAmount(resource) < cost)
            {
                return;
            }

            if ((base.Owner.Body.PrimaryHand.Weapon.Blueprint.Category == WeaponCategory.Dagger || base.Owner.Body.PrimaryHand.Weapon.Blueprint.Category == WeaponCategory.Starknife) && base.Owner.Body.PrimaryHand.Weapon.Blueprint.IsRanged)
            {
                ThrowAnything.toggleThrown(base.Owner.Body.PrimaryHand.Weapon, evt.Initiator);
                did_swap = true;
            }

            if (!evt.Weapon.Blueprint.IsMelee || evt.Parry != null || !base.Owner.Unit.IsEnemy(evt.Initiator))
            {
                return;
            }
            if (evt.Target != base.Owner.Unit)
            {
                return;
            }
            if (!base.Owner.Unit.IsReach(evt.Target, base.Owner.Body.PrimaryHand))
            {
                return;
            }
            //TODO - Conditions?

            /*
             * if (this.AttackerCondition.HasConditions)
             * {
             *  MechanicsContext maybeContext = base.Fact.MaybeContext;
             *  using ((maybeContext != null) ? maybeContext.GetDataScope(evt.Initiator) : null)
             *  {
             *      if (!this.AttackerCondition.Check(null))
             *      {
             *          return;
             *      }
             *  }
             * }
             */

            evt.TryParry(base.Owner.Unit, base.Owner.Body.PrimaryHand.Weapon, 0);
            if (evt.Parry == null)
            {
                return;
            }
            ModifiableValue additionalAttackBonus = base.Owner.Stats.AdditionalAttackBonus;
            int             num = evt.Initiator.Descriptor.State.Size - base.Owner.State.Size;

            if (num > 0)
            {
                int value = -2 * num;
                evt.AddTemporaryModifier(additionalAttackBonus.AddModifier(value, this, ModifierDescriptor.Penalty));
            }
        }
예제 #3
0
            static void Postfix(LibraryScriptableObject __instance)
            {
                var self = __instance;

                if (Main.library != null)
                {
                    return;
                }
                Main.library = self;
                try
                {
                    Main.DebugLog("Loading Derring-Do");
                    if (settings.thrown_weapons_and_flying_blade)
                    {
                        Main.DebugLog("Adding Thrown Daggers and Starknives");
                        ThrowAnything.create();
                    }
                    Swashbuckler.createSwashbucklerClass(settings.thrown_weapons_and_flying_blade);
                }
                catch (Exception ex)
                {
                    Main.DebugError(ex);
                }
            }