Ejemplo n.º 1
0
    /// <summary>
    /// Shows a basic overview of the character with some stats and combat stats.
    /// </summary>
    /// <param name="tactics"></param>
    private void ShowBasicStats(TacticsMove tactics)
    {
        if (tactics == null)
        {
            return;
        }
        StatsContainer  stats  = tactics.stats;
        SkillsContainer skills = tactics.skills;

        menuView.SetActive(true);
        statsObject.SetActive(false);
        basicObject.SetActive(true);
        inventoryObject.SetActive(false);

        //		colorBackground.color = (tactics.faction == Faction.PLAYER) ?
        //			new Color(0.2f,0.2f,0.5f) : new Color(0.5f,0.2f,0.2f);

        characterName.text = stats.charData.entryName;
        portrait.enabled   = true;
        portrait.sprite    = stats.charData.portraitSet.small;
        levelClass.text    = string.Format("Level {0}  {1}", stats.level, stats.currentClass.entryName);
        healthBar.SetAmount(tactics.currentHealth, tactics.stats.hp);
        expBar.SetAmount(tactics.stats.currentExp, 100);
        expBar.gameObject.SetActive(tactics.faction == Faction.PLAYER);
        weakIcon1.sprite  = weaknessIcons.icons[(int)stats.currentClass.classType];
        weakIcon1.enabled = (weakIcon1.sprite != null);

        InventoryTuple weapon = tactics.GetEquippedWeapon(ItemCategory.WEAPON);

        wpnIcon.sprite  = weapon?.icon;
        wpnIcon.enabled = (weapon != null);
        wpnName.text    = (weapon != null) ? weapon.entryName : "---";

        for (int i = 0; i < skillImages.Length; i++)
        {
            if (i >= skills.skills.Length || skills.skills[i] == null)
            {
                skillImages[i].sprite = noSkillImage;
            }
            else
            {
                skillImages[i].sprite = skills.skills[i].icon;
            }
        }

        int pwer = BattleCalc.CalculateDamage(weapon, stats);

        pwrText.text = (pwer != -1) ? "Pwr:  " + pwer : "Pwr:  --";
        int hitrate = BattleCalc.GetHitRate(weapon, stats);

        hitText.text   = (hitrate != -1) ? "Hit:  " + hitrate : "Hit:  --";
        avoidText.text = "Avo:  " + (BattleCalc.GetAvoid(stats) + tactics.currentTile.terrain.avoid);
        for (int i = 0; i < fatigueLevels.Length; i++)
        {
            fatigueLevels[i].SetActive(i == tactics.stats.fatigueAmount);
        }

        //Terrain
        boostAvoid.enabled = (tactics.currentTile.terrain.avoid > 0);
    }
    private IEnumerator ChangeClass()
    {
        lockControls.value = true;
        LevelGain level = gains[classList.GetPosition()];

        yield return(new WaitForSeconds(1f * currentGameSpeed.value));

        StatsContainer     stats     = playerData.stats[entryList.GetPosition()];
        InventoryContainer inventory = playerData.inventory[entryList.GetPosition()];
        SkillsContainer    skills    = playerData.skills[entryList.GetPosition()];

        levelupScript.SetupStats(stats, false);
        Debug.Log("CLASS CHANGE!");
        stats.ClassGain(level, (int)level.playerClassName);
        inventory.IncreaseWpnSkill(level.weaponSkills);
        skills.GainSkill(level.skill);

        sfxQueue.Enqueue(levelupFanfare);
        playSfxEvent.Invoke();
        popupMode = true;
        yield return(StartCoroutine(levelupScript.RunLevelup(stats)));

        popupMode = false;

        CreateListEntries();
        DeselectCharacter();
        lockControls.value = false;
        yield break;
    }
Ejemplo n.º 3
0
    public void StoreData(StatsContainer stats, InventoryContainer invCon, SkillsContainer skillCont, SupportContainer supportCont)
    {
        id           = stats.charData.uuid;
        currentClass = stats.currentClass.uuid;
        classLevels  = new int[ClassWheel.CLASS_COUNT];
        for (int i = 0; i < ClassWheel.CLASS_COUNT; i++)
        {
            classLevels[i] = stats.classLevels[i];
        }

        level      = stats.level;
        currentExp = stats.currentExp;

        wpnSkills = new int[InventoryContainer.WPN_SKILLS];
        for (int i = 0; i < invCon.wpnSkills.Length; i++)
        {
            wpnSkills[i] = (int)invCon.wpnSkills[i];
        }

        inventory  = new List <string>();
        invCharges = new List <int>();
        for (int i = 0; i < InventoryContainer.INVENTORY_SIZE; i++)
        {
            if (string.IsNullOrEmpty(invCon.GetTuple(i).uuid))
            {
                continue;
            }
            inventory.Add(invCon.GetTuple(i).uuid);
            invCharges.Add(invCon.GetTuple(i).currentCharges);
        }

        skills = new List <string>();
        for (int i = 0; i < skillCont.skills.Length; i++)
        {
            if (!skillCont.skills[i])
            {
                continue;
            }
            skills.Add(skillCont.skills[i].uuid);
        }

        stats.GenerateStartingStats();

        eHp  = stats.eHp;
        eDmg = stats.eDmg;
        eMnd = stats.eMnd;
        eSpd = stats.eSpd;
        eSkl = stats.eSkl;
        eDef = stats.eDef;

        roomNo   = supportCont.roomNo;
        supports = new List <SupportValue>();
        for (int i = 0; i < supportCont.supportValues.Count; i++)
        {
            supports.Add(supportCont.supportValues[i]);
        }
    }
