Example #1
0
 //随机生成
 void RandomOnce()
 {
     int[] baseNum = GetRandomInt(20, 1, 50);      //随机生成的基数
     myHero.setHero_age(baseNum[0] * 2);           //随机生成2~100岁
     myHero.setHero_sex(baseNum[1] % 2 + 1);       //性别 只有1和2 1=男 2=女
     myHero.setHero_agility(baseNum[2]);           //敏捷 1~50
     myHero.setHero_bloodtype(baseNum[3] % 4 + 1); //血型 1=A血 2=B血 3=O血 4=AB血
     //稀有血型概率1/1000的概率 5=RH血
     if (dran.startBet(1, 1000))
     {
         myHero.setHero_bloodtype(5);
     }
     myHero.setHero_charm(baseNum[4]);         //魅力 1~50
     myHero.setHero_endurance(baseNum[5]);     //耐力 1~50
     myHero.setHero_eq(baseNum[6]);            //情商 1~50
     myHero.setHero_eye(baseNum[7] * 10);      //视力 10~500
     myHero.setHero_face(baseNum[8]);          //颜值 1~50
     myHero.setHero_group(baseNum[9] % 6 + 1); //种族 1=人类,2=兽人,3=恶魔,4=精灵,5=不死族 6=龙人
     //稀有种族概率 1/2000 7=未来人
     if (dran.startBet(1, 2000))
     {
         myHero.setHero_group(7);
     }
     //稀有种族概率 1/5000 8=灵魂
     if (dran.startBet(1, 5000))
     {
         myHero.setHero_group(8);
     }
     myHero.setHero_hair(baseNum[10] * 100);            //发量 100~5000
     myHero.setHero_height(baseNum[11] % 5 * 10 + 150); //身高 160~200
     myHero.setHero_iq(baseNum[12]);                    //智商 1~50
     myHero.setHero_job(baseNum[13] % 10 + 1);          //职业 1=无职业 2=程序员 3=会计 4=建筑工 5=厨师 6=警察 7=教师 8=科学家 9=语言学家 10=律师
     //稀有职业概率 1/1000 11=军人
     if (dran.startBet(1, 1000))
     {
         myHero.setHero_job(11);
     }
     //稀有职业概率 1/2000 12=格斗家
     if (dran.startBet(1, 1000))
     {
         myHero.setHero_job(12);
     }
     myHero.setHero_lucky(baseNum[14]);          //运气 1~50
     myHero.setHero_money(baseNum[15] * 100);    //金钱 100~5000
     myHero.setHero_strength(baseNum[16]);       //力量 1~50
     myHero.setHero_talk(baseNum[17]);           //口才 1~50
     myHero.setHero_weight(baseNum[18] + 50);    //体重 51~100
     MaxRandomTimes--;
     randomBtn.Text = "还能随机" + MaxRandomTimes + "次";
     if (MaxRandomTimes == 0)
     {
         randomBtn.Enabled = false;
     }
 }
Example #2
0
 //当英雄没看到敌人时,就要乱打
 private void attack_aimless_Click(object sender, EventArgs e)
 {
     if (dr.startBet(1, 7))
     {
         if (radioButton1.Checked)
         {
             HeroAttackAction.AttackEnemy(BF.getMyHero(), ((defaultMob)BF.getMyHero().getStandBlock().getMob_list()[index]), 1);
         }
         else if (radioButton2.Checked)
         {
             HeroAttackAction.AttackEnemy(BF.getMyHero(), ((defaultMob)BF.getMyHero().getStandBlock().getMob_list()[index]), 2);
         }
         else if (radioButton3.Checked)
         {
             HeroAttackAction.AttackEnemy(BF.getMyHero(), ((defaultMob)BF.getMyHero().getStandBlock().getMob_list()[index]), 5);
         }
         BF.setHeroLastMove("乱打");
         BSEO.setIsHeroSeeEnemy(true);
         EndTurn();
     }
     else
     {
         this.BattleMsg.Items.Add("你没打中什么");
         BF.setHeroLastMove("乱打");
         EndTurn();
     }
 }
 public void judgeOnce(theHero hero, defaultMob enemy)
 {
     if (!getIsHeroSeeEnemy())                                                  //英雄若没看到敌人,则要判断
     {
         if (dr.startBet(1000 - hero.getHero_eye(), hero.getHero_eye() + 1000)) //看见了
         {
             setIsHeroSeeEnemy(true);                                           //英雄看到敌人
         }
     }
     if (!getIsEnemySeeHero())//若敌人没看到英雄,则判断
     {
         if (dr.startBet(200 - hero.getHero_agility(), 200 + hero.getHero_agility()))
         {
             setIsEnemySeeHero(true);//敌人看到英雄 英雄敏捷越高,越不容易看到
         }
     }
 }
Example #4
0
 public defaultIll InitIllByIDwithRate(int ID, int rate)
 {
     if (dr.startBet(rate, 1000))
     {
         return(iii.getIllByID(ID));
     }
     else
     {
         return(null);
     }
 }
Example #5
0
 public void LootOnce()
 {
     for (int i = 0; i < loot.getItemID_canLoot().Count; i++)
     {
         if (dr.startBet((int)loot.getItemID_lootRate()[i] + loot.getLootIndex(), loot.getMaxLootIndex()))
         {
             //
             loot.getTheBlock().getItemInGround().Add(AddItemAction.AddOneItemByID((int)loot.getItemID_canLoot()[i]));
             //AddItemAction.AddOneItemByIDToBlock((int)loot.getItemID_canLoot()[i], loot.getTheBlock());
             Thread.Sleep(10);
             getLootMessage().Items.Add("你搜刮到了一个东西");
             isLootSomething = true;
         }
     }
 }
Example #6
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());
                    }
                }
            }
        }
Example #7
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));
 }
        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);
            }
        }