Пример #1
0
        private void RefreshStats(int currentCharacter)
        {
            CharacterParty character = DataStorage.PartyCharacters[_currentCharacter];

            // Basic stuff
            lblStatsValueName.Text   = character.Name;
            lblStatsValueStatus.Text = character.Status.ToString();

            lblStatsValueHealth.Text  = character.HealthCurrent.ToString();
            lblStatsValueRations.Text = character.Rations.ToString();
            lblStatsValueGold.Text    = character.Gold.ToString();

            // Death Saves
            lblStatsValueDeathSavesSuccesses.Text = $"{character.DeathSavingThrowSuccess} / 3";
            lblStatsValueDeathSavesFailures.Text  = $"{character.DeathSavingThrowFailure} / 3";

            // Spell Slots
            lblStatsValueSpellSlot1stLevel.Text = $"{character.SpellSlots1stLevelCurrent} / {character.SpellSlots1stLevelMaximum}";
            lblStatsValueSpellSlot2ndLevel.Text = $"{character.SpellSlots2ndLevelCurrent} / {character.SpellSlots2ndLevelMaximum}";
            lblStatsValueSpellSlot3rdLevel.Text = $"{character.SpellSlots3rdLevelCurrent} / {character.SpellSlots3rdLevelMaximum}";
            lblStatsValueSpellSlot4thLevel.Text = $"{character.SpellSlots4thLevelCurrent} / {character.SpellSlots4thLevelMaximum}";
            lblStatsValueSpellSlot5thLevel.Text = $"{character.SpellSlots5thLevelCurrent} / {character.SpellSlots5thLevelMaximum}";
            lblStatsValueSpellSlot6thLevel.Text = $"{character.SpellSlots6thLevelCurrent} / {character.SpellSlots6thLevelMaximum}";
            lblStatsValueSpellSlot7thLevel.Text = $"{character.SpellSlots7thLevelCurrent} / {character.SpellSlots7thLevelMaximum}";
            lblStatsValueSpellSlot8thLevel.Text = $"{character.SpellSlots8thLevelCurrent} / {character.SpellSlots8thLevelMaximum}";
            lblStatsValueSpellSlot9thLevel.Text = $"{character.SpellSlots9thLevelCurrent} / {character.SpellSlots9thLevelMaximum}";
        }
Пример #2
0
        public void CreatePartyCharacter(CharacterParty partyCharacter)
        {
            partyCharacter.Id = _idPartyCounter;
            _idPartyCounter++;

            PartyCharacters.Add(partyCharacter);
        }
Пример #3
0
    public static void Init()
    {
        if (transformsList == null)
        {
            transformsList = new List <GameObjectData>();
        }

        CharacterParty.Init();

        //Inicializar el código de salida
        for (int i = 0; i < code.Length; ++i)
        {
            code[i] = Random.Range(0, 10);
            Debug.Log("Code " + i + ": " + code [i]);
        }

        initialized = true;
    }
Пример #4
0
    void Start()
    {
        instance = GetInstance();

        PlayableCharacter mainCharacter = gameObject.GetComponent <PlayableCharacter>();

        CharacterParty.JoinParty(mainCharacter);

        spriteRenderer = GetComponent <SpriteRenderer>();
        charStats.InitCharacterStats();

        if (currentEquipment.currentArmor != null)
        {
            EquipableItem armor = currentEquipment.currentArmor;
            armor.ApplyItemEquiped(this);

            if (!Game.returningFromBattle && !battlePrefab)
            {
                armor.AddItem(1, false);
                Destroy(armor.equipmentMenuList.Find(armor.menuEquipPrefab.name + "(Clone)").gameObject);
            }
        }

        if (currentEquipment.currentWeapon != null)
        {
            EquipableItem currentWeapon = currentEquipment.currentWeapon;
            currentWeapon.ApplyItemEquiped(this);
            if (!Game.returningFromBattle && !battlePrefab)
            {
                currentWeapon.AddItem(1, false);
                Destroy(currentWeapon.equipmentMenuList.Find(currentWeapon.menuEquipPrefab.name + "(Clone)").gameObject);
            }
        }
        orderInLayer = spriteRenderer.sortingOrder;
        if (Game.initialized)
        {
            LoadCharacter();
        }

        CharGameObject = gameObject;

        //Debug.Log ("total attack: " + charStats.totalAttack);
    }
