Ejemplo n.º 1
0
 public void heroIncreasePee()  //增加尿量
 {
     if (getPee() + getPeeIncreaseIndex() >= getMaxPee())
     {
         setPee(getMaxPee());
         return;
     }
     setPee(getPee() + getPeeIncreaseIndex());
     if (getPeeIncreaseIndex() <= 0)
     {
         setPeeIncreaseIndex(0);
         return;
     }
     setPeeIncreaseIndex((int)getPeeIncreaseIndex() / dr.getRandomNum(1, 3));
     return;
 }
Ejemplo n.º 2
0
 public void initDistence()
 {
     for (int i = 0; i < getMyHero().getStandBlock().getMob_Count(); i++)
     {
         getDistence().Add(dr.getRandomNum(4, 30));
     }
 }
Ejemplo n.º 3
0
        //在英雄的 range*range周围生成怪物 随机的 index概率
        public void AddAnMobOnRandomBlockNearbyHero(int range, int index, int maxIndex)
        {
            int x, y;
            int mob_ID;

            x = getMyHero().getLoc_x();
            y = getMyHero().getLoc_y();
            for (int i = (((x - range) <= 0) ? 0 : x - range); i < (((x + range) >= 399) ? 399 : x + range); i++)
            {
                for (int j = (((y - range) <= 0) ? 0 : y - range); j < (((y + range) >= 399) ? 399 : y + range); j++)
                {
                    if (dr.startBet(index, maxIndex))
                    {
                        mob_ID = dr.getRandomNum(1, 2);
                        defaultMob newMob = InitMobByID(mob_ID);
                        getMyWorld().getBlockByXY(i, j).getMob_list().Add(newMob);
                        getMyWorld().getBlockByXY(i, j).setMob_Count(getMyWorld().getBlockByXY(i, j).getMob_Count() + 1);
                        getMessageBox().Items.Add("在" + i + "," + j + "位置生成了一只" + newMob.getMob_Name());
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void Loot()
        {
            if (loot.getHero().isOutOfEnergy(5))
            {
                getLootMessage().Items.Add("你没有精力来搜刮了");
                return;
            }

            if (loot.getLootIndex() == 0)
            {
                getLootMessage().Items.Add("没搜刮到什么东西"); return;
            }
            for (int i = 0; i < dr.getRandomNum(1, loot.getHero().getHero_lucky()); i++)
            {
                LootOnce();
            }
            if (!isLootSomething)
            {
                getLootMessage().Items.Add("运气真差,啥都没搜刮到");
            }
            loot.setLootIndex(0);
            loot.getHero().lootCauseDecreaseEnergy();
        }
Ejemplo n.º 5
0
 public void LevelUp(theHero hero, System.Windows.Forms.ListBox Msg)
 {
     Msg.Items.Add("恭喜升级!你升到了" + hero.getLevel());
     if (dr.startBet(1, 5))
     {
         i = dr.getRandomNum(1, 3);
         hero.setHero_strength(hero.getHero_strength() + i);
         Msg.Items.Add("力量+" + i);
     }
     if (dr.startBet(1, 5))
     {
         i = dr.getRandomNum(1, 3);
         hero.setHero_iq(hero.getHero_iq() + i);
         Msg.Items.Add("智商+" + i);
     }
     if (dr.startBet(1, 5))
     {
         i = dr.getRandomNum(1, 3);
         hero.setHero_lucky(hero.getHero_lucky() + i);
         Msg.Items.Add("幸运+" + i);
     }
     if (dr.startBet(1, 5))
     {
         i = dr.getRandomNum(1, 3);
         hero.setHero_charm(hero.getHero_charm() + i);
         Msg.Items.Add("魅力+" + i);
     }
     if (dr.startBet(1, 5))
     {
         i = dr.getRandomNum(1, 3);
         hero.setHero_agility(hero.getHero_agility() + i);
         Msg.Items.Add("敏捷+" + i);
     }
     if (dr.startBet(1, 5))
     {
         i = dr.getRandomNum(1, 3);
         hero.setHero_face(hero.getHero_face() + i);
         Msg.Items.Add("颜值+" + i);
     }
     if (dr.startBet(1, 5))
     {
         i = dr.getRandomNum(1, 3);
         hero.setHero_eq(hero.getHero_eq() + i);
         Msg.Items.Add("情商+" + i);
     }
     if (dr.startBet(1, 5))
     {
         i = dr.getRandomNum(1, 3);
         hero.setHero_talk(hero.getHero_talk() + i);
         Msg.Items.Add("口才+" + i);
     }
     if (dr.startBet(1, 5))
     {
         i = dr.getRandomNum(1, 3);
         hero.setHero_endurance(hero.getHero_endurance() + i);
         Msg.Items.Add("耐力+" + i);
     }
     hero.setMaxHp(hero.getMaxHp() + (int)(hero.getHero_endurance() * 0.05));
     hero.setMaxHungry(hero.getMaxHungry() + (int)(hero.getHero_endurance() * 0.04));
     hero.setMaxThirsty(hero.getMaxThirsty() + (int)(hero.getHero_endurance() * 0.04));
     hero.setMaxImmunity(hero.getMaxImmunity() + (int)(hero.getHero_endurance() * 0.03 + hero.getHero_eq() * 0.03));
     hero.setMaxBlood(hero.getMaxBlood() + (int)(hero.getHero_strength() * 0.04 + hero.getHero_iq()));
     hero.setMaxPain(hero.getMaxPain() + (int)(hero.getHero_endurance() * 0.02 + hero.getHero_strength() * 0.03));
     hero.setMaxEnergy(hero.getMaxEnergy() + (int)(hero.getHero_agility() * 0.05 + hero.getHero_strength() * 0.04));
 }
Ejemplo n.º 6
0
        public int AttackByLeftHand(theHero myHero)
        {
            if (myHero.isOutOfEnergy(1))
            {
                getMessageBox().Items.Add("没有多余的精力来攻击了!"); return(0);
            }
            int Damage;

            if (myHero.getHero_LeftHand().getIsEquipedSomething())
            {
                switch (myHero.getHero_LeftHand().getTakeInHand().getType())
                {
                case 2:
                {         //单手武器
                    Damage = (int)(myHero.getHero_strength() * 0.5) + dr.getRandomNum(myHero.getHero_LeftHand().getTakeInHand().getMinDamage(), myHero.getHero_LeftHand().getTakeInHand().getMaxDamage());
                    if (!dr.startBet(myHero.getHero_LeftHand().getTakeInHand().getHitRate(), 100))
                    {
                        getMessageBox().Items.Add("你用拿着" + myHero.getHero_LeftHand().getTakeInHand().getName() + "的左手攻击了一次,但没打中");
                        //System.Console.WriteLine("你用拿着" + myHero.getHero_LeftHand().getTakeInHand().getName() + "的左手攻击了一次,但没打中");
                        return(0);
                    }

                    if (dr.startBet(myHero.getHero_LeftHand().getTakeInHand().getGreatDamageRate(), 100))
                    {
                        Damage = Damage * myHero.getHero_LeftHand().getTakeInHand().getGreatDamageIndex();
                        getMessageBox().Items.Add("你用拿着" + myHero.getHero_LeftHand().getTakeInHand().getName() + "的左手攻击了一次,居然出现了暴击!\n造成了" + Damage + "点伤害");
                        // System.Console.WriteLine("你用拿着" + myHero.getHero_LeftHand().getTakeInHand().getName() + "的左手攻击了一次,居然出现了暴击!\n造成了" + Damage + "点伤害");
                    }
                    else
                    {
                        getMessageBox().Items.Add("你用拿着" + myHero.getHero_LeftHand().getTakeInHand().getName() + "的左手攻击了一次\n造成了" + Damage + "点伤害");
                        //System.Console.WriteLine("你用拿着" + myHero.getHero_LeftHand().getTakeInHand().getName() + "的左手攻击了一次\n造成了" + Damage + "点伤害");
                    }
                    myHero.getHero_LeftHand().getTakeInHand().decreaseEnduranceByAttack();
                    myHero.getHeroBag().checkItems();
                    myHero.getHeroBag().updata(myHero);
                    myHero.attackCauseDecreaseEnergy();
                    return(Damage);
                }

                case 3:
                {
                    Damage = (int)(myHero.getHero_strength() * 0.3);
                    getMessageBox().Items.Add("你用拿着" + myHero.getHero_LeftHand().getTakeInHand().getName() + "的左手打了一次,\n造成了" + Damage + "点伤害");
                    //System.Console.WriteLine("你用拿着" + myHero.getHero_LeftHand().getTakeInHand().getName() + "的左手打了一次,\n造成了" + Damage + "点伤害");
                    myHero.getHero_LeftHand().getTakeInHand().DecreaseEndurance();
                    myHero.getHeroBag().checkItems();
                    myHero.getHeroBag().updata(myHero);
                    myHero.attackCauseDecreaseEnergy();
                    return(Damage);
                }

                case 4:
                {
                    getMessageBox().Items.Add("双手武器不能单手用啦");
                    // System.Console.WriteLine("双手武器不能单手用啦");
                    return(0);
                }

                default: return(0);
                }
            }
            else
            {
                Damage = (int)(myHero.getHero_strength() * 0.2);
                getMessageBox().Items.Add("你用左手拳头打了一拳,\n造成了" + Damage + "点伤害");
                // System.Console.WriteLine("你用左手拳头打了一拳,\n造成了" + Damage + "点伤害");
                myHero.attackCauseDecreaseEnergy();
                return(Damage);
            }
        }