예제 #1
0
        private static float CalcucateEquipmentStats(Robbery robbery)
        {
            Dictionary <int, int> items = robbery.Items;

            float itemsStats = 0;

            foreach (int itemNum in items.Keys)
            {
                switch (robbery.RobberyType)
                {
                case RobberyType.DarkStreet:
                    itemsStats += items[itemNum] * float.Parse(ItemsOptions.GetItemData(itemNum)[ItemProperty.influence0]);
                    break;

                case RobberyType.Stall:
                    itemsStats += items[itemNum] * float.Parse(ItemsOptions.GetItemData(itemNum)[ItemProperty.influence1]);
                    break;

                case RobberyType.House:
                    itemsStats += items[itemNum] * float.Parse(ItemsOptions.GetItemData(itemNum)[ItemProperty.influence2]);
                    break;

                case RobberyType.Shop:
                    itemsStats += items[itemNum] * float.Parse(ItemsOptions.GetItemData(itemNum)[ItemProperty.influence3]);
                    break;

                case RobberyType.Band:
                    itemsStats += items[itemNum] * float.Parse(ItemsOptions.GetItemData(itemNum)[ItemProperty.influence4]);
                    break;
                }
            }
            return(itemsStats);
        }
예제 #2
0
        public static void GetNewRobberies()
        {
            if (DataScript.EData.RobberiesData != null)
            {
                DataScript.EData.RobberiesData.Clear();
            }

            DataScript.EData.RobberiesData = new Dictionary <RobberyType, Dictionary <int, Robbery> >()
            {
                { RobberyType.DarkStreet, new Dictionary <int, Robbery>() },
                { RobberyType.Stall, new Dictionary <int, Robbery>() }
            };

            Robbery robbery0 = GetRandomRobbery(RobberyType.DarkStreet, 0);

            DataScript.EData.RobberiesData[RobberyType.DarkStreet].Add(0, robbery0);

//            Robbery robbery1 = GetRandomRobbery(RobberyType.Stall, 0);
//            DataScript.EData.RobberiesData[RobberyType.Stall].Add(0, robbery1);

            Robbery robbery2 = GetRandomRobbery(RobberyType.DarkStreet, 1);

            DataScript.EData.RobberiesData[RobberyType.DarkStreet].Add(1, robbery2);

            Robbery robbery3 = GetRandomRobbery(RobberyType.DarkStreet, 2);

            DataScript.EData.RobberiesData[RobberyType.DarkStreet].Add(2, robbery3);

//            Robbery robbery4 = GetRandomRobbery(RobberyType.Stall, 1);
//            DataScript.EData.RobberiesData[RobberyType.Stall].Add(1, robbery4);
//
//            Robbery robbery5 = GetRandomRobbery(RobberyType.Stall, 2);
//            DataScript.EData.RobberiesData[RobberyType.Stall].Add(2, robbery5);
        }
예제 #3
0
        public static float CalculatePreliminaryChance(Robbery robbery)
        {
            List <Trait> chanceTraits;

            int rStrength = robbery.Strength;
            int rAgility  = robbery.Agility;
            int rSkill    = robbery.Skill;
            int rLuck     = robbery.Luck;

            float banditsStats   = CalculateBanditsStats(robbery, out chanceTraits);
            float robberyStats   = rStrength + rAgility + rSkill + rLuck;
            float equipmentStats = CalcucateEquipmentStats(robbery);

            //Debug.Log(robbery.RobberyType + " " + robbery.LocationNum);
            //Debug.Log("banditsStats: " + banditsStats);
            //Debug.Log("robberyStats: " + robberyStats);
            //Debug.Log("equipmentStats: " + equipmentStats);

            float chance = (banditsStats + equipmentStats) / (banditsStats + equipmentStats + robberyStats);

            //Debug.Log(chance);

            foreach (Trait chanceTrait in chanceTraits)
            {
                switch (chanceTrait.stat)
                {
                case Stat.chance:
                    chance *= chanceTrait.value;
                    break;
                }
            }

            chance = Random.Range(0, 100);
            return(chance);
        }
예제 #4
0
 public void CustomizeRobbery(int num, RobberyType robType)
 {
     m_number      = num;
     m_robberyType = robType;
     m_robbery     = DataScript.EData.RobberiesData[robType][m_number];
     SetCounter();
 }
