protected override IEnumerable<Targets> SelectTargets(TargetingRuleParameters p)
        {
            var sourceTargetCandidates = GetDamageSourceAndDamageTargetCandidates(p);

              if (sourceTargetCandidates.DamageSource.Count == 0 ||
            sourceTargetCandidates.DamageTarget.Count == 0)
              {
            return None<Targets>();
              }

              // for simplicity we consider only 'best' 1 legal assignment
              var damageSource = sourceTargetCandidates.DamageSource[0];
              var damageTarget = sourceTargetCandidates.DamageTarget[0];

              // cost should not be paid with damage target
              var cost = p.Candidates<Card>(selector: trgs => trgs.Cost)
            .OrderBy(x => x.Score)
            .Where(x => x != damageTarget)
            .FirstOrDefault();

              if (cost == null)
              {
            return None<Targets>();
              }

              var targets = new Targets();
              targets.AddCost(cost);
              targets.AddEffect(damageSource);
              targets.AddEffect(damageTarget);

              return new[] {targets};
        }
예제 #2
0
 public override void Pay(Targets targets, int? x, int repeat = 1)
 {
     foreach (var cost in _costs)
       {
     cost.Pay(targets, x, repeat);
       }
 }
예제 #3
0
 public virtual void Pay(Targets targets, int? x, int repeat = 1)
 {
     // only one cost target is currently
       // supported, changes this to support
       // more
       PayCost(targets, x, repeat);
 }
예제 #4
0
 public ProjectSync(string projectPath, Targets target, IConsole console, IProjectFactory factory)
 {
     _projectPath = projectPath;
     _target = target;
     _console = console;
     _factory = factory;
 }
예제 #5
0
파일: Target.cs 프로젝트: nbolabs/KnifeLi
	public static Target allocateTarget(Targets id, Transform tf, Vector3 pos, bool left, int speed) {
		Target result = null;
		foreach (var keyvalue in targetPool) {
			Target t = keyvalue.Key;
			if (t.TARGET_ID == id && keyvalue.Value) {
				result = t;
				targetPool[t] = false;
				t.gameObject.active = true;
				break;
			}
		}
		
		if (result == null) {
			Transform targetInst = (Transform)Instantiate(tf);
			result = targetInst.GetComponent<Target>();
			targetPool.Add (result, false);
		}
		result.transform.position = pos;
		
		if (left) {
			result.transform.rotation = Quaternion.LookRotation(result.leftFace);
			result.rigidbody.AddForce(Vector3.right * speed);
		}
		else {
			result.transform.rotation = Quaternion.LookRotation(result.rightFace);
			result.rigidbody.AddForce(Vector3.left * speed);
		}
		result.Resume();
		return result;
	}
예제 #6
0
 public override void SetTriggeredAbilityTargets(Targets targets)
 {
     foreach (var childEffect in _childEffects)
       {
     childEffect.SetTriggeredAbilityTargets(targets);
       }
 }
예제 #7
0
        /// <summary>
        /// Create the application element
        /// </summary>
        private void CreateApplication(Targets target, XElement manifest, string outputFolder)
        {
            // Find application attribute
            var appTuple = FindApplication();
            var attr = appTuple.Item2;

            var label = attr.GetValue<string>(0, "Label");
            if (string.IsNullOrEmpty(label))
                throw new ArgumentException(string.Format("No Label set in {0}", attr));
            var icon = attr.GetValue<string>("Icon");
            if (string.IsNullOrEmpty(icon))
            {
                // Select icon from activity
                var activityIcons = FindActivities().Select(x => x.Item2.GetValue<string>("Icon")).Where(x => !string.IsNullOrEmpty(x));
                icon = activityIcons.FirstOrDefault();
            }
            // Create application
            var application = new XElement("application");
            manifest.Add(application);
            application.AddAttr("label", Namespace, FormatStringOrLiteral(label));
            if (appTuple.Item1 != null)
            {
                var xType = XBuilder.AsTypeDefinition(module, appTuple.Item1);
                application.AddAttr("name", Namespace, FormatClassName(xType));
            }
            else
            {
                // use Dot42.Internal.Application
                // FIXME: there should be a better way to specify the type...
                application.AddAttr("name", Namespace, "dot42.Internal.Application");
            }
            application.AddAttrIfNotEmpty("icon", Namespace, icon, FormatDrawable);
            application.AddAttrIfNotEmpty("theme", Namespace, attr.GetValue<string>("Theme"), FormatStyle);
            application.AddAttrIfNotEmpty("description", Namespace, attr.GetValue<string>("Description"));
            application.AddAttrIfNotEmpty("logo", Namespace, attr.GetValue<string>("Logo"), FormatDrawable);
            application.AddAttrIfNotDefault("debuggable", Namespace, attr.GetValue<bool>("Debuggable", debuggable), false);
            application.AddAttrIfFound("enabled", Namespace, attr, "Enabled");
            application.AddAttrIfNotDefault("persistent", Namespace, attr.GetValue<bool>("Persistent"), false);
            application.AddAttrIfFound("allowTaskReparenting", Namespace, attr, "AllowTaskReparenting");
            application.AddAttrIfNotEmpty("backupAgent", Namespace, attr.GetValue<Type>("BackupAgent"), nsConverter.GetConvertedFullName);
            application.AddAttrIfFound("hardwareAccelerated", Namespace, attr, "HardwareAccelerated");
            application.AddAttrIfFound("killAfterRestore", Namespace, attr, "KillAfterRestore");
            application.AddAttrIfFound("largeHeap", Namespace, attr, "LargeHeap");
            application.AddAttrIfNotEmpty("manageSpaceActivity", Namespace, attr.GetValue<Type>("ManageSpaceActivity"), nsConverter.GetConvertedFullName);
            application.AddAttrIfNotEmpty("process", Namespace, attr.GetValue<string>("Process"));
            application.AddAttrIfFound("restoreAnyVersion", Namespace, attr, "RestoreAnyVersion");
            application.AddAttrIfNotEmpty("taskAffinity", Namespace, attr.GetValue<string>("TaskAffinity"));
            application.AddAttrIfNotDefault("uiOptions", Namespace, attr.GetValue<int>("UIOptions"), 0, uiOptions.Format);

            // Create child elements
            CreateActivity(application);
            CreateService(application);
            CreateReceiver(application);
            CreateAppWidgetProvider(application, outputFolder);
            CreateUsesLibrary(application);
            CreateProvider(application);
            CreateMetaData(application, assembly); // Must be last
        }
        public PushMessage(string body,
                            Targets target = Targets.All,
                            DateTime? expire = null)
        {
            Body = body;

            Expire = expire;
            Target = target;
        }
예제 #9
0
 private static void WriteLineInternal(string text = null, Severities severity = Severities.Info, Targets target = Targets.Debug, [CallerMemberName]string caller = null)
 {
     switch (target)
     {
         case Targets.Debug:
             System.Diagnostics.Debug.WriteLineIf(Enabled, $"{DateTime.Now.TimeOfDay.ToString()} {severity} {caller} {text}");
             break;
         case Targets.Log:
             throw new NotImplementedException();
     }
 }
예제 #10
0
        protected override void PayCost(Targets targets, int? x, int repeat)
        {
            var target = targets.Cost.FirstOrDefault();

              if (target != null)
              {
            target.Card().Sacrifice();
            return;
              }

              Card.Sacrifice();
        }
예제 #11
0
 /// <summary>
 /// Registry base for application (C# for Android)
 /// </summary>
 internal static string ROOT(Targets target)
 {
     switch (target)
     {
         case Targets.Android:
             return ROOT_ANDROID_1;
         case Targets.BlackBerry:
             return ROOT_BLACKBERRY_1;
         default:
             throw new ArgumentException("Unknown target " + (int)target);
     }
 }
예제 #12
0
        public ActionResult Create(Guid gid, string name)
        {
            var newTarget = new Target()
            {
                GroupKey = gid,
                Name = name,
            };

            if (string.IsNullOrWhiteSpace(name)) ModelState.AddModelError("name", "Name is required.");

            if (ModelState.IsValid)
            {
                try
                {
                    var targets = new Targets();
                    targets.CreateTarget(newTarget);
                    try
                    {
                        var defaultAppValue = System.Configuration.ConfigurationManager.AppSettings["Plywood.DefaultApp"];
                        if (!string.IsNullOrEmpty(defaultAppValue))
                        {
                            Guid defaultApp;
                            if (Guid.TryParse(defaultAppValue, out defaultApp))
                            {
                                var targetApps = new TargetApps();
                                targetApps.AddApp(newTarget.Key, defaultApp);
                            }
                        }
                    }
                    catch (Exception)
                    {
                        // TODO: Log failing to add the toolkit to a new target.
                        // Just carry on - this isn't too important!
                    }
                    return RedirectToAction("Details", new { id = newTarget.Key });
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("Error", ex);
                }
            }

            var groups = new Groups();
            var group = groups.GetGroup(gid);

            var model = new TargetDetails()
            {
                Target = new Target() { GroupKey = gid },
                Group = group,
            };

            return View(model);
        }
예제 #13
0
        public ActionResult AddTag(Guid id, string name, string value)
        {
            var targets = new Targets();
            var target = targets.GetTarget(id);
            if (target.Tags.ContainsKey(name))
                throw new HttpException(406, "Tag name already exists");

            target.Tags.Add(name, value);
            targets.UpdateTarget(target);
            if (Request.IsAjaxRequest())
                return Json(null);
            else
                return RedirectToAction("EditTags", new { id = id });
        }
예제 #14
0
        private static void DefaultWriteLine(string text = null, Severities severity = Severities.Info, Targets target = Targets.Debug, [CallerMemberName]string caller = null)
        {
            var enabled = Template10.Settings.LogginEnabled;
            if (!enabled) return;

            switch (target)
            {
                case Targets.Debug:
                    System.Diagnostics.Debug.WriteLine($"{DateTime.Now.TimeOfDay.ToString()} {severity} {caller} {text}");
                    break;
                case Targets.Log:
                    throw new NotImplementedException();
            }
        }
예제 #15
0
        /// <summary>
        /// Compile the given XML file to a binary XML file in the given output folder.
        /// </summary>
        private void CreateManifest(Targets target, string outputFolder)
        {
#if DEBUG
            //Debugger.Launch();
#endif
            var pkgAttributes = assembly.GetAttributes(PackageAttribute).ToList();
            if (pkgAttributes.Count > 1)
                throw new ArgumentException("Multiple Package attributes found");
            var pkgAttr = pkgAttributes.FirstOrDefault();
            
            // Create xml root
            var doc = new XDocument();
            var manifest = new XElement("manifest");
            manifest.Add(new XAttribute(XNamespace.Xmlns + "android", XNamespace.Get(Namespace)));
            doc.Add(manifest);

            // Create uses-sdk
            CreateUsesSdk(manifest, pkgAttr);

            // Set attributes
            manifest.Add(new XAttribute(XName.Get("package"), packageName));
            var version = assembly.Name.Version;
            var versionCode = (pkgAttr != null) ? pkgAttr.GetValue("VersionCode", version.Major) : version.Major;
            manifest.Add(new XAttribute(XName.Get("versionCode", Namespace), versionCode));
            var versionName = (pkgAttr != null) ? pkgAttr.GetValue("VersionName", version.ToString()) : version.ToString();
            manifest.Add(new XAttribute(XName.Get("versionName", Namespace), versionName));
            // Set additional attributes
            if (pkgAttr != null)
            {
                manifest.AddAttrIfNotEmpty("sharedUserId", Namespace, pkgAttr.GetValue<string>("SharedUserId"));
                manifest.AddAttrIfNotEmpty("sharedUserLabel", Namespace, pkgAttr.GetValue<string>("SharedUserLabel"), FormatString);
                manifest.AddAttrIfNotDefault("installLocation", Namespace, pkgAttr.GetValue<int>("InstallLocation"), 0, installLocationsOptions.Format);
            }

            // Create child elements
            CreateApplication(target, manifest, outputFolder);
            CreateInstrumentation(manifest);
            CreatePermission(manifest);
            CreatePermissionGroup(manifest);
            CreateSupportsScreens(manifest);
            CreateUsesFeature(manifest);
            CreateUsesPermission(manifest);

            // Save
            if (!Directory.Exists(outputFolder))
                Directory.CreateDirectory(outputFolder);
            doc.Save(Path.Combine(outputFolder, "AndroidManifest.xml"));
        }
