コード例 #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);
    }
コード例 #2
0
    public int GetExperience()
    {
        if (defender.faction == Faction.WORLD)
        {
            return(0);
        }

        //Exp for support skills
        if (type != Type.DAMAGE)
        {
            return((attacker.faction == Faction.PLAYER) ? BattleCalc.GetExperienceSupport(staffAtk, attacker.stats) : 0);
        }

        //Exp for fights
        TacticsMove player = (attacker.faction == Faction.PLAYER) ? attacker : defender;
        TacticsMove enemy  = (attacker.faction == Faction.PLAYER) ? defender : attacker;

        if (!player.IsAlive())
        {
            return(0);
        }

        bool killed = (!enemy.IsAlive());
        bool isBoss = (enemy is NPCMove && ((NPCMove)enemy).aggroType == AggroType.BOSS);

        return(BattleCalc.GetExperienceDamage(player.stats, enemy.stats, killed, isBoss));
    }
コード例 #3
0
 public int GetCritRate()
 {
     if (defender.faction == Faction.WORLD)
     {
         return(0);
     }
     return(BattleCalc.GetCritRateBattle(weaponAtk, weaponDef, attacker.stats, defender.stats));
 }
コード例 #4
0
    public int GetHitRate()
    {
        if (defender.faction == Faction.WORLD)
        {
            return(100);
        }
        InventoryTuple wpn = (weaponDef != null) ? weaponDef : null;

        return(BattleCalc.GetHitRateBattle(weaponAtk, wpn, attacker.stats, defender.stats, terrainDef));
    }
コード例 #5
0
    /// <summary>
    /// Returns the speed difference between the battling characters.
    /// Positive values mean the attacker is faster, negative for the defender.
    /// </summary>
    /// <returns></returns>
    public int GetSpeedDifference()
    {
        if (defender.faction == Faction.WORLD)
        {
            return(0);
        }
        InventoryTuple wpn = (weaponDef != null) ? weaponDef : null;

        return(BattleCalc.GetAttackSpeed(weaponAtk, attacker.stats) - BattleCalc.GetAttackSpeed(wpn, defender.stats));
    }
コード例 #6
0
 private void Start()
 {
     battleCalc = this;
     if (m_allEntities != null)
     {
         foreach (var Entity in m_allEntities)
         {
             StatsEffected(Entity);
         }
     }
 }
コード例 #7
0
    public override void Start(Battle battle)
    {
        // this is a transient state, pop it right off the stack
        battle.states.Pop();

        // compute effects
        var effects       = BattleCalc.CalculateEffects(_feat, _battler, _target.battler);
        var targetBattler = _target.battler;

        if (targetBattler == null)
        {
            Debug.LogError("cannot handle feat used on empty tile yet");
        }

        // push a state to apply each effect
        foreach (var effect in effects)
        {
            battle.states.Push(new ApplyFeatEffect(targetBattler, effect));
        }
    }
コード例 #8
0
 private void Start()
 {
     battleCalc = this;
     foreach (var entity in m_allEntities)
     {
         if (entity.currentMoves.Count <= 0)
         {
             for (int i = 0; i < entity.m_nameOfMovesCurrent.Count; i++)
             {
                 entity.currentMoves.Add(entity.m_nameOfMovesCurrent[i][entity.currentMoveSetIndex[i]]);
             }
         }
     }
     //Applying all the stat changes to the entities at the beginning.
     //if (m_allEntities != null)
     //{
     //    foreach (var Entity in m_allEntities)
     //    {
     //        StatsEffected(Entity);
     //    }
     //}
 }
