/// <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); }
/// <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); } } } }