예제 #16
0
        public ActionResult ConfirmDelete(Guid id)
        {
            var targets = new Targets();
            var groups = new Groups();

            var target = targets.GetTarget(id);
            var group = groups.GetGroup(target.GroupKey);

            var model = new TargetDetails()
            {
                Target = target,
                Group = group,
            };

            return View(model);
        }
예제 #17
0
        protected override void PayCost(Targets targets, int? x, int repeat)
        {
            var amount = Game.GetActualCost(_amount, _manaUsage, Card);

              if (x.HasValue)
            amount = amount.Add(x.Value.Colorless());

              if (_supportsRepetitions)
              {
            for (var i = 1; i < repeat; i++)
            {
              amount = amount.Add(_amount);
            }
              }

              Card.Controller.Consume(amount, _manaUsage);
        }
예제 #18
0
	public static int ScoreOfTarget (Targets target)
	{
		if(target == Targets.NormalTarget)
			return 10;
		else if(target == Targets.BombTarget)
			return 15;
		else if(target == Targets.StrongTarget)
			return 30;
		else if(target == Targets.ProjectileTarget)
			return 15;
		else if(target == Targets.TimeTarget)
			return 15;
		else if(target == Targets.WallTarget)
			return 50;
		else
			return 10;
	}
예제 #19
0
        //
        // GET: /Instances/Create
        public ActionResult Create(Guid tid)
        {
            var targets = new Targets();
            var groups = new Groups();

            var target = targets.GetTarget(tid);
            var group = groups.GetGroup(target.GroupKey);

            var model = new InstanceDetails()
            {
                Instance = new Instance(),
                Target = target,
                Group = group,
            };

            return View(model);
        }
        protected override IEnumerable<Targets> SelectTargets(TargetingRuleParameters p)
        {
            var costCandidates = p.Candidates<Card>(selectorIndex: 0, selector: c => c.Cost);

              var canTargetOpponent = p.Candidates<Player>(selectorIndex: 0, selector: c => c.Effect)
            .Any(x => x != p.Controller);

              // check to see if we can kill opponent by sacing any one creature
              var opponentsLife = p.Controller.Opponent.Life;
              if (canTargetOpponent && costCandidates.Any(x => opponentsLife <= x.Power))
              {
            var targets = new Targets(
              cost: costCandidates.Where(x => opponentsLife <= x.Power).OrderBy(x => x.Score).First(),
              effect: p.Controller.Opponent
              );

            return new[] {targets};
              }

              // pair your creatures and opponents
              // power -> lifepoints left

              var yourCreatures = costCandidates
            .OrderBy(x => x.Power)
            .ThenBy(x => x.Score)
            .ToList();

              var opponentCreatures = p.Candidates<Card>(selectorIndex: 0, selector: c => c.Effect)
            .OrderBy(x => x.Life)
            .ToList();

              var pairs =
            (from yourCreature in yourCreatures
             from opponentCreature in opponentCreatures
             where yourCreature.Power >= opponentCreature.Life
             select new Pair(yourCreature, opponentCreature))
              .OrderByDescending(x => x.Score)
              .ToList();

              return pairs.Select(x =>
            new Targets(
              cost: x.Yours,
              effect: x.Opponents)
            );
        }
예제 #21
0
        //
        // GET: /TargetApps/
        public ActionResult Index(Guid tid, string q = null, int o = 0, int c = 50)
        {
            var targetApps = new TargetApps();
            var targets = new Targets();
            var groups = new Groups();

            var targetAppList = targetApps.SearchTargetApps(tid, q, o, c);
            var target = targets.GetTarget(tid);
            var group = groups.GetGroup(target.GroupKey);

            var model = new TargetAppsIndex()
            {
                TargetAppList = targetAppList,
                Target = target,
                Group = group,
            };
            return View(model);
        }
예제 #22
0
        //
        // GET: /Instances/ConfirmDelete/5
        public ActionResult ConfirmDelete(Guid id)
        {
            var instances = new Instances();
            var targets = new Targets();
            var groups = new Groups();

            var instance = instances.GetInstance(id);
            var target = targets.GetTarget(instance.TargetKey);
            var group = groups.GetGroup(target.GroupKey);

            var model = new InstanceDetails()
            {
                Instance = instance,
                Target = target,
                Group = group,
            };

            return View(model);
        }
예제 #23
0
    //TODO: Place for model data.
    void Start()
    {
        Material Red = (Material)Resources.Load("Temp/Materials/Redfish_MT");
        Material Blue = (Material)Resources.Load("Temp/Materials/Purpfish_MT");
        Material Green = (Material)Resources.Load("Temp/Materials/Goldfish_MT");
        //TODO: Load Model Data
        //TODO: Calculate complexity

        species = GenUtil.species(Random.Range(1,40),complexity:75, targets: Targets.Smaller);
        //Debug.Log (species);

        //Unpack species string
        string[] temp = species.Split(new char[] {' '});
        speciesName = temp[0];
        Diet = (DietType)System.Enum.Parse(typeof(DietType),temp[1]);
        dimensions.x = float.Parse(temp[2]);
        dimensions.y = float.Parse(temp[3]);
        dimensions.z = float.Parse(temp[4]);
        AttType = (AttackType)System.Enum.Parse(typeof(AttackType),temp[5]);
        DefType = (DefenceType)System.Enum.Parse(typeof(DefenceType),temp[6]);
        MovType = (MovementType)System.Enum.Parse(typeof(MovementType),temp[7]);
        targets = (Targets)System.Enum.Parse(typeof(Targets),temp[8]);
        speed = float.Parse(temp[9]);
        if(temp.Length > 10){
            for(int i = 10;i<temp.Length;i++){
                gameObject.AddComponent(temp[i]);
            }
        }
        size = (dimensions.x+dimensions.y+dimensions.z)/3;

        //Switch Color based on Diet
        switch(Diet){
        case DietType.Omnivore:
            renderer.material = Blue;
            break;
        case DietType.Herbivore:
            renderer.material = Green;
            break;
        case DietType.Carnivore:
            renderer.material = Red;
            break;
        }
    }
예제 #24
0
        public ActionResult Details(Guid iid, long t, LogStatus s)
        {
            var logs = new Logs();
            var instances = new Instances();
            var targets = new Targets();
            var groups = new Groups();

            var log = logs.GetLogEntry(iid, new DateTime(t, DateTimeKind.Utc), s);
            var instance = instances.GetInstance(iid);
            var target = targets.GetTarget(instance.TargetKey);
            var group = groups.GetGroup(target.GroupKey);

            var model = new LogDetails()
            {
                LogEntry = log,
                Instance = instance,
                Target = target,
                Group = group,
            };

            return View(model);
        }
예제 #25
0
        //
        // GET: /Logs/
        public ActionResult Index(Guid iid, string m = null, int c = 50)
        {
            var logs = new Logs();
            var instances = new Instances();
            var targets = new Targets();
            var groups = new Groups();

            var logPage = logs.GetLogEntryPage(iid, m, c);
            var instance = instances.GetInstance(iid);
            var target = targets.GetTarget(instance.TargetKey);
            var group = groups.GetGroup(target.GroupKey);

            var model = new LogIndex()
            {
                LogEntryPage = logPage,
                Instance = instance,
                Target = target,
                Group = group,
            };

            return View(model);
        }
예제 #26
0
        public ActionResult Version(Guid tid, Guid aid)
        {
            var targetAppVersions = new TargetAppVersions();
            var versions = new Versions();
            var apps = new Apps();
            var targets = new Targets();
            var groups = new Groups();

            Version version;
            var versionKey = targetAppVersions.GetTargetAppVersion(tid, aid);
            if (versionKey.HasValue)
            {
                try
                {
                    version = versions.GetVersion(versionKey.Value);
                }
                catch (Exception)
                {
                    version = null;
                }
            }
            else
            {
                version = null;
            }

            var app = apps.GetApp(aid);
            var target = targets.GetTarget(tid);
            var group = groups.GetGroup(target.GroupKey);

            var model = new TargetAppVersionDetails()
            {
                Version = version,
                App = app,
                Target = target,
                Group = group,
            };
            return View(model);
        }
예제 #27
0
 public static RenderTarget2D GetTarget()
 {
     return(Targets.Peek());
 }
예제 #28
0
        protected override ITime EngineInitialize(List <IArgument> arguments)
        {
            Debug.Assert(true);
            _engine = new Engine();

            FileInfo fileInNetwork = base.GetFirstCaptionMatchArgumentValueAsRootedFileInfo(
                "FileInNetwork");

            FileInfo fileInBoundaryConditions = base.GetFirstCaptionMatchArgumentValueAsRootedFileInfo(
                "FileInBoundaryConditions");

            FileInfo fileOut = base.GetFirstCaptionMatchArgumentValueAsRootedFileInfo(
                "FileOut");

            _monitorExchangeEvents = (bool)base.GetArgumentValueFirstCaptionMatch(
                "MonitorExchangeEvents");
            _showGroundWaterLevelTargets = (bool)base.GetArgumentValueFirstCaptionMatch(
                "ShowGroundWaterLevelTargets");

            _engine.ReadInputFiles(fileInNetwork.FullName, fileInBoundaryConditions.FullName);
            _engine.init(fileOut.FullName);

            _describes.Caption = _engine.GetModelID();

            // Time horizon --
            DateTime startTime         = _engine.GetSimulationStartTime();
            int      numberOfTimeSteps = _engine.GetNumberOfTimeSteps();
            double   timeStepLength    = _engine.GetTimeStepLength();

            double  duration   = (numberOfTimeSteps * timeStepLength) / (3600 * 24.0);
            double  start      = Time.ToModifiedJulianDay(startTime);
            TimeSet timeExtent = new TimeSet();

            timeExtent.TimeHorizon = new Time(start, duration);
            TimeExtent             = timeExtent;

            int nNodes    = _engine.GetNumberOfNodes();
            int nBranches = nNodes - 1;

            Point2D[] points = new Point2D[nNodes];

            for (int n = 0; n < nNodes; ++n)
            {
                points[n] = new Point2D(_engine.GetXCoordinate(n), _engine.GetYCoordiante(n));
            }

            double initialValue  = 0;
            double defaultValue  = 0;
            double relaxation    = 1;                                  // for linear extrapolation, 1 = None
            double timeTolerance = 1.0 / (24.0 * 60.0 * 60.0 * 100.0); // 1/100th sec

            ItemOutBase source;
            ItemInBase  target;

            for (int n = 0; n < nBranches; ++n)
            {
                source = new FlowAlongBranch(
                    string.Format("River branch [{0}]", n),
                    new List <Point2D[]> {
                    new Point2D[2] {
                        points[n], points[n + 1]
                    }
                },
                    initialValue,
                    relaxation,
                    this);

                if (_monitorExchangeEvents)
                {
                    source.ItemChanged += new EventHandler <ExchangeItemChangeEventArgs>(ForwardExchangeEvent);
                }

                _branchIndexs.Add(source, n);

                Sources.Add(source);
            }

            for (int n = 0; n < nNodes; ++n)
            {
                target = new InflowAtNode(
                    string.Format("Inflow location [{0}]", n),
                    points[n],
                    defaultValue,
                    timeTolerance,
                    this);

                if (_monitorExchangeEvents)
                {
                    target.ItemChanged += new EventHandler <ExchangeItemChangeEventArgs>(ForwardExchangeEvent);
                }

                _nodeIndexs.Add(target, n);

                Targets.Add(target);

                if (_showGroundWaterLevelTargets)
                {
                    target = new GroundWaterLevelAtNode(
                        string.Format("Ground Water level, location [{0}]", n),
                        points[n],
                        defaultValue,
                        timeTolerance,
                        this);

                    if (_monitorExchangeEvents)
                    {
                        target.ItemChanged += new EventHandler <ExchangeItemChangeEventArgs>(ForwardExchangeEvent);
                    }

                    _nodeIndexs.Add(target, n);

                    Targets.Add(target);
                }
            }

            return(new Time(_engine.GetCurrentTime()));
        }
