Ejemplo n.º 1
0
        private TypeSet ArmorType(TypeSet typeSet)
        {
            TypeSet helmet     = typeSet;
            TypeSet chestplate = typeSet;
            TypeSet leggings   = typeSet;

            if (DictionaryHelper.Armor(player.armor[0]).TryGetValue(player.armor[0].type, out ArmorTypeInfo helmetType))
            {
                helmet = new TypeSet(helmetType);
            }
            if (DictionaryHelper.Armor(player.armor[1]).TryGetValue(player.armor[1].type, out ArmorTypeInfo chestplateType))
            {
                chestplate = new TypeSet(chestplateType);
            }
            if (DictionaryHelper.Armor(player.armor[2]).TryGetValue(player.armor[2].type, out ArmorTypeInfo leggingsType))
            {
                leggings = new TypeSet(leggingsType);
            }

            bool primaryMatch   = helmet.Primary == chestplate.Primary && helmet.Primary == leggings.Primary;
            bool secondaryMatch = helmet.Secondary == chestplate.Secondary && helmet.Secondary == leggings.Secondary;
            bool typeMatch      = helmet.GetAbility == chestplate.GetAbility && helmet.GetAbility == leggings.GetAbility;

            if (primaryMatch && secondaryMatch)
            {
                typeSet.Primary   = helmet.Primary;
                typeSet.Secondary = helmet.Secondary;
                if (typeMatch)
                {
                    typeSet.GetAbility = helmet.GetAbility;
                }
            }

            return(typeSet);
        }
Ejemplo n.º 2
0
        public override void ModifyTooltips(Item item, List <TooltipLine> tooltips)
        {
            if (DictionaryHelper.Item(item).ContainsKey(item.type))
            {
                var line = new TooltipLine(mod, "Type", LangHelper.ElementName(DictionaryHelper.Item(item)[item.type].Offensive))
                {
                    overrideColor = new Color
                                    (
                        Colors.Type[DictionaryHelper.Item(item)[item.type].Offensive].Item1,
                        Colors.Type[DictionaryHelper.Item(item)[item.type].Offensive].Item2,
                        Colors.Type[DictionaryHelper.Item(item)[item.type].Offensive].Item3
                                    )
                };
                tooltips.Add(line);
            }
            else if (DictionaryHelper.Ammo(item).ContainsKey(item.type))
            {
                var line = new TooltipLine(mod, "Type", LangHelper.ElementName(DictionaryHelper.Ammo(item)[item.type].Offensive))
                {
                    overrideColor = new Color
                                    (
                        Colors.Type[DictionaryHelper.Ammo(item)[item.type].Offensive].Item1,
                        Colors.Type[DictionaryHelper.Ammo(item)[item.type].Offensive].Item2,
                        Colors.Type[DictionaryHelper.Ammo(item)[item.type].Offensive].Item3
                                    )
                };
                tooltips.Add(line);
            }
            else if (DictionaryHelper.Armor(item).ContainsKey(item.type))
            {
                var firstline = new TooltipLine(mod, "Type", LangHelper.ElementName(DictionaryHelper.Armor(item)[item.type].Primary))
                {
                    overrideColor = new Color
                                    (
                        Colors.Type[DictionaryHelper.Armor(item)[item.type].Primary].Item1,
                        Colors.Type[DictionaryHelper.Armor(item)[item.type].Primary].Item2,
                        Colors.Type[DictionaryHelper.Armor(item)[item.type].Primary].Item3
                                    )
                };
                tooltips.Add(firstline);

                if (DictionaryHelper.Armor(item)[item.type].Secondary != Element.none)
                {
                    var secondline = new TooltipLine(mod, "Type", LangHelper.ElementName(DictionaryHelper.Armor(item)[item.type].Secondary))
                    {
                        overrideColor = new Color
                                        (
                            Colors.Type[DictionaryHelper.Armor(item)[item.type].Secondary].Item1,
                            Colors.Type[DictionaryHelper.Armor(item)[item.type].Secondary].Item2,
                            Colors.Type[DictionaryHelper.Armor(item)[item.type].Secondary].Item3
                                        )
                    };
                    tooltips.Add(secondline);
                }
            }
        }
Ejemplo n.º 3
0
        NPCTypeInfo GetTypeInfo()
        {
            NPCTypeInfo typeInfo = new NPCTypeInfo(Element.none, Element.none, Element.none);

            if (DictionaryHelper.NPC(NPC).ContainsKey(NPC.type))
            {
                typeInfo = DictionaryHelper.NPC(NPC)[NPC.type];
            }
            return(typeInfo);
        }
Ejemplo n.º 4
0
        public override void SetDefaults(NPC npc)
        {
            base.SetDefaults(npc);
            this.NPC = npc;

            if (DictionaryHelper.NPC(npc).ContainsKey(npc.type))
            {
                NPCTypeInfo      typeInfo         = DictionaryHelper.NPC(npc)[npc.type];
                AbilityContainer abilityContainer = typeInfo.Container;
                float            chance           = ModContent.GetInstance <Config>().HiddenAbilityChancePercent;

                AbilityID ability = abilityContainer.PrimaryAbility;
                if (abilityContainer.SecondaryAbility != AbilityID.None)
                {
                    if (Main.rand.NextDouble() <= 0.5)
                    {
                        ability = abilityContainer.SecondaryAbility;
                    }
                }

                if (abilityContainer.HiddenAbility != AbilityID.None)
                {
                    if (Main.rand.NextDouble() <= (chance * 0.01))
                    {
                        ability = abilityContainer.HiddenAbility;
                    }
                }

                CurrentAbilityID = ability;

                //Main.NewText(
                //    $"NPC: {NPCID.GetUniqueKey(npc.type)}. " +
                //    $"Possible Abilities: {abilityContainer.PrimaryAbility}, {abilityContainer.SecondaryAbility}, ({abilityContainer.HiddenAbility}). " +
                //    $"Selected Ability: {AbilityID}. ");
            }
        }