예제 #1
0
파일: Npc.cs 프로젝트: exodus444/swtoremu2
        //public List<string> AbilityPackagesTrained { get; set; }

        public override int GetHashCode()
        {
            int hash = Name.GetHashCode();

            if (Title != null)
            {
                hash ^= Title.GetHashCode();
            }
            hash ^= ClassSpec.Id.GetHashCode();
            hash ^= MinLevel.GetHashCode();
            hash ^= MaxLevel.GetHashCode();
            hash ^= Faction.GetHashCode();
            hash ^= Toughness.GetHashCode();
            hash ^= DifficultyFlags.GetHashCode();
            if (Codex != null)
            {
                hash ^= Codex.Id.GetHashCode();
            }
            hash ^= ProfessionTrained.GetHashCode();
            if (ConversationFqn != null)
            {
                hash ^= ConversationFqn.GetHashCode();
            }
            return(hash);
        }
예제 #2
0
        public override string ToString()
        {
            StringBuilder res = new StringBuilder(name);

            if (!ManaCost.HasNoCost)
            {
                res.Append(" | ").Append(ManaCost.ToString());
            }
            res.Append(" | ").Append(TypeLine);
            if (Power != null && Toughness != null)
            {
                res.Append(" | ").Append(Power.ToString()).Append("/").Append(Toughness.ToString());
            }
            if (Loyalty != null)
            {
                res.Append(" | L=").Append(Loyalty.ToString());
            }
            int len0 = oracleText.Length > 0 ? oracleText[0].Length : 0;

            switch (oracleText.Length)
            {
            case 0: break;

            case 1: res.Append(" | ").Append(len0 > 30 ? oracleText[0].Substring(0, 30) + "…" : oracleText[0]); break;

            default: res.Append(" | ").Append(len0 > 30 ? oracleText[0].Substring(0, 30) + "…" : oracleText[0]).Append(" +").Append(oracleText.Length - 1).Append(" more"); break;
            }
            return(res.ToString());
        }
예제 #3
0
        /**
         * TODO
         * Equipment
         * Powers
         * Hindrances
         *
         * Later:
         * Injuries
         **/

        public override string ToString()
        {
            StringBuilder retval = new StringBuilder("");

            retval.AppendLine("Name:" + Name);
            retval.AppendLine("Charisma:" + Charisma.ToString());
            retval.AppendLine("Pace:" + Pace.ToString());
            retval.AppendLine("Parry:" + Parry.ToString());
            retval.AppendLine("Toughness:" + Toughness.ToString());
            retval.AppendLine("Agility:" + Agility.ToString());
            retval.AppendLine("Smarts:" + Smarts.ToString());
            retval.AppendLine("Strength:" + Strength.ToString());
            retval.AppendLine("Spirit:" + Spirit.ToString());
            retval.AppendLine("Vigor:" + Vigor.ToString());
            return(retval.ToString());
        }
예제 #4
0
파일: Card.cs 프로젝트: longde123/grove
        public int CalculateHash(HashCalculator calc)
        {
            if (Ai.IsSearchInProgress && IsVisibleToSearchingPlayer == false)
            {
                return(Zone.GetHashCode());
            }

            if (_hash.Value.HasValue == false)
            {
                // this value can be same for different cards with same NAME,
                // sometimes this is good sometimes not, currently we favor
                // smaller tree sizes and less accurate results.
                // if tree size is no longer a problem we will replace NAME with
                // a guid.
                _hash.Value = HashCalculator.Combine(
                    Name.GetHashCode(),
                    _hasSummoningSickness.Value.GetHashCode(),
                    UsageScore.GetHashCode(),
                    IsTapped.GetHashCode(),
                    Damage,
                    HasRegenerationShield.GetHashCode(),
                    HasLeathalDamage.GetHashCode(),
                    Power.GetHashCode(),
                    Toughness.GetHashCode(),
                    Level.GetHashCode(),
                    Counters.GetHashCode(),
                    Type.GetHashCode(),
                    Zone.GetHashCode(),
                    _isRevealed.Value.GetHashCode(),
                    _isPeeked.Value.GetHashCode(),
                    _isHidden.Value.GetHashCode(),
                    calc.Calculate(_simpleAbilities),
                    calc.Calculate(_triggeredAbilities),
                    calc.Calculate(_activatedAbilities),
                    calc.Calculate(_protections),
                    calc.Calculate(_attachments),
                    calc.Calculate(_colors)
                    );
            }

            return(_hash.Value.GetValueOrDefault());
        }
