Esempio n. 1
0
    public DamageDetails TakeDamage(Move move, Nuzlon attacker)
    {
        //this is the damage magic. This is where you must look at the numbers to see how much damage moves should do
        float typeEffect = TypeChart.GetEffectiveness(move.Base.Type, this.Base.Type1) * TypeChart.GetEffectiveness(move.Base.Type, this.Base.Type2);

        DamageDetails details = new DamageDetails()
        {
            TypeEffect = typeEffect,
            Fainted    = false
        };

        float attack  = (move.Base.IsRanged) ? attacker.SpecialAttack : attacker.Attack;
        float defense = (move.Base.IsRanged) ? SpecialDefense : Defense;

        float modifiers = Random.Range(0.85f, 1f) * typeEffect;
        float a         = (2f * attacker.Level + 10f) / 50f;
        float d         = a * move.Base.Power * (attack / defense) + 2f;
        int   damage    = Mathf.FloorToInt(d * modifiers);

        CurrentHP -= damage;
        if (CurrentHP <= 0)
        {
            CurrentHP       = 0;
            details.Fainted = true;
        }
        return(details);
    }
Esempio n. 2
0
    public Nuzlon GetRandomWildNuzlon()
    {
        Nuzlon wildNuzlon = _wildNuzlonList[Random.Range(0, _wildNuzlonList.Count)];

        wildNuzlon.Initialize();
        return(wildNuzlon);
    }
Esempio n. 3
0
    public void SetPartyHUD(Nuzlon nuzlon)
    {
        _nuzlon = nuzlon;

        _nameText.text  = nuzlon.Base.Name;
        _levelText.text = "Lvl " + nuzlon.Level;
        _hpBar.SetHP((float)nuzlon.CurrentHP / nuzlon.MaxHp);
    }
Esempio n. 4
0
    private void StartBattle()
    {
        state = GameState.Battle;
        _battlesystem.gameObject.SetActive(true);
        _worldCamera.gameObject.SetActive(false);

        NuzlonParty playerParty = _playerController.GetComponent <NuzlonParty>();
        Nuzlon      wildNuzlon  = FindObjectOfType <MapArea>().GetComponent <MapArea>().GetRandomWildNuzlon();

        _battlesystem.StartBattle(playerParty, wildNuzlon);
    }
Esempio n. 5
0
    public void Setup(Nuzlon nuzlon)
    {
        BattleNuzlon = nuzlon;
        if (_isPlayerUnit)
        {
            _image.sprite = BattleNuzlon.Base.BackSprite;
        }
        else
        {
            _image.sprite = BattleNuzlon.Base.FrontSprite;
        }

        _hud.SetHUD(nuzlon);

        _image.color = _originalColor;
        PlayEnterAnimation();
    }
Esempio n. 6
0
    IEnumerator SwitchNuzlon(Nuzlon newNuzlon)
    {
        if (_playerUnit.BattleNuzlon.CurrentHP > 0)
        {
            yield return(_dialogueBox.TypeDialogue($"Comeback {_playerUnit.BattleNuzlon.Base.name}!"));

            _playerUnit.PlayFaintAnimation();
            yield return(new WaitForSeconds(2f));
        }

        _playerUnit.Setup(newNuzlon);

        _dialogueBox.SetMoveNames(newNuzlon.Moves);

        yield return(_dialogueBox.TypeDialogue($"Go {newNuzlon.Base.name}!"));

        StartCoroutine(EnemyMove());
    }
Esempio n. 7
0
 private void CheckForBattleOver(BattleUnit faintedUnit)
 {
     if (faintedUnit.IsPlayerUnit)
     {
         Nuzlon nextNuzlon = _playerParty.GetHealthyNuzlon();
         if (nextNuzlon != null)
         {
             OpenPartyScreen();
         }
         else
         {
             BattleOver(false);
         }
     }
     else
     {
         BattleOver(true);
     }
 }
Esempio n. 8
0
    private void HandlePartySelection()
    {
        if (!_pressedBtn)
        {
            if (Input.GetAxisRaw("Horizontal") > 0)
            {
                if (_currentPartyMemberIndex < _playerParty.NuzlonList.Count - 1)
                {
                    _currentPartyMemberIndex++;
                    _pressedBtn = true;
                }
            }
            else if (Input.GetAxisRaw("Horizontal") < 0)
            {
                if (_currentPartyMemberIndex > 0)
                {
                    _currentPartyMemberIndex--;
                    _pressedBtn = true;
                }
            }
            else if (Input.GetAxisRaw("Vertical") < 0)
            {
                if (_currentPartyMemberIndex < _playerParty.NuzlonList.Count - 2)
                {
                    _currentPartyMemberIndex += 2;
                    _pressedBtn = true;
                }
            }
            else if (Input.GetAxisRaw("Vertical") > 0)
            {
                if (_currentPartyMemberIndex > 1)
                {
                    _currentPartyMemberIndex -= 2;
                    _pressedBtn = true;
                }
            }

            _partyScreen.UpdateMemberSelection(_currentPartyMemberIndex);
        }

        if (Input.GetAxisRaw("Vertical") == 0 && Input.GetAxisRaw("Horizontal") == 0)
        {
            _pressedBtn = false;
        }

        if (Input.GetButtonDown("Jump"))
        {
            Nuzlon selectedMember = _playerParty.NuzlonList[_currentPartyMemberIndex];
            if (selectedMember.CurrentHP <= 0)
            {
                _partyScreen.SetMessageText("You can't send out a fainted Nuzlon");
                return;
            }
            if (selectedMember == _playerUnit.BattleNuzlon)
            {
                _partyScreen.SetMessageText("That Nuzlon is already out");
                return;
            }

            //_dialogueBox.EnableMoveSelector(false);
            //_dialogueBox.EnableDialogueText(true);
            _partyScreen.gameObject.SetActive(false);
            state = BattleState.Busy;
            StartCoroutine(SwitchNuzlon(selectedMember));
        }
        else if (Input.GetButtonDown("Fire1"))
        {
            if (_playerUnit.BattleNuzlon.CurrentHP <= 0)
            {
                return;
            }
            _partyScreen.gameObject.SetActive(false);
            ActionSelection();
        }
    }
Esempio n. 9
0
 public void StartBattle(NuzlonParty playerParty, Nuzlon wildNuzlon)
 {
     _playerParty = playerParty;
     _wildNuzlon  = wildNuzlon;
     StartCoroutine(SetupBattle());
 }