예제 #29
0
        internal override List <PhaseData> GetPhases(ParsedEvtcLog log, bool requirePhases)
        {
            long                fightDuration = log.FightData.FightEnd;
            List <PhaseData>    phases        = GetInitialPhase(log);
            AbstractSingleActor dhuum         = Targets.FirstOrDefault(x => x.ID == (int)ArcDPSEnums.TargetID.Dhuum);

            if (dhuum == null)
            {
                throw new MissingKeyActorsException("Dhuum not found");
            }
            phases[0].AddTarget(dhuum);
            if (!requirePhases)
            {
                return(phases);
            }
            // Sometimes the pre event is not in the evtc
            IReadOnlyList <AbstractCastEvent> castLogs  = dhuum.GetCastEvents(log, 0, log.FightData.FightEnd);
            IReadOnlyList <AbstractCastEvent> dhuumCast = dhuum.GetCastEvents(log, 0, 20000);

            if (dhuumCast.Any(x => !(x is InstantCastEvent)))
            {
                // full fight does not contain the pre event
                ComputeFightPhases(phases, castLogs, fightDuration, 0);
                _isBugged = true;
            }
            else
            {
                // full fight contains the pre event
                AbstractBuffEvent invulDhuum = log.CombatData.GetBuffData(Determined762).FirstOrDefault(x => x is BuffRemoveManualEvent && x.To == dhuum.AgentItem && x.Time > 115000);
                // pre event done
                if (invulDhuum != null)
                {
                    long end = invulDhuum.Time;
                    phases.Add(new PhaseData(0, end, "Pre Event"));
                    phases.Add(new PhaseData(end + 1, fightDuration, "Main Fight")
                    {
                        CanBeSubPhase = false
                    });
                    ComputeFightPhases(phases, castLogs, fightDuration, end + 1);
                }
            }
            bool hasRitual = phases.Last().Name == "Ritual";
            // present if not bugged and pre-event done
            PhaseData mainFight = phases.Find(x => x.Name == "Main Fight");
            // if present, Dhuum was at least at 10%
            PhaseData dhuumFight = phases.Find(x => x.Name == "Dhuum Fight");

            if (mainFight != null)
            {
                mainFight.CanBeSubPhase = dhuumFight == null;
                // from pre event end to 10% or fight end if 10% not achieved
                phases.AddRange(GetInBetweenSoulSplits(log, dhuum, mainFight.Start, dhuumFight != null ? dhuumFight.End : mainFight.End, hasRitual));
            }
            else if (_isBugged)
            {
                // from start to 10% or fight end if 10% not achieved
                phases.AddRange(GetInBetweenSoulSplits(log, dhuum, 0, dhuumFight != null ? dhuumFight.End : fightDuration, hasRitual));
            }
            for (int i = 1; i < phases.Count; i++)
            {
                phases[i].AddTarget(dhuum);
            }
            return(phases);
        }
예제 #30
0
 public static float GetValue(Item item, Targets.Item target, bool forceRealTime = false)
 {
     try
     {
         if (ItemCache.MaxAge > 0 && !forceRealTime)
         {
             var cacheValue = ItemCache[item.UniqueName];
             if (cacheValue != null)
             {
                 return (float) cacheValue;
             }
         }
         var value = item.ValueFunction(target.Hero);
         value = Math.Max(0, value);
         ItemCache.AddOrUpdate(item.UniqueName, value);
         return value;
     }
     catch
     {
         return item.Inverted ? item.MaxValue : item.MinValue;
     }
 }
예제 #31
0
 /// <summary>
 /// Add Target
 /// </summary>
 public void AddTarget(ITarget target)
 {
     Targets.Add(target);
     onAddTarget(target);
     CountTargets++;
 }
예제 #32
0
        public override List <PhaseData> GetPhases(ParsedLog log, bool requirePhases)
        {
            long             start         = 0;
            long             end           = 0;
            long             fightDuration = log.FightData.FightDuration;
            List <PhaseData> phases        = GetInitialPhase(log);
            Target           mainTarget    = Targets.Find(x => x.ID == (ushort)ParseEnum.TargetIDS.KeepConstruct);

            if (mainTarget == null)
            {
                throw new InvalidOperationException("Main target of the fight not found");
            }
            phases[0].Targets.Add(mainTarget);
            if (!requirePhases)
            {
                return(phases);
            }
            // Main phases 34894
            List <CastLog> castLogs    = mainTarget.GetCastLogs(log, 0, log.FightData.FightEnd);
            List <CastLog> magicCharge = castLogs.Where(x => x.SkillId == 35048).ToList();
            List <CastLog> magicBlast  = castLogs.Where(x => x.SkillId == 34894).ToList();

            foreach (CastLog cl in magicCharge)
            {
                end = cl.Time;
                phases.Add(new PhaseData(start, end));
                CastLog blast = magicBlast.FirstOrDefault(x => x.Time >= cl.Time);
                if (blast != null)
                {
                    start = blast.Time + blast.ActualDuration;
                }
                else
                {
                    start = end + cl.ActualDuration;
                }
            }
            if (fightDuration - start > 5000 && start >= phases.Last().End)
            {
                phases.Add(new PhaseData(start, fightDuration));
                start = fightDuration;
            }
            for (int i = 1; i < phases.Count; i++)
            {
                phases[i].Name = "Phase " + i;
                phases[i].Targets.Add(mainTarget);
            }
            // add burn phases
            int offset = phases.Count;
            List <CombatItem> orbItems = log.GetBoonData(35096).Where(x => x.DstInstid == mainTarget.InstID).ToList();

            // Get number of orbs and filter the list
            start = 0;
            int orbCount = 0;
            List <BoonsGraphModel.Segment> segments = new List <BoonsGraphModel.Segment>();

            foreach (CombatItem c in orbItems)
            {
                if (c.IsBuffRemove == ParseEnum.BuffRemove.None)
                {
                    if (start == 0)
                    {
                        start = log.FightData.ToFightSpace(c.Time);
                    }
                    orbCount++;
                }
                else if (start != 0)
                {
                    segments.Add(new BoonsGraphModel.Segment(start, Math.Min(log.FightData.ToFightSpace(c.Time), fightDuration), orbCount));
                    orbCount = 0;
                    start    = 0;
                }
            }
            int burnCount = 1;

            foreach (var seg in segments)
            {
                var phase = new PhaseData(seg.Start, seg.End)
                {
                    Name = "Burn " + burnCount++ + " (" + seg.Value + " orbs)",
                };
                phase.Targets.Add(mainTarget);
                phases.Add(phase);
            }
            phases.Sort((x, y) => (x.Start < y.Start) ? -1 : 1);
            return(phases);
        }
예제 #33
0
        public override List <PhaseData> GetPhases(ParsedLog log, bool requirePhases)
        {
            long             start         = 0;
            long             end           = 0;
            long             fightDuration = log.FightData.FightDuration;
            List <PhaseData> phases        = GetInitialPhase(log);
            Target           mainTarget    = Targets.Find(x => x.ID == (ushort)ParseEnum.TargetIDS.KeepConstruct);

            if (mainTarget == null)
            {
                throw new InvalidOperationException("Main target of the fight not found");
            }
            phases[0].Targets.Add(mainTarget);
            if (!requirePhases)
            {
                return(phases);
            }
            // Main phases 34894
            List <CastLog> castLogs    = mainTarget.GetCastLogs(log, 0, log.FightData.FightEnd);
            List <CastLog> magicCharge = castLogs.Where(x => x.SkillId == 35048).ToList();
            List <CastLog> magicBlast  = castLogs.Where(x => x.SkillId == 34894).ToList();

            foreach (CastLog cl in magicCharge)
            {
                end = cl.Time;
                phases.Add(new PhaseData(start, end));
                CastLog blast = magicBlast.FirstOrDefault(x => x.Time >= cl.Time);
                if (blast != null)
                {
                    start = blast.Time + blast.ActualDuration;
                }
                else
                {
                    start = end + cl.ActualDuration;
                }
            }
            if (fightDuration - start > 5000 && start >= phases.Last().End)
            {
                phases.Add(new PhaseData(start, fightDuration));
                start = fightDuration;
            }
            string[] mainPhaseNames = { "100% - 66%", "66% - 33%", "33% - 0%" };
            for (int i = 1; i < phases.Count; i++)
            {
                phases[i].Name = mainPhaseNames[i - 1];
                phases[i].Targets.Add(mainTarget);
            }
            // add burn phases
            int offset = phases.Count;
            List <CombatItem> orbItems = log.GetBoonData(35096).Where(x => x.DstInstid == mainTarget.InstID).ToList();

            // Get number of orbs and filter the list
            start = 0;
            int orbCount = 0;
            List <BoonsGraphModel.Segment> segments = new List <BoonsGraphModel.Segment>();

            foreach (CombatItem c in orbItems)
            {
                if (c.IsBuffRemove == ParseEnum.BuffRemove.None)
                {
                    if (start == 0)
                    {
                        start = log.FightData.ToFightSpace(c.Time);
                    }
                    orbCount++;
                }
                else if (start != 0)
                {
                    segments.Add(new BoonsGraphModel.Segment(start, Math.Min(log.FightData.ToFightSpace(c.Time), fightDuration), orbCount));
                    orbCount = 0;
                    start    = 0;
                }
            }
            int burnCount = 1;

            foreach (var seg in segments)
            {
                var phase = new PhaseData(seg.Start, seg.End)
                {
                    Name = "Burn " + burnCount++ + " (" + seg.Value + " orbs)",
                };
                phase.Targets.Add(mainTarget);
                phases.Add(phase);
            }
            phases.Sort((x, y) => x.Start.CompareTo(y.Start));
            // pre burn phases
            int preBurnCount = 1;
            List <PhaseData>  preBurnPhase = new List <PhaseData>();
            List <CombatItem> kcInvuls     = GetFilteredList(log, 762, mainTarget, true);

            foreach (CombatItem invul in kcInvuls)
            {
                if (invul.IsBuffRemove == ParseEnum.BuffRemove.None)
                {
                    end = log.FightData.ToFightSpace(invul.Time);
                    PhaseData prevPhase = phases.LastOrDefault(x => x.Start <= end || x.End <= end);
                    if (prevPhase != null)
                    {
                        start = (prevPhase.End >= end ? prevPhase.Start : prevPhase.End) + 1;
                        if (end - start > 5000)
                        {
                            var phase = new PhaseData(start, end)
                            {
                                Name = "Pre-Burn " + preBurnCount++,
                            };
                            phase.Targets.Add(mainTarget);
                            preBurnPhase.Add(phase);
                        }
                    }
                }
            }
            phases.AddRange(preBurnPhase);
            phases.Sort((x, y) => x.Start.CompareTo(y.Start));
            // add leftover phases
            PhaseData        cur            = null;
            int              leftOverCount  = 1;
            List <PhaseData> leftOverPhases = new List <PhaseData>();

            for (int i = 0; i < phases.Count; i++)
            {
                PhaseData phase = phases[i];
                if (phase.Name.Contains("%"))
                {
                    cur = phase;
                }
                else if (phase.Name.Contains("orbs"))
                {
                    if (cur != null)
                    {
                        if (cur.End >= phase.End + 5000 && (i == phases.Count - 1 || phases[i + 1].Name.Contains("Phase")))
                        {
                            PhaseData leftOverPhase = new PhaseData(phase.End + 1, cur.End)
                            {
                                Name = "Leftover " + leftOverCount++,
                            };
                            leftOverPhase.Targets.Add(mainTarget);
                            leftOverPhases.Add(leftOverPhase);
                        }
                    }
                }
            }
            phases.AddRange(leftOverPhases);
            phases.Sort((x, y) => x.Start.CompareTo(y.Start));
            return(phases);
        }
