Пример #1
0
        public InstantHit(InstantHitInfo info, ProjectileArgs args)
        {
            this.args = args;
            this.info = info;
            source    = args.Source;

            if (info.Inaccuracy.Length > 0)
            {
                var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
                var maxOffset  = inaccuracy * (args.PassiveTarget - source).Length / args.Weapon.Range.Length;
                target = Target.FromPos(args.PassiveTarget + WVec.FromPDF(args.SourceActor.World.SharedRandom, 2) * maxOffset / 1024);
            }
            else
            {
                target = args.GuidedTarget;
            }
        }
Пример #2
0
        public InstantHit(InstantHitInfo info, ProjectileArgs args)
        {
            this.args = args;
            this.info = info;

            if (args.Weapon.TargetActorCenter)
            {
                target = args.GuidedTarget;
            }
            else if (info.Inaccuracy.Length > 0)
            {
                var maxInaccuracyOffset = Util.GetProjectileInaccuracy(info.Inaccuracy.Length, info.InaccuracyType, args);
                var inaccuracyOffset    = WVec.FromPDF(args.SourceActor.World.SharedRandom, 2) * maxInaccuracyOffset / 1024;
                target = Target.FromPos(args.PassiveTarget + inaccuracyOffset);
            }
            else
            {
                target = Target.FromPos(args.PassiveTarget);
            }
        }