Exemple #1
0
        public override bool UseItem(Player player)
        {
            if (!FargoSoulsUtil.AnyBossAlive())
            {
                FargoSoulsWorld.EternityMode = !FargoSoulsWorld.EternityMode;
                Main.expertMode = true;

                //if (FargoSoulsWorld.MasochistMode) ModLoader.GetMod("Fargowiltas").Call("DebuffDisplay", true);

                if (Main.netMode != NetmodeID.MultiplayerClient && FargoSoulsWorld.EternityMode && !FargoSoulsWorld.spawnedDevi &&
                    !NPC.AnyNPCs(ModLoader.GetMod("Fargowiltas").NPCType("Deviantt")))
                {
                    FargoSoulsWorld.spawnedDevi = true;

                    //NPC.SpawnOnPlayer(player.whoAmI, ModLoader.GetMod("Fargowiltas").NPCType("Deviantt"));
                    int projType  = ModLoader.GetMod("Fargowiltas").ProjectileType("SpawnProj");
                    int spawnType = ModLoader.GetMod("Fargowiltas").NPCType("Deviantt");
                    Projectile.NewProjectile(player.Center - 1000 * Vector2.UnitY, Vector2.Zero, projType, 0, 0, Main.myPlayer, spawnType);

                    FargoSoulsUtil.PrintText("Deviantt has awoken!", new Color(175, 75, 255));
                }

                Main.PlaySound(SoundID.Roar, (int)player.position.X, (int)player.position.Y, 0);

                FargoSoulsUtil.PrintText(FargoSoulsWorld.EternityMode ? "Eternity Mode initiated!" : "Eternity Mode deactivated!", new Color(175, 75, 255));

                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendData(MessageID.WorldData); //sync world
                }
            }
            return(true);
        }