예제 #34
0
        public override void Header()
        {
            var entities = Targets.Cast <UTinyEntity>();

            var firstEntity = entities.FirstOrDefault();

            if (null == firstEntity)
            {
                return;
            }

            UTinyGUI.BackgroundColor(new Rect(0, 0, Screen.width, 15 + 2 * UTinyGUIUtility.SingleLineAndSpaceHeight), UTinyColors.Inspector.HeaderBackground);
            GUILayout.Space(10);
            var name = firstEntity.Name;

            name = entities.All(entity => entity.Name == name) ? name : "-";
            var enabled     = firstEntity.Enabled;
            var sameEnabled = entities.All(tiny => tiny.Enabled == enabled);

            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUI.BeginChangeCheck();
                var mixed = EditorGUI.showMixedValue;
                EditorGUI.showMixedValue = !sameEnabled;
                enabled = EditorGUILayout.ToggleLeft(GUIContent.none, enabled, GUILayout.Width(EditorGUIUtility.singleLineHeight));
                EditorGUI.showMixedValue = mixed;
                if (EditorGUI.EndChangeCheck())
                {
                    foreach (var entity in entities)
                    {
                        entity.Enabled = enabled;
                        entity.View.gameObject.SetActive(enabled);
                    }
                    UTinyHierarchyWindow.InvalidateDataModel();
                    UTinyEditorUtility.RepaintAllWindows();
                }
                EditorGUI.BeginChangeCheck();
                name = EditorGUILayout.DelayedTextField(name, UTinyStyles.ComponentHeaderStyle);
                if (EditorGUI.EndChangeCheck())
                {
                    foreach (var entity in entities)
                    {
                        entity.Name = name;
                    }
                    UTinyHierarchyWindow.InvalidateDataModel();
                    UTinyEditorUtility.RepaintAllWindows();
                }
                GUILayout.Space(EditorGUIUtility.singleLineHeight);
            }

            var layer     = firstEntity.Layer;
            var sameLayer = entities.All(tiny => tiny.Layer == layer);

            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.Space(50);
                EditorGUILayout.LabelField("Layer", GUILayout.Width(50));
                EditorGUI.BeginChangeCheck();
                var mixed = EditorGUI.showMixedValue;
                EditorGUI.showMixedValue = !sameLayer;
                layer = EditorGUILayout.LayerField(layer);
                if (EditorGUI.EndChangeCheck())
                {
                    foreach (var entity in entities)
                    {
                        entity.Layer = layer;
                        entity.View.gameObject.layer = layer;
                    }
                    UTinyHierarchyWindow.InvalidateDataModel();
                    UTinyEditorUtility.RepaintAllWindows();
                }
                GUILayout.Space(EditorGUIUtility.singleLineHeight);
                EditorGUI.showMixedValue = mixed;
            }
            GUILayout.Space(5);
            UTinyGUILayout.Separator(UTinyColors.Inspector.Separator, UTinyGUIUtility.ComponentHeaderSeperatorHeight);
        }
예제 #35
0
        public override List <PhaseData> GetPhases(ParsedLog log, bool requirePhases)
        {
            long             start  = 0;
            long             end    = 0;
            List <PhaseData> phases = GetInitialPhase(log);
            Boss             qadim  = Targets.Find(x => x.ID == (ushort)ParseEnum.BossIDS.Qadim);

            if (qadim == null)
            {
                throw new InvalidOperationException("Qadim not found");
            }
            phases[0].Targets.Add(qadim);
            if (!requirePhases)
            {
                return(phases);
            }
            List <long> moltenArmor = GetFilteredList(log, 52329, qadim).Select(x => x.Time - log.FightData.FightStart).Distinct().ToList();

            for (int i = 1; i < moltenArmor.Count; i++)
            {
                if (i % 2 == 0)
                {
                    end = Math.Min(moltenArmor[i], log.FightData.FightDuration);
                    phases.Add(new PhaseData(start, end));
                    if (i == moltenArmor.Count - 1)
                    {
                        phases.Add(new PhaseData(end, log.FightData.FightDuration));
                    }
                }
                else
                {
                    start = Math.Min(moltenArmor[i], log.FightData.FightDuration);
                    phases.Add(new PhaseData(end, start));
                    if (i == moltenArmor.Count - 1)
                    {
                        phases.Add(new PhaseData(start, log.FightData.FightDuration));
                    }
                }
            }
            string[] names = { "Hydra", "Qadim P1", "Apocalypse", "Qadim P2", "Wyvern", "Qadim P3" };
            for (int i = 1; i < phases.Count; i++)
            {
                PhaseData phase = phases[i];
                phase.Name = names[i - 1];
                switch (i)
                {
                case 2:
                case 4:
                case 6:
                    List <long> pyresFirstAware = log.AgentData.GetAgentsByID((ushort)PyreGuardian).Where(x => phase.InInterval(x.FirstAware - log.FightData.FightStart)).Select(x => x.FirstAware - log.FightData.FightStart).ToList();
                    if (pyresFirstAware.Count > 0 && pyresFirstAware.Max() > phase.Start)
                    {
                        phase.OverrideStart(pyresFirstAware.Max());
                    }
                    phase.Targets.Add(qadim);
                    break;

                default:
                    List <ushort> ids = new List <ushort>
                    {
                        (ushort)WyvernMatriarch,
                        (ushort)WyvernPatriarch,
                        (ushort)AncientInvokedHydra,
                        (ushort)ApocalypseBringer
                    };
                    AddTargetsToPhase(phase, ids, log);
                    phase.DrawArea  = true;
                    phase.DrawEnd   = true;
                    phase.DrawStart = true;
                    break;
                }
            }
            phases.RemoveAll(x => x.Start >= x.End);
            return(phases);
        }
예제 #36
0
 public Item(Obj_AI_Hero sender, Targets.Item target)
 {
     Sender = sender;
     Target = target;
     Timestamp = Game.Time;
 }
예제 #37
0
        public override void ComputePlayerCombatReplayActors(Player p, ParsedLog log, CombatReplay replay)
        {
            // big bomb
            var bigbomb = log.CombatData.GetBuffData(37966).Where(x => (x.To == p.AgentItem && x is BuffApplyEvent)).ToList();

            foreach (AbstractBuffEvent c in bigbomb)
            {
                int bigStart = (int)c.Time;
                int bigEnd   = bigStart + 6000;
                replay.Decorations.Add(new CircleDecoration(true, 0, 300, (bigStart, bigEnd), "rgba(150, 80, 0, 0.2)", new AgentConnector(p)));
                replay.Decorations.Add(new CircleDecoration(true, bigEnd, 300, (bigStart, bigEnd), "rgba(150, 80, 0, 0.2)", new AgentConnector(p)));
            }
            // small bomb
            var smallbomb = log.CombatData.GetBuffData(38247).Where(x => (x.To == p.AgentItem && x is BuffApplyEvent)).ToList();

            foreach (AbstractBuffEvent c in smallbomb)
            {
                int smallStart = (int)c.Time;
                int smallEnd   = smallStart + 6000;
                replay.Decorations.Add(new CircleDecoration(true, 0, 80, (smallStart, smallEnd), "rgba(80, 150, 0, 0.3)", new AgentConnector(p)));
            }
            // fixated
            List <AbstractBuffEvent> fixatedSam = GetFilteredList(log.CombatData, 37868, p, true);
            int fixatedSamStart = 0;

            foreach (AbstractBuffEvent c in fixatedSam)
            {
                if (c is BuffApplyEvent)
                {
                    fixatedSamStart = Math.Max((int)c.Time, 0);
                }
                else
                {
                    int fixatedSamEnd = (int)c.Time;
                    replay.Decorations.Add(new CircleDecoration(true, 0, 80, (fixatedSamStart, fixatedSamEnd), "rgba(255, 80, 255, 0.3)", new AgentConnector(p)));
                }
            }
            //fixated Ghuldem
            List <AbstractBuffEvent> fixatedGuldhem = GetFilteredList(log.CombatData, 38223, p, true);
            int fixationGuldhemStart = 0;
            NPC guldhem = null;

            foreach (AbstractBuffEvent c in fixatedGuldhem)
            {
                if (c is BuffApplyEvent)
                {
                    fixationGuldhemStart = (int)c.Time;
                    long logTime = c.Time;
                    guldhem = Targets.FirstOrDefault(x => x.ID == (int)Guldhem && logTime >= x.FirstAware && logTime <= x.LastAware);
                }
                else
                {
                    int fixationGuldhemEnd = (int)c.Time;
                    if (guldhem != null)
                    {
                        replay.Decorations.Add(new LineDecoration(0, (fixationGuldhemStart, fixationGuldhemEnd), "rgba(255, 100, 0, 0.3)", new AgentConnector(p), new AgentConnector(guldhem)));
                    }
                }
            }
            //fixated Rigom
            List <AbstractBuffEvent> fixatedRigom = GetFilteredList(log.CombatData, 37693, p, true);
            int fixationRigomStart = 0;
            NPC rigom = null;

            foreach (AbstractBuffEvent c in fixatedRigom)
            {
                if (c is BuffApplyEvent)
                {
                    fixationRigomStart = (int)c.Time;
                    long logTime = c.Time;
                    rigom = Targets.FirstOrDefault(x => x.ID == (int)Rigom && logTime >= x.FirstAware && logTime <= x.LastAware);
                }
                else
                {
                    int fixationRigomEnd = (int)c.Time;
                    if (rigom != null)
                    {
                        replay.Decorations.Add(new LineDecoration(0, (fixationRigomStart, fixationRigomEnd), "rgba(255, 0, 0, 0.3)", new AgentConnector(p), new AgentConnector(rigom)));
                    }
                }
            }
        }
예제 #38
0
 /// <summary>
 /// Returns the targets in the format the Nessus XMLrpc protocol expects it to be.
 /// </summary>
 /// <returns>
 /// A <see cref="System.String"/>
 /// </returns>
 public string EncodeTargets()
 {
     return(string.Join(",", Targets.ToArray()));
 }
