Пример #1
0
        public override void ModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            if (info.savageBloodTime > 0)
            {
                damage = (int)(damage * .8);
            }
        }
Пример #2
0
        public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            if (npc.FindBuffIndex(mod.BuffType("DeathMark")) >= 0)
            {
                info.deathMarkDamage += (int)damage;
                if (crit)
                {
                    info.deathMarkDamage += (int)damage;
                }
            }
            if (info.savageBloodTime > 0)
            {
                damage *= 1.1;
            }
            return(base.StrikeNPC(npc, ref damage, defense, ref knockback, hitDirection, ref crit));
        }
Пример #3
0
        public override void UpdateLifeRegen(NPC npc, ref int damage)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            if (info.savageBloodTime > 0)
            {
                info.savageBloodTime--;
                npc.lifeRegen -= (int)(info.savageBlood * .7f);
                damage        += (int)(info.savageBlood * .7f / 8);
            }
            if (info.mothPoisonTime > 0)
            {
                info.mothPoisonTime--;
                npc.lifeRegen -= (int)info.mothPoison;
                damage        += (int)info.mothPoison / 8;
            }
            if (info.mothAmpTime > 0 && npc.lifeRegen <= 0)
            {
                info.mothAmpTime--;
                npc.lifeRegen = (int)(npc.lifeRegen * info.mothAmp);
                damage        = (int)(damage * info.mothAmp);
            }
        }
Пример #4
0
        public override void NPCLoot(NPC npc)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            if (info.deathMarkOwner >= 0)
            {
                Player player = Main.player[info.deathMarkOwner];
                int    index  = player.FindBuffIndex(mod.BuffType <Buffs.ActiveCooldown>());
                player.buffTime[index] = 1;
            }
            if (!npc.boss)
            {
                return;
            }
            for (int i = 0; i < 256; i++)
            {
                if (Main.player[i].active)
                {
                    Player        p         = Main.player[i];
                    MPlayer       player    = p.GetModPlayer <MPlayer>();
                    bool          leveledUp = false;
                    BossGroupEnum msgType   = BossGroupEnum.INVALID;

                    if (npc.type == NPCID.KingSlime && !player.killedSlime)
                    {
                        msgType            = BossGroupEnum.KING_SLIME;
                        player.killedSlime = true;
                        leveledUp          = true;
                    }
                    else if (npc.type == NPCID.EyeofCthulhu && !player.killedEye)
                    {
                        msgType          = BossGroupEnum.EYE_OF_CTHULHU;
                        player.killedEye = true;
                        leveledUp        = true;
                    }
                    else if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail || npc.type == NPCID.BrainofCthulhu) && !player.killedWormOrBrain)
                    {
                        msgType = BossGroupEnum.BRAIN_OF_CTHULHU_OR_EATER_OF_WORLDS;
                        player.killedWormOrBrain = true;
                        leveledUp = true;
                    }
                    else if (npc.type == NPCID.SkeletronHead && !player.killedSkelly)
                    {
                        msgType             = BossGroupEnum.SKELETRON;
                        player.killedSkelly = true;
                        leveledUp           = true;
                    }
                    else if (npc.type == NPCID.QueenBee && !player.killedBee)
                    {
                        msgType          = BossGroupEnum.QUEEN_BEE;
                        player.killedBee = true;
                        leveledUp        = true;
                    }
                    else if (npc.type == NPCID.WallofFlesh && !player.killedWall)
                    {
                        msgType           = BossGroupEnum.WALL_OF_FLESH;
                        player.killedWall = true;
                        leveledUp         = true;
                    }
                    else if (npc.type == NPCID.TheDestroyer && !player.killedDestroyer)
                    {
                        msgType = BossGroupEnum.DESTROYER;
                        player.killedDestroyer = true;
                        leveledUp = true;
                    }
                    else if ((npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism) && !player.killedTwins)
                    {
                        msgType            = BossGroupEnum.TWINS;
                        player.killedTwins = true;
                        leveledUp          = true;
                    }
                    else if (npc.type == NPCID.SkeletronPrime && !player.killedPrime)
                    {
                        msgType            = BossGroupEnum.SKELETRON_PRIME;
                        player.killedPrime = true;
                        leveledUp          = true;
                    }
                    else if (npc.type == NPCID.Plantera && !player.killedPlant)
                    {
                        msgType            = BossGroupEnum.PLANTERA;
                        player.killedPlant = true;
                        leveledUp          = true;
                    }
                    else if (npc.type == NPCID.Golem && !player.killedGolem)
                    {
                        msgType            = BossGroupEnum.GOLEM;
                        player.killedGolem = true;
                        leveledUp          = true;
                    }
                    else if (npc.type == NPCID.DukeFishron && !player.killedFish)
                    {
                        msgType           = BossGroupEnum.DUKE_FISHRON;
                        player.killedFish = true;
                        leveledUp         = true;
                    }
                    else if (npc.type == NPCID.CultistBoss && !player.killedCultist)
                    {
                        msgType = BossGroupEnum.LUNATIC_CULTIST;
                        player.killedCultist = true;
                        leveledUp            = true;
                    }
                    else if (npc.type == NPCID.MoonLordCore && !player.killedMoon)
                    {
                        msgType           = BossGroupEnum.MOON_LORD;
                        player.killedMoon = true;
                        leveledUp         = true;
                    }

                    if (leveledUp)
                    {
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);

                        LevelUpPlayerNetMsg.SerializeAndSend(
                            mod,
                            p.whoAmI,
                            msgType);
                    }
                }
            }
        }
