示例#1
0
    private void SetCharacteristic(CharacteristicType type, int statValue)
    {
        characterHolder.GetCharacteristicInput(type).text = statValue.ToString();
        int modificator = CharacterValuesUtility.GetCharacteristicModificator(statValue);

        characterHolder.GetCharacteristicModificatorText(type).text = TextUtility.GetSignedValueString(modificator);
    }
示例#2
0
        public ActionResult Save(Characteristic characteristic)
        {
            if (Session["User"] == null || !((User)Session["User"]).Admin)
            {
                return(RedirectToAction("Index", "Dogcheck", new {
                    msg = "No te hagas el vivo bro, no podes entrar aca sin admin"
                }));
            }

            if (!ModelState.IsValid)
            {
                ViewBag.types = CharacteristicType.ListCharactersisticType();
                return(View("Edit", characteristic));
            }

            if (characteristic.Id == -1)
            {
                Characteristic.CreateCharacteristic(characteristic);
            }
            else
            {
                Characteristic.EditCharacteristic(characteristic);
            }
            return(RedirectToAction("List"));
        }
    public TMP_InputField GetCharacteristicInput(CharacteristicType type)
    {
        switch (type)
        {
        case CharacteristicType.Strength:
            return(strengthInput);

        case CharacteristicType.Dexterity:
            return(dexterityInput);

        case CharacteristicType.Constitution:
            return(constitutionInput);

        case CharacteristicType.Intelligence:
            return(intelligenceInput);

        case CharacteristicType.Wisdom:
            return(wisdomInput);

        case CharacteristicType.Charisma:
            return(charismaInput);

        default:
            throw new System.Exception("Undefined charactiristic type " + type);
        }
    }
示例#4
0
        public ActionResult Play(int type = -1, int characteristic = -1)
        {
            List <Character> RemainingCharacters    = Session["RemainingCharacters"] as List <Character>;
            List <Character> newRemainingCharacters = new List <Character>();
            Character        SecretCharacter        = Session["SecretCharacter"] as Character;

            Session["Bitcoins"] = ((long)Session["Bitcoins"]) - 1000;
            if (Session["User"] != null)
            {
                ((User)Session["User"]).UpdateBitcoins(-1000);

                if (((User)Session["User"]).Bitcoins <= 0)
                {
                    return(RedirectToAction("Lose"));
                }
            }
            else
            {
                if (((long)Session["Bitcoins"]) <= 0)
                {
                    return(RedirectToAction("Lose"));
                }
            }

            for (int i = 0; i < SecretCharacter.Characteristics.Count; i++)
            {
                if (SecretCharacter.Characteristics[i].Type == type)
                {
                    bool hasIt = SecretCharacter.Characteristics[i].Id == characteristic;
                    ViewBag.hasIt = hasIt;
                    foreach (Character character in RemainingCharacters)
                    {
                        if ((character.Characteristics[i].Id == characteristic) == hasIt)
                        {
                            newRemainingCharacters.Add(character);
                        }
                    }
                    break;
                }
            }


            if (newRemainingCharacters.Count == 1)
            {
                return(RedirectToAction("Win"));
            }

            if (type != -1 && characteristic != -1)
            {
                Session["RemainingCharacters"] = newRemainingCharacters;
            }
            ((List <int>)Session["QuestionsAsked"]).Add(characteristic);

            ViewBag.characters      = Session["RemainingCharacters"];
            ViewBag.characteristics = Characteristic.ListCharacteristics();
            ViewBag.types           = CharacteristicType.ListCharactersisticType();
            ViewBag.bitcoins        = Session["Bitcoins"];

            return(View());
        }
    public TMP_Text GetCharacteristicModificatorText(CharacteristicType type)
    {
        switch (type)
        {
        case CharacteristicType.Strength:
            return(strengthModificatorText);

        case CharacteristicType.Dexterity:
            return(dexterityModificatorText);

        case CharacteristicType.Constitution:
            return(constitutionModificatorText);

        case CharacteristicType.Intelligence:
            return(intelligenceModificatorText);

        case CharacteristicType.Wisdom:
            return(wisdomModificatorText);

        case CharacteristicType.Charisma:
            return(charismaModificatorText);

        default:
            throw new System.Exception("Undefined charactiristic type " + type);
        }
    }
示例#6
0
 public Characteristic CharacteristicByType(CharacteristicType type)
 {
     if (type == CharacteristicType.Wisdom)
     {
         return(Wisdom);
     }
     else if (type == CharacteristicType.Charisma)
     {
         return(Charisma);
     }
     else if (type == CharacteristicType.Intelligence)
     {
         return(Intelligence);
     }
     else if (type == CharacteristicType.Dexterity)
     {
         return(Dexterity);
     }
     else if (type == CharacteristicType.Strength)
     {
         return(Strength);
     }
     else
     {
         return(Constitution);
     }
 }
