Ejemplo n.º 1
0
        public static void createProjectile()
        {
            var throwing_axe_proj = library.Get <BlueprintProjectile>("dbcc51cfd11fc1441a495daf9df9b340");

            thrown_weapon_proj               = library.CopyAndAdd <BlueprintProjectile>("c8559cabbf082234e80ad8e046bfa1a1", "ThrownWeaponProjectile", "c732ed37c1a3414fafcb959ed5c358ce");
            thrown_weapon_proj.Trajectory    = library.Get <BlueprintProjectileTrajectory>("d2b5ccb441b77b045a0d68a18d8f0154");
            thrown_weapon_proj.CastFx        = throwing_axe_proj.CastFx.CloneObject();
            thrown_weapon_proj.ProjectileHit = throwing_axe_proj.ProjectileHit.CloneObject();
            thrown_weapon_proj.DamageHit     = throwing_axe_proj.DamageHit.CloneObject();
        }
Ejemplo n.º 2
0
        static bool Prefix(RuleAttackWithWeapon __instance, BlueprintProjectile projectile, bool first)
        {
            if ((!first) && __instance.Weapon.Blueprint.Type.FighterGroup == WeaponFighterGroup.Bows && (bool)__instance.Initiator.Descriptor.State.Features.Manyshot && (__instance.IsFirstAttack && __instance.IsFullAttack))
            {
                if (__instance.Initiator.Get <UnitPartManyshotNotAvailable>() != null && __instance.Initiator.Get <UnitPartManyshotNotAvailable>().active())
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
 static void Postfix(ProjectileController __instance, UnitEntityData launcher, TargetWrapper target, BlueprintProjectile projectileBlueprint, RuleAttackRoll attackRoll, RulebookEvent ruleOnHit, Projectile __result)
 {
     if (projectileBlueprint == thrown_weapon_proj)
     {
         var        weapon     = attackRoll.Weapon;
         GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(weapon.Blueprint.VisualParameters.Model, __result.View.transform);
         gameObject.transform.localPosition = Vector3.zero;
         gameObject.transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
         gameObject.transform.localScale    = Vector3.one;
         __result.MaxRange = weapon.AttackRange.Meters;
     }
 }
        public override IEnumerator <AbilityDeliveryTarget> Deliver(AbilityExecutionContext context, TargetWrapper target)
        {
            UnitEntityData        caster  = context.Caster;
            List <UnitEntityData> targets = this.GetTargets(caster);
            Vector3 tp = target.Point;

            Vector3[] points   = new Vector3[targets.Count];
            float[]   radiuses = new float[targets.Count];
            for (int i = 0; i < targets.Count; i++)
            {
                points[i]   = tp;
                radiuses[i] = targets[i].View.Corpulence;
            }
            FreePlaceSelector.RelaxPoints(points, radiuses, targets.Count, null);
            Vector3    targetPoint = points[0];
            GameObject portalFrom  = FxHelper.SpawnFxOnUnit(this.PortalFromPrefab, caster.View, null, default(Vector3));
            GameObject portalTo    = FxHelper.SpawnFxOnUnit(this.PortalToPrefab, caster.View, null, default(Vector3));

            if (portalTo != null)
            {
                portalTo.transform.position = targetPoint;
            }
            Transform portalFromBone   = (!(portalFrom != null)) ? null : portalFrom.transform.FindChildRecursive(this.PortalBone);
            Vector3   portalFromPoint  = (!(portalFromBone != null)) ? caster.Position : portalFromBone.transform.position;
            Transform portalToBone     = (!(portalTo != null)) ? null : portalTo.transform.FindChildRecursive(this.PortalBone);
            Vector3   portalToPoint    = (!(portalToBone != null)) ? targetPoint : portalToBone.transform.position;
            TimeSpan  startTime        = Game.Instance.TimeController.GameTime;
            bool      casterTeleported = false;

            for (int j = 0; j < targets.Count; j++)
            {
                UnitEntityData t = targets[j];
                t.Wake(10f);
                Vector3             teleportPosition = points[j];
                GameObject          prefab           = (j != 0) ? this.SideDisappearFx : this.CasterDisappearFx;
                GameObject          appearFx         = (j != 0) ? this.SideAppearFx : this.CasterAppearFx;
                BlueprintProjectile blueprint        = (j != 0) ? this.SideDisappearProjectile : this.CasterDisappearProjectile;
                BlueprintProjectile appearProjectile = (j != 0) ? this.SideAppearProjectile : this.CasterAppearProjectile;
                FxHelper.SpawnFxOnUnit(prefab, t.View, null, default(Vector3));
                GameHelper.LaunchProjectile(t, portalFromPoint, blueprint, delegate(Projectile dp)
                {
                    t.CombatState.PreventAttacksOfOpporunityNextFrame = true;
                    t.Position = teleportPosition;
                    t.View.StopMoving();
                    Game.Instance.ProjectileController.Launch(t, t, appearProjectile, portalToPoint, delegate(Projectile ap)
                    {
                        if (this.LookAtTarget)
                        {
                            t.ForceLookAt(target.Point);
                        }
                        FxHelper.SpawnFxOnUnit(appearFx, t.View, null, default(Vector3));
                        casterTeleported |= (caster == t);
                    });
                });
            }
            while (!casterTeleported && Game.Instance.TimeController.GameTime - startTime < 2.Seconds())
            {
                yield return(null);
            }
            if (casterTeleported)
            {
                yield return(new AbilityDeliveryTarget(target));
            }
            yield break;
        }