Пример #5
0
    public void LoadCharacter()
    {
        PlayableCharacter player = CharacterParty.GetCharacterData(charStats.name);

        charStats = player.charStats;
        spriteRenderer.sortingOrder = player.orderInLayer;

        if (!battlePrefab)
        {
            CharacterParty.UpdateCharacterGameObject(charStats.name, gameObject);
            GameObjectData trans = Game.LoadSceneObjectTransformByName(name);
            currentEquipment = player.currentEquipment;

            if (trans != null)
            {
                transform.position   = trans.position;
                transform.rotation   = trans.rotation;
                transform.localScale = trans.localScale;
            }

            CharacterParty.UpdateCharacter(this);
        }
    }
Пример #6
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            CharacterParty partyCharacter = new CharacterParty();

            lblFeedback.Visible = false;

            if (tbxName.Text != "" && tbxHealthCurrent.Text != "")
            {
                #region Set properties
                partyCharacter.Name          = tbxName.Text;
                partyCharacter.HealthCurrent = Validation.CheckIfValidInt(tbxHealthCurrent.Text);
                partyCharacter.HealthMaximum = Validation.CheckIfValidInt(tbxHealthMaximum.Text);
                partyCharacter.Rations       = Validation.CheckIfValidDouble(tbxRations.Text);
                partyCharacter.Gold          = Validation.CheckIfValidInt(tbxGold.Text);

                partyCharacter.SpellSlots1stLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot1stLevelCurrent.Text);
                partyCharacter.SpellSlots2ndLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot2ndLevelCurrent.Text);
                partyCharacter.SpellSlots3rdLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot3rdLevelCurrent.Text);
                partyCharacter.SpellSlots4thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot4thLevelCurrent.Text);
                partyCharacter.SpellSlots5thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot5thLevelCurrent.Text);
                partyCharacter.SpellSlots6thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot6thLevelCurrent.Text);
                partyCharacter.SpellSlots7thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot7thLevelCurrent.Text);
                partyCharacter.SpellSlots8thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot8thLevelCurrent.Text);
                partyCharacter.SpellSlots9thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot9thLevelCurrent.Text);

                partyCharacter.SpellSlots1stLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot1stLevelMaximum.Text);
                partyCharacter.SpellSlots2ndLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot2ndLevelMaximum.Text);
                partyCharacter.SpellSlots3rdLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot3rdLevelMaximum.Text);
                partyCharacter.SpellSlots4thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot4thLevelMaximum.Text);
                partyCharacter.SpellSlots5thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot5thLevelMaximum.Text);
                partyCharacter.SpellSlots6thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot6thLevelMaximum.Text);
                partyCharacter.SpellSlots7thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot7thLevelMaximum.Text);
                partyCharacter.SpellSlots8thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot8thLevelMaximum.Text);
                partyCharacter.SpellSlots9thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot9thLevelMaximum.Text);

                #endregion

                #region Check inputs
                if (!(partyCharacter.HealthCurrent <= 0))
                {
                    if (!(partyCharacter.HealthMaximum < partyCharacter.HealthCurrent))
                    {
                        if (!(partyCharacter.SpellSlots1stLevelMaximum < partyCharacter.SpellSlots1stLevelCurrent) &&
                            !(partyCharacter.SpellSlots2ndLevelMaximum < partyCharacter.SpellSlots2ndLevelCurrent) &&
                            !(partyCharacter.SpellSlots3rdLevelMaximum < partyCharacter.SpellSlots3rdLevelCurrent) &&
                            !(partyCharacter.SpellSlots4thLevelMaximum < partyCharacter.SpellSlots4thLevelCurrent) &&
                            !(partyCharacter.SpellSlots5thLevelMaximum < partyCharacter.SpellSlots5thLevelCurrent) &&
                            !(partyCharacter.SpellSlots6thLevelMaximum < partyCharacter.SpellSlots6thLevelCurrent) &&
                            !(partyCharacter.SpellSlots7thLevelMaximum < partyCharacter.SpellSlots7thLevelCurrent) &&
                            !(partyCharacter.SpellSlots8thLevelMaximum < partyCharacter.SpellSlots8thLevelCurrent) &&
                            !(partyCharacter.SpellSlots9thLevelMaximum < partyCharacter.SpellSlots9thLevelCurrent))
                        {
                            FormMain.DataStorage.CreatePartyCharacter(partyCharacter);

                            lblFeedback.Visible = true;
                            lblFeedback.Text    = $"{tbxName.Text} added!";
                            FormController.TbxClear(this);
                        }
                        else
                        {
                            MessageBox.Show("Current spell slots cannot be greater than maximum spell slots.", "Error");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Current health cannot be greater than maximum health.", "Error");
                    }
                }
                else
                {
                    MessageBox.Show("You cannot have a character with 0 starting health or less.", "Error");
                }
            }
            else
            {
                MessageBox.Show("You must enter at least a name and starting health.", "Error");
            }

            #endregion
        }