3DMGAME 3DM首页 新闻中心 前瞻 | 评测 游戏库 热门 | 最新 攻略中心 攻略 | 秘籍 下载中心 游戏 | 汉化 购买正版 论坛

注册 登录

QQ登录

只需一步,快速开始

查看: 3842|回复: 50
打印 上一主题 下一主题

[原创] Thea 2 The Shattering Build 0657(0555)升级 属性 更随机 修改 按取消(cancel) 后 再按升级重新随机属性

  [复制链接]

14

主题

797

帖子

1344

积分

游戏狂人

Rank: 6Rank: 6

贡献度
105
金元
9044
积分
1344
精华
2
注册时间
2012-1-8
跳转到指定楼层
主题
发表于 2019-8-5 20:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 psyduck197 于 2020-3-24 21:42 编辑


程式对 属性排序 由人物属性的数值由大到小
然后 程式取数个随机数 取最小值
再来 取属性排序第X个 属性

所以 人物属性的数 越大越容易抽中
我改了 取随机数程式 只且取一次



修改Thea 2 The Shattering Build 0332\Thea2_Data\Managed\Assembly-CSharp.dll
                Thea2.Client:                                  CharacterProgression:








private void ItemUpdate(GameObject item, object source, object data, int index)
                {
                        CharacterProgressionListItem cItem = item.GetComponent<CharacterProgressionListItem>();
                        ClientTurnSummaryData clientTurnSummaryData = source as ClientTurnSummaryData;
                        ClientGroupData @for = ClientGroupData.GetFor(clientTurnSummaryData.groupID);
                        ClientEntityCharacter character = null;
                        if (@for != null)
                        {
                                character = (@for.GetEntity(clientTurnSummaryData.relatedValue) as ClientEntityCharacter);
                        }
                        if (character == null)
                        {
                                foreach (KeyValuePair<int, ClientGroupData> keyValuePair in ClientGroupData.GetAll())
                                {
                                        if (keyValuePair.Value != null && keyValuePair.Value.GetOwnerID() == RootNetworkManager.GetMyPlayerID())
                                        {
                                                ClientEntity entity = keyValuePair.Value.GetEntity(clientTurnSummaryData.relatedValue);
                                                if (entity != null)
                                                {
                                                        character = (entity as ClientEntityCharacter);
                                                }
                                        }
                                }
                        }
                        if (character == null)
                        {
                                return;
                        }
                        int seed = World.gameSeed ^ character.Id ^ character.Level << 3;
                        MHRandom mhrandom = new MHRandom(seed);
                        string instanceName = character.SubraceName;
                        Subrace instanceFromDB = Globals.GetInstanceFromDB<Subrace>(instanceName);
                        DBDef.Tag t1 = null;
                        DBDef.Tag t2 = null;
                        DBDef.Tag t3 = null;
                        List<Multitype<Skill, FInt>> chosenSkills = null;
                        bool flag = character.Level % 2 == 1;
                        if (flag)
                        {
                                List<CountedTag> list = new List<CountedTag>(instanceFromDB.mainSubraceAttributes);
                                list.Sort((CountedTag a, CountedTag b) => -a.amount.CompareTo(b.amount));
                                int index2 = Mathf.Min(new int[]
                                {
                                        //mhrandom.GetInt(0, list.Count),
                                       // mhrandom.GetInt(0, list.Count),
                                        //mhrandom.GetInt(0, list.Count)                                            

                                       UnityEngine.Random.Range(0, list.Count)
                                });
                                t1 = list[index2].tag;
                                list.RemoveAt(index2);
                               //index2 = Mathf.Min(mhrandom.GetInt(0, list.Count), mhrandom.GetInt(0, list.Count));
                               index2 = UnityEngine.Random.Range(0, list.Count);
                                t2 = list[index2].tag;
                                list.RemoveAt(index2);
                                //index2 = Mathf.Min(mhrandom.GetInt(0, list.Count), mhrandom.GetInt(0, list.Count));
                               index2 = UnityEngine.Random.Range(0, list.Count);                                t3 = list[index2].tag;
                                list.RemoveAt(index2);
                        }





                        if (!flag)

                        {
                                List<Multitype<Skill, FInt>> list2 = new List<Multitype<Skill, FInt>>();
                                if (!NetType.IsNullOrEmpty(character.LearnedSkills))
                                {
                                        foreach (NetType netType in character.LearnedSkills.value)
                                        {
                                                NetStringFInt2 netStringFInt = (NetStringFInt2)netType;
                                                Skill instanceFromDB2 = Globals.GetInstanceFromDB<Skill>(netStringFInt.name);
                                                FInt value = netStringFInt.value;
                                                if (value < 5 && netStringFInt.value2 == FInt.ZERO)
                                                {
                                                        list2.Add(new Multitype<Skill, FInt>(instanceFromDB2, value));
                                                }
                                        }
                                }
                                if (instanceFromDB.advancementSkills != null && SkillInstance.skillPacks.ContainsKey(instanceFromDB.advancementSkills))
                                {
                                        List<Skill> list3 = SkillInstance.skillPacks[instanceFromDB.advancementSkills];
                                        using (List<Skill>.Enumerator enumerator3 = list3.GetEnumerator())
                                        {
                                                while (enumerator3.MoveNext())
                                                {
                                                        Skill v = enumerator3.Current;
                                                        if (list2.Find((Multitype<Skill, FInt> o) => o.t0 == v) == null)
                                                        {
                                                                list2.Add(new Multitype<Skill, FInt>(v, FInt.ZERO));
                                                        }
                                                }
                                        }
                                }
                                list2 = list2.FindAll((Multitype<Skill, FInt> o) => o.t1 * o.t1 < character.Level);
                                if (list2.Count > 2)
                                {
                                        chosenSkills = new List<Multitype<Skill, FInt>>();
                                        int @int = mhrandom.GetInt(0, list2.Count);
                                        Multitype<Skill, FInt> multitype = list2[@int];
                                        if (multitype.t1 == FInt.ZERO)
                                        {
                                                @int = mhrandom.GetInt(0, list2.Count);
                                        }
                                        chosenSkills.Add(list2[@int]);
                                        list2.RemoveAt(@int);
                                        int int2 = mhrandom.GetInt(0, list2.Count);
                                        multitype = list2[int2];
                                        if (multitype.t1 == FInt.ZERO)
                                        {
                                                int2 = mhrandom.GetInt(0, list2.Count);
                                        }
                                        chosenSkills.Add(list2[int2]);
                                }
                                else
                                {
                                        chosenSkills = list2;
                                }
                        }
                        cItem.characterName.text = character.GetName();
                        cItem.previousLevel.text = character.Level.ToString();
                        cItem.newLevel.text = (character.Level + 1).ToString();
                        cItem.characterIcon.texture = character.GetIcon();
                        cItem.levelUpIndicator.SetActive(!this.IsSet(character));
                        RolloverCharacterTooltip.SetCharacter(cItem.characterInputCatch, character);
                        if (flag)
                        {
                                cItem.tagGroup.SetActive(true);
                                cItem.skillGroup.SetActive(false);
                                cItem.attribute1Icon.texture = AssetManager.GetTexture(t1);
                                cItem.attribute2Icon.texture = AssetManager.GetTexture(t2);
                                cItem.attribute3Icon.texture = AssetManager.GetTexture(t3);
                                cItem.attribute1Value.text = "+2";
                                cItem.attribute2Value.text = "+1";
                                cItem.attribute3Value.text = "+1";
                                cItem.attribute1.onValueChanged.RemoveAllListeners();
                                cItem.attribute2.onValueChanged.RemoveAllListeners();
                                cItem.attribute3.onValueChanged.RemoveAllListeners();
                                cItem.attribute1.isOn = this.IsTag(character, t1);
                                cItem.attribute2.isOn = this.IsTag(character, t2);
                                cItem.attribute3.isOn = this.IsTag(character, t3);
                                cItem.attribute1.onValueChanged.AddListener(delegate(bool b)
                                {
                                        this.SetTag(character, t1, 2);        
                                        cItem.levelUpIndicator.SetActive(false);
                                });
                                RolloverTooltip.SetTag(cItem.attribute1.gameObject, t1);
                                cItem.attribute2.onValueChanged.AddListener(delegate(bool b)
                                {
                                        this.SetTag(character, t2, 1);      
                                        cItem.levelUpIndicator.SetActive(false);
                                });
                                RolloverTooltip.SetTag(cItem.attribute2.gameObject, t2);
                                cItem.attribute3.onValueChanged.AddListener(delegate(bool b)
                                {
                                        this.SetTag(character, t3, 1);      
                                        cItem.levelUpIndicator.SetActive(false);
                                });
                                RolloverTooltip.SetTag(cItem.attribute3.gameObject, t3);
                        }
                        else
                        {
                                cItem.tagGroup.SetActive(false);
                                cItem.skillGroup.SetActive(true);
                                cItem.skill1.onValueChanged.RemoveAllListeners();
                                cItem.skill2.onValueChanged.RemoveAllListeners();
                                if (chosenSkills.Count > 0)
                                {
                                        cItem.skill1Group.SetActive(true);
                                        cItem.skill1Icon.texture = AssetManager.GetTexture(chosenSkills[0].t0);
                                        cItem.skill1New.SetActive(chosenSkills[0].t1 == FInt.ZERO);
                                        cItem.skill1.isOn = this.IsSkill(character, chosenSkills[0].t0.dbName);
                                        cItem.skill1.onValueChanged.AddListener(delegate(bool b)
                                        {
                                                if (b)
                                                {
                                                        this.SetSkill(character, chosenSkills[0].t0.dbName);
                                                        cItem.levelUpIndicator.SetActive(false);
                                                }
                                        });
                                        string dbName = chosenSkills[0].t0.dbName;
                                        FInt t = chosenSkills[0].t1;
                                        if (t == FInt.ZERO)
                                        {
                                                RolloverSkillTooltip component = cItem.skill1Icon.gameObject.GetComponent<RolloverSkillTooltip>();
                                                if (component != null)
                                                {
                                                        UnityEngine.Object.Destroy(component);
                                                }
                                        }
                                        else
                                        {
                                                RolloverSkillTooltip.SetSkill(cItem.skill1Icon.gameObject, new NetStringFInt2(dbName, t, FInt.ZERO), character);
                                        }
                                        RolloverSkillTooltip.SetSkill(cItem.skill1.gameObject, new NetStringFInt2(dbName, t + 1, FInt.ZERO), character);
                                }
                                else
                                {
                                        cItem.skill1Group.SetActive(false);
                                }
                                if (chosenSkills.Count > 1)
                                {
                                        cItem.skill2Group.SetActive(true);
                                        cItem.skill2Icon.texture = AssetManager.GetTexture(chosenSkills[1].t0);
                                        cItem.skill2New.SetActive(chosenSkills[1].t1 == FInt.ZERO);
                                        cItem.skill2.isOn = this.IsSkill(character, chosenSkills[1].t0.dbName);
                                        cItem.skill2.onValueChanged.AddListener(delegate(bool b)
                                        {
                                                if (b)
                                                {
                                                        this.SetSkill(character, chosenSkills[1].t0.dbName);
                                                        cItem.levelUpIndicator.SetActive(false);
                                                }
                                        });
                                        string dbName2 = chosenSkills[1].t0.dbName;
                                        FInt t4 = chosenSkills[1].t1;
                                        if (t4 == FInt.ZERO)
                                        {
                                                RolloverSkillTooltip component2 = cItem.skill2Icon.gameObject.GetComponent<RolloverSkillTooltip>();
                                                if (component2 != null)
                                                {
                                                        UnityEngine.Object.Destroy(component2);
                                                }
                                        }
                                        else
                                        {
                                                RolloverSkillTooltip.SetSkill(cItem.skill2Icon.gameObject, new NetStringFInt2(dbName2, t4, FInt.ZERO), character);
                                        }
                                        RolloverSkillTooltip.SetSkill(cItem.skill2.gameObject, new NetStringFInt2(dbName2, t4 + 1, FInt.ZERO), character);
                                }
                                else
                                {
                                        cItem.skill2Group.SetActive(false);
                                }
                        }
                }



Assembly-CSharp.zip.001

600 KB, 下载次数: 72

0555

Assembly-CSharp.zip.002

476.26 KB, 下载次数: 74

0555

0657Assembly-CSharp.zip.001

600 KB, 下载次数: 34

0657

0657Assembly-CSharp.zip.002

600 KB, 下载次数: 32

0657

0657Assembly-CSharp.zip.003

65.15 KB, 下载次数: 30

0657

评分

2

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|3DMGAME ( 京ICP备14006952号-1  沪公网安备 31011202006753号

GMT+8, 2026-5-11 04:46 , Processed in 0.040186 second(s), 19 queries , Memcached On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表