예제 #39
0
 /// <summary>
 /// Remove Target
 /// </summary>
 public void RemoveTarget(ITarget target)
 {
     Targets.Remove(target);
     onRemoveTarget(target);
     CountTargets--;
 }
예제 #40
0
 public CostRuleParameters(Card owningCard, int maxX, Targets targets = null)
 {
     OwningCard = owningCard;
     MaxX       = maxX;
     Targets    = targets;
 }
예제 #41
0
 public bool HasTargetB(Targets target)
 {
     return(Effects.Any(eff => eff != null && eff.ImplicitTarget[1] == (uint)target));
 }
예제 #42
0
        public override void SpecialParse(FightData fightData, AgentData agentData, List <CombatItem> combatData)
        {
            // Find target
            Target target = Targets.Find(x => x.ID == (ushort)ParseEnum.TargetIDS.Deimos);

            if (target == null)
            {
                throw new InvalidOperationException("Main target of the fight not found");
            }
            if (!target.Character.Contains("Deimos"))
            {
                target.OverrideName("Deimos");
            }
            // enter combat
            CombatItem enterCombat = combatData.FirstOrDefault(x => x.SrcInstid == target.InstID && x.IsStateChange == ParseEnum.StateChange.EnterCombat);

            if (enterCombat != null)
            {
                fightData.FightStart = enterCombat.Time;
            }
            // Remove deimos despawn events as they are useless and mess with combat replay
            combatData.RemoveAll(x => x.IsStateChange == ParseEnum.StateChange.Despawn && x.SrcInstid == target.InstID && x.Time <= target.LastAware && x.Time >= target.FirstAware);
            // Deimos gadgets
            List <AgentItem> deimosGadgets = agentData.GetAgentByType(AgentItem.AgentType.Gadget).Where(x => x.Name.Contains("Deimos") && x.LastAware > target.LastAware).ToList();
            CombatItem       invulApp      = combatData.FirstOrDefault(x => x.DstInstid == target.InstID && x.IsBuff != 0 && x.BuffDmg == 0 && x.Value > 0 && x.SkillID == 762);
            CombatItem       targetable    = combatData.LastOrDefault(x => x.IsStateChange == ParseEnum.StateChange.Targetable && x.Time > combatData.First().Time&& x.DstAgent > 0);

            if (invulApp != null && targetable != null)
            {
                HashSet <ulong> gadgetAgents = new HashSet <ulong>();
                long            firstAware   = targetable.Time;
                AgentItem       targetAgent  = agentData.GetAgentByInstID(targetable.SrcInstid, targetable.Time);
                if (targetAgent != GeneralHelper.UnknownAgent)
                {
                    try
                    {
                        string[] names = targetAgent.Name.Split('-');
                        if (ushort.TryParse(names[2], out ushort masterInstid))
                        {
                            CombatItem structDeimosDamageEvent = combatData.FirstOrDefault(x => x.Time >= firstAware && x.IFF == ParseEnum.IFF.Foe && x.DstInstid == masterInstid && x.IsStateChange == ParseEnum.StateChange.Normal && x.IsBuffRemove == ParseEnum.BuffRemove.None &&
                                                                                           ((x.IsBuff == 1 && x.BuffDmg >= 0 && x.Value == 0) ||
                                                                                            (x.IsBuff == 0 && x.Value >= 0)));
                            if (structDeimosDamageEvent != null)
                            {
                                gadgetAgents.Add(structDeimosDamageEvent.DstAgent);
                            }
                            CombatItem armDeimosDamageEvent = combatData.FirstOrDefault(x => x.Time >= firstAware && (x.SkillID == 37980 || x.SkillID == 37982 || x.SkillID == 38046) && x.SrcAgent != 0 && x.SrcInstid != 0);
                            if (armDeimosDamageEvent != null)
                            {
                                gadgetAgents.Add(armDeimosDamageEvent.SrcAgent);
                            }
                        }
                        ;
                    }
                    catch
                    {
                        // nothing to do
                    }
                }
                invulApp.OverrideValue((int)(firstAware - invulApp.Time));
                _specialSplit = (firstAware >= target.LastAware ? firstAware : target.LastAware);
                target.AgentItem.LastAware = combatData.Last().Time;
                SetUniqueID(target, gadgetAgents, agentData, combatData);
            }
            // legacy method
            else if (deimosGadgets.Count > 0)
            {
                long firstAware = deimosGadgets.Max(x => x.FirstAware);
                _specialSplit = (firstAware >= target.LastAware ? firstAware : target.LastAware);
                target.AgentItem.LastAware = deimosGadgets.Max(x => x.LastAware);
                HashSet <ulong> gadgetAgents = new HashSet <ulong>(deimosGadgets.Select(x => x.Agent));
                SetUniqueID(target, gadgetAgents, agentData, combatData);
            }
        }
예제 #43
0
        public PhaseDto(PhaseData phaseData, List <PhaseData> phases, ParsedLog log)
        {
            Name     = phaseData.Name;
            Duration = phaseData.DurationInMS;
            Start    = phaseData.Start / 1000.0;
            End      = phaseData.End / 1000.0;
            foreach (NPC target in phaseData.Targets)
            {
                Targets.Add(log.FightData.Logic.Targets.IndexOf(target));
            }
            PlayerActiveTimes = new List <long>();
            foreach (Player p in log.PlayerList)
            {
                PlayerActiveTimes.Add(phaseData.GetActorActiveDuration(p, log));
            }
            // add phase markup
            MarkupLines = new List <double>();
            MarkupAreas = new List <AreaLabelDto>();
            for (int j = 1; j < phases.Count; j++)
            {
                PhaseData curPhase = phases[j];
                if (curPhase.Start < phaseData.Start || curPhase.End > phaseData.End ||
                    (curPhase.Start == phaseData.Start && curPhase.End == phaseData.End) || !curPhase.CanBeSubPhase)
                {
                    continue;
                }
                if (SubPhases == null)
                {
                    SubPhases = new List <int>();
                }
                SubPhases.Add(j);
                long start = curPhase.Start - phaseData.Start;
                long end   = curPhase.End - phaseData.Start;
                if (curPhase.DrawStart)
                {
                    MarkupLines.Add(start / 1000.0);
                }

                if (curPhase.DrawEnd)
                {
                    MarkupLines.Add(end / 1000.0);
                }

                var phaseArea = new AreaLabelDto
                {
                    Start     = start / 1000.0,
                    End       = end / 1000.0,
                    Label     = curPhase.DrawLabel ? curPhase.Name : null,
                    Highlight = curPhase.DrawArea
                };
                MarkupAreas.Add(phaseArea);
            }
            if (MarkupAreas.Count == 0)
            {
                MarkupAreas = null;
            }

            if (MarkupLines.Count == 0)
            {
                MarkupLines = null;
            }
        }
예제 #44
0
        protected override void OnPostUpdate()
        {
            if (_ultimate.IsActive(UltimateModeType.Flash) && R.IsReady() && SummonerManager.Flash.IsReady())
            {
                if (_ultimate.ShouldMove(UltimateModeType.Flash))
                {
                    Orbwalking.MoveTo(Game.CursorPos, Orbwalker.HoldAreaRadius);
                }
                var targets =
                    Targets.Where(
                        t =>
                        t.Distance(Player) < (R.Range + R.Width + SummonerManager.Flash.Range) * 1.5f &&
                        !t.IsDashing() &&
                        (t.IsFacing(Player)
                                ? (t.Distance(Player))
                                : (R.GetPrediction(t).UnitPosition.Distance(Player.Position))) > R.Range);
                var backwards = Menu.Item(Menu.Name + ".ultimate.backwards").GetValue <bool>();
                foreach (var target in targets)
                {
                    var flashPos = Player.Position.Extend(target.Position, SummonerManager.Flash.Range);
                    var maxHits  = GetMaxRHits(HitChance.High, flashPos);
                    if (maxHits.Item1.Count > 0)
                    {
                        var castPos = backwards
                            ? Player.Position.Extend(maxHits.Item2, -(Player.Position.Distance(maxHits.Item2) * 2))
                            : Player.Position.Extend(maxHits.Item2, Player.Position.Distance(maxHits.Item2));
                        if (_ultimate.Check(UltimateModeType.Flash, maxHits.Item1))
                        {
                            if (R.Cast(castPos))
                            {
                                Utility.DelayAction.Add(
                                    300 + (Game.Ping / 2), () => SummonerManager.Flash.Cast(flashPos));
                            }
                        }
                        else if (_ultimate.ShouldSingle(UltimateModeType.Flash))
                        {
                            if (
                                maxHits.Item1.Where(hit => _ultimate.CheckSingle(UltimateModeType.Flash, hit))
                                .Any(hit => R.Cast(castPos)))
                            {
                                Utility.DelayAction.Add(
                                    300 + (Game.Ping / 2), () => SummonerManager.Flash.Cast(flashPos));
                            }
                        }
                    }
                }
            }

            if (_ultimate.IsActive(UltimateModeType.Assisted) && R.IsReady())
            {
                if (_ultimate.ShouldMove(UltimateModeType.Assisted))
                {
                    Orbwalking.MoveTo(Game.CursorPos, Orbwalker.HoldAreaRadius);
                }

                if (!RLogic(UltimateModeType.Assisted, R.GetHitChance("combo")))
                {
                    RLogicSingle(UltimateModeType.Assisted, R.GetHitChance("combo"), false);
                }
            }

            if (_ultimate.IsActive(UltimateModeType.Auto) && R.IsReady())
            {
                if (!RLogic(UltimateModeType.Auto, R.GetHitChance("combo")))
                {
                    RLogicSingle(UltimateModeType.Auto, R.GetHitChance("combo"));
                }
            }

            if (HeroListManager.Enabled("w-immobile") && W.IsReady())
            {
                var target =
                    Targets.FirstOrDefault(
                        t =>
                        HeroListManager.Check("w-immobile", t) && BestTargetOnlyManager.Check("w-immobile", W, t) &&
                        Utils.IsImmobile(t));
                if (target != null)
                {
                    Casting.SkillShot(target, W, HitChance.High);
                }
            }
        }
예제 #45
0
        internal override List <PhaseData> GetPhases(ParsedEvtcLog log, bool requirePhases)
        {
            List <PhaseData>    phases = GetInitialPhase(log);
            AbstractSingleActor ca     = Targets.FirstOrDefault(x => x.ID == (int)ArcDPSEnums.TargetID.ConjuredAmalgamate);

            if (ca == null)
            {
                throw new MissingKeyActorsException("Conjured Amalgamate not found");
            }
            phases[0].AddTarget(ca);
            if (!requirePhases)
            {
                return(phases);
            }
            phases.AddRange(GetPhasesByInvul(log, 52255, ca, true, false));
            for (int i = 1; i < phases.Count; i++)
            {
                string    name;
                PhaseData phase = phases[i];
                if (i % 2 == 1)
                {
                    name = "Arm Phase";
                }
                else
                {
                    name = "Burn Phase";
                    phase.AddTarget(ca);
                }
                phase.Name = name;
            }
            AbstractSingleActor leftArm = Targets.FirstOrDefault(x => x.ID == (int)ArcDPSEnums.TargetID.CALeftArm);

            if (leftArm != null)
            {
                List <long> targetables = GetTargetableTimes(log, leftArm);
                for (int i = 1; i < phases.Count; i += 2)
                {
                    PhaseData phase = phases[i];
                    if (targetables.Exists(x => phase.InInterval(x)))
                    {
                        phase.Name = "Left " + phase.Name;
                        phase.AddTarget(leftArm);
                    }
                }
            }
            AbstractSingleActor rightArm = Targets.FirstOrDefault(x => x.ID == (int)ArcDPSEnums.TargetID.CARightArm);

            if (rightArm != null)
            {
                List <long> targetables = GetTargetableTimes(log, rightArm);
                for (int i = 1; i < phases.Count; i += 2)
                {
                    PhaseData phase = phases[i];
                    if (targetables.Exists(x => phase.InInterval(x)))
                    {
                        if (phase.Name.Contains("Left"))
                        {
                            phase.Name = "Both Arms Phase";
                        }
                        else
                        {
                            phase.Name = "Right " + phase.Name;
                        }
                        phase.AddTarget(rightArm);
                    }
                }
            }
            return(phases);
        }
