Ejemplo n.º 1
0
        public override void DefaultInitialize()
        {
            Vitality = Add(new VitalityFocus());
            Tenacity = Add(new TenacityFocus());
            Mobility = Add(new MobilityFocus());
            Utility  = Add(new UtilityFocus());
            Ferocity = Add(new FerocityFocus());
            Capacity = Add(new CapacityFocus());

            Vitality.RegisterEnemies(new Focus[] { Mobility, Ferocity });
            Vitality.RegisterNemeses(Utility);

            Tenacity.RegisterEnemies(new Focus[] { Utility, Capacity });
            Tenacity.RegisterNemeses(Ferocity);

            Mobility.RegisterEnemies(new Focus[] { Ferocity, Vitality });
            Mobility.RegisterNemeses(Capacity);

            Utility.RegisterEnemies(new Focus[] { Capacity, Tenacity });
            Utility.RegisterNemeses(Vitality);

            Ferocity.RegisterEnemies(new Focus[] { Vitality, Mobility });
            Ferocity.RegisterNemeses(Tenacity);

            Capacity.RegisterEnemies(new Focus[] { Tenacity, Utility });
            Capacity.RegisterNemeses(Mobility);

            ForAllItems(f => f.ManagerEndInitialization());
            base.DefaultInitialize();
        }
Ejemplo n.º 2
0
    protected virtual void InitializUnitStats(BaseStats baseStats)
    {
        Health = new Health(baseStats.BaseHealth);

        AttackDamage         = new AttackDamage(baseStats.BaseAttackDamage);
        AbilityPower         = new AbilityPower();
        Armor                = new Resistance(baseStats.BaseArmor);
        MagicResistance      = new Resistance(baseStats.BaseMagicResistance);
        AttackSpeed          = new AttackSpeed(baseStats.BaseAttackSpeed);
        CooldownReduction    = new CooldownReduction();
        CriticalStrikeChance = new CriticalStrikeChance();
        MovementSpeed        = new MovementSpeed(baseStats.BaseMovementSpeed);

        HealthRegeneration      = new ResourceRegeneration();
        Lethality               = new Lethality();
        ArmorPenetrationPercent = new ResistancePenetrationPercent();
        MagicPenetrationFlat    = new ResistancePenetrationFlat();
        MagicPenetrationPercent = new ResistancePenetrationPercent();
        LifeSteal               = new PercentBonusOnlyStat();
        SpellVamp               = new PercentBonusOnlyStat();
        AttackRange             = new AttackRange(baseStats.BaseAttackRange);
        Tenacity = new Tenacity();

        CriticalStrikeDamage           = new CriticalStrikeDamage();
        CriticalStrikeDamageReduction  = new PercentBonusOnlyStat();
        PhysicalDamageModifier         = new DamageModifier();
        MagicDamageModifier            = new DamageModifier();
        PhysicalDamageReceivedModifier = new DamageModifier();
        MagicDamageReceivedModifier    = new DamageModifier();
        HealAndShieldPower             = new PercentBonusOnlyStat();
        SlowResistance = new SlowResistance();

        GrievousWounds = new GrievousWounds();

        ExtraAdjustments();
    }
Ejemplo n.º 3
0
 public void RemoveModifier(IStatsModifier modifier)
 {
     if (AbilityPower.RemoveStatModificator(modifier.AbilityPower))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Base_Ap, AbilityPower.BaseValue);
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Bonus_Ap_Flat, AbilityPower.FlatBonus);
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Bonus_Ap_Pct, AbilityPower.PercentBonus);
     }
     if (Armor.RemoveStatModificator(modifier.Armor))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Armor, Armor.Total);
     }
     if (ArmorPenetration.RemoveStatModificator(modifier.ArmorPenetration))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Armor_Pen_Flat, ArmorPenetration.FlatBonus);
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Armor_Pen_Pct, ArmorPenetration.PercentBonus);
     }
     if (AttackDamage.RemoveStatModificator(modifier.AttackDamage))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Base_Ad, AttackDamage.BaseValue);
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Bonus_Ad_Flat, AttackDamage.FlatBonus);
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Bonus_Ad_Pct, AttackDamage.PercentBonus);
     }
     if (AttackSpeedMultiplier.RemoveStatModificator(modifier.AttackSpeed))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Atks_multiplier, AttackSpeedMultiplier.Total);
     }
     if (CriticalChance.RemoveStatModificator(modifier.CriticalChance))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Crit_Chance, CriticalChance.Total);
     }
     GoldPerSecond.RemoveStatModificator(modifier.GoldPerSecond);
     if (HealthPoints.RemoveStatModificator(modifier.HealthPoints))
     {
         appendStat(_updatedStats, MasterMask.MM_Four, FieldMask.FM4_MaxHp, HealthPoints.Total);
     }
     if (HealthRegeneration.RemoveStatModificator(modifier.HealthRegeneration))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Hp5, HealthRegeneration.Total);
     }
     if (LifeSteal.RemoveStatModificator(modifier.LifeSteel))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_LifeSteal, LifeSteal.Total);
     }
     if (MagicResist.RemoveStatModificator(modifier.MagicResist))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Magic_Armor, MagicResist.Total);
     }
     if (MagicPenetration.RemoveStatModificator(modifier.MagicPenetration))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Magic_Pen_Flat, MagicPenetration.FlatBonus);
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Magic_Pen_Pct, MagicPenetration.PercentBonus);
     }
     if (ManaPoints.RemoveStatModificator(modifier.ManaPoints))
     {
         appendStat(_updatedStats, MasterMask.MM_Four, FieldMask.FM4_MaxMp, ManaPoints.Total);
     }
     if (ManaRegeneration.RemoveStatModificator(modifier.ManaRegeneration))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Mp5, ManaRegeneration.Total);
     }
     if (MoveSpeed.RemoveStatModificator(modifier.MoveSpeed))
     {
         appendStat(_updatedStats, MasterMask.MM_Four, FieldMask.FM4_Speed, MoveSpeed.Total);
     }
     if (Range.RemoveStatModificator(modifier.Range))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Range, Range.Total);
     }
     if (Size.RemoveStatModificator(modifier.Size))
     {
         appendStat(_updatedStats, MasterMask.MM_Four, FieldMask.FM4_ModelSize, Size.Total);
     }
     if (SpellVamp.RemoveStatModificator(modifier.SpellVamp))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_SpellVamp, SpellVamp.Total);
     }
     if (Tenacity.RemoveStatModificator(modifier.Tenacity))
     {
         appendStat(_updatedStats, MasterMask.MM_Two, FieldMask.FM2_Tenacity, Tenacity.Total);
     }
 }