Exemple #2
0
        public override bool?UseItem(Player player)
        {
            if (FargoSoulsUtil.WorldIsExpertOrHarder())
            {
                if (!FargoSoulsUtil.AnyBossAlive())
                {
                    FargoSoulsWorld.ShouldBeEternityMode = !FargoSoulsWorld.ShouldBeEternityMode;

                    if (Main.netMode != NetmodeID.MultiplayerClient && FargoSoulsWorld.ShouldBeEternityMode && !FargoSoulsWorld.spawnedDevi &&
                        ModContent.TryFind("Fargowiltas", "Deviantt", out ModNPC deviantt) && !NPC.AnyNPCs(deviantt.Type))
                    {
                        FargoSoulsWorld.spawnedDevi = true;

                        if (ModContent.TryFind("Fargowiltas", "SpawnProj", out ModProjectile spawnProj))
                        {
                            Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.Center - 1000 * Vector2.UnitY, Vector2.Zero, spawnProj.Type, 0, 0, Main.myPlayer, deviantt.Type);
                        }

                        FargoSoulsUtil.PrintLocalization($"Mods.{Mod.Name}.Message.{Name}SpawnDevi", new Color(175, 75, 255));
                    }

                    SoundEngine.PlaySound(SoundID.Roar, player.Center);

                    if (Main.netMode == NetmodeID.Server)
                    {
                        NetMessage.SendData(MessageID.WorldData); //sync world
                    }
                }
            }
            else
            {
                FargoSoulsUtil.PrintLocalization($"Mods.{Mod.Name}.Message.{Name}WrongDifficulty", new Color(175, 75, 255));
            }
            return(true);
        }
 public override void Update(Player player, ref int buffIndex)
 {
     player.GetModPlayer <FargoPlayer>().OceanicMaul = true;
     if (player.buffTime[buffIndex] < 30 && FargoSoulsUtil.AnyBossAlive())
     {
         player.buffTime[buffIndex] = 30;
     }
 }
        public override bool UseItem(Player player)
        {
            if (!FargoSoulsUtil.AnyBossAlive())
            {
                FargoSoulsWorld.MasochistModeReal = !FargoSoulsWorld.MasochistModeReal;
                FargoSoulsWorld.EternityMode      = true;
                Main.expertMode = true;

                Main.PlaySound(SoundID.Roar, (int)player.position.X, (int)player.position.Y, 0);

                FargoSoulsUtil.PrintText(FargoSoulsWorld.MasochistModeReal ? "The difficulty got real!" : "The difficulty got fake!", new Color(255, 51, 153));

                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendData(MessageID.WorldData); //sync world
                }
            }
            return(true);
        }
        public override bool CanUseItem(Item item, Player player)
        {
            if (!FargoSoulsWorld.EternityMode)
            {
                return(base.CanUseItem(item, player));
            }

            if (item.type == ItemID.RodofDiscord || item.type == ItemID.WireKite || item.type == ItemID.WireCutter || item.type == ItemID.Wrench || item.type == ItemID.BlueWrench || item.type == ItemID.GreenWrench || item.type == ItemID.MulticolorWrench || item.type == ItemID.YellowWrench || item.type == ItemID.Actuator)
            {
                //either player is affected by lihzahrd curse, or cursor is targeting a place in temple (player standing outside)
                if (player.GetModPlayer <FargoSoulsPlayer>().LihzahrdCurse || (Framing.GetTileSafely(Main.MouseWorld).WallType == WallID.LihzahrdBrickUnsafe && !player.buffImmune[ModContent.BuffType <Buffs.Masomode.LihzahrdCurse>()]))
                {
                    return(false);
                }
            }

            if (item.type == ItemID.RodofDiscord && FargoSoulsUtil.AnyBossAlive())
            {
                player.chaosState = true;
            }

            return(base.CanUseItem(item, player));
        }
        public override void AI(NPC npc)
        {
            base.AI(npc);

            /*if (!masoBool[0]) //roar when spawn
             * {
             *  masoBool[0] = true;
             *  SoundEngine.PlaySound(SoundID.Roar, npc.Center);
             *  if (Main.netMode == NetmodeID.SinglePlayer)
             *      Main.NewText("A Clown has begun ticking!", 175, 75, 255);
             *  else if (Main.netMode == NetmodeID.Server)
             *      ChatHelper.BroadcastChatMessage(NetworkText.FromLiteral("A Clown has begun ticking!"), new Color(175, 75, 255));
             * }*/

            const int maxFuseTime = 300 * 5;

            float ratio = (float)FuseTimer / maxFuseTime; //caught down bad 4k
            int   dust  = Dust.NewDust(npc.Top, 0, 0, DustID.Torch, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f);

            Main.dust[dust].velocity.Y -= 0.5f + 2.5f * ratio;
            Main.dust[dust].velocity   *= 1f + 3f * ratio;
            Main.dust[dust].scale       = 0.5f + 5.5f * ratio;
            if (Main.rand.NextBool(4))
            {
                Main.dust[dust].scale    += 0.5f;
                Main.dust[dust].noGravity = true;
            }

            if (++FuseTimer >= maxFuseTime)
            {
                npc.life = 0;
                npc.HitEffect();
                if (npc.DeathSound != null)
                {
                    SoundEngine.PlaySound(npc.DeathSound.Value, npc.Center);
                }
                npc.active = false;

                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    if (FargoSoulsUtil.AnyBossAlive())
                    {
                        Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileID.BouncyGrenade, 60, 8f, Main.myPlayer);
                    }
                    else
                    {
                        for (int i = 0; i < 30; i++)
                        {
                            int p = Projectile.NewProjectile(npc.GetSource_FromThis(), npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height), Main.rand.Next(-1000, 1001) / 100, Main.rand.Next(-2000, 101) / 100, ModContent.ProjectileType <ClownBomb>(), 100, 8f, Main.myPlayer);
                            Main.projectile[p].timeLeft -= Main.rand.Next(120);
                        }

                        for (int i = 0; i < 30; i++)
                        {
                            int   type      = ProjectileID.Grenade;
                            int   damage    = 250;
                            float knockback = 8f;
                            switch (Main.rand.Next(10))
                            {
                            case 0:
                            case 1:
                            case 2: type = ProjectileID.HappyBomb; break;

                            case 3:
                            case 4:
                            case 5:
                            case 6: type = ProjectileID.BouncyGrenade; break;

                            case 7:
                            case 8:
                            case 9: type = ProjectileID.StickyGrenade; break;
                            }

                            int p = Projectile.NewProjectile(npc.GetSource_FromThis(), npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height), Main.rand.Next(-1000, 1001) / 100, Main.rand.Next(-2000, 101) / 100, type, damage, knockback, Main.myPlayer);
                            Main.projectile[p].timeLeft += Main.rand.Next(-120, 120);
                        }
                    }
                }
            }
        }