Ejemplo n.º 4
0
 public void CopyData(TacticsMove other)
 {
     battleMap = other.battleMap;
     posx      = other.posx;
     posy      = other.posy;
     stats     = other.stats;
     inventory = other.inventory;
     skills    = other.skills;
 }
Ejemplo n.º 5
0
 public SpawnData(TacticsMove tactics)
 {
     x                  = tactics.posx;
     y                  = tactics.posy;
     charData           = tactics.stats.charData;
     level              = tactics.stats.level;
     stats              = tactics.stats;
     inventoryContainer = tactics.inventory;
     skills             = tactics.skills;
 }
    private void SetupCharacterInfo()
    {
        StatsContainer     stats     = playerData.stats[entryList.GetPosition()];
        InventoryContainer inventory = playerData.inventory[entryList.GetPosition()];
        SkillsContainer    skills    = playerData.skills[entryList.GetPosition()];

        characterName.text = stats.charData.entryName;
        portrait.sprite    = stats.charData.portraitSet.small;
        className.text     = stats.currentClass.entryName;
        level.text         = "Level: " + stats.level;
        exp.text           = "EXP: " + stats.currentExp;

        for (int i = 0; i < skillIcons.Length; i++)
        {
            if (skills.skills[i] == null)
            {
                skillIcons[i].enabled = false;
            }
            else
            {
                skillIcons[i].sprite  = skills.skills[i].icon;
                skillIcons[i].enabled = true;
            }
        }

        hpText.text  = "HP:  " + stats.hp.ToString();
        dmgText.text = "Dmg:  " + stats.dmg.ToString();
        mndText.text = "Mnd:  " + stats.mnd.ToString();
        sklText.text = "Skl:  " + stats.skl.ToString();
        spdText.text = "Spd:  " + stats.spd.ToString();
        defText.text = "Def:  " + stats.def.ToString();

        for (int i = 0; i < wpnRanks.Count; i++)
        {
            Destroy(wpnRanks[i].gameObject);
        }
        wpnRanks.Clear();
        for (int i = 0; i < inventory.wpnSkills.Length; i++)
        {
            if (inventory.wpnSkills[i] == WeaponRank.NONE)
            {
                continue;
            }

            Transform t = Instantiate(wpnTemplate, wpnParent);
            t.GetComponentInChildren <Image>().sprite = wpnIcons.icons[i];
            t.GetComponentInChildren <Text>().text    = inventory.wpnSkills[i].ToString();
            t.gameObject.SetActive(true);
            wpnRanks.Add(t);
        }
        wpnTemplate.gameObject.SetActive(false);
    }
    /// <summary>
    /// Updates the inventory and the explanation groups.
    /// </summary>
    private void Setup()
    {
        InventoryContainer inv = selectedCharacter.value.inventory;

        for (int i = 0; i < InventoryContainer.INVENTORY_SIZE; i++)
        {
            inventory[i] = inv.GetTuple(i);
        }

        SkillsContainer skill = selectedCharacter.value.skills;

        for (int i = 0; i < SkillsContainer.SKILL_SIZE; i++)
        {
            skills[i].value = skill.skills[i];
        }

        baseStats.UpdateSelection(page == StatsPage.BASIC);
        statsStats.UpdateSelection(page == StatsPage.STATS);
        inventoryStats.UpdateSelection(page == StatsPage.INVENTORY);
    }
Ejemplo n.º 8
0
        /// <summary>
        /// Instructs new warriors.
        /// </summary>
        /// <param name="o">The offense.</param>
        /// <param name="d">The defense.</param>
        /// <param name="p">The penalty.</param>
        /// <returns>
        /// A new warrior.
        /// </returns>
        public Warrior instruct(double o, double d, int p)
        {
            var sc = new SkillsContainer(o, d, p);

            return(new AncientGreek(new SpearHandlerImpl(), sc));
        }
Ejemplo n.º 9
0
 void Awake()
 {
     instance = this;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Instructs new warriors.
        /// </summary>
        /// <param name="o">The offense.</param>
        /// <param name="d">The defense.</param>
        /// <param name="p">The penalty.</param>
        /// <returns>
        /// A new warrior.
        /// </returns>
        public Warrior instruct(double o, double d, int p)
        {
            var sc = new SkillsContainer(o, d, p);

            return(new Samurai(new SwordHandlerImpl(), sc));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Instructs new warriors.
        /// </summary>
        /// <param name="o">The offense.</param>
        /// <param name="d">The defense.</param>
        /// <param name="p">The penalty.</param>
        /// <returns>
        /// A new warrior.
        /// </returns>
        public Warrior instruct(double o, double d, int p)
        {
            var sc = new SkillsContainer(o, d, p);

            return(new Elf(new BowHandlerImpl(), sc));
        }