예제 #1
0
        private void JamEnemy(CharacterBody obj)
        {
            if (!obj || !obj.inventory || !obj.master)
            {
                return;
            }
            var inventory = obj.inventory;

            var teamComponent = obj.teamComponent;

            if (!teamComponent)
            {
                return;
            }

            // Ghosts inherit their previous inventories which include the isJammedItem //
            // So we can just skip the whole section if it's a ghost //
            if (CurseUtil.CheckJammedStatus(obj) && JammedAllowGhost)
            {
                CurseUtil.JamEnemy(obj, 100);
                return;
            }

            CharacterBody mostCursedPlayer = HelperUtil.GetPlayerWithMostItemDef(curseTally);

            if (!mostCursedPlayer)
            {
                return;
            }
            int   PlayerItemCount = mostCursedPlayer.inventory.GetItemCount(curseTally);
            float RollValue;
            float RollValueBosses = 0f;

            var teamIndex = teamComponent.teamIndex;

            switch (PlayerItemCount)
            {
            case 0:
                RollValue = 0f;
                break;

            case 1:                 //0.5
            case 2:                 //1
            case 3:                 //1.5
            case 4:                 //2
                RollValue = 1f;
                break;

            case 5:                 //2.5
            case 6:                 //3
            case 7:                 //3.5
            case 8:                 //4
                RollValue = 2f;
                break;

            case 9:                  //4.5
            case 10:                 //5
            case 11:                 //5.5
            case 12:                 //6
                RollValue = 5f;
                break;

            case 13:                 //6.5
            case 14:                 //7
            case 15:                 //7.5
            case 16:                 //8
                RollValue       = 10f;
                RollValueBosses = 20f;
                break;

            case 17:                 //8.5
            case 18:                 //9
            case 19:                 //9.5
                RollValue       = 25f;
                RollValueBosses = 30f;
                break;

            default:                 //10 and default
                RollValue       = 50f;
                RollValueBosses = 50f;
                break;
            } //adjusts jammed chance

            // NORMAL CHECK //
            if (teamIndex != TeamIndex.Player)
            {
                //BOSS CHECK
                if (obj.isBoss)
                {
                    if (inventory.GetItemCount(umbraItemDef) > 0)
                    {
                        // UMBRA CHECK //
                        if (JammedAllowUmbra)
                        {
                            CurseUtil.JamEnemy(obj, RollValueBosses);
                        }
                    }
                    else
                    {
                        if (JammedAllowBosses)
                        {
                            CurseUtil.JamEnemy(obj, RollValueBosses);
                        }
                    }
                }
                else
                {
                    CurseUtil.JamEnemy(obj, RollValue);
                }
            }
            // AETHERIUM SUPPORT //
            else if (teamIndex == TeamIndex.Player && JammedAllowUnstableDesign)
            {
                bool AetheriumCheck = obj.master.bodyPrefab.name.Contains("UnstableDesignAetherium");
                if (AetheriumCheck)
                {
                    CurseUtil.JamEnemy(obj, RollValue);
                }
            }
        }