当前位置: 首页>>代码示例>>C#>>正文


C# Pokemon类代码示例

本文整理汇总了C#中Pokemon的典型用法代码示例。如果您正苦于以下问题:C# Pokemon类的具体用法?C# Pokemon怎么用?C# Pokemon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Pokemon类属于命名空间,在下文中一共展示了Pokemon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Damage

	public void Damage(Pokemon otherPoke, Move move){
		//this must take p account weakness and attributes (defense, attack, sp_Defense, sp_Attack)
		//this must be object oriented
		moveCast = move.moveType.ToString () ;
		switch(move.moveType){ //These attack type and stab are not included. They(included atkpower) will have to be be invoked directly from database and switch wont be required
		case MoveNames.Tackle:{
			int atkPower = 35;
			damage = ((((2 * otherPoke.level / 5 + 2) * otherPoke.attack * atkPower / defence) / 50) + 2) * Random.Range(217,255)/255; //((2A/5+2)*B*C)/D)/50)+2)*X)*Y/10)*Z)/255
			hp -= damage/TotalHP();	
			isHPZero();
			currentHealth -= damage;
			GiveXP(10);
			break;
		}
		case MoveNames.Scratch:{
			int atkPower = 35;
			
			damage = ((((2 * otherPoke.level / 5 + 2) * otherPoke.attack * atkPower / defence) / 50) + 2) * Random.Range(217,255)/255; //((2A/5+2)*B*C)/D)/50)+2)*X)*Y/10)*Z)/255
			hp -= damage/TotalHP();	
			isHPZero();
			GiveXP(10);
			break;
		}
		}
	}
开发者ID:Arpit0492,项目名称:Unity,代码行数:25,代码来源:Pokemon.cs

示例2: composePoke

        static void composePoke()
        {
            PokemonArray[0] = new Pokemon();
            PokemonArray[0].pokename = "Bulbasaur";
            PokemonArray[0].type = "Grass";
            PokemonArray[0].hp = 45;
            PokemonArray[0].attack = 49;
            PokemonArray[0].defence = 49;
            PokemonArray[0].speed = 45;
            PokemonArray[0].move = new Move[] { MoveArray[0], MoveArray[1], MoveArray[2], MoveArray[3] };

            PokemonArray[1] = new Pokemon();
            PokemonArray[1].pokename = "Charmander";
            PokemonArray[1].type = "Fire";
            PokemonArray[1].hp = 39;
            PokemonArray[1].attack = 52;
            PokemonArray[1].defence = 43;
            PokemonArray[1].speed = 65;

            PokemonArray[2] = new Pokemon();
            PokemonArray[2].pokename = "Squirtle";
            PokemonArray[2].type = "Water";
            PokemonArray[2].hp = 44;
            PokemonArray[2].attack = 48;
            PokemonArray[2].defence = 65;
            PokemonArray[2].speed = 43;

            PokemonArray[3] = new Pokemon();
            PokemonArray[3].pokename = "Pikachu";
            PokemonArray[3].type = "Electric";
            PokemonArray[3].hp = 35;
            PokemonArray[3].attack = 55;
            PokemonArray[3].defence = 40;
            PokemonArray[3].speed = 90;
        }
开发者ID:Misty,项目名称:Pokebattle,代码行数:35,代码来源:Program.cs

示例3: trdata6

        public trdata6(byte[] trData, byte[] trPoke, bool ORAS)
        {
            using (BinaryReader br = new BinaryReader(new MemoryStream(trData)))
            {
                isORAS = ORAS;
                Format = ORAS ? br.ReadUInt16() : br.ReadByte();
                Class = ORAS ? br.ReadUInt16() : br.ReadByte();
                if (ORAS) uORAS = br.ReadUInt16();
                Item = ((Format >> 1) & 1) == 1;
                Moves = (Format & 1) == 1;
                BattleType = br.ReadByte();
                NumPokemon = br.ReadByte();
                for (int i = 0; i < 4; i++)
                    Items[i] = br.ReadUInt16();
                AI = br.ReadByte();
                u1 = br.ReadByte();
                u2 = br.ReadByte();
                u3 = br.ReadByte();
                Healer = br.ReadByte() != 0;
                Money = br.ReadByte();
                Prize = br.ReadUInt16();

                // Fetch Team
                Team = new Pokemon[NumPokemon];
                byte[][] TeamData = new byte[NumPokemon][];
                int dataLen = trPoke.Length / NumPokemon;
                for (int i = 0; i < TeamData.Length; i++)
                    TeamData[i] = trPoke.Skip(i * dataLen).Take(dataLen).ToArray();
                for (int i = 0; i < NumPokemon; i++)
                    Team[i] = new Pokemon(TeamData[i], Item, Moves);
            }
        }