예제 #5
0
        public static PlayerClass FighterClass()
        {
            var fighter = new PlayerClass
            {
                Name               = "Fighter",
                IsBaseClass        = true,
                ExperienceModifier = 500,
                HelpText           = new Help(),
                Skills             = new List <Skill>(),
                ReclassOptions     = new List <PlayerClass>(),
                MaxHpGain          = 15,
                MinHpGain          = 10,
                MaxManaGain        = 8,
                MinManaGain        = 4,
                MaxEnduranceGain   = 15,
                MinEnduranceGain   = 11,
                StatBonusStr       = 1,
                StatBonusCon       = 1,
            };

            /* TODO: some skills to add
             * Axe Dagger Polearm  Mace
             * Spear Shield Block
             * staff  sword
             *  bash Whip Enhanced damage
             *  parry rescue swim  scrolls
             *  staves  wands  recall
             *  age  dig
             *  dirt kicking
             *  second atttack
             *  third attack
             *  fouth attack
             *  fast healing
             *  kick
             *  disarm
             *  blind fighting
             *  trip
             *  berserk
             *  dual wield (eek)
             * */


            #region  Lvl 1 skills

            var longBlades = LongBlades.LongBladesAb();
            longBlades.Learned = true;
            fighter.Skills.Add(longBlades);

            var shortBlades = ShortBlades.ShortBladesAb();
            shortBlades.Learned = true;
            fighter.Skills.Add(shortBlades);

            var axe = Axe.AxeAb();
            axe.Learned = true;
            fighter.Skills.Add(axe);

            var blunt = BluntWeapons.BluntWeaponsAb();
            blunt.Learned = true;
            fighter.Skills.Add(blunt);

            var polearm = Polearms.PolearmsAb();
            polearm.Learned = true;
            fighter.Skills.Add(polearm);

            var exotic = Exotic.ExoticAb();
            exotic.Learned = true;
            fighter.Skills.Add(exotic);

            var staff = Staff.StaffAb();
            staff.Learned = true;
            fighter.Skills.Add(staff);

            var handToHand = HandToHand.HandToHandAb();
            handToHand.Learned = true;
            fighter.Skills.Add(handToHand);

            var lightArmour = LightArmour.LightArmourAb();
            lightArmour.Learned = true;
            fighter.Skills.Add(lightArmour);



            #endregion

            #region  Lvl 2 skills
            fighter.Skills.Add(HeavyArmour.HeavyArmourAb());
            fighter.Skills.Add(MediumArmour.MediumArmourAb());


            #endregion

            #region Lvl 3 skills
            fighter.Skills.Add(Trip.TripAb());
            #endregion

            #region Lvl 4
            fighter.Skills.Add(FastHealing.FastHealingAb());
            fighter.Skills.Add(Toughness.ToughnessAb());
            #endregion

            #region Lvl 5

            var parry = Parry.ParryAb();
            fighter.Skills.Add(parry);


            #endregion


            #region Lvl 6

            var shieldBlock = ShieldBlock.ShieldBlockAb();
            fighter.Skills.Add(shieldBlock);

            var dodge = Dodge.DodgeAb();
            fighter.Skills.Add(dodge);

            #endregion


            #region Lvl 7

            var dirtKick = DirtKick.DirtKickAb();
            fighter.Skills.Add(dirtKick);

            var kick = Kick.KickAb();
            fighter.Skills.Add(kick);

            #endregion

            #region Lvl 9

            var bash = Bash.BashAb();
            fighter.Skills.Add(bash);



            #endregion


            #region Lvl 10

            var rescue = Rescue.RescueAb();
            fighter.Skills.Add(rescue);



            #endregion

            #region Lvl 11

            var sneak = Sneak.SneakAb();
            fighter.Skills.Add(sneak);



            #endregion


            #region Lvl 12
            fighter.Skills.Add(SecondAttack.SecondAttackAb());



            #endregion


            #region Lvl 13

            var lunge = Lunge.LungeAb();
            fighter.Skills.Add(lunge);



            #endregion


            #region Lvl 14

            var sbash = ShieldBash.ShieldBashAb();
            fighter.Skills.Add(sbash);

            #endregion


            #region Lvl 15

            var disarm = Disarm.DisarmAb();
            fighter.Skills.Add(disarm);

            #endregion


            #region Lvl 16

            var enhancedDam = EnhancedDamage.EnhancedDamageAb();
            fighter.Skills.Add(enhancedDam);

            #endregion

            #region Lvl 18

            var mount = Mount.MountAb();
            fighter.Skills.Add(mount);

            #endregion

            #region Lvl 20

            var thirdAttk = ThirdAttack.ThirdAttackAb();
            fighter.Skills.Add(thirdAttk);

            #endregion



            fighter.ReclassOptions.Add(Ranger.RangerClass());

            return(fighter);
        }
예제 #6
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, Toughness>();

            //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;
                    Toughness v = new Toughness(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 Toughnesses:");
                //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("Toughness: MinToughness={0}\r\n", minVAT.MinVat);
                meta.AppendFormat("Removed Count:{0} \r\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);
        }