Esempio n. 1
0
    private void Update()
    {
        Meshes.Update();

        if (Meshes.AllLoaded() && WaitingForLoading)
        {
            WaitingForLoading = false;

            Battle.Team[] teams = new Battle.Team[]
            {
                new Battle.Team(sets1),
                new Battle.Team(sets2)
            };

            b = new Battle(null, teams);

            for (int i = 0; i < teams.Length; i++)
            {
                for (int j = 0; j < teams[i].pokemons.Length; j++)
                {
                    teams[i].pokemons[j].pokemonData.isActive = true;
                }
            }

            AddCameras(teams);
        }
    }
Esempio n. 2
0
 public void Init(Battle b, PokemonSet set, Battle.Team t)
 {
     pokemonData  = new Pokemon(b, set, t, this);
     targetScript = GetComponent <TargetableElement>();
     targetScript.sourceElement = this;
     this.id           = pokemonData.speciesId;
     currentActiveMove = null;
 }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Z))
        {
            //TYPECHART
            int    value  = TypeChart.BattleTypeChart["" + typeDefense].damageTaken["" + typeAttack];
            string result = (value == 0) ? " is ok against " : (value == 1) ? " is super effective against " : (value == 2) ? "is not very effective against " : (value == 3) ? " does not affect " : "wat";
            Debug.Log(typeAttack + result + typeDefense);
        }

        if (Input.GetKeyDown(KeyCode.X))
        {
            //LOG TEMPLATEDATA
            LogPokemon();
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            //BOOSTMODIFIERS STUFF
            int   previousMod = 6144;
            int   nextMod     = 5325;
            int   nextValue   = (previousMod * nextMod + 2048);
            int   test        = nextValue >> 12;
            float end         = (float)test / 4096f;
            float wat         = (6144f / 4096f) * (5325f / 4096f);
            Debug.Log("((previousMod * nextMod + 2048) >> 12) / 4096 \n" +
                      "((" + previousMod + "*" + nextMod + "+ 2048) >> 12) / 4096 \n" +
                      "((" + previousMod + " * " + nextMod + " + 2048) = " + nextValue + "\n" +
                      nextValue + " >> 12 = " + test + "\n" +
                      test + " / 4096 = " + end
                      );

            Debug.Log("" + 6144f / 4096f + " * " + 5325f / 4096f + " = " + wat);
        }

        if (Input.GetKeyDown(KeyCode.V))
        {
            //LOG BATTLE STATS
            Globals.StatsTable baseStats = new Globals.StatsTable(hp: 45, atk: 49, def: 49, spa: 65, spd: 65, spe: 45);
            Globals.StatsTable stats     = baseStats.ShallowCopy();// new Globals.StatsTable(hp: 45, atk: 49, def: 49, spa: 65, spd: 65, spe: 45);
            PokemonSet         set       = new PokemonSet();
            set.ivs    = new Globals.StatsTable();
            set.evs    = new Globals.StatsTable();
            set.level  = 50;
            set.nature = new Globals.Nature("Testing");//, plus: "hp", minus: "spe");

            stats.SetBattleStats(set);
            Debug.Log("Testing Stats: hp: " + stats.hp + ", atk:" + stats.atk + ", def:" + stats.def + ", spa:" + stats.spa + ", spd:" + stats.spd + ", spe:" + stats.spe);
            Debug.Log("Base stats used: hp: " + baseStats.hp + ", atk:" + baseStats.atk + ", def:" + baseStats.def + ", spa:" + baseStats.spa + ", spd:" + baseStats.spd + ", spe:" + baseStats.spe);
        }

        if (Input.GetKeyDown(KeyCode.B))
        {
            //LOG HIDDEN POWER
            Globals.HiddenPower hp = new Globals.HiddenPower(hpIvs);
            Debug.Log("Hidden Power: " + hp.hpType + " " + hp.hpPower);
        }

        if (Input.GetKeyDown(KeyCode.N))
        {
            //LOG CAN MEGA EVOLVE
            TemplateData templateData = Pokedex.BattlePokedex["rayquaza"];
            PokemonSet   set          = new PokemonSet();
            set.itemId  = "abomasite";
            set.movesId = new string[] { "tackle" };
            Debug.Log("Can mega evolve " + CanMegaEvolve(templateData, set));
        }

        if (Input.GetKeyDown(KeyCode.M))
        {
            //LOG CAN ULTRA BURST
            TemplateData templateData = Pokedex.BattlePokedex["necrozmadawnwings"];
            PokemonSet   set          = new PokemonSet();
            set.itemId  = "ultranecroziumz";
            set.movesId = new string[] { "tackle" };
            Debug.Log("Can ultra burst " + CanUltraBurst(templateData, set));
        }

        if (Input.GetKeyDown(KeyCode.A))
        {
            //LOG POKEMON DATA
            Battle     battle = new Battle();
            PokemonSet set    = new PokemonSet(
                speciesId: "bulbasaur",
                name: "Flamenco",
                level: 50,
                gender: Globals.GenderName.M,
                happiness: 100,
                pokeball: "MajoBall",
                shiny: false,
                abilityId: "overgrow",
                itemId: "normaliumz",
                movesId: new string[] { "tackle", "absorb", "caca", "10000000voltthunderbolt" },
                evs: new Globals.StatsTable(spd: 252, def: 252, spe: 6),
                ivs: BestHiddenPowers.HiddenPowers["Ice"],
                nature: Natures.BattleNatures["adamant"],
                ppBoosts: new int[] { 3, 1, 0, 2 }
                );
            Pokemon testPoke = new Pokemon(battle, set, new Battle.Team(new PokemonSet[] { set }), null);
            testPoke.LogPokemon();
        }

        if (Input.GetKeyDown(KeyCode.S))
        {
            //TESTING CALLBACK GETTERS AND CALLERS
            MoveData move = Moves.BattleMovedex["test"];
            Debug.Log(move.id);

            Debug.Log(move.eventMethods.HasCallback("onModifyAtk"));
            Debug.Log(move.eventMethods.HasCallback("onTakeItem"));
            Debug.Log(move.eventMethods.HasCallback("caca"));
            Debug.Log(move.eventMethods.HasCallback("id"));

            Battle.RelayVar relayVar = new Battle.RelayVar();

            Debug.Log("I was a " + relayVar.integerValue + " before");
            move.eventMethods.StartCallback("onModifyAtk", null, relayVar, null, null, null);
            Debug.Log("But now, thanks to the StartCallback method, I am a " + relayVar.integerValue);
        }

        if (Input.GetKeyDown(KeyCode.D))
        {
            //Single event test
            Battle   b    = new Battle();
            MoveData move = Moves.BattleMovedex["test"];

            Battle.RelayVar tororo = b.SingleEvent("ModifyAtk", move);
            Debug.Log(tororo.integerValue);
        }

        if (Input.GetKeyDown(KeyCode.F))
        {
        }


        if (Input.GetKeyDown(KeyCode.Q))
        {
            Battle           b    = new Battle();
            PokemonSet       set1 = new PokemonSet(speciesId: "bulbasaur", name: "Tentomon", level: 50, gender: Globals.GenderName.F, abilityId: "testingrunevent", itemId: "testingrunevent", movesId: new string[] { "testingrunevent" });
            Battle.Team      t1   = new Battle.Team(new PokemonSet[] { set1 });
            GameObject       go1  = new GameObject();
            PokemonCharacter pc1  = go1.AddComponent <PokemonCharacter>();
            pc1.Init(b, set1, t1);
            pc1.pokemonData.isActive = true;
            t1.pokemons  = new PokemonCharacter[] { pc1 };
            t1.teamMoves = new List <ActiveMove>();

            PokemonSet       set2 = new PokemonSet(speciesId: "bulbasaur", name: "Tentomon", level: 50, gender: Globals.GenderName.F, abilityId: "testingrunevent", itemId: "testingrunevent", movesId: new string[] { "testingrunevent" });
            Battle.Team      t2   = new Battle.Team(new PokemonSet[] { set2 });
            GameObject       go2  = new GameObject();
            PokemonCharacter pc2  = go2.AddComponent <PokemonCharacter>();
            pc2.Init(b, set2, t2);
            pc2.pokemonData.isActive = true;
            t2.pokemons  = new PokemonCharacter[] { pc2 };
            t2.teamMoves = new List <ActiveMove>();


            b.teams = new Battle.Team[] { t1, t2 };

            MoveData        move     = Moves.BattleMovedex["testingrunevent"];
            Battle.RelayVar relayVar = new Battle.RelayVar(integerValue: move.basePower);
            relayVar = b.RunEvent("BasePower", pc1.targetScript, pc2, move, relayVar, true);
            Debug.Log(relayVar.integerValue);

            //public int GetDamage(Pokemon pokemon, Pokemon target, ActiveMove activeMove, int directDamage = -1)//movedata comes from active move?? //DirectDamage for confusion and stuff
            GameObject go3 = new GameObject();
            ActiveMove am  = go3.AddComponent <ActiveMove>();
            am.activeData = new ActiveMove.ActiveMoveData(move.id);
            int damage = b.GetDamage(pc1.pokemonData, pc2.pokemonData, am);

            Debug.Log("Damage " + damage);
        }
    }