コード例 #1
0
    IEnumerator RunMoveEffect(Move move, PokemonLevel source, PokemonLevel target)
    {
        var effects = move.Base.Effects;

        //start Boosting
        if (effects.Boosts != null)
        {
            if (move.Base.Target == MoveTarget.Self)
            {
                source.ApplyBoosts(effects.Boosts);
            }
            else
            {
                target.ApplyBoosts(effects.Boosts);
            }
        }
        //Status Condition
        if (effects.Status != ConditionID.none)
        {
            target.SetStatus(effects.Status);
        }


        yield return(ShowStatusChange(source));

        yield return(ShowStatusChange(target));
    }
コード例 #2
0
    IEnumerator SwitchPokemon(PokemonLevel newPokemon)
    {
        bool currentPokemonFainted = true;

        if (playerUnit.Pokemon.HP > 0)
        {
            currentPokemonFainted = false;
            yield return(dialogBox.TypeDialog($"Come back {playerUnit.Pokemon.Base.Name}"));

            playerUnit.PlayFaintAnimation();
            yield return(new WaitForSeconds(2.0f));
        }

        playerUnit.Setup(newPokemon);
        // playerHud.SetData(newPokemon);

        dialogBox.SetMoveName(newPokemon.Moves);

        yield return(dialogBox.TypeDialog($"Go {newPokemon.Base.Name} . "));

        if (currentPokemonFainted)
        {
            ChooseFirstTurn();
        }
        else
        {
            StartCoroutine(EnemyMove());
        }
    }
コード例 #3
0
    public void StartBattle(PokemonParty playerParty, PokemonLevel wildpokemon)
    {
        sounds           = GetComponents <AudioSource>();
        this.playerParty = playerParty;
        this.wildpokemon = wildpokemon;

        StartCoroutine(SetupBattle());
    }
コード例 #4
0
 IEnumerator ShowStatusChange(PokemonLevel pokemon)
 {
     while (pokemon.StatusChanges.Count > 0)
     {
         var message = pokemon.StatusChanges.Dequeue();
         yield return(dialogBox.TypeDialog(message));
     }
 }
コード例 #5
0
    public void SetData(PokemonLevel pokemon)
    {
        _pokemon = pokemon;

        nameText.text  = pokemon.Base.Name;
        LevelText.text = "Lvl" + pokemon.Level;
        hpbar.SetHP((float)pokemon.HP / pokemon.Maxhp);
    }
コード例 #6
0
 public void save()
 {
     writeValue("Credentials", "Username", Username, _filename);
     writeValue("Credentials", "Password", Password, _filename);
     writeValue("Authenticity", "ClickLower", ClickLower.ToDecimalString(), _filename);
     writeValue("Authenticity", "ClickUpper", ClickUpper.ToDecimalString(), _filename);
     writeValue("Authenticity", "WaitLower", WaitLower.ToString(), _filename);
     writeValue("Authenticity", "WaitUpper", WaitUpper.ToString(), _filename);
     writeValue("Authenticity", "IntervalUpper", IntervalUpper.ToString(), _filename);
     writeValue("Authenticity", "IntervalLower", IntervalLower.ToString(), _filename);
     writeValue("BattleSettings", "PokemonNumber", PokemonNumber.ToString(), _filename);
     writeValue("BattleSettings", "PokemonLevel", PokemonLevel.ToString(), _filename);
     writeValue("BattleSettings", "ShowMessage", ShowMessage.ToString(), _filename);
     writeValue("BattleSettings", "PlaySound", PlaySound.ToString(), _filename);
 }
コード例 #7
0
ファイル: BattleUnit.cs プロジェクト: Talha991s/Pokemon
    public void Setup(PokemonLevel pokemon)
    {
        Pokemon = pokemon;
        if (isPlayerUnit)
        {
            image.sprite = Pokemon.Base.BackSprite;
        }
        else
        {
            image.sprite = Pokemon.Base.FrontSprite;
        }

        hud.SetData(pokemon);

        image.color = originalColor;
        PlayEnteranimation();
    }
コード例 #8
0
ファイル: PokemonLevel.cs プロジェクト: Talha991s/Pokemon
    public DamageDetails TakeDamage(Move move, PokemonLevel attacker)
    {
        float criticalhit = 1.0f;

        if (Random.value * 100.0f <= 6.25)   // random value for critical hit
        {
            criticalhit = 2.0f;
        }

        float type = TypeChart.GetEffectiveness(move.Base.Type, this.Base.Type1) * TypeChart.GetEffectiveness(move.Base.Type, this.Base.Type2);

        var damageDetails = new DamageDetails()
        {
            TypeEffectiveness = type,
            Critical          = criticalhit,
            Fainted           = false
        };

        float attack  = (move.Base.Category == MoveCategory.Special)? attacker.SpAttack : attacker.Attack;
        float defense = (move.Base.Category == MoveCategory.Special) ? SpDefense : Defense;

        float modifiers = Random.Range(0.85f, 1.0f) * type * criticalhit;      // damage depend on the Level of the attacker // random range so that the damage is a lil bit different everytime
        float a         = (2 * attacker.Level + 10) / 250f;
        float d         = a * move.Base.Power * ((float)attack / defense) + 2; // depend the power of the move and the attack stats and the defense the pokemon.
        int   damage    = Mathf.FloorToInt(d * modifiers);

        UpdateHP(damage);

        //HP -= damage; // checking if the pokemon faint
        //if(HP <= 0)
        //{
        //    HP = 0;
        //    damageDetails.Fainted = true;
        //}

        return(damageDetails);
    }