Example #1
0
    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);
    }
Example #2
0
    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);
    }
Example #3
0
 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();
 }
Example #4
0
 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()
                              );
 }
Example #5
0
    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);
    }
Example #6
0
    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);
    }
Example #7
0
 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;
     }
 }
Example #8
0
#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();
    }
Example #9
0
 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);
     }
 }
Example #10
0
    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);
    }
Example #11
0
    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);
    }
Example #12
0
    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);
    }
Example #13
0
    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);
    }
Example #14
0
    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));
    }
Example #15
0
    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();
    }
Example #16
0
    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);
    }
Example #17
0
    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);
    }
Example #18
0
    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();
        }
    }
Example #19
0
 private void FillTotalDamageValues(FightStages attacker)
 {
     NormalTotalValue.text   = attacker.Attack.NormalDamage.ToString();
     PassiveTotalValue.text  = attacker.Attack.CriticalHitPower.ToString();
     CriticalTotalValue.text = attacker.Attack.BleedingPower.ToString();
 }
Example #20
0
 private void FillSquadHps(FightStages attacker, FightStages defender)
 {
     AttackTotalHpValue.text  = attacker.SquadHealth.ToString();
     DefenseTotalHpValue.text = defender.SquadHealth.ToString();
 }
Example #21
0
 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);
 }