Exemple #7
0
        public override void AI()
        {
            if (Projectile.localAI[1] == 0f)
            {
                Projectile.localAI[1] = 1;
                SoundEngine.PlaySound(new SoundStyle("Terraria/Sounds/Zombie_20"), Projectile.Center);
                p = FargoSoulsUtil.AnyBossAlive() ? Main.npc[NPCs.FargoSoulsGlobalNPC.boss].target : Player.FindClosest(Projectile.Center, 0, 0);
                Projectile.netUpdate = true;
            }

            if (++Projectile.localAI[0] > 85) //dash
            {
                Projectile.rotation     = Projectile.velocity.ToRotation();
                Projectile.direction    = Projectile.spriteDirection = Projectile.velocity.X > 0 ? 1 : -1;
                Projectile.frameCounter = 5;
                Projectile.frame        = 6;
            }
            else //preparing to dash
            {
                int ai0 = p;
                //const float moveSpeed = 1f;
                if (Projectile.localAI[0] == 85) //just about to dash
                {
                    Projectile.velocity = Main.player[ai0].Center - Projectile.Center;
                    Projectile.velocity.Normalize();
                    Projectile.velocity    *= Projectile.type == ModContent.ProjectileType <MutantFishron>() ? 24f : 20f;
                    Projectile.rotation     = Projectile.velocity.ToRotation();
                    Projectile.direction    = Projectile.spriteDirection = Projectile.velocity.X > 0 ? 1 : -1;
                    Projectile.frameCounter = 5;
                    Projectile.frame        = 6;
                }
                else //regular movement
                {
                    Vector2 vel = Main.player[ai0].Center - Projectile.Center;
                    Projectile.rotation = vel.ToRotation();
                    if (vel.X > 0) //projectile is on left side of target
                    {
                        vel.X -= 300;
                        Projectile.direction = Projectile.spriteDirection = 1;
                    }
                    else //projectile is on right side of target
                    {
                        vel.X += 300;
                        Projectile.direction = Projectile.spriteDirection = -1;
                    }
                    Vector2 targetPos = Main.player[ai0].Center + new Vector2(Projectile.ai[0], Projectile.ai[1]);
                    Vector2 distance  = (targetPos - Projectile.Center) / 4f;
                    Projectile.velocity  = (Projectile.velocity * 19f + distance) / 20f;
                    Projectile.position += Main.player[ai0].velocity / 2f;

                    /*vel.Y -= 200f;
                     * vel.Normalize();
                     * vel *= 12f;
                     * if (Projectile.velocity.X < vel.X)
                     * {
                     *  Projectile.velocity.X += moveSpeed;
                     *  if (Projectile.velocity.X < 0 && vel.X > 0)
                     *      Projectile.velocity.X += moveSpeed;
                     * }
                     * else if (Projectile.velocity.X > vel.X)
                     * {
                     *  Projectile.velocity.X -= moveSpeed;
                     *  if (Projectile.velocity.X > 0 && vel.X < 0)
                     *      Projectile.velocity.X -= moveSpeed;
                     * }
                     * if (Projectile.velocity.Y < vel.Y)
                     * {
                     *  Projectile.velocity.Y += moveSpeed;
                     *  if (Projectile.velocity.Y < 0 && vel.Y > 0)
                     *      Projectile.velocity.Y += moveSpeed;
                     * }
                     * else if (Projectile.velocity.Y > vel.Y)
                     * {
                     *  Projectile.velocity.Y -= moveSpeed;
                     *  if (Projectile.velocity.Y > 0 && vel.Y < 0)
                     *      Projectile.velocity.Y -= moveSpeed;
                     * }*/
                    if (++Projectile.frameCounter > 5)
                    {
                        Projectile.frameCounter = 0;
                        if (++Projectile.frame > 5)
                        {
                            Projectile.frame = 0;
                        }
                    }
                }
            }
        }
        public override bool CanUseItem(Item item, Player player)
        {
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            if (modPlayer.IronGuard)
            {
                //Main.NewText($"iron {modPlayer.ironShieldCD}, {modPlayer.ironShieldTimer}");
                modPlayer.IronGuard          = false;
                modPlayer.wasHoldingShield   = false;
                player.shield_parry_cooldown = 0; //prevent that annoying tick sound
                //check is necessary so if player does a real parry then switches to right click weapon, using it won't reset cooldowns
                if (modPlayer.ironShieldCD == 40 && modPlayer.ironShieldTimer == 20)
                {
                    modPlayer.ironShieldCD    = 0;
                    modPlayer.ironShieldTimer = 0;
                }
            }

            //dont use hotkeys in stasis
            if (player.HasBuff(ModContent.BuffType <GoldenStasis>()))
            {
                if (item.type == ItemID.RodofDiscord)
                {
                    player.ClearBuff(ModContent.BuffType <Buffs.Souls.GoldenStasis>());
                }
                else
                {
                    return(false);
                }
            }

            if (FargoSoulsWorld.EternityMode)
            {
                if (item.type == ItemID.RodofDiscord &&
                    (modPlayer.LihzahrdCurse ||
                     (Framing.GetTileSafely(Main.MouseWorld).wall == WallID.LihzahrdBrickUnsafe &&
                      !player.buffImmune[ModContent.BuffType <Buffs.Masomode.LihzahrdCurse>()])))
                {
                    return(false);
                }

                if (modPlayer.LihzahrdCurse &&
                    (item.type == ItemID.WireKite || item.type == ItemID.WireCutter))
                {
                    return(false);
                }
            }

            if (item.damage > 0 && (item.melee || item.ranged || item.magic) && item.pick == 0 && item.axe == 0 && item.hammer == 0)
            {
                modPlayer.MasomodeWeaponUseTimer = Math.Max(item.useTime + item.reuseDelay, 30);
            }

            if (item.magic && player.GetModPlayer <FargoPlayer>().ReverseManaFlow)
            {
                int damage = (int)(item.mana / (1f - player.endurance) + player.statDefense);
                player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " was destroyed by their own magic."), damage, 0);
                player.immune     = false;
                player.immuneTime = 0;
            }

            if (modPlayer.BuilderMode && (item.createTile != -1 || item.createWall != -1) && item.type != ItemID.PlatinumCoin && item.type != ItemID.GoldCoin)
            {
                item.useTime      = 1;
                item.useAnimation = 1;
            }

            if (item.damage > 0 && player.HasAmmo(item, true) && !(item.mana > 0 && player.statMana < item.mana) && //non weapons and weapons with no ammo begone
                item.type != ItemID.ExplosiveBunny && item.type != ItemID.Cannonball &&
                item.useTime > 0 && item.createTile == -1 && item.createWall == -1 && item.ammo == AmmoID.None && item.hammer == 0 && item.pick == 0 && item.axe == 0)
            {
                modPlayer.TryAdditionalAttacks(item.damage, item.melee, item.ranged, item.magic, item.summon);
            }

            //critter attack timer
            if (modPlayer.WoodEnchant && player.altFunctionUse == ItemAlternativeFunctionID.ActivatedAndUsed && item.makeNPC > 0)
            {
                if (modPlayer.CritterAttackTimer == 0)
                {
                    Vector2 vel = Vector2.Normalize(Main.MouseWorld - player.Center);
                    float   damageMultiplier = player.minionDamage;

                    int type           = -1;
                    int damage         = 0;
                    int attackCooldown = 0;

                    switch (item.type)
                    {
                    //case ItemID.Bunny:
                    //    type = ProjectileID.ExplosiveBunny;
                    //    damage = 10;
                    //    attackCooldown = 10;
                    //    break;

                    case ItemID.Bird:
                        type           = ModContent.ProjectileType <BirdProj>();
                        damage         = 15;
                        attackCooldown = 15;
                        break;

                    case ItemID.BlueJay:
                        type           = ModContent.ProjectileType <BlueJayProj>();
                        damage         = 10;
                        attackCooldown = 10;
                        break;

                    case ItemID.Cardinal:
                        type           = ModContent.ProjectileType <CardinalProj>();
                        damage         = 20;
                        attackCooldown = 20;
                        break;
                    }

                    if (type != -1)
                    {
                        Projectile.NewProjectile(player.Center, vel * 2f, type, damage, 2, player.whoAmI);
                        modPlayer.CritterAttackTimer = attackCooldown;
                    }
                }



                return(false);
            }

            if (item.type == ItemID.RodofDiscord)
            {
                if (FargoSoulsWorld.EternityMode && FargoSoulsUtil.AnyBossAlive())
                {
                    /*player.AddBuff(ModContent.BuffType<Buffs.Masomode.ChaosLife>(), 30);
                     * modPlayer.MaxLifeReduction += 100;*/
                    player.chaosState = true;

                    /*player.statLife -= player.statLifeMax2 / 5;
                     * PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13);
                     * if (Main.rand.NextBool())
                     *  damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15);
                     * if (player.statLife <= 0 && !player.chaosState) //since chaos state will check and kill anyway, avoid doublekill
                     *  player.KillMe(damageSource, 1, 0);
                     * player.lifeRegenCount = 0;
                     * player.lifeRegenTime = 0;*/
                }

                if (player.chaosState)
                {
                    player.GetModPlayer <FargoPlayer>().WasHurtBySomething = true; //with abom rebirth, die to chaos state
                }
            }

            return(true);
        }
        public override void AI()
        {
            Player           player    = Main.player[Projectile.owner];
            FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>();

            if (player.dead || player.ghost)
            {
                modPlayer.ChibiDevi = false;
            }
            if (modPlayer.ChibiDevi)
            {
                Projectile.timeLeft = 2;
            }

            DelegateMethods.v3_1 = new Vector3(1f, 0.5f, 0.9f) * 0.75f;
            Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * 6f, 20f, DelegateMethods.CastLightOpen);
            Utils.PlotTileLine(Projectile.Left, Projectile.Right, 20f, DelegateMethods.CastLightOpen);

            bool asleep = Projectile.ai[0] == 1;

            if (asleep)
            {
                Projectile.tileCollide = true;
                Projectile.ignoreWater = false;

                Projectile.frameCounter = 0;
                Projectile.frame        = Projectile.velocity.Y == 0 ? 5 : 4;

                Projectile.velocity.X *= 0.95f;
                Projectile.velocity.Y += 0.3f;

                if (Projectile.owner == Main.myPlayer && Projectile.Distance(Main.MouseWorld) > 180)
                {
                    Projectile.ai[0] = 0;

                    TryTalkWithCD(TalkType.Wake, ShortCD);
                }
            }
            else
            {
                if (Projectile.owner == Main.myPlayer)
                {
                    Projectile.tileCollide = false;
                    Projectile.ignoreWater = true;

                    Projectile.direction = Projectile.Center.X < Main.MouseWorld.X ? 1 : -1;

                    float distance     = 2500;
                    float possibleDist = Main.player[Projectile.owner].Distance(Main.MouseWorld) / 2 + 100;
                    if (distance < possibleDist)
                    {
                        distance = possibleDist;
                    }
                    if (Projectile.Distance(Main.player[Projectile.owner].Center) > distance && Projectile.Distance(Main.MouseWorld) > distance)
                    {
                        Projectile.Center   = player.Center;
                        Projectile.velocity = Vector2.Zero;
                    }

                    if (Projectile.Distance(Main.MouseWorld) > 30)
                    {
                        Movement(Main.MouseWorld, 0.15f, 32f);
                    }

                    if (oldMouse == Main.MouseWorld)
                    {
                        Projectile.ai[1]++;
                        if (Projectile.ai[1] > 600)
                        {
                            bool okToRest = !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height);

                            if (okToRest)
                            {
                                okToRest = false;

                                Vector2 targetPos = new Vector2(Projectile.Center.X, Projectile.position.Y + Projectile.height);
                                for (int i = 0; i < 10; i++) //collision check below self
                                {
                                    targetPos.Y += 16;
                                    Tile tile = Framing.GetTileSafely(targetPos); //if solid, ok
                                    if (tile.HasUnactuatedTile && Main.tileSolid[tile.TileType])
                                    {
                                        okToRest = true;
                                        break;
                                    }
                                }
                            }

                            if (okToRest) //not in solid tiles, but found tiles within a short distance below
                            {
                                Projectile.ai[0] = 1;
                                Projectile.ai[1] = 0;

                                TryTalkWithCD(TalkType.Sleep, ShortCD);
                            }
                            else //try again in a bit
                            {
                                Projectile.ai[1] = 540;
                            }
                        }
                    }
                    else
                    {
                        Projectile.ai[1] = 0;
                        oldMouse         = Main.MouseWorld;
                    }
                }

                if (++Projectile.frameCounter > 6)
                {
                    Projectile.frameCounter = 0;
                    if (++Projectile.frame >= 4)
                    {
                        Projectile.frame = 0;
                    }
                }
            }

            Projectile.spriteDirection = Projectile.direction;

            bool bossAlive = FargoSoulsUtil.AnyBossAlive();

            if (bossAlive)
            {
                TryTalkWithCD(TalkType.BossSpawn, ShortCD);

                if (Main.npc[FargoSoulsGlobalNPC.boss].life < Main.npc[FargoSoulsGlobalNPC.boss].lifeMax / 4)
                {
                    TryTalkWithCD(TalkType.BossAlmostDead, MediumCD);
                }
            }
            else
            {
                //only do idle talk when awake, not a boss fight, and not in danger
                if (asleep)
                {
                    TalkCDs[(int)TalkType.Idle] = Math.Max(TalkCDs[(int)TalkType.Idle], 12 * 60);
                }
                else if (player.statLife > player.statLifeMax2 / 2)
                {
                    TryTalkWithCD(TalkType.Idle, MediumCD);
                }

                //wont cheer in boss fight unless over 30 seconds
                const int timeRequirement = 30 * 60;
                TalkCDs[(int)TalkType.BossAlmostDead] = Math.Max(TalkCDs[(int)TalkType.BossAlmostDead], timeRequirement);
                TalkCDs[(int)TalkType.KillBoss]       = Math.Max(TalkCDs[(int)TalkType.KillBoss], timeRequirement);
            }

            if (universalTalkCD > 0)
            {
                universalTalkCD--;
            }

            if (Projectile.owner == Main.myPlayer)
            {
                for (int i = 0; i < TalkCDs.Length; i++)
                {
                    //dont run these timer during a boss fight
                    if (bossAlive && (i == (int)TalkType.Idle || i == (int)TalkType.BossSpawn))
                    {
                        continue;
                    }

                    if (TalkCDs[i] > 0)
                    {
                        TalkCDs[i]--;
                    }
                }
            }
        }