private float CalculateTotalDamage(FightStages attacker, FightStages defender) { float attack = attacker.Attack.TotalAttackPower; float defense = defender.Defense.TotalDefensePower; return((attack <= 0 || attack < defense) ? 0 : attack - defense); }
private bool ProcessExperienceResult(FightStages player) { int level = GameManager.Instance.CurrentPlayer.Level; GameManager.Instance.CurrentPlayer.AddXp(player.Won ? 25.0f : 12.5f); return(level < GameManager.Instance.CurrentPlayer.Level); }
public FightersManager(EnemySquadronGenerator enemySquad) { Player = new FightStages(GameManager.Instance.CurrentPlayer.Squadron, GameManager.Instance.AbilitiesContainer, true); Enemy = new FightStages(enemySquad.Squadron, enemySquad.AbilitiesContainer, false); Player.Squad.UpdateCurrentHealth(); Enemy.Squad.UpdateCurrentHealth(); IsPlayerAttacking = MathConts.HalfChance(); }
private void FillSabotagePanel(FightStages attacker, FightStages defender) { sabotagePanel.Initialize(defender.Squad.SabMonster.MonsterName, attacker.Attack.NormalDamageToSabotage.ToString(), attacker.Attack.CriticalDamageToSabotage.ToString(), attacker.Attack.PassiveDamageToSabotage.ToString(), defender.Defense.SabotageMonsterFainted, defender.Squad.SabPowers.HealthPower.WasRevived, defender.Squad.SabPowers.HealthPower.LastHeal.ToString() ); }
private void InitiliazeDefense(FightStages attacker) { float ativ = attacker.Squad.DefPowers.AttackPower.Bonus; float atx = attacker.Attack.DefOnTurnBonusAttack; float baseAttack = MathConts.RoundNumber(attacker.Squad.DefPowers.AttackPower.Base); float totalAttack = attacker.Attack.DefenseOffensivePower; attackerDefense.Initialize(attacker.Squad.DefMonster.MonsterName, ativ, atx, baseAttack, totalAttack); }
private void InitiliazeAttack(FightStages defensor) { float dfx = defensor.Squad.AtkPowers.DefensePower.Bonus; float atvii = defensor.Defense.CripleStrikeToAttack; float baseDefense = MathConts.RoundNumber(defensor.Squad.AtkPowers.DefensePower.Base); float totalDefense = defensor.Defense.AttackDefensivePower; defensorAttack.Initialize(defensor.Squad.AtkMonster.MonsterName, dfx, atvii, baseDefense, totalDefense); }
public void ManageRounds(FightStages attacker, FightStages defender) { attacker.Attacked = true; if (attacker.Attacked && defender.Attacked) { attacker.Round = defender.Round = +1; attacker.Attacked = defender.Attacked = false; } }
#pragma warning restore 0649 public void Initialize(FightStages attacker, FightStages defender) { InitiateHeads(defender); AttackPercentage.text = defender.Defense.DivergeDamageToAttack.ToString(); DefenseIncrPercentage.text = defender.Squad.DefPowers.DefensePower.DivergeDamageToDefense.ToString(); DefenseDecrPercentage.text = attacker.Attack.DecreaseDivergePower.ToString(); SabotagePercentage.text = defender.Defense.DivergeDamageToSabotage.ToString(); AttackTotalPercentage.text = defender.Defense.PercentageDamageAttack.ToString(); DefenseTotalPercentage.text = defender.Defense.PercentageDamageDefense.ToString(); SabotageTotalPercentage.text = defender.Defense.PercentageDamageSabotage.ToString(); }
private void CalculateDamage(FightStages attacker, FightStages defender) { TotalDamage = CalculateTotalDamage(attacker, defender); attacker.Attack.CalculateBaseDamage(TotalDamage, defender.Defense.PercentageDamageAttack, defender.Defense.PercentageDamageDefense, defender.Defense.PercentageDamageSabotage); if (attacker.Attack.CriticalHitPower > 0) { attacker.Attack.CalculateCriticalDamage(defender.Defense.PercentageDamageAttack, defender.Defense.PercentageDamageDefense, defender.Defense.PercentageDamageSabotage); } if (attacker.Attack.PassiveDamage > 0) { attacker.Attack.CalculatePassiveDamage(defender.Defense.PercentageDamageAttack, defender.Defense.PercentageDamageDefense, defender.Defense.PercentageDamageSabotage); } }
private void InitiliazeAttack(FightStages attacker) { float ati = attacker.Squad.AtkPowers.AttackPower.Bonus; float atiii = attacker.Attack.CriticalHitPower; float atv = attacker.Attack.BleedingPower; float atviii = attacker.Attack.DoubleStrikePower; float atix = attacker.Attack.AdrenalineRushPower; float atx = attacker.Attack.AtkOnTurnBonusAttack; float sabiv = attacker.Attack.AttackDecrease; float baseAttack = MathConts.RoundNumber(attacker.Squad.AtkPowers.AttackPower.Base); float totalAttack = attacker.Attack.AttackOffensivePower; attackerAttack.Initialize(attacker.Squad.AtkMonster.MonsterName, ati, atiii, atv, atviii, atix, atx, sabiv, baseAttack, totalAttack); }
public void OnEnable() { FightStages attacker = fightersManager.GetAttacker(); LanguagesFillers.FillAttackerSection( Title, AttackBaseTitle, DefenseBaseTitle, SabotageBaseTitle, AttackTotalTitle, DefenseTotalTitle, SabotageTotalTitle, TotalAttackTitle, Continue, attacker.IsPlayer, Round, attacker.Round ); TotalAttackValue.text = attacker.Attack.TotalAttackPower.ToString(); InitiliazeAttack(attacker); InitiliazeDefense(attacker); InitiliazeSabotage(attacker); }
public void OnEnable() { FightStages defender = fightersManager.GetDefender(); LanguagesFillers.FillDefensorSection( Title, AttackBaseTitle, DefenseBaseTitle, SabotageBaseTitle, AttackTotalTitle, DefenseTotalTitle, SabotageTotalTitle, TotalDefenseTitle, defender.IsPlayer ); TotalDefenseValue.text = defender.Defense.TotalDefensePower.ToString(); InitiliazeAttack(defender); InitiliazeDefense(defender); InitiliazeSabotage(defender); }
private void InitiliazeDefense(FightStages defensor) { float dfi = defensor.Squad.DefPowers.DefensePower.Bonus; float dfiii = defensor.Squad.DefPowers.DefensePower.DivergeDamageToDefense; float dfv = defensor.Squad.DefPowers.DefensePower.CriticalHitResistance; float dfix = defensor.Defense.StopBleedingPower; float sabiii = defensor.Defense.DefenseDecrease; float sabix = defensor.Defense.CriticalResistanteDecrease; float atvii = defensor.Defense.CripleStrikeToDefense; float baseDefense = MathConts.RoundNumber(defensor.Squad.DefPowers.DefensePower.Base); float totalDefense = defensor.Defense.DefenseDefensivePower; defensorDefense.Initialize(defensor.Squad.DefMonster.MonsterName, dfi, dfiii, dfv, dfix, sabiii, sabix, atvii, baseDefense, totalDefense); }
public void OnEnable() { FightStages player = fightersManager.Player; LanguagesFillers.FillEndDuelPanel(player.Won, Title, ExperienceTitle, WonTitle, TotalTitle, DamageTitle, ReceivedTitle, GivenTitle, DefendedTitle, EndDuel); if (ProcessExperienceResult(player)) { EvolutionPanel.SetActive(true); LanguagesFillers.FillPlayerLevelUp(Evolution, WonPointsTitle, TotalPointsTitle, WonPointsValue, TotalPointsValue); } WonValue.text = player.Won ? "25" : "12.5"; TotalValue.text = GameManager.Instance.CurrentPlayer.Xp.ToString(); ReceivedValue.text = player.AllReceivedDamage.ToString(); GivenValue.text = player.Attack.AllGivenDamage.ToString(); DefendedValue.text = player.Defense.AllDamageDefended.ToString(); EndDuelBtn.onClick.AddListener(() => SceneTransitionManager.Instance.GoToScene(SquadUpConstants.SCENE_WORLD)); }
public void OnEnable() { FightStages attacker = fightersManager.GetAttacker(); FightStages defender = fightersManager.GetDefender(); LanguagesFillers.FillDamageResultPanel( Round, attacker.Round, PercentageTitle, DamageTitle, NormalTotalTitle, CriticalTotalTitle, PassiveTotalTitle, NormalDmgTitle, CriticalDmgTitle, PassiveDmgTitle, FaintedTitle, ReviveTitle, HealTitle, EndRoundBtn, AttackTotalHpTitle, DefenseTotalHpTitle ); monsterPercentagesPanel.Initialize(attacker, defender); FillTotalDamageValues(attacker); FillAttackPanel(attacker, defender); FillDefensePanel(attacker, defender); FillSabotagePanel(attacker, defender); FillSquadHps(attacker, defender); fightersManager.ChangeStances(); }
private void InitiliazeSabotage(FightStages attacker) { float sabi = attacker.Squad.SabPowers.SabotagePower.Bonus; float ativ_sabvii = 0.0f; if (attacker.Attack.SabFullAttack > 0) { ativ_sabvii = attacker.Attack.SabFullAttack; ImagesFillers.GetAbilityIcon(Icon_ativ_sabvii, AbilityIndex.ATTACK4.ToString()); } else { ativ_sabvii = attacker.Squad.SabPowers.AttackPower.Bonus; ImagesFillers.GetAbilityIcon(Icon_ativ_sabvii, AbilityIndex.SABOTAGE7.ToString()); } float atx = attacker.Attack.SabOnTurnBonusAttack; float sabv = attacker.Attack.SabotageDecrease; float baseAttack = MathConts.RoundNumber(attacker.Squad.SabPowers.AttackPower.Base); float totalAttack = attacker.Attack.SabotageOffensivePower; attackerSabotage.Initialize(attacker.Squad.SabMonster.MonsterName, sabi, ativ_sabvii, atx, sabv, baseAttack, totalAttack); }
private void InitiliazeSabotage(FightStages defensor) { float sabi = defensor.Squad.SabPowers.SabotagePower.Bonus; float dfx_sabviii = 0.0f; if (defensor.Attack.SabFullDefense > 0) { dfx_sabviii = defensor.Defense.SabFullDefense; ImagesFillers.GetAbilityIcon(Icon_dfx_sabviii, AbilityIndex.DEFENSE10.ToString()); } else { dfx_sabviii = defensor.Squad.DefPowers.DefensePower.Bonus; ImagesFillers.GetAbilityIcon(Icon_dfx_sabviii, AbilityIndex.SABOTAGE8.ToString()); } float atvii = defensor.Defense.CripleStrikeToSabotage; float sabv = defensor.Defense.SabotageDecrease; float baseDefense = MathConts.RoundNumber(defensor.Squad.SabPowers.DefensePower.Base); float totalDefense = defensor.Defense.SabotageDefensivePower; defensorSabotage.Initialize(defensor.Squad.SabMonster.MonsterName, sabi, dfx_sabviii, atvii, sabv, baseDefense, totalDefense); }
public void Fight() { FightStages attacker = fightersManager.GetAttacker(); FightStages defender = fightersManager.GetDefender(); fightersManager.ManageRounds(attacker, defender); attacker.BuildAttackStats(); defender.BuildDefenseStats(); attacker.Attack.ProcessPowers(defender.Defense); defender.Defense.ProcessPowers(attacker.Attack); defender.Defense.CalculatePercentagesOfDamage(); CalculateDamage(attacker, defender); defender.ApplyDamage(attacker.Attack.DamageToAttack, attacker.Attack.DamageToDefense, attacker.Attack.DamageToSabotage); if (defender.ProcessInjuries()) { GameFinished = true; attacker.Won = true; } else { defender.RestoreHealth(); } }
private void FillTotalDamageValues(FightStages attacker) { NormalTotalValue.text = attacker.Attack.NormalDamage.ToString(); PassiveTotalValue.text = attacker.Attack.CriticalHitPower.ToString(); CriticalTotalValue.text = attacker.Attack.BleedingPower.ToString(); }
private void FillSquadHps(FightStages attacker, FightStages defender) { AttackTotalHpValue.text = attacker.SquadHealth.ToString(); DefenseTotalHpValue.text = defender.SquadHealth.ToString(); }
private void InitiateHeads(FightStages defender) { ImagesFillers.AddMonsterHead(AttackHead, defender.Squad.AtkMonster.MonsterName); ImagesFillers.AddMonsterHead(DefenseHead, defender.Squad.DefMonster.MonsterName); ImagesFillers.AddMonsterHead(SabotageHead, defender.Squad.SabMonster.MonsterName); }