예제 #5
0
 //Constructor
 public NightRobberyData(Robbery robbery)
 {
     this.m_robbery    = robbery;
     nightEvent        = NightEventsOptions.GetRandomEvent(robbery.RobberyType);
     m_eventStatus     = EventStatus.InProgress;
     m_chance          = RobberiesOptions.CalculatePreliminaryChance(robbery);
     m_policeChance    = Random.Range(0, 51);
     m_hospitalChance  = Random.Range(0, 51);
     m_money           = RobberiesOptions.GetRobberyMoneyRewardAtTheCurrentMoment(robbery.RobberyType);
     m_awards          = RobberiesOptions.GetRobberyAwardsAtTheCurrentMoment(robbery.RobberyType);
     m_policeKnowledge = 1;
 }
예제 #6
0
        public void SetRobberyWindow(RobberyType robberyType, int locationNumber)
        {
            this.robType     = robberyType;
            this.locationNum = locationNumber;
            robberyData      = DataScript.EData.RobberiesData[robberyType][locationNumber];

            UpdateCharacters();
            UpdateItems();

            robberyImage.sprite  = RobberiesOptions.Instance.RobberySprites[(int)robType];
            descriptionText.text = RobberiesOptions.GetRobberyDescription(robType);
            nameText.text        = RobberiesOptions.GetRobberyName(robType);

            robberyWindowObject.SetActive(true);
            robberyWindowObject.transform.SetAsLastSibling();

            DataScript.EData.RobberiesData[robType][locationNum].OnAddToRobEvent      += OnAddReaction;
            DataScript.EData.RobberiesData[robType][locationNum].OnRemoveFromRobEvent += OnRemoveReaction;
        }
예제 #7
0
        private static float CalculateBanditsStats(Robbery robbery, out List <Trait> chanceTraits)
        {
            int         count = 0;
            RobberyType rType = robbery.RobberyType;

            chanceTraits = new List <Trait>();
            List <Trait> groupTraits = new List <Trait>();

            float cStrength = 0;
            float cAgility  = 0;
            float cSkill    = 0;
            float cLuck     = 0;
            float cFear     = 0;

            foreach (Character character in robbery.Characters)
            {
                count++;
                float coefStr = 1, coefAg = 1, coefSk = 1, coefL = 1, coefF = 1;

                if (character.GetType() == typeof(SpecialCharacter))
                {
                    SpecialCharacter spChar = (SpecialCharacter)character;
                    foreach (Trait trait in spChar.Traits)
                    {
                        //При редактировании трейтов ДОБАВИТЬ ИХ СЮДА!!!!!
                        switch (trait.traitType)
                        {
                        case TraitType.single:
                            switch (trait.stat)
                            {
                            case Stat.strenght:
                                coefStr = trait.value;
                                break;

                            case Stat.luck:
                                coefL = trait.value;
                                break;

                            case Stat.fear:
                                coefF = trait.value;
                                break;

                            case Stat.skill:
                                coefSk = trait.value;
                                break;

                            case Stat.agility:
                                coefAg = trait.value;
                                break;
                            }
                            break;

                        case TraitType.group:
                            groupTraits.Add(trait);
                            break;

                        case TraitType.chance:
                            chanceTraits.Add(trait);
                            break;
                        }
                    }
                }

                cStrength += (character.Stats.Strength * coefStr);
                cAgility  += (character.Stats.Agility * coefAg);
                cSkill    += (character.Stats.Skill * coefSk);
                cLuck     += (character.Stats.Luck * coefL);
                cFear     += (character.Stats.Fear * coefF);
            }

            foreach (Trait groupTrait in groupTraits)
            {
                switch (groupTrait.stat)
                {
                case Stat.strenght:
                    cStrength *= groupTrait.value;
                    break;

                case Stat.luck:
                    cLuck *= groupTrait.value;
                    break;

                case Stat.fear:
                    cFear *= groupTrait.value;
                    break;

                case Stat.skill:
                    cSkill *= groupTrait.value;
                    break;

                case Stat.agility:
                    cAgility *= groupTrait.value;
                    break;
                }
            }

            return
                ((cStrength * m_robberiesCollection.Robberies[(int)rType].StrenghtInfluence +
                  cLuck * m_robberiesCollection.Robberies[(int)rType].LuckInfluence +
                  cAgility * m_robberiesCollection.Robberies[(int)rType].AgilityInfluence +
                  cSkill * m_robberiesCollection.Robberies[(int)rType].SkillInfluence)
                 *
                 (1 - cFear / (110 * count)));
        }