コード例 #1
0
        /// <summary>
        /// Validly adds an affix to the item.
        /// </summary>
        /// <param name="item"></param>
        public bool AddRandomAffix(Item item)
        {
            Affix newAffix = PoMAffixController.RollNewAffix(this, item);

            if (newAffix == null)
            {
                return(false);
            }

            AddAffix(newAffix, item);

            UpdateName(item);
            return(true);
        }
コード例 #2
0
ファイル: PoMNPC.cs プロジェクト: Liburia/PathOfModifiers
        public void RollAffixes(NPC npc)
        {
            Affix newAffix;
            int   freeAffixes = FreeAffixes;

            for (int i = 0; i < freeAffixes; i++)
            {
                if (i >= rarity.minAffixes && Main.rand.NextFloat(0, 1) > rarity.chanceToRollAffix)
                {
                    break;
                }

                newAffix = PoMAffixController.RollNewAffix(this, npc);
                if (newAffix == null)
                {
                    break;
                }

                AddAffix(newAffix, npc);
            }
        }