コード例 #9
0
    /// <summary>
    /// Takes a weapon and shows the possible tiles it can be used on to define where the AI
    /// can do things. Each opponent or each ally depending on weapon type.
    /// </summary>
    /// <param name="weapon"></param>
    private void GenerateHitTiles(List <InventoryTuple> weapons)
    {
        battleMap.ResetMap();

        //Sort characters
        enemies.Clear();
        friends.Clear();
        if (faction == Faction.ALLY)
        {
            for (int i = 0; i < enemyList.values.Count; i++)
            {
                if (enemyList.values[i].IsAlive() && !enemyList.values[i].hasEscaped)
                {
                    enemies.Add(enemyList.values[i]);
                }
            }
            for (int i = 0; i < playerList.Count; i++)
            {
                if (playerList.values[i].IsAlive() && !playerList.values[i].hasEscaped)
                {
                    friends.Add(playerList.values[i]);
                }
            }
            for (int i = 0; i < allyList.Count; i++)
            {
                if (this != allyList.values[i] && allyList.values[i].IsAlive() && !allyList.values[i].hasEscaped)
                {
                    friends.Add(allyList.values[i]);
                }
            }
        }
        else if (faction == Faction.ENEMY)
        {
            for (int i = 0; i < enemyList.values.Count; i++)
            {
                if (this != enemyList.values[i] && enemyList.values[i].IsAlive() && !enemyList.values[i].hasEscaped)
                {
                    friends.Add(enemyList.values[i]);
                }
            }
            for (int i = 0; i < playerList.Count; i++)
            {
                if (playerList.values[i].IsAlive() && !playerList.values[i].hasEscaped)
                {
                    enemies.Add(playerList.values[i]);
                }
            }
            for (int i = 0; i < allyList.Count; i++)
            {
                if (allyList.values[i].IsAlive() && !allyList.values[i].hasEscaped)
                {
                    enemies.Add(allyList.values[i]);
                }
            }
        }

        //Calculate range

        //Generate attack/support tiles
        if (weapons[0].itemCategory == ItemCategory.WEAPON)
        {
            int         damage = BattleCalc.CalculateDamage(weapons[0], stats);
            WeaponRange reach  = inventory.GetReach(ItemCategory.WEAPON);
            for (int i = 0; i < enemies.Count; i++)
            {
                int defense = (weapons[0].attackType == AttackType.PHYSICAL) ? enemies[i].stats.def : enemies[i].stats.mnd;
                enemies[i].ShowAttackTiles(reach, damage - defense);
            }
        }
        else
        {
            WeaponRange reach = inventory.GetReach(ItemCategory.SUPPORT);
            for (int i = 0; i < friends.Count; i++)
            {
                bool isBuff = (weapons[0].weaponType == WeaponType.BARRIER);
                if (isBuff || friends[i].IsInjured())
                {
                    friends[i].ShowSupportTiles(reach, isBuff);
                }
            }
        }
    }
コード例 #10
0
ファイル: ForecastUI.cs プロジェクト: parrexion/Fried-Embrum
    private void ShowHealForecast(TacticsMove healer, TacticsMove receiver, InventoryTuple staff)
    {
        StatsContainer stats = healer.stats;

        colorBackground.color  = (healer.faction == Faction.PLAYER) ? new Color(0.7f, 0.7f, 1f) : new Color(1f, 0.7f, 0.7f);
        eColorBackground.color = (receiver.faction == Faction.PLAYER) ? new Color(0.7f, 0.7f, 1f) : new Color(1f, 0.7f, 0.7f);
        hCharacterName.text    = stats.charData.entryName;
        hPortrait.sprite       = stats.charData.portraitSet.small;

        stats = receiver.stats;
        hCharacterName2.text = stats.charData.entryName;
        hPortrait2.sprite    = stats.charData.portraitSet.small;
        if (inBattle)
        {
            hHpBar.SetAmount(healer.currentHealth, healer.stats.hp);
            hHpBar2.SetAmount(receiver.currentHealth, receiver.stats.hp);
        }

        hWpnIcon.sprite = staff.icon;
        hWpnName.text   = staff.entryName;

        if (!inBattle)
        {
            hWpnCharge.text = (string.IsNullOrEmpty(staff.uuid)) ? staff.currentCharges.ToString() : "";
            hHealText.text  = string.Format("{0} → {1} ({2})",
                                            _defenderTactics.currentHealth,
                                            Mathf.Min(_defenderTactics.currentHealth + BattleCalc.CalculateHeals(staff, _attackerTactics.stats), _defenderTactics.stats.hp),
                                            _defenderTactics.stats.hp);
        }
    }
コード例 #11
0
    public bool CheckWeaponWeakness()
    {
        InventoryTuple wpn = (weaponAtk != null) ? weaponAtk : null;

        return(BattleCalc.CheckWeaponWeakness(wpn, defender.stats));
    }
コード例 #12
0
 public int GetHeals()
 {
     return(BattleCalc.CalculateHeals(staffAtk, attacker.stats));
 }
コード例 #13
0
    public int GetDamage()
    {
        InventoryTuple wpn = (weaponDef != null) ? weaponDef : null;

        return(BattleCalc.CalculateDamageBattle(weaponAtk, wpn, attacker.stats, defender.stats, terrainDef));
    }