Пример #1
0
        // TODO Change this in favor of auto checking.
        public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
        {
            List <NPC> activeBosses = new List <NPC>();
            bool       isGolemAlive = false;


            foreach (NPC npc in Main.npc)
            {
                if (npc.boss && npc.active)
                {
                    activeBosses.Add(npc);
                }

                if (npc.type == NPCID.Golem)
                {
                    isGolemAlive = true;
                }
            }

            if (zenkaiCharm && !zenkaiCharmActive && !player.HasBuff(mod.BuffType("ZenkaiCooldown")))
            {
                player.statLife = 50;
                player.HealEffect(50);
                player.AddBuff(mod.BuffType("ZenkaiBuff"), 300);
                return(false);
            }

            if (eliteSaiyanBonus && !zenkaiCharmActive && !player.HasBuff(mod.BuffType("ZenkaiCooldown")))
            {
                int healamount = (player.statLifeMax + player.statLifeMax2);
                player.statLife += healamount;
                player.HealEffect(healamount);
                player.AddBuff(mod.BuffType("ZenkaiBuff"), 600);
                return(false);
            }

            TransformationDefinition transformation = GetCurrentTransformation();

            if (transformation != null)
            {
                transformation.OnPlayerPreKill(this, activeBosses, damage, hitDirection, pvp, ref playSound, ref genGore, ref damageSource);
            }

            if (activeBosses.Count > 0 && !SSJ1Achived && player.whoAmI == Main.myPlayer && NPC.downedBoss3)
            {
                if (rageCurrent >= 3)
                {
                    overallFormUnlockChance = 1;
                }
                else
                {
                    formUnlockChance = 20;
                }

                if (Main.rand.Next(overallFormUnlockChance) == 0)
                {
                    Main.NewText("The humiliation of failing drives you mad.", Color.Yellow);
                    player.statLife = player.statLifeMax2 / 2;
                    player.HealEffect(player.statLifeMax2 / 2);

                    TransformationDefinitionManager.LSSJDefinition.TryUnlock(this);

                    isTransforming = true;
                    SSJTransformation();
                    TransformationMenu.SelectedTransformation = TransformationDefinitionManager.SSJ1Definition;
                    TransformationDefinitionManager.SSJ1Definition.TryUnlock(this);
                    rageCurrent = 0;
                    EndTransformations();
                    return(false);
                }
            }

            if (activeBosses.Count > 0 && SSJ1Achived && !SSJ2Achieved && player.whoAmI == Main.myPlayer && !IsLegendary() && NPC.downedMechBossAny &&
                (IsTransformedInto(TransformationDefinitionManager.SSJ1Definition) || IsTransformedInto(TransformationDefinitionManager.SSJ2Definition) || IsTransformedInto(TransformationDefinitionManager.SSJ3Definition) &&
                 PlayerTransformations[TransformationDefinitionManager.SSJ1Definition].Mastery >= 1))
            {
                Main.NewText("The rage of failing once more dwells deep within you.", Color.Red);
                player.statLife = player.statLifeMax2 / 2;
                player.HealEffect(player.statLifeMax2 / 2);

                TransformationDefinitionManager.SSJ2Definition.Unlock(this);

                isTransforming = true;
                SSJ2Transformation();
                TransformationMenu.SelectedTransformation = TransformationDefinitionManager.SSJ2Definition;
                EndTransformations();
                rageCurrent = 0;
                return(false);
            }

            if (activeBosses.Count > 0 && SSJ1Achived && !LSSJAchieved && player.whoAmI == Main.myPlayer && IsLegendary() && NPC.downedMechBossAny && player.HasBuff(TransformationDefinitionManager.SSJ1Definition.GetBuffId()) &&
                PlayerTransformations[TransformationDefinitionManager.SSJ1Definition].Mastery >= 1)
            {
                Main.NewText("Your rage is overflowing, you feel something rise up from deep inside.", Color.Green);
                player.statLife = player.statLifeMax2 / 2;
                player.HealEffect(player.statLifeMax2 / 2);

                TransformationDefinitionManager.LSSJDefinition.Unlock(this);

                isTransforming = true;
                LSSJTransformation();
                TransformationMenu.SelectedTransformation = TransformationDefinitionManager.LSSJDefinition;
                EndTransformations();
                rageCurrent = 0;
                return(false);
            }

            if (isGolemAlive && SSJ1Achived && SSJ2Achieved && !SSJ3Achieved && !IsLegendary() && player.whoAmI == Main.myPlayer && player.HasBuff(TransformationDefinitionManager.SSJ2Definition.GetBuffId()) &&
                PlayerTransformations[TransformationDefinitionManager.SSJ2Definition].Mastery >= 1)
            {
                Main.NewText("The ancient power of the Lihzahrds seeps into you, causing your power to become unstable.", Color.Orange);
                player.statLife = player.statLifeMax2 / 2;
                player.HealEffect(player.statLifeMax2 / 2);

                TransformationDefinitionManager.SSJ3Definition.Unlock(this);

                isTransforming = true;
                SSJ3Transformation();
                TransformationMenu.SelectedTransformation = TransformationDefinitionManager.SSJ3Definition;
                EndTransformations();
                rageCurrent = 0;
                return(false);
            }

            if (immortalityRevivesLeft > 0)
            {
                int healamount = (player.statLifeMax + player.statLifeMax2);
                player.statLife += healamount;
                player.HealEffect(healamount);
                immortalityRevivesLeft -= 1;
                return(false);
            }

            if (activeBosses.Count > 0 && player.whoAmI == Main.myPlayer)
            {
                rageCurrent += 1;
                return(true);
            }

            return(true);
        }