예제 #46
0
        public override List <PhaseData> GetPhases(ParsedLog log, bool requirePhases)
        {
            long             start  = 0;
            long             end    = 0;
            List <PhaseData> phases = GetInitialPhase(log);
            Target           ca     = Targets.Find(x => x.ID == (ushort)ParseEnum.TargetIDS.ConjuredAmalgamate);

            if (ca == null)
            {
                throw new InvalidOperationException("Conjurate Amalgamate not found");
            }
            phases[0].Targets.Add(ca);
            if (!requirePhases)
            {
                return(phases);
            }
            List <CombatItem> CAInvul = GetFilteredList(log, 52255, ca, false);

            for (int i = 0; i < CAInvul.Count; i++)
            {
                CombatItem invul = CAInvul[i];
                if (invul.IsBuffRemove != ParseEnum.BuffRemove.None)
                {
                    end = Math.Min(log.FightData.ToFightSpace(invul.Time), log.FightData.FightDuration);
                    phases.Add(new PhaseData(start, end));
                    if (i == CAInvul.Count - 1)
                    {
                        phases.Add(new PhaseData(end, log.FightData.FightDuration));
                    }
                }
                else
                {
                    start = Math.Min(log.FightData.ToFightSpace(invul.Time), log.FightData.FightDuration);
                    phases.Add(new PhaseData(end, start));
                    if (i == CAInvul.Count - 1)
                    {
                        phases.Add(new PhaseData(start, log.FightData.FightDuration));
                    }
                }
            }
            phases.RemoveAll(x => x.GetDuration() < 1000);
            for (int i = 1; i < phases.Count; i++)
            {
                string    name;
                PhaseData phase = phases[i];
                if (i % 2 == 1)
                {
                    name = "Arm Phase";
                }
                else
                {
                    name = "Burn Phase";
                    phase.Targets.Add(ca);
                }
                phase.Name = name;
            }
            Target leftArm = Targets.Find(x => x.ID == (ushort)ParseEnum.TargetIDS.CALeftArm);

            if (leftArm != null)
            {
                List <long> leftArmDown = log.GetBoonData(52430).Where(x => x.IsBuffRemove == ParseEnum.BuffRemove.All && x.SrcInstid == leftArm.InstID).Select(x => log.FightData.ToFightSpace(x.Time)).ToList();
                for (int i = 1; i < phases.Count; i += 2)
                {
                    PhaseData phase = phases[i];
                    if (leftArmDown.Exists(x => phase.InInterval(x)))
                    {
                        phase.Name = "Left " + phase.Name;
                        phase.Targets.Add(leftArm);
                    }
                }
            }
            Target rightArm = Targets.Find(x => x.ID == (ushort)ParseEnum.TargetIDS.CARightArm);

            if (rightArm != null)
            {
                List <long> rightArmDown = log.GetBoonData(52430).Where(x => x.IsBuffRemove == ParseEnum.BuffRemove.All && x.SrcInstid == rightArm.InstID).Select(x => log.FightData.ToFightSpace(x.Time)).ToList();
                for (int i = 1; i < phases.Count; i += 2)
                {
                    PhaseData phase = phases[i];
                    if (rightArmDown.Exists(x => phase.InInterval(x)))
                    {
                        if (phase.Name.Contains("Left"))
                        {
                            phase.Name = "Both Arms Phase";
                        }
                        else
                        {
                            phase.Name = "Right " + phase.Name;
                        }
                        phase.Targets.Add(rightArm);
                    }
                }
            }
            return(phases);
        }
예제 #47
0
        public override List <PhaseData> GetPhases(ParsedLog log, bool requirePhases)
        {
            long             start         = 0;
            long             end           = 0;
            long             fightDuration = log.FightData.FightDuration;
            List <PhaseData> phases        = GetInitialPhase(log);
            Target           mainTarget    = Targets.Find(x => x.ID == (ushort)ParseEnum.TargetIDS.Deimos);

            if (mainTarget == null)
            {
                throw new InvalidOperationException("Main target of the fight not found");
            }
            phases[0].Targets.Add(mainTarget);
            if (!requirePhases)
            {
                return(phases);
            }
            // Determined + additional data on inst change
            CombatItem invulDei = log.CombatData.GetBoonData(762).Find(x => x.IsBuffRemove == ParseEnum.BuffRemove.None && x.DstInstid == mainTarget.InstID);

            if (invulDei != null)
            {
                end = log.FightData.ToFightSpace(invulDei.Time);
                phases.Add(new PhaseData(start, end));
                start = (_specialSplit > 0 ? log.FightData.ToFightSpace(_specialSplit) : fightDuration);
                //mainTarget.AddCustomCastLog(end, -6, (int)(start - end), ParseEnum.Activation.None, (int)(start - end), ParseEnum.Activation.None, log);
            }
            if (fightDuration - start > 5000 && start >= phases.Last().End)
            {
                phases.Add(new PhaseData(start, fightDuration));
            }
            string[] names = { "100% - 10%", "10% - 0%" };
            for (int i = 1; i < phases.Count; i++)
            {
                phases[i].Name = names[i - 1];
                phases[i].Targets.Add(mainTarget);
            }
            foreach (Target tar in Targets)
            {
                if (tar.ID == (ushort)Thief || tar.ID == (ushort)Drunkard || tar.ID == (ushort)Gambler)
                {
                    string    name     = (tar.ID == (ushort)Thief ? "Thief" : (tar.ID == (ushort)Drunkard ? "Drunkard" : (tar.ID == (ushort)Gambler ? "Gambler" : "")));
                    PhaseData tarPhase = new PhaseData(log.FightData.ToFightSpace(tar.FirstAware) - 1000, log.FightData.ToFightSpace(tar.LastAware) + 1000);
                    tarPhase.Targets.Add(tar);
                    tarPhase.OverrideTimes(log);
                    // override first then add Deimos so that it does not disturb the override process
                    tarPhase.Targets.Add(mainTarget);
                    tarPhase.Name = name;
                    phases.Add(tarPhase);
                }
            }

            /*
             * List<CombatItem> signets = GetFilteredList(log, 38224, mainTarget, true);
             * long sigStart = 0;
             * long sigEnd = 0;
             * int burstID = 1;
             * for (int i = 0; i < signets.Count; i++)
             * {
             *  CombatItem signet = signets[i];
             *  if (signet.IsBuffRemove == ParseEnum.BuffRemove.None)
             *  {
             *      sigStart = log.FightData.ToFightSpace(signet.Time);
             *  }
             *  else
             *  {
             *      sigEnd = log.FightData.ToFightSpace(signet.Time);
             *      PhaseData burstPhase = new PhaseData(sigStart, sigEnd)
             *      {
             *          Name = "Burst " + burstID++
             *      };
             *      burstPhase.Targets.Add(mainTarget);
             *      phases.Add(burstPhase);
             *  }
             * }*/
            phases.Sort((x, y) => x.Start.CompareTo(y.Start));
            phases.RemoveAll(x => x.Targets.Count == 0);
            return(phases);
        }
예제 #48
0
        /// <summary>
        /// Executes an automated build. Called from <c>Main</c>.
        /// </summary>
        /// <param name="args">The command-line arguments from <c>Main</c>.</param>
        /// <param name="initialize">Called to initialize the build.</param>
        /// <returns>The exit code for the build.</returns>
        public static int Execute(string[] args, Action <BuildApp> initialize)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }
            if (initialize == null)
            {
                throw new ArgumentNullException(nameof(initialize));
            }

            var commandLineApp = new CommandLineApplication();

            var buildApp = new BuildApp(commandLineApp);

            initialize(buildApp);

            var noColorFlag          = buildApp.AddFlag("--no-color", "Disable color output");
            var skipDependenciesFlag = buildApp.AddFlag("-s|--skip-dependencies", "Don't run target dependencies");
            var helpFlag             = buildApp.AddFlag("-h|-?|--help", "Show build help");
            var targetsArgument      = commandLineApp.Argument("targets", "The targets to build", multipleValues: true);

            var bullseyeTargets = new Targets();

            foreach (var target in buildApp.Targets)
            {
                bullseyeTargets.Add(target.Name, target.Dependencies, target.Run);
            }

            commandLineApp.OnExecute(() =>
            {
                var bullseyeArgs = targetsArgument.Values.ToList();

                if (bullseyeArgs.Count == 0 && buildApp.Targets.Any(x => x.Name == c_defaultTarget))
                {
                    bullseyeArgs.Add(c_defaultTarget);
                }

                if (helpFlag.Value || bullseyeArgs.Count == 0)
                {
                    commandLineApp.ShowHelp(usePager: false);
                    ShowTargets(buildApp.Targets);
                }
                else
                {
                    if (noColorFlag.Value)
                    {
                        bullseyeArgs.Add("--no-color");
                    }
                    if (skipDependenciesFlag.Value)
                    {
                        bullseyeArgs.Add("--skip-dependencies");
                    }
                    bullseyeArgs.Add("--no-extended-chars");

                    try
                    {
                        bullseyeTargets.RunWithoutExiting(bullseyeArgs);
                    }
                    catch (TargetFailedException)
                    {
                        return(1);
                    }
                    catch (Exception exception) when(exception is ApplicationException || exception is CommandParsingException || exception is InvalidUsageException)
                    {
                        Console.Error.WriteLine(exception.Message);
                        return(2);
                    }
                }

                return(0);
            });

            return(commandLineApp.Execute(args));
        }
예제 #49
0
 protected override float TargetEvaluation()
 {
     // TODO: sorting criteria
     return(Targets.None() ? 0 : 100);
 }