Пример #5
0
        public override void NPCLoot(NPC npc)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            if (info.deathMarkOwner >= 0)
            {
                Player player = Main.player[info.deathMarkOwner];
                int    index  = player.FindBuffIndex(mod.BuffType("ActiveCooldown"));
                player.buffTime[index] = 1;
            }
            if (!npc.boss)
            {
                return;
            }
            for (int i = 0; i < 256; i++)
            {
                if (Main.player[i].active)
                {
                    Player  p       = Main.player[i];
                    MPlayer player  = (MPlayer)(p.GetModPlayer(mod, "MPlayer"));
                    int     msgType = 0;
                    if (npc.type == 4 && !player.killedEye)
                    {
                        player.killedEye = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                        msgType = 1;
                    }
                    if ((npc.type == 13 || npc.type == 14 || npc.type == 15 || npc.type == 266) && !player.killedWormOrBrain)
                    {
                        player.killedWormOrBrain = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                        msgType = 2;
                    }
                    if (npc.type == 35 && !player.killedSkelly)
                    {
                        player.killedSkelly = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                        msgType = 3;
                    }
                    if (npc.type == NPCID.QueenBee && !player.killedBee)
                    {
                        msgType          = 4;
                        player.killedBee = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.KingSlime && !player.killedSlime)
                    {
                        msgType            = 5;
                        player.killedSlime = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.WallofFlesh && !player.killedWall)
                    {
                        msgType           = 6;
                        player.killedWall = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.TheDestroyer && !player.killedDestroyer)
                    {
                        msgType = 7;
                        player.killedDestroyer = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if ((npc.type == 125 || npc.type == 126) && !player.killedTwins)
                    {
                        msgType            = 8;
                        player.killedTwins = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.SkeletronPrime && !player.killedPrime)
                    {
                        msgType            = 9;
                        player.killedPrime = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.Plantera && !player.killedPlant)
                    {
                        msgType            = 10;
                        player.killedPlant = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.Golem && !player.killedGolem)
                    {
                        msgType            = 11;
                        player.killedGolem = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.DukeFishron && !player.killedFish)
                    {
                        msgType           = 12;
                        player.killedFish = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.CultistBoss && !player.killedCultist)
                    {
                        msgType = 13;
                        player.killedCultist = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.MoonLordCore && !player.killedMoon)
                    {
                        msgType           = 14;
                        player.killedMoon = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (msgType > 0)
                    {
                        var netMessage = mod.GetPacket();
                        netMessage.Write("Level");
                        netMessage.Write(p.whoAmI);
                        netMessage.Write(msgType);
                        netMessage.Send();
                    }
                }
            }
        }