Ejemplo n.º 4
0
        public Partition GetPartition()
        {
            DistanceMatrix mat = null;

            if (_data.Type == AbstractDataset.DataType.DistanceMatrix)
            {
                mat = (DistanceMatrix)_data;
            }
            else if (_data.Type == AbstractDataset.DataType.PointSet)
            {
                mat = ((PointSet)_data).GetDistanceMatrix();
            }

            //Setup our partition with a single cluster, with all points
            List <Cluster> clusterList = new List <Cluster> {
                new Cluster(0, Enumerable.Range(0, _data.Count).ToList())
            };
            Partition partition = new Partition(clusterList, _data);

            //Dictionary to hold VAT
            var vatMap = new Dictionary <int, Tenacity>();

            //Dictionary to hold subset array
            var subsetMap = new Dictionary <int, int[]>();

            while (clusterList.Count < _minK)
            {
                //Calculate the VAT for all values
                foreach (var c in partition.Clusters.Where(c => !vatMap.ContainsKey(c.ClusterId)))
                {
                    //We must calculate a graph for this subset of data
                    List <int> clusterSubset = c.Points.Select(p => p.Id).ToList();

                    //Now calculate Vat
                    LightWeightGraph lwg;
                    if (_data.Type == AbstractDataset.DataType.Graph)
                    {
                        bool[] exclusion = new bool[_data.Count];
                        for (int i = 0; i < _data.Count; i++)
                        {
                            exclusion[i] = true;
                        }
                        foreach (var p in c.Points)
                        {
                            exclusion[p.Id] = false;
                        }
                        lwg = new LightWeightGraph((LightWeightGraph)_data, exclusion);
                    }
                    else //Distance matrix or Pointset
                    {
                        Debug.Assert(mat != null, "mat != null");
                        var subMatrix = mat.GetReducedDataSet(clusterSubset);

                        //Generate our graph
                        lwg = _graphGen.GenerateGraph(subMatrix.Mat);
                    }

                    subsetMap.Add(c.ClusterId, clusterSubset.ToArray());
                    lwg.IsWeighted = _weighted;
                    Tenacity v = new Tenacity(lwg, _reassignNodes, _alpha, _beta);
                    _vatNodeRemovalOrder = v.NodeRemovalOrder;
                    _vatNumNodesRemoved  = v.NumNodesRemoved;
                    if (_hillClimb)
                    {
                        v.HillClimb();
                    }
                    ////VATClust v = new VATClust(subMatrix.Mat, _weighted, _useKnn, _kNNOffset, _alpha, _beta);
                    vatMap.Add(c.ClusterId, v);
                }

                meta.AppendLine("All calculated Tenacitys:");
                //Now find the minimum vat value
                int    minVatCluster = 0;
                double minVatValue   = double.MaxValue;
                foreach (var c in vatMap)
                {
                    meta.Append(String.Format("{0} ", c.Value.MinVat));
                    if (c.Value.MinVat < minVatValue)
                    {
                        minVatCluster = c.Key;
                        minVatValue   = c.Value.MinVat;
                    }
                }
                meta.AppendLine();

                //now merge the partition into the cluster
                var minVAT       = vatMap[minVatCluster];
                var subPartition = minVAT.GetPartition();
                var nodeIndexMap = subsetMap[minVatCluster];

                meta.AppendFormat("Tenacity: MinTenacity={0}\n", minVAT.MinVat);
                meta.AppendFormat("Removed Count:{0} \n", minVAT.NumNodesRemoved);
                meta.AppendLine(String.Join(",",
                                            minVAT.NodeRemovalOrder.GetRange(0, minVAT.NumNodesRemoved).Select(c => nodeIndexMap[c])));

                partition.MergeSubPartition(subPartition, nodeIndexMap, minVatCluster);
                vatMap.Remove(minVatCluster);
                subsetMap.Remove(minVatCluster);
            }
            partition.MetaData = meta.ToString();
            return(partition);
        }