示例#7
0
        public ActionResult Edit(int id, string _action)
        {
            if (Session["User"] == null || !((User)Session["User"]).Admin)
            {
                return(RedirectToAction("Index", "Dogcheck", new {
                    msg = "No te hagas el vivo bro, no podes entrar aca sin admin"
                }));
            }

            ViewBag.types = CharacteristicType.ListCharactersisticType();
            switch (_action)
            {
            case "delete":
                Characteristic.DeleteCharacteristic(id);
                return(RedirectToAction("List"));

            case "edit":
                return(View(Characteristic.GetCharacteristic(id)));

            case "create":
                return(View(new Characteristic()));

            default:
                return(RedirectToAction("List"));
            }
        }
示例#8
0
 public Characteristic(string name, int index, CharacteristicType type, bool randomizable = false, bool custom = false)
 {
     this.Name         = name;
     this.Index        = index;
     this.Type         = type;
     this.Randomizable = randomizable;
     this.Custom       = custom;
 }
 public int this[CharacteristicType type]
 {
     get { return(characteristics[type]); }
     set
     {
         characteristics[type] = value;
         OnCharacteristicChanged?.Invoke(type, value);
         CharacterSheetStorage.SaveCharacter(Id);
     }
 }
示例#10
0
 public Characteristic(CharacteristicType type, int score, int rBonus, int oModifier, bool saving)
 {
     Type          = type;
     BaseScore     = score;
     RacialBonus   = rBonus;
     OtherModifier = oModifier;
     SavingThrow   = saving;
     Mod           = 0;
     Mod           = CalculateMood(BaseScore, RacialBonus, OtherModifier);
 }
示例#11
0
 public Skill(Characteristic mainCharacteristic, string skillName, int profBonus, Proficiency prof)
 {
     MainCharacteristic = mainCharacteristic;
     Type      = mainCharacteristic.Type;
     Prof      = prof;
     ProfBonus = profBonus;
     SkillName = skillName;
     Bonus     = 0;
     Bonus     = CalculateBonus(prof);
 }
 public static bool IsBool(CharacteristicType type)
 {
     switch (type)
     {
         case CharacteristicType.InputOutputCompliance:
             return true;
         default:
             return false;
     }
 }
    private void SetSkillModificators(CharacteristicType characteristic, int value)
    {
        SkillType skills = CharacterUtility.GetSkillsByCharacteristic(characteristic);

        foreach (var skillHolder in characterHolder.skills)
        {
            if ((skills & skillHolder.type) == skillHolder.type)
            {
                SetSkillModificator(skillHolder);
            }
        }
    }
    public SavingThrowHolder GetSavingThrow(CharacteristicType characteristic)
    {
        foreach (var item in savingThrows)
        {
            if (item.characteristic == characteristic)
            {
                return(item);
            }
        }

        throw new Exception($"There isn't saving throw for {characteristic} characteristic");
    }
示例#15
0
        public ActionResult List()
        {
            if (Session["User"] == null || !((User)Session["User"]).Admin)
            {
                return(RedirectToAction("Index", "Dogcheck", new {
                    msg = "No te hagas el vivo bro, no podes entrar aca sin admin"
                }));
            }

            ViewBag.types           = CharacteristicType.ListCharactersisticType();
            ViewBag.characteristics = Characteristic.ListCharacteristics();
            return(View());
        }
示例#16
0
    public void AddCharacteristic(CharacteristicType type, float amount)
    {
        if (type == CharacteristicType.Life)
        {
            currentLife += amount;
            currentLife  = Mathf.Min(currentLife, maxLife);
        }

        if (type == CharacteristicType.Mana)
        {
            currentMana += amount;
            currentMana  = Mathf.Min(currentMana, maxMana);
        }
    }
示例#17
0
    public void SubstractCharacteristic(CharacteristicType type, float amount)
    {
        if (type == CharacteristicType.Life)
        {
            currentLife -= amount;
            currentLife  = Mathf.Max(0, currentLife);
            if (currentLife <= 0)
            {
                CombatManager.instance.RemoveFromList(this);
                Debug.Log(entityName + " is dead !");

                Destroy(this.gameObject);
            }
        }

        if (type == CharacteristicType.Mana)
        {
            currentMana -= amount;
            currentMana  = Mathf.Max(0, currentMana);
        }
    }