开发者ID:FullLifeGames,项目名称:pk3DS,代码行数:32,代码来源:trdata6.cs

示例4: btSerializer_Click

 private void btSerializer_Click(object sender, EventArgs e)
 {
     Stopwatch sw = new Stopwatch();
     Pokemon p = new Pokemon(@"DescriptionPokemon\Pikachu.xml", FileType.Description);
     sw.Start();
     XmlSerializer xs = null;
     try
     {
        xs  = new XmlSerializer(typeof(Pokemon));
     }
     catch (InvalidOperationException ex)
     {
         MessageBox.Show(ex.InnerException.Message);
         return;
     }
     sw.Stop();
     MessageBox.Show("Instance XmlSerializer: " + sw.Elapsed.TotalMilliseconds.ToString());
     sw.Reset();
     Stream s = File.Create("pokétest.xml");
     sw.Start();
     xs.Serialize(s, p);
     sw.Stop();
     s.Close();
     MessageBox.Show("Serialization: " + sw.Elapsed.TotalMilliseconds.ToString());
 }
开发者ID:xamtheone,项目名称:URA-pokemon,代码行数:25,代码来源:FormDebug.cs

示例5: Update

    void Update()
    {
        switch(currentState){

        case States.Ready:{
            Vector3 direct = Player.This.transform.position - transform.position;
            if (direct.sqrMagnitude<10*10 && Vector3.Dot(direct, transform.forward)>0){

                Dialog.inDialog = true;
                Dialog.NPCobj = gameObject;
                Dialog.NPCname = "Young Trainer";
                Dialog.text = "You're a pokemon trainer right? That means we have to battle!";
                if (Dialog.doneDialog){
                    Dialog.inDialog = false;
                    //populate pokemon
                    party = new Pokemon[pokemon.Length];
                    for(int i=0; i<pokemon.Length; i++){
                        party[i] = new Pokemon((int)(pokemon[i].pokemon), false, pokemon[i].level);
                        party[i].name = pokemon[i].name;
                    }
                    currentState = States.InBattle;
                    trainerPosition = transform.position - direct.normalized*10;
                }
            }
            break;}

        case States.InBattle:	InBattle();	break;

        }
    }
开发者ID:RPenergy,项目名称:PokemonNXT,代码行数:30,代码来源:Trainer.cs

示例6: OpenStatWindow

    //Creates a box for a Pokemon Overview.  Currently shows a base stat overview for the current
    //selected pokemon.  Having trouble converting out move and item names for the overview.
    //Currently has hard coded names for items/moves to test UI spacing.
    public void OpenStatWindow(Pokemon pkmn)
    {
        if (dataWindow) {
            GUI.DrawTexture (new Rect (Screen.width - 275, Screen.height - 250, 250, 250), GUImgr.gradRight);
            /*foreach (var slot in Player.trainer.party.GetSlots ()) {
        var pokemon = slot.pokemon;

        if (party.IsActive (pokemon)) {*/
            GUI.Label (new Rect (Screen.width - 270, Screen.height - 245, 200, 25), pkmn.GetName ());
            GUI.Label (new Rect (Screen.width - 270, Screen.height - 215, 75, 25), "HP: " + pkmn.CurrentHP () + "/" + pkmn.TotalHP ());
            GUI.Label (new Rect (Screen.width - 270, Screen.height - 185, 75, 25), "Atk: " + pkmn.TotalAttack ());
            GUI.Label (new Rect (Screen.width - 270, Screen.height - 155, 75, 25), "Def: " + pkmn.TotalDefence ());
            GUI.Label (new Rect (Screen.width - 270, Screen.height - 125, 75, 25), "Spd: " + pkmn.TotalSpeed ());
            //As far as I can tell, held items aren't implemented, so I'm just hardcoding None.
            GUI.Label (new Rect (Screen.width - 195, Screen.height - 215, 190, 25), "Item: None" /*+ pokemon.GetItemName()*/);
            int height = 185;
            int loop = 1;
            foreach (Move mve in pkmn.moves) {
                    if (loop > 4)
                            break;
                    GUI.Label (new Rect (Screen.width - 195, Screen.height - height, 190, 25), "Move " + loop + ": " + mve.ToFriendlyString ());
                    loop++;
                    height -= 30;
            }
        }
        //GUI.Label (new Rect (Screen.width - 195, Screen.height - 185, 190, 25), "Move 1: Hydro Cannon" /*+ pokemon.GetMoveName(0)*/);
        //GUI.Label (new Rect (Screen.width - 195, Screen.height - 155, 190, 25), "Move 2: " /*+ pokemon.GetMoveName(0)*/);
        //GUI.Label (new Rect (Screen.width - 195, Screen.height - 125, 190, 25), "Move 3: " /*+ pokemon.GetMoveName(0)*/);
        //GUI.Label (new Rect (Screen.width - 195, Screen.height - 95, 190, 25), "Move 4: " /*+ pokemon.GetMoveName(0)*/);
    }
开发者ID:jackleo-,项目名称:Unity,代码行数:33,代码来源:GameGUI.cs

示例7: Start

    // Use this for initialization
    void Start()
    {
        Attack tackle = new Attack ();
        Attack tackle2 = new Attack ();
        Attack tackle3 = new Attack ();
        Attack tackle4 = new Attack ();

        Pokemon nikuh = new Pokemon ();

        tackle.aname = "Milchmelker";
        tackle.ap = 30;
        tackle.maxAp = 30;
        tackle.precise = 100;
        tackle.strenght = 10;
        tackle.type = Attack.Type.physical;

        tackle2.aname = "Gemuhe";
        tackle2.ap = 20;
        tackle2.maxAp = 30;
        tackle2.precise = 100;
        tackle2.strenght = 10;
        tackle2.type = Attack.Type.physical;

        tackle3.aname = "Hufstampfer";
        tackle3.ap = 10;
        tackle3.maxAp = 30;
        tackle3.precise = 100;
        tackle3.strenght = 10;
        tackle3.type = Attack.Type.physical;

        tackle4.aname = "Dubstepkanone";
        tackle4.ap = 40;
        tackle4.maxAp = 50;
        tackle4.precise = 100;
        tackle4.strenght = 10;
        tackle4.type = Attack.Type.physical;

        nikuh.name = "Nikuh";
        nikuh.attack = 20;
        nikuh.defense = 15;
        nikuh.specialAttack = 13;
        nikuh.specialDefense = 8;
        nikuh.experience = 300;
        nikuh.level = 6;
        nikuh.id = 0;
        nikuh.pokedexId = 1;
        nikuh.trainer = InterSceneData.main.playerName;
        nikuh.types = new Pokemon.Type[10];
        nikuh.types [0] = Pokemon.Type.grass;
        nikuh.maxHp = 50;
        nikuh.hp = 50;
        nikuh.picture = Resources.LoadAll<Sprite> ("Sprites/pokemon_battle")[245];
        nikuh.attacks = new Attack[4];
        nikuh.attacks [0] = tackle;
        nikuh.attacks [1] = tackle2;
        nikuh.attacks [2] = tackle3;
        nikuh.attacks [3] = tackle4;

        insertPokemon (nikuh);
    }
开发者ID:stone3311,项目名称:Thomasmon,代码行数:61,代码来源:TrainerPokemonDatabase.cs

示例8: InBattle

    void InBattle()
    {
        //move trainer to position
        Vector3 direct = trainerPos-transform.position;
        direct.y = 0;
        if (direct.sqrMagnitude>2){
            transform.rotation = Quaternion.LookRotation(direct);
            GetComponent<Animator>().SetBool("run", true);
        }else{
            if (direct.sqrMagnitude>1)	transform.position += direct;
            if (currentPokemon==null){
                currentPokemon = trainer.pokemon[0];
            }

            if (currentPokemon.obj!=null){
                direct = currentPokemon.obj.transform.position-transform.position;
            }else{
                direct = enemyTrainer.transform.position-transform.position;
            }
            direct.y = 0;
            transform.rotation = Quaternion.LookRotation(direct);
            GetComponent<Animator>().SetBool("run", false);
            if (currentPokemon.obj==null)	trainer.ThrowPokemon(trainer.pokemon[0]);
        }

        /*if (currentPokemonObj!=null){
            PokemonTrainer pokeComp = currentPokemonObj.GetComponent<PokemonTrainer>;
            if (pokeComp!=null){
                if (Player.pokemonObj!=null){
                    pokeComp.AttackEnemy(Player.pokemonObj);
                }
            }
        }*/
    }
开发者ID:Jebbado,项目名称:PokemonNXT,代码行数:34,代码来源:TrainerAI.cs

示例9: GetDamage

 public int GetDamage(Pokemon attacker, Pokemon defender)
 {
     //log.Log(attacker.Name + " used Pound on " + defender.Name);
     double damage = (2 * attacker.Level + 10) / 250.0;
     double modifier = random.NextDouble() * (1.0 - 0.85) + 0.85;
     if (random.Critical()) //determines critical hit!
     {
         //log.Log("Critical Hit!");
         modifier *= 2;
     }
     if (random.FlipCoin()) //determines which type is hit with.
     {
         modifier *= attacker.Type_1_Chart[defender.Type_1];
         modifier *= attacker.Type_1_Chart[defender.Type_2];
     }
     else
     {
         modifier *= attacker.Type_1_Chart[defender.Type_1];
         modifier *= attacker.Type_1_Chart[defender.Type_2];
     }
     damage *= (double) attacker.AttackPower / (double) defender.Defense;
     damage *= 40;
     damage += 2;
     damage *= modifier;
     //log.Log("Total damage: " + damage);
     if (damage == 0)
     {
         return 1;
     }
     return (int)(Math.Round(damage));
 }
开发者ID:alikoneko,项目名称:AI_Final_Project,代码行数:31,代码来源:Pound.cs

示例10: Client

        public Client(ClientIdentifier id)
        {
            Id = id;

            var stats = new Stats { Atk = 10, Def = 10, HP = 30, SpAtk = 10, SpDef = 10, Speed = 10 };
            var data = new PokemonData { Id = 0, Type1 = PokemonType.Normal, BaseStats = stats };

            var moveData = new MoveData
            {
                Name = "Move",
                Accuracy = 100,
                Damage = 120,
                DamageType = DamageCategory.Physical,
                PokemonType = PokemonType.Normal,
                PP = 20
            };

            for (int i = 0; i < 6; i++)
            {
                var pkmn = new Pokemon(data, stats) { Name = Id.Name + "_Pkmn" + i, Level = i + 20};
                for (int j = 0; j < 2; j++)
                    pkmn.SetMove(j, new Move(moveData));
                pkmn.Stats.HP = 30;
                pkmn.HP = 30;

                pokemons.Add(pkmn);
            }
        }
开发者ID:Nexus87,项目名称:PokeClone,代码行数:28,代码来源:Client.cs

示例11: GetDamage

 public int GetDamage(Pokemon attacker, Pokemon defender)
 {
     log.Log(attacker.Name + " used Surf on " + defender.Name);
     double damage = (2 * attacker.Level + 10) / 250.0;
     double modifier = random.NextDouble() * (1.0 - 0.85) + 0.85;
     if (random.Critical()) //determines critical hit!
     {
         log.Log("Critical Hit!");
         modifier *= 2;
     }
     if (random.FlipCoin()) //determines which type is hit with.
     {
         modifier *= TypeEffectivenessModifier(attacker.Type_1, defender);
     }
     else
     {
         modifier *= TypeEffectivenessModifier(attacker.Type_2, defender);
     }
     damage *= ((attacker.SpecialAttack) / (defender.SpecialDefense));
     damage *= 90;
     damage += 2;
     damage *= modifier;
     log.Log("Total damage: " + damage);
     if (damage == 1)
     {
         return 1;
     }
     return (int)(Math.Round(damage));
 }
开发者ID:alikoneko,项目名称:DarwinianPokemon,代码行数:29,代码来源:Surf.cs

示例12: updatePokemonStats

    void updatePokemonStats()
    {
        poke = Party.S.party [Party.S.activeItem];
        nam = this.transform.Find ("NameAndLevel").gameObject;
        atk1 = this.transform.Find ("Attack1").gameObject;
        atk2 = this.transform.Find ("Attack2").gameObject;
        atk3 = this.transform.Find ("Attack3").gameObject;
        atk4 = this.transform.Find ("Attack4").gameObject;
        atk = this.transform.Find ("Attack").gameObject;
        def = this.transform.Find ("Defense").gameObject;
        spl = this.transform.Find ("Special").gameObject;
        spd = this.transform.Find ("Speed").gameObject;
        exp = this.transform.Find ("EXPtoNext").gameObject;

        GUIText gui = nam.GetComponent<GUIText> ();
        gui.text = poke.Name + " lvl " + poke.Level;

        gui = atk1.GetComponent<GUIText> ();
        gui.text = poke.Attacks [0].AttackName + " " + poke.Attacks [0].AttackType + " " +
            poke.Attacks [0].AttackPPRemaining + "/" + poke.Attacks [0].AttackPP;

        gui = atk2.GetComponent<GUIText> ();
        if (poke.Attacks [1].AttackName == "-") {
            gui.text = "-";
        } else {
            gui.text = poke.Attacks [1].AttackName + " " + poke.Attacks [1].AttackType + " " +
                poke.Attacks [1].AttackPPRemaining + "/" + poke.Attacks [1].AttackPP;
        }

        gui = atk3.GetComponent<GUIText> ();
        if (poke.Attacks [2].AttackName == "-") {
            gui.text = "-";
        } else {
            gui.text = poke.Attacks [2].AttackName + " " + poke.Attacks [2].AttackType + " " +
                poke.Attacks [2].AttackPPRemaining + "/" + poke.Attacks [2].AttackPP;
        }

        gui = atk4.GetComponent<GUIText> ();
        if (poke.Attacks [3].AttackName == "-") {
            gui.text = "-";
        } else {
            gui.text = poke.Attacks [3].AttackName + " " + poke.Attacks [3].AttackType + " " +
                poke.Attacks [3].AttackPPRemaining + "/" + poke.Attacks [3].AttackPP;
        }

        gui = atk.GetComponent<GUIText> ();
        gui.text = "Attack: " + poke.AttackStat;

        gui = def.GetComponent<GUIText> ();
        gui.text = "Defense: " + poke.DefenseStat;

        gui = spl.GetComponent<GUIText> ();
        gui.text = "Special: " + poke.SpecialStat;

        gui = spd.GetComponent<GUIText> ();
        gui.text = "Speed: " + poke.SpeedStat;

        gui = exp.GetComponent<GUIText> ();
        gui.text = "Experience to next level: " + (poke.ExperienceToNext - poke.ExperienceCurrent);
    }
开发者ID:grackend,项目名称:pokemonv1,代码行数:60,代码来源:PokemonStats.cs

示例13: btCherche_Click

        private void btCherche_Click(object sender, EventArgs e)
        {
            if (ComboPok閙on.Text != "")
            {
                try
                {
                    //TODO modifier l'acc鑣 au pok閙on par l'index du combo
                    Pokemon p = X.PKlist[ComboPok閙on.SelectedIndex];
                    if (p.dependevo)
                    {
                        Pokemon evo = X.GetPok閙on(p.evolution.ToArray()[0].nom);
                        Pokemon p2 = new Pokemon();
                        X.CopyPokemon(p, p2);
                        p2.Oeuf1 = evo.Oeuf1;
                        p2.Oeuf2 = evo.Oeuf2;
                        X.argPokemon = p2;
                    }
                    else
                        X.argPokemon = p;

                    Stack<Capacite> cap = new Stack<Capacite>();

                    if (txtCapacit�Text == "" && txtCapacit�Text == "" && txtCapacit�Text == "" && txtCapacit�Text == "")
                    {
                        MessageBox.Show("Capacit� mal s閘ectionn�, click eul' nom dans la bo顃e!");
                        return;
                    }
                    if (txtCapacit�Text != "")
                        cap.Push(Xblood.GetCapacite(txtCapacit�Text));
                    if (txtCapacit�Text != "")
                        cap.Push(Xblood.GetCapacite(txtCapacit�Text));
                    if (txtCapacit�Text != "")
                        cap.Push(Xblood.GetCapacite(txtCapacit�Text));
                    if (txtCapacit�Text != "")
                        cap.Push(Xblood.GetCapacite(txtCapacit�Text));

                    X.argCapacite = cap.ToArray();
                    X.deepness = (int)NumUDDepth.Value;

                    lblBranches.Text = "";
                    lblLeaf.Text = "";
                    lblResult.Text = "Recherche...";
                    btChercher.Enabled = false;
                    btStop.Enabled = true;

                    t = new Thread(new ThreadStart(X.StartThread));
                    //t.Priority = ThreadPriority.AboveNormal;

                    t.Start();
                    timer1.Start();
                }
                catch
                {
                    MessageBox.Show("Pok閙on mal s閘ectionn�, click eul' nom dans la bo顃e!");
                }
            }
            else
                TVr閟ultat.Nodes.Clear();
        }
开发者ID:xamtheone,项目名称:URA-pokemon,代码行数:59,代码来源:FormAccouplement.cs

示例14: CheckFor

 public bool CheckFor(Pokemon pok)
 {
     if (pokemon.Contains (pok)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:stone3311,项目名称:Thomasmon,代码行数:8,代码来源:Pokemons.cs

示例15: CreateModel

        public static MoveModel CreateModel(Pokemon pkmn)
        {
            var wrapper = new PokemonWrapper(new ClientIdentifier());
            if(pkmn != null)
                wrapper.Pokemon = pkmn;

            return CreateModel(wrapper);
        }
开发者ID:Nexus87,项目名称:PokeClone,代码行数:8,代码来源:MoveModelTestFactory.cs


注:本文中的Pokemon类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。