day03 c# 定义一个简单的英雄类

public class Hero               //英雄类
    {
        public int name;
        public int attack;
        public int Hp;
        public int Mp;
        public int defense;
        public int moveSpeed;
        public int grade;
        public weapon holdweapon;
        public void addWeapon(Hero hero, weapon weapon)  //穿武器
        {
            if (hero.holdweapon.name == weapon.name)
            {
                Hp += weapon.HpAdd;
                Mp += weapon.MpAdd;
                //懒得写了。。。
            }
        }
        public void unloadWeapon(Hero hero, weapon weapon)  //卸武器
        {
            if (hero.holdweapon.name == weapon.name)
            {
                Hp -= weapon.HpAdd;
                Mp -= weapon.MpAdd;
                //懒得写了。。。
            }
        }
        public void redueHp(weapon weapon,Hero hero)        //掉血
        {
            hero.Hp -= weapon.atkAdd;
        }
        public void addGrade(Player player1, Player player2)        //升级
        {
            if (player2.HP < 0)
            {
                player1.HP += 200;          
            }
        }

    }

 

你可能感兴趣的:(day03 c# 定义一个简单的英雄类)