예제 #50
0
        internal void CleanUp()
        {
            AiCloseTick = Session.Tick;

            MyGrid.Components.Remove <AiComponent>();

            if (Session.IsClient)
            {
                Session.SendUpdateRequest(MyGrid.EntityId, PacketType.ClientAiRemove);
            }

            Data.Repo.ControllingPlayers.Clear();
            Data.Repo.ActiveTerminal = 0;

            CleanSortedTargets();
            Construct.Clean();
            Obstructions.Clear();
            ObstructionsTmp.Clear();
            TargetAis.Clear();
            TargetAisTmp.Clear();
            EntitiesInRange.Clear();
            Batteries.Clear();
            Targets.Clear();
            Weapons.Clear();
            WeaponsIdx.Clear();
            WeaponBase.Clear();
            LiveProjectile.Clear();
            DeadProjectiles.Clear();
            NearByShieldsTmp.Clear();
            NearByFriendlyShields.Clear();
            StaticsInRange.Clear();
            StaticsInRangeTmp.Clear();
            TestShields.Clear();
            NewEntities.Clear();
            SubGridsRegistered.Clear();
            PreviousTargets.Clear();
            SourceCount           = 0;
            BlockCount            = 0;
            AiOwner               = 0;
            ProjectileTicker      = 0;
            NearByEntities        = 0;
            NearByEntitiesTmp     = 0;
            MyProjectiles         = 0;
            AccelChecked          = false;
            PointDefense          = false;
            FadeOut               = false;
            SuppressMouseShoot    = false;
            OverPowered           = false;
            UpdatePowerSources    = false;
            AvailablePowerChanged = false;
            PowerIncrease         = false;
            RequestedPowerChanged = false;
            RequestIncrease       = false;
            DbReady               = false;
            GridInit              = false;
            TouchingWater         = false;
            Data.Clean();

            MyShield         = null;
            MyPlanetTmp      = null;
            MyPlanet         = null;
            TerminalSystem   = null;
            LastTerminal     = null;
            PowerDistributor = null;
            PowerBlock       = null;
            MyGrid           = null;
            PowerDistributor = null;
            Session          = null;
            Closed           = true;
            CanShoot         = true;
            Version++;
        }
예제 #51
0
 public static float CalculatedWeight(Item item,
     Targets.Item target,
     bool simulation = false,
     bool forceRealTime = false)
 {
     try
     {
         var minValue = simulation ? item.SimulationMinValue : item.MinValue;
         var maxValue = simulation ? item.SimulationMaxValue : item.MaxValue;
         if (item.Weight <= MinWeight || maxValue <= 0)
         {
             return MinWeight;
         }
         var minWeight = minValue > 0 ? item.Weight / (maxValue / minValue) : MinWeight;
         var weight = item.Inverted
             ? item.Weight - item.Weight * GetValue(item, target, forceRealTime) / maxValue + minWeight
             : item.Weight * GetValue(item, target, forceRealTime) / maxValue;
         return float.IsNaN(weight) || float.IsInfinity(weight)
             ? MinWeight
             : Math.Min(MaxWeight, Math.Min(item.Weight, Math.Max(MinWeight, Math.Max(weight, minWeight))));
     }
     catch
     {
         // Ignored
     }
     return MinWeight;
 }
        public override List <PhaseData> GetPhases(ParsedLog log, bool requirePhases)
        {
            long             start         = 0;
            long             end           = 0;
            long             fightDuration = log.FightData.FightDuration;
            List <PhaseData> phases        = GetInitialPhase(log);
            Boss             mainTarget    = Targets.Find(x => x.ID == (ushort)ParseEnum.BossIDS.Deimos);

            if (mainTarget == null)
            {
                throw new InvalidOperationException("Main target of the fight not found");
            }
            phases[0].Targets.Add(mainTarget);
            if (!requirePhases)
            {
                return(phases);
            }
            // Determined + additional data on inst change
            CombatItem invulDei = log.GetBoonData(762).Find(x => x.IsBuffRemove == ParseEnum.BuffRemove.None && x.DstInstid == mainTarget.InstID);

            if (invulDei != null)
            {
                end = invulDei.Time - log.FightData.FightStart;
                phases.Add(new PhaseData(start, end));
                start = (log.FightData.PhaseData.Count == 1 ? log.FightData.PhaseData[0] - log.FightData.FightStart : fightDuration);
                mainTarget.AddCustomCastLog(new CastLog(end, -6, (int)(start - end), ParseEnum.Activation.None, (int)(start - end), ParseEnum.Activation.None), log);
            }
            if (fightDuration - start > 5000 && start >= phases.Last().End)
            {
                phases.Add(new PhaseData(start, fightDuration));
            }
            for (int i = 1; i < phases.Count; i++)
            {
                phases[i].Name = "Phase " + i;
                phases[i].Targets.Add(mainTarget);
                if (i == 2)
                {
                    phases[i].DrawArea = true;
                }
            }
            int        offsetDei = phases.Count;
            CombatItem teleport  = log.GetBoonData(38169).FirstOrDefault(x => x.Time > log.FightData.FightStart);
            int        splits    = 0;

            while (teleport != null && splits < 3)
            {
                start = teleport.Time - log.FightData.FightStart;
                CombatItem teleportBack = log.GetBoonData(38169).FirstOrDefault(x => x.Time - log.FightData.FightStart > start + 10000);
                if (teleportBack != null)
                {
                    end = Math.Min(teleportBack.Time - log.FightData.FightStart, fightDuration);
                }
                else
                {
                    end = fightDuration;
                }
                phases.Add(new PhaseData(start, end));
                splits++;
                teleport = log.GetBoonData(38169).FirstOrDefault(x => x.Time - log.FightData.FightStart > end + 10000);
            }

            string[] namesDeiSplit = new [] { "Thief", "Gambler", "Drunkard" };
            for (int i = offsetDei; i < phases.Count; i++)
            {
                PhaseData phase = phases[i];
                phase.Name     = namesDeiSplit[i - offsetDei];
                phase.DrawArea = true;
                List <ushort> ids = new List <ushort>
                {
                    (ushort)Thief,
                    (ushort)Drunkard,
                    (ushort)Gambler,
                };
                AddTargetsToPhase(phase, ids, log);
            }
            phases.Sort((x, y) => (x.Start < y.Start) ? -1 : 1);
            foreach (PhaseData phase in phases)
            {
                phase.DrawStart = true;
                phase.DrawEnd   = true;
            }
            phases.RemoveAll(x => x.Targets.Count == 0);
            return(phases);
        }
예제 #53
0
        internal override void ComputePlayerCombatReplayActors(AbstractPlayer p, ParsedEvtcLog log, CombatReplay replay)
        {
            // spirit transform
            var spiritTransform            = log.CombatData.GetBuffData(FracturedSpirit).Where(x => x.To == p.AgentItem && x is BuffApplyEvent).ToList();
            AbstractSingleActor mainTarget = Targets.FirstOrDefault(x => x.ID == (int)ArcDPSEnums.TargetID.Dhuum);

            if (mainTarget == null)
            {
                throw new MissingKeyActorsException("Dhuum not found");
            }
            foreach (AbstractBuffEvent c in spiritTransform)
            {
                int duration = 15000;
                HealthUpdateEvent hpUpdate = log.CombatData.GetHealthUpdateEvents(mainTarget.AgentItem).FirstOrDefault(x => x.Time > c.Time);
                if (hpUpdate != null && hpUpdate.HPPercent < 10.50)
                {
                    duration = 30000;
                }
                AbstractBuffEvent removedBuff = log.CombatData.GetBuffRemoveAllData(MortalCoilDhuum).FirstOrDefault(x => x.To == p.AgentItem && x.Time > c.Time && x.Time < c.Time + duration);
                int start = (int)c.Time;
                int end   = start + duration;
                if (removedBuff != null)
                {
                    end = (int)removedBuff.Time;
                }
                replay.Decorations.Add(new CircleDecoration(true, 0, 100, (start, end), "rgba(0, 50, 200, 0.3)", new AgentConnector(p)));
                replay.Decorations.Add(new CircleDecoration(true, start + duration, 100, (start, end), "rgba(0, 50, 200, 0.5)", new AgentConnector(p)));
            }
            // bomb
            List <AbstractBuffEvent> bombDhuum = GetFilteredList(log.CombatData, ArcingAffliction, p, true, true);
            int bombDhuumStart = 0;

            foreach (AbstractBuffEvent c in bombDhuum)
            {
                if (c is BuffApplyEvent)
                {
                    bombDhuumStart = (int)c.Time;
                }
                else
                {
                    int bombDhuumEnd = (int)c.Time;
                    replay.Decorations.Add(new CircleDecoration(true, 0, 100, (bombDhuumStart, bombDhuumEnd), "rgba(80, 180, 0, 0.3)", new AgentConnector(p)));
                    replay.Decorations.Add(new CircleDecoration(true, bombDhuumStart + 13000, 100, (bombDhuumStart, bombDhuumEnd), "rgba(80, 180, 0, 0.5)", new AgentConnector(p)));
                }
            }
            // shackles connection
            var    shackles       = GetFilteredList(log.CombatData, DhuumShackles1, p, true, true).Concat(GetFilteredList(log.CombatData, DhuumShackles2, p, true, true)).ToList();
            int    shacklesStart  = 0;
            Player shacklesTarget = null;

            foreach (AbstractBuffEvent c in shackles)
            {
                if (c is BuffApplyEvent)
                {
                    shacklesStart  = (int)c.Time;
                    shacklesTarget = log.PlayerList.FirstOrDefault(x => x.AgentItem == c.CreditedBy);
                }
                else
                {
                    int shacklesEnd = (int)c.Time;
                    if (shacklesTarget != null)
                    {
                        replay.Decorations.Add(new LineDecoration(0, (shacklesStart, shacklesEnd), "rgba(0, 255, 255, 0.5)", new AgentConnector(p), new AgentConnector(shacklesTarget)));
                    }
                }
            }
            // shackles damage (identical to the connection for now, not yet properly distinguishable from the pure connection, further investigation needed due to inconsistent behavior (triggering too early, not triggering the damaging skill though)
            // shackles start with buff 47335 applied from one player to the other, this is switched over to buff 48591 after mostly 2 seconds, sometimes later. This is switched to 48042 usually 4 seconds after initial application and the damaging skill 47164 starts to deal damage from that point on.
            // Before that point, 47164 is only logged when evaded/blocked, but doesn't deal damage. Further investigation needed.
            List <AbstractBuffEvent> shacklesDmg = GetFilteredList(log.CombatData, DhuumDamagingShackles, p, true, true);
            int    shacklesDmgStart  = 0;
            Player shacklesDmgTarget = null;

            foreach (AbstractBuffEvent c in shacklesDmg)
            {
                if (c is BuffApplyEvent)
                {
                    shacklesDmgStart  = (int)c.Time;
                    shacklesDmgTarget = log.PlayerList.FirstOrDefault(x => x.AgentItem == c.CreditedBy);
                }
                else
                {
                    int shacklesDmgEnd = (int)c.Time;
                    if (shacklesDmgTarget != null)
                    {
                        replay.Decorations.Add(new LineDecoration(0, (shacklesDmgStart, shacklesDmgEnd), "rgba(255, 200, 0, 0.5)", new AgentConnector(p), new AgentConnector(shacklesDmgTarget)));
                    }
                }
            }
        }
예제 #54
0
 public override void CheckSuccess(CombatData combatData, AgentData agentData, FightData fightData, HashSet <AgentItem> playerAgents)
 {
     SetSuccessByBuffCount(combatData, fightData, playerAgents, Targets.Find(x => x.ID == (int)ParseEnum.TargetIDS.Artsariiv), 762, 4);
 }
        public override List <PhaseData> GetPhases(ParsedLog log, bool requirePhases)
        {
            List <PhaseData> phases     = GetInitialPhase(log);
            Target           mainTarget = Targets.Find(x => x.ID == (ushort)ParseEnum.TargetIDS.Sabetha);

            if (mainTarget == null)
            {
                throw new InvalidOperationException("Main target of the fight not found");
            }
            phases[0].Targets.Add(mainTarget);
            if (!requirePhases)
            {
                return(phases);
            }
            // Invul check
            phases.AddRange(GetPhasesByInvul(log, 757, mainTarget, true, true));
            string[] namesSab = new [] { "Phase 1", "Kernan", "Phase 2", "Knuckles", "Phase 3", "Karde", "Phase 4" };
            for (int i = 1; i < phases.Count; i++)
            {
                PhaseData phase = phases[i];
                phase.Name = namesSab[i - 1];
                if (i == 2 || i == 4 || i == 6)
                {
                    List <ushort> ids = new List <ushort>
                    {
                        (ushort)Kernan,
                        (ushort)Knuckles,
                        (ushort)Karde,
                    };
                    AddTargetsToPhase(phase, ids, log);
                }
                else
                {
                    phase.Targets.Add(mainTarget);
                    Target addTarget;
                    switch (i)
                    {
                    case 3:
                        addTarget = Targets.Find(x => x.ID == (ushort)Kernan);
                        if (addTarget == null)
                        {
                            throw new InvalidOperationException("Kernan not found when we should have been able to");
                        }
                        phase.Targets.Add(addTarget);
                        break;

                    case 5:
                        addTarget = Targets.Find(x => x.ID == (ushort)Knuckles);
                        if (addTarget == null)
                        {
                            throw new InvalidOperationException("Knuckles not found when we should have been able to");
                        }
                        phase.Targets.Add(addTarget);
                        break;

                    case 7:
                        addTarget = Targets.Find(x => x.ID == (ushort)Karde);
                        if (addTarget == null)
                        {
                            throw new InvalidOperationException("Karde not found when we should have been able to");
                        }
                        phase.Targets.Add(addTarget);
                        break;
                    }
                }
            }
            return(phases);
        }
예제 #56
0
        public override void ComputeAdditionalPlayerData(Player p, ParsedLog log)
        {
            // spirit transform
            CombatReplay      replay          = p.CombatReplay;
            List <CombatItem> spiritTransform = log.GetBoonData(46950).Where(x => x.DstInstid == p.InstID && x.IsBuffRemove == ParseEnum.BuffRemove.None).ToList();
            Target            mainTarget      = Targets.Find(x => x.ID == (ushort)ParseEnum.TargetIDS.Dhuum);

            if (mainTarget == null)
            {
                throw new InvalidOperationException("Main target of the fight not found");
            }
            foreach (CombatItem c in spiritTransform)
            {
                int duration = 15000;
                int start    = (int)(log.FightData.ToFightSpace(c.Time));
                if (mainTarget.HealthOverTime.FirstOrDefault(x => x.X > start).Y < 1050)
                {
                    duration = 30000;
                }
                CombatItem removedBuff = log.GetBoonData(48281).FirstOrDefault(x => x.SrcInstid == p.InstID && x.IsBuffRemove == ParseEnum.BuffRemove.All && x.Time > c.Time && x.Time < c.Time + duration);
                int        end         = start + duration;
                if (removedBuff != null)
                {
                    end = (int)(log.FightData.ToFightSpace(removedBuff.Time));
                }
                replay.Actors.Add(new CircleActor(true, 0, 100, (start, end), "rgba(0, 50, 200, 0.3)", new AgentConnector(p)));
                replay.Actors.Add(new CircleActor(true, start + duration, 100, (start, end), "rgba(0, 50, 200, 0.5)", new AgentConnector(p)));
            }
            // bomb
            List <CombatItem> bombDhuum = GetFilteredList(log, 47646, p, true);
            int bombDhuumStart          = 0;

            foreach (CombatItem c in bombDhuum)
            {
                if (c.IsBuffRemove == ParseEnum.BuffRemove.None)
                {
                    bombDhuumStart = (int)(log.FightData.ToFightSpace(c.Time));
                }
                else
                {
                    int bombDhuumEnd = (int)(log.FightData.ToFightSpace(c.Time));
                    replay.Actors.Add(new CircleActor(true, 0, 100, (bombDhuumStart, bombDhuumEnd), "rgba(80, 180, 0, 0.3)", new AgentConnector(p)));
                    replay.Actors.Add(new CircleActor(true, bombDhuumStart + 13000, 100, (bombDhuumStart, bombDhuumEnd), "rgba(80, 180, 0, 0.5)", new AgentConnector(p)));
                }
            }
            // shackles connection
            List <CombatItem> shackles = GetFilteredList(log, 47335, p, true).Concat(GetFilteredList(log, 48591, p, true)).ToList();
            int    shacklesStart       = 0;
            Player shacklesTarget      = null;

            foreach (CombatItem c in shackles)
            {
                if (c.IsBuffRemove == ParseEnum.BuffRemove.None)
                {
                    shacklesStart  = (int)(log.FightData.ToFightSpace(c.Time));
                    shacklesTarget = log.PlayerList.FirstOrDefault(x => x.Agent == c.SrcAgent);
                }
                else
                {
                    int shacklesEnd = (int)(log.FightData.ToFightSpace(c.Time));
                    if (shacklesTarget != null)
                    {
                        replay.Actors.Add(new LineActor(0, (shacklesStart, shacklesEnd), "rgba(0, 255, 255, 0.5)", new AgentConnector(p), new AgentConnector(shacklesTarget)));
                    }
                }
            }
            // shackles damage (identical to the connection for now, not yet properly distinguishable from the pure connection, further investigation needed due to inconsistent behavior (triggering too early, not triggering the damaging skill though)
            // shackles start with buff 47335 applied from one player to the other, this is switched over to buff 48591 after mostly 2 seconds, sometimes later. This is switched to 48042 usually 4 seconds after initial application and the damaging skill 47164 starts to deal damage from that point on.
            // Before that point, 47164 is only logged when evaded/blocked, but doesn't deal damage. Further investigation needed.
            List <CombatItem> shacklesDmg = GetFilteredList(log, 48042, p, true);
            int    shacklesDmgStart       = 0;
            Player shacklesDmgTarget      = null;

            foreach (CombatItem c in shacklesDmg)
            {
                if (c.IsBuffRemove == ParseEnum.BuffRemove.None)
                {
                    shacklesDmgStart  = (int)(log.FightData.ToFightSpace(c.Time));
                    shacklesDmgTarget = log.PlayerList.FirstOrDefault(x => x.Agent == c.SrcAgent);
                }
                else
                {
                    int shacklesDmgEnd = (int)(log.FightData.ToFightSpace(c.Time));
                    if (shacklesDmgTarget != null)
                    {
                        replay.Actors.Add(new LineActor(0, (shacklesDmgStart, shacklesDmgEnd), "rgba(0, 255, 255, 0.5)", new AgentConnector(p), new AgentConnector(shacklesDmgTarget)));
                    }
                }
            }
        }
 public override List <AbstractDamageEvent> SpecialDamageEventProcess(Dictionary <AgentItem, List <AbstractDamageEvent> > damageBySrc, Dictionary <AgentItem, List <AbstractDamageEvent> > damageByDst, Dictionary <long, List <AbstractDamageEvent> > damageById, SkillData skillData)
 {
     NegateDamageAgainstBarrier(Targets.Select(x => x.AgentItem).ToList(), damageByDst);
     return(new List <AbstractDamageEvent>());
 }
예제 #58
0
 public static void PushTarget(RenderTarget2D rt)
 {
     Targets.Push(rt);
     CurrentTraget = rt;
 }
예제 #59
0
파일: Default.aspx.cs 프로젝트: PavelPZ/REW
 protected void doMinify(Targets target) {
   try { Packager.RewApp.minify(false, target); } catch (Exception exp) { error(exp); }
 }
        internal override List <PhaseData> GetPhases(ParsedEvtcLog log, bool requirePhases)
        {
            long                start         = 0;
            long                end           = 0;
            long                fightDuration = log.FightData.FightEnd;
            List <PhaseData>    phases        = GetInitialPhase(log);
            AbstractSingleActor mainTarget    = Targets.FirstOrDefault(x => x.ID == (int)ArcDPSEnums.TargetID.KeepConstruct);

            if (mainTarget == null)
            {
                throw new MissingKeyActorsException("Keep Construct not found");
            }
            phases[0].AddTarget(mainTarget);
            if (!requirePhases)
            {
                return(phases);
            }
            // Main phases 35025
            List <AbstractBuffEvent> kcPhaseInvuls = GetFilteredList(log.CombatData, XerasBoon, mainTarget, true, true);

            foreach (AbstractBuffEvent c in kcPhaseInvuls)
            {
                if (c is BuffApplyEvent)
                {
                    end = c.Time;
                    phases.Add(new PhaseData(start, end));
                }
                else
                {
                    start = c.Time;
                }
            }
            if (fightDuration - start > ParserHelper.PhaseTimeLimit && start >= phases.Last().End)
            {
                phases.Add(new PhaseData(start, fightDuration));
                start = fightDuration;
            }
            for (int i = 1; i < phases.Count; i++)
            {
                phases[i].Name = "Phase " + i;
                phases[i].AddTarget(mainTarget);
            }
            // add burn phases
            int offset   = phases.Count;
            var orbItems = log.CombatData.GetBuffData(Compromised).Where(x => x.To == mainTarget.AgentItem).ToList();

            // Get number of orbs and filter the list
            start = 0;
            int orbCount = 0;
            var segments = new List <Segment>();

            foreach (AbstractBuffEvent c in orbItems)
            {
                if (c is BuffApplyEvent)
                {
                    if (start == 0)
                    {
                        start = c.Time;
                    }
                    orbCount++;
                }
                else if (start != 0)
                {
                    segments.Add(new Segment(start, Math.Min(c.Time, fightDuration), orbCount));
                    orbCount = 0;
                    start    = 0;
                }
            }
            int burnCount = 1;

            foreach (Segment seg in segments)
            {
                var phase = new PhaseData(seg.Start, seg.End, "Burn " + burnCount++ + " (" + seg.Value + " orbs)");
                phase.AddTarget(mainTarget);
                phases.Add(phase);
            }
            phases.Sort((x, y) => x.Start.CompareTo(y.Start));
            // pre burn phases
            int preBurnCount = 1;
            var preBurnPhase = new List <PhaseData>();
            List <AbstractBuffEvent> kcInvuls = GetFilteredList(log.CombatData, Determined762, mainTarget, true, true);

            foreach (AbstractBuffEvent invul in kcInvuls)
            {
                if (invul is BuffApplyEvent)
                {
                    end = invul.Time;
                    PhaseData prevPhase = phases.LastOrDefault(x => x.Start <= end || x.End <= end);
                    if (prevPhase != null)
                    {
                        start = (prevPhase.End >= end ? prevPhase.Start : prevPhase.End) + 1;
                        if (end - start > 1000)
                        {
                            var phase = new PhaseData(start, end, "Pre-Burn " + preBurnCount++);
                            phase.AddTarget(mainTarget);
                            preBurnPhase.Add(phase);
                        }
                    }
                }
            }
            phases.AddRange(preBurnPhase);
            phases.Sort((x, y) => x.Start.CompareTo(y.Start));
            // add leftover phases
            PhaseData cur            = null;
            int       leftOverCount  = 1;
            var       leftOverPhases = new List <PhaseData>();

            for (int i = 0; i < phases.Count; i++)
            {
                PhaseData phase = phases[i];
                if (phase.Name.Contains("%"))
                {
                    cur = phase;
                }
                else if (phase.Name.Contains("orbs"))
                {
                    if (cur != null)
                    {
                        if (cur.End >= phase.End + 5000 && (i == phases.Count - 1 || phases[i + 1].Name.Contains("%")))
                        {
                            var leftOverPhase = new PhaseData(phase.End + 1, cur.End, "Leftover " + leftOverCount++);
                            leftOverPhase.AddTarget(mainTarget);
                            leftOverPhases.Add(leftOverPhase);
                        }
                    }
                }
            }
            phases.AddRange(leftOverPhases);
            return(phases);
        }