示例#18
0
        public ActionResult Index()
        {
            List <Character> RemainingCharacters = Character.ListCharactersDeep();

            Session["RemainingCharacters"] = RemainingCharacters;
            Session["QuestionsAsked"]      = new List <int>();

            if (Session["User"] == null)
            {
                Session["Bitcoins"]         = (long)6000; // 6 questions
                Session["OriginalBitcoins"] = (long)6000;
            }
            else
            {
                Session["Bitcoins"]         = ((User)Session["User"]).Bitcoins;
                Session["OriginalBitcoins"] = ((User)Session["User"]).Bitcoins;
            }


            System.Random random          = new System.Random();
            int           i               = random.Next();
            int           charactersCount = RemainingCharacters.Count;

            while (i >= charactersCount)
            {
                i = random.Next();
            }

            Session["SecretCharacter"] = RemainingCharacters[i];
            Debug.Print("Secret character: " + RemainingCharacters[i].Name);

            ViewBag.characters      = Session["RemainingCharacters"];
            ViewBag.characteristics = Characteristic.ListCharacteristics();
            ViewBag.types           = CharacteristicType.ListCharactersisticType();
            ViewBag.bitcoins        = Session["Bitcoins"];

            return(View("Play"));
        }
示例#19
0
 public Characteristic(CharacteristicType type, CharacteristicGrouping group, int value)
 {
     this.value = value;
     this.type  = type;
     this.group = group;
 }
 public ChannelsCharacteristicsProcessor(LogWriter logger, CharacteristicType characteristicType) : base(logger)
 {
     _characteristicType = characteristicType;
 }
示例#21
0
 public static SkillType GetSkillsByCharacteristic(CharacteristicType characteristic)
 {
     return(skillsByCharacteristics[characteristic]);
 }
示例#22
0
 public Characteristic(CharacteristicType type, int score) :
     this(type, score, 0, 0, false)
 {
 }
 /// <summary>
 /// Gets all Bluetooth Low Energy services configured for this profile instance, filtered by its <see cref="CharacteristicType"/>.
 /// </summary>
 /// <param name="characteristicType">Type of the characteristic.</param>
 /// <returns></returns>
 public BluetoothLeCharacteristic GetCharacteristicOfType(CharacteristicType characteristicType)
 {
     return(Characteristics.Values.FirstOrDefault(c => c.Type == characteristicType));
 }
示例#24
0
        protected async Task <HttpResponseMessage> ValidateObjectAndCharacteristic(Guid objectId, Guid characteristicId, CharacteristicType type)
        {
            var obj = await _dbContext.HierarchyObjectContext.Entities.FirstOrDefaultAsync(o => o.Id == objectId);

            if (obj == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Object not found"));
            }

            var characteristic = await _dbContext.CharacteristicContext.Entities.FirstOrDefaultAsync(c => c.Id == characteristicId);

            if (characteristic == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Characteristic not found"));
            }

            if (characteristic.CharacteristicType != type)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Characteristic does not support this type"));
            }
            return(null);
        }
示例#25
0
    private void SetSavingThrowModificator(CharacteristicType characteristic)
    {
        var savingThrow = characterHolder.GetSavingThrow(characteristic);

        SetSavingThrowModificator(savingThrow);
    }
        /// <summary>
        /// Takes the value of an value and check if it is greater or equal than a specified value
        /// </summary>
        /// <param name="attributeValue">Value of the value to be tested</param>
        /// <param name="setValue">value to test against</param>
        /// <param name="description">description of the test params</param>
        /// <param name="characteristicName"></param>
        /// <param name="characteristic"></param>
        /// <param name="modifier">value, if any, that modified the value of the value tested</param>
        /// <returns></returns>
        protected bool TestAttributeGreaterOrEqualThanSetValue(int attributeValue, int setValue, string description, string characteristicName, CharacteristicType characteristic, int modifier = 0)
        {
            var myTestResult = new NodeTestInfo
            {
                TestedCharacteristic = characteristic,
                CharacteristicName   = characteristicName,
                AttributeValue       = attributeValue,
                ProfileScore         = characteristic == CharacteristicType.Quality? EvaluateProfileScore(characteristicName, attributeValue) : 0,
                Result       = attributeValue + modifier >= setValue, //this is the test
                PassingValue = setValue,
                Description  = description,
                Modifier     = modifier
            };

            DataToMemorize.Add(myTestResult);

            return(myTestResult.Result);
        }
 public Characteristic()
 {
     this.type = CharacteristicType.Uknown;
     this.value = new object();
 }