示例#1
0
    void InitializeVitals()
    {
        Ship slowestShip = _ships.OrderBy(s => s.GetVital(VitalType.MovementSpeed)).FirstOrDefault();

        _vitals = new FleetVital[]
        {
            new FleetVital(FleetVitalType.ProcessedFuel, _ships.Sum(s => s.GetVital(VitalType.FuelStorage))),
            new FleetVital(FleetVitalType.Ammunition, _ships.Sum(s => s.GetVital(VitalType.GoodsStorage))),
            new FleetVital(FleetVitalType.CivilianSupplies, _ships.Sum(s => s.GetVital(VitalType.GoodsStorage))),
            new FleetVital(FleetVitalType.NebulaGas, _ships.Sum(s => s.GetVital(VitalType.GasStorage))),
            new FleetVital(FleetVitalType.Veldspar, _ships.Sum(s => s.GetVital(VitalType.OreStorage))),
            new FleetVital(FleetVitalType.Tritanite, _ships.Sum(s => s.GetVital(VitalType.OreStorage))),
            new FleetVital(FleetVitalType.Movement, Mathf.Clamp(slowestShip == null ? 0f : 500f / (int)slowestShip.size, 0f, 400f)),
            new FleetVital(FleetVitalType.Detection, (200f - (ships.Count * 10f)) * 1.5f)
        };

        for (int i = 0; i < _vitals.Length; i++)
        {
            _vitals[i].OnCurrentChanged  += delegate { OnStatsUpdated?.Invoke(this); };
            _vitals[i].OnMaxChanged      += delegate { OnStatsUpdated?.Invoke(this); };
            _vitals[i].OnCurrentCritical += OnVitalCritical;
            _vitals[i].OnVitalUpdated    += delegate { OnStatsUpdated?.Invoke(this); };
        }

        //add ship modifiers
        for (int i = 0; i < _ships.Count; i++)
        {
            for (int j = 0; j < _ships[i].modifiers.Count; j++)
            {
                GetVital(_ships[i].modifiers[j].type).AddModifier(_ships[i].modifiers[j]);
            }
        }
    }
        public static void Parse(Packet p)
        {
            Client.Info.MinimumPhysicalAttack = p.ReadUInt32();
            Client.Info.MaximumPhysicalAttack = p.ReadUInt32();
            Client.Info.MinimumMagicalAttack  = p.ReadUInt32();
            Client.Info.MaximumMagicalAttack  = p.ReadUInt32();
            Client.Info.PhysicalDefense       = p.ReadUInt16();
            Client.Info.MagicalDefense        = p.ReadUInt16();
            Client.Info.HitRate   = p.ReadUInt16();
            Client.Info.ParryRate = p.ReadUInt16();
            Client.Info.MaxHP     = p.ReadUInt32();
            Client.Info.MaxMP     = p.ReadUInt32();
            Client.Info.STR       = p.ReadUInt16();
            Client.Info.INT       = p.ReadUInt16();

            if (Client.Info.CurrentHP > Client.Info.MaxHP)
            {
                Client.Info.CurrentHP = Client.Info.MaxHP;
            }
            if (Client.Info.CurrentMP > Client.Info.MaxMP)
            {
                Client.Info.CurrentMP = Client.Info.MaxMP;
            }

            OnStatsUpdated?.Invoke();
        }
 public void ContractOnChanged(object sender, EventArgs e)
 {
     lock (UpdateLock)
         if (UpdatingStats)
         {
             return;
         }
         else
         {
             UpdatingStats = true;
         }
     try
     {
         CalculateStats().Wait();
         UpdatingStats = false;
         OnStatsUpdated?.Invoke(this, EventArgs.Empty);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         UpdatingStats = false;
     }
 }
示例#4
0
 public void StatsUpdated()
 {
     OnPropertyChanged(nameof(StatsString));
     OnPropertyChanged(nameof(LastPlayed));
     OnPropertyChanged(nameof(LastPlayedNewFirst));
     OnPropertyChanged(nameof(WinLossString));
     OnPropertyChanged(nameof(WinPercent));
     OnPropertyChanged(nameof(WinPercentString));
     OnPropertyChanged(nameof(VisibilityStats));
     OnPropertyChanged(nameof(VisibilityNoStats));
     OnStatsUpdated?.Invoke();
 }
示例#5
0
 public void StatsUpdated()
 {
     OnPropertyChanged(nameof(StatsString));
     OnPropertyChanged(nameof(LastPlayed));
     OnPropertyChanged(nameof(LastPlayedNewFirst));
     OnPropertyChanged(nameof(WinLossString));
     OnPropertyChanged(nameof(WinPercent));
     OnPropertyChanged(nameof(WinPercentString));
     OnPropertyChanged(nameof(VisibilityStats));
     OnPropertyChanged(nameof(VisibilityNoStats));
     OnStatsUpdated?.Invoke();
     Core.MainWindow.DeckPickerList.RefreshDisplayedDecks();
 }
示例#6
0
    void UpdateVitals()
    {
        //recalculate fleet maximum values
        GetVital(FleetVitalType.ProcessedFuel).SetMax(_ships.Sum(s => s.GetVital(VitalType.FuelStorage)));
        GetVital(FleetVitalType.Ammunition).SetMax(_ships.Sum(s => s.GetVital(VitalType.GoodsStorage)));
        GetVital(FleetVitalType.CivilianSupplies).SetMax(_ships.Sum(s => s.GetVital(VitalType.GoodsStorage)));
        GetVital(FleetVitalType.NebulaGas).SetMax(_ships.Sum(s => s.GetVital(VitalType.GasStorage)));
        GetVital(FleetVitalType.Veldspar).SetMax(_ships.Sum(s => s.GetVital(VitalType.OreStorage)));
        GetVital(FleetVitalType.Tritanite).SetMax(_ships.Sum(s => s.GetVital(VitalType.OreStorage)));

        Ship slowestShip = _ships.OrderBy(s => s.GetVital(VitalType.MovementSpeed)).First();

        GetVital(FleetVitalType.Movement).SetMax(Mathf.Clamp(slowestShip == null ? 0f : 500f / (int)slowestShip.size, 0f, 400f), true);
        GetVital(FleetVitalType.Detection).SetMax((200f - (ships.Count * 10f)) * 1.5f);

        UpdateDetectionAndMovement();
        OnStatsUpdated?.Invoke(this);
    }
示例#7
0
    void UpdateStats()
    {
        //initialize base values
        float movementSpeed = _hull.baseMovementSpeed;
        float rotationSpeed = _hull.baseRotationSpeed;

        //base scanRadius, basically optical range
        float scanRadius = 200;
        float scanRate   = 5f;

        float hullpoints   = _hull.hullpoints;
        float shieldpoints = 0f;

        float gasStorage   = _hull.gasStorage;
        float oreStorage   = _hull.oreStorage;
        float fuelStorage  = _hull.fuelStorage;
        float goodsStorage = _hull.goodsStorage;

        _vitals = new float[]
        {
            movementSpeed,
            rotationSpeed,
            scanRadius,
            scanRate,
            hullpoints,
            shieldpoints,
            gasStorage,
            oreStorage,
            fuelStorage,
            goodsStorage
        };

        //apply additive modifiers
        for (int i = 0; i < _components.Length; i++)
        {
            for (int j = 0; j < _components[i].modifiers.Length; j++)
            {
                if (_components[i].modifiers[j].mode == ModifierMode.Additive)
                {
                    _vitals[(int)_components[i].modifiers[j].type] += _components[i].modifiers[j].value;
                }
            }
        }
        //apply percentage buffs
        for (int i = 0; i < _components.Length; i++)
        {
            for (int j = 0; j < _components[i].modifiers.Length; j++)
            {
                if (_components[i].modifiers[j].mode == ModifierMode.Percentage)
                {
                    _vitals[(int)_components[i].modifiers[j].type] *= _components[i].modifiers[j].value;
                }
            }
        }
        //sanity checking, this needs expanding
        for (int i = 0; i < _vitals.Length; i++)
        {
            if (_vitals[i] < 0f)
            {
                _vitals[i] = 0f;
            }
        }

        OnStatsUpdated?.Invoke();
    }