예제 #1
0
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "Spirits around you are marked and upon death they violently explode.";

            //Giving NPCs the markers
            detectionTimer++;
            if (detectionTimer >= 360)
            {
                for (int n = 0; n < Main.maxNPCs; n++)
                {
                    NPC npc = Main.npc[n];
                    if (npc.active)
                    {
                        JoJoGlobalNPC jojoNPC = npc.GetGlobalNPC <JoJoGlobalNPC>();
                        if (npc.lifeMax > 5 && !npc.friendly && !jojoNPC.taggedWithPhantomMarker)
                        {
                            Projectile.NewProjectile(npc.position, npc.velocity, mod.ProjectileType("PhantomMarker"), 0, 0f, Main.myPlayer, npc.whoAmI);
                            jojoNPC.taggedWithPhantomMarker = true;
                        }
                    }
                }
                detectionTimer = 0;
            }
            Lighting.AddLight(player.Center, 1.73f / 2f, 2.24f / 2f, 2.3f / 2f);
        }
        public override void AI()
        {
            SelectAnimation();
            UpdateStandInfo();
            updateTimer++;
            if (shootCount > 0)
            {
                shootCount--;
            }
            if (timeAfterTouch > 0)
            {
                timeAfterTouch--;
            }
            Player   player    = Main.player[projectile.owner];
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            projectile.frameCounter++;
            if (modPlayer.StandOut)
            {
                projectile.timeLeft = 2;
            }
            if (updateTimer >= 90)      //an automatic netUpdate so that if something goes wrong it'll at least fix in about a second
            {
                updateTimer          = 0;
                projectile.netUpdate = true;
            }

            if (!modPlayer.StandAutoMode)
            {
                if (Main.mouseLeft && projectile.owner == Main.myPlayer)
                {
                    Punch();
                }
                else
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        attackFrames = false;
                    }
                }
                if (!attackFrames)
                {
                    StayBehind();
                }
                if (Main.mouseRight && shootCount <= 0 && timeAfterTouch <= 0 && projectile.owner == Main.myPlayer)
                {
                    shootCount    += 5;
                    Main.mouseLeft = false;
                    attackFrames   = false;
                    normalFrames   = false;

                    if (!touchedNPC && !touchedTile)
                    {
                        if (mouseToPlayerDistance < maxAltDistance)
                        {
                            bool foundNPCTarget = false;
                            for (int n = 0; n < Main.maxNPCs; n++)
                            {
                                NPC npc = Main.npc[n];
                                if (npc.active)
                                {
                                    if (npc.Distance(Main.MouseWorld) <= (npc.width / 2f) + 20f)
                                    {
                                        touchedNPC     = true;
                                        timeAfterTouch = 60;
                                        foundNPCTarget = true;
                                        npc.GetGlobalNPC <JoJoGlobalNPC>().taggedByKillerQueen = true;
                                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/KQButtonClick"));
                                        break;
                                    }
                                }
                            }
                            if (!foundNPCTarget)
                            {
                                if (Collision.SolidCollision(Main.MouseWorld, 1, 1) && !touchedTile)
                                {
                                    touchedTile    = true;
                                    timeAfterTouch = 60;
                                    savedPosition  = Main.MouseWorld;
                                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/KQButtonClick"));
                                }
                            }
                        }
                    }
                    else
                    {
                        if (touchedNPC)
                        {
                            for (int n = 0; n < Main.maxNPCs; n++)
                            {
                                NPC npc = Main.npc[n];
                                if (npc.active)
                                {
                                    JoJoGlobalNPC jojoNPC = npc.GetGlobalNPC <NPCs.JoJoGlobalNPC>();
                                    if (jojoNPC.taggedByKillerQueen)
                                    {
                                        touchedNPC = false;
                                        int projectile = Projectile.NewProjectile(npc.position, Vector2.Zero, ProjectileID.GrenadeIII, (int)(altDamage * modPlayer.standDamageBoosts), 50f, player.whoAmI);
                                        Main.projectile[projectile].friendly  = true;
                                        Main.projectile[projectile].timeLeft  = 2;
                                        Main.projectile[projectile].netUpdate = true;
                                        jojoNPC.taggedByKillerQueen           = false;
                                        break;
                                    }
                                }
                            }
                        }
                        if (touchedTile)
                        {
                            touchedTile            = false;
                            secondaryAbilityFrames = true;
                            int projectile = Projectile.NewProjectile(savedPosition, Vector2.Zero, ProjectileID.GrenadeIII, (int)(altDamage * modPlayer.standDamageBoosts), 50f, player.whoAmI);
                            Main.projectile[projectile].friendly  = true;
                            Main.projectile[projectile].timeLeft  = 2;
                            Main.projectile[projectile].netUpdate = true;
                            savedPosition = Vector2.Zero;
                        }
                    }
                }
                else
                {
                    secondaryAbilityFrames = false;
                }
                if (SpecialKeyPressed() && player.ownedProjectileCounts[mod.ProjectileType("SheerHeartAttack")] == 0)
                {
                    Projectile.NewProjectile(projectile.position + new Vector2(10f * projectile.direction, 0f), projectile.velocity, mod.ProjectileType("SheerHeartAttack"), 1, 0f, projectile.owner, 1f);
                }
            }
            if (modPlayer.StandAutoMode)
            {
                NPC     target    = null;
                Vector2 targetPos = projectile.position;
                if (npcExplosionTimer >= 0)
                {
                    npcExplosionTimer--;
                }
                if (!attackFrames)
                {
                    StayBehind();
                }
                float targetDist = maxDistance * 1.5f;
                if (target == null)
                {
                    for (int k = 0; k < 200; k++)       //the targeting system
                    {
                        NPC npc = Main.npc[k];
                        if (npc.CanBeChasedBy(this, false))
                        {
                            float distance = Vector2.Distance(npc.Center, player.Center);
                            if (distance < targetDist && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
                            {
                                if (npc.boss)       //is gonna try to detect bosses over anything
                                {
                                    targetDist = distance;
                                    targetPos  = npc.Center;
                                    target     = npc;
                                }
                                else        //if it fails to detect a boss, it'll detect the next best thing
                                {
                                    targetDist = distance;
                                    targetPos  = npc.Center;
                                    target     = npc;
                                }
                            }
                        }
                    }
                }
                float touchedTargetDistance = 0f;
                if (savedTarget != null)
                {
                    touchedTargetDistance = Vector2.Distance(player.Center, savedTarget.Center);
                    if (!savedTarget.active)
                    {
                        savedTarget = null;
                    }
                }
                if (savedTarget == null)
                {
                    explosionTimer    = 0;
                    npcExplosionTimer = 0;
                }
                if (savedTarget != null && touchedTargetDistance > newMaxDistance + 8f && npcExplosionTimer <= 0)       //if the target leaves and the bomb won't damage you, detonate the enemy
                {
                    secondaryAbilityFrames = true;
                    attackFrames           = false;
                    normalFrames           = false;
                    explosionTimer++;
                    if (explosionTimer == 5)
                    {
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/sound/KQButtonClick"));
                    }
                    if (explosionTimer >= 90)
                    {
                        int bomb = Projectile.NewProjectile(savedTarget.position, Vector2.Zero, ProjectileID.GrenadeIII, (int)(altDamage * modPlayer.standDamageBoosts), 3f, projectile.owner);
                        Main.projectile[bomb].timeLeft  = 2;
                        Main.projectile[bomb].netUpdate = true;
                        explosionTimer    = 0;
                        npcExplosionTimer = 360;
                        savedTarget       = null;
                    }
                }
                if (target != null)
                {
                    attackFrames = true;
                    normalFrames = false;
                    if ((targetPos - projectile.Center).X > 0f)
                    {
                        projectile.spriteDirection = projectile.direction = 1;
                    }
                    else if ((targetPos - projectile.Center).X < 0f)
                    {
                        projectile.spriteDirection = projectile.direction = -1;
                    }
                    Vector2 velocity = targetPos - projectile.position;
                    velocity.Normalize();
                    projectile.velocity = velocity * 4f;
                    if (shootCount <= 0)
                    {
                        if (Main.myPlayer == projectile.owner)
                        {
                            shootCount += newPunchTime;
                            Vector2 shootVel = targetPos - projectile.Center;
                            if (shootVel == Vector2.Zero)
                            {
                                shootVel = new Vector2(0f, 1f);
                            }
                            shootVel.Normalize();
                            if (projectile.direction == 1)
                            {
                                shootVel *= shootSpeed;
                            }
                            int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, shootVel.X, shootVel.Y, mod.ProjectileType("Fists"), (int)(newPunchDamage * 0.9f), 3f, projectile.owner, fistWhoAmI, tierNumber);
                            Main.projectile[proj].netUpdate = true;
                            projectile.netUpdate            = true;
                        }
                    }
                }
                else
                {
                    normalFrames = true;
                    attackFrames = false;
                }
            }
            if (!touchedTile)
            {
                mouseToPlayerDistance = Vector2.Distance(Main.MouseWorld, player.Center);
            }
            if (touchedTile && MyPlayer.AutomaticActivations)
            {
                for (int i = 0; i < 200; i++)
                {
                    npcDistance = Vector2.Distance(Main.npc[i].Center, savedPosition);
                    if (npcDistance < 50f && touchedTile)       //or youd need to go from its center, add half its width to the direction its facing, and then add 16 (also with direction) -- Direwolf
                    {
                        int projectile = Projectile.NewProjectile(savedPosition, Vector2.Zero, ProjectileID.GrenadeIII, (int)(altDamage * modPlayer.standDamageBoosts), 50f, player.whoAmI);
                        Main.projectile[projectile].friendly  = true;
                        Main.projectile[projectile].timeLeft  = 2;
                        Main.projectile[projectile].netUpdate = true;
                        touchedTile   = false;
                        savedPosition = Vector2.Zero;
                    }
                }
            }
        }
예제 #3
0
        public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
        {
            Player   player  = Main.player[projectile.owner];
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            if (Main.rand.NextFloat(0, 101) <= mPlayer.standCritChangeBoosts)
            {
                crit = true;
            }
            if (projectile.ai[0] == 2f)
            {
                if (projectile.ai[1] == 3f)
                {
                    target.AddBuff(mod.BuffType("LifePunch"), 4 * 60);
                }
                if (projectile.ai[1] == 4f)
                {
                    target.AddBuff(mod.BuffType("LifePunch"), 6 * 60);
                }
                if (projectile.ai[1] == 5f)
                {
                    target.AddBuff(mod.BuffType("LifePunch"), 8 * 60);
                }
            }
            if (projectile.ai[0] == 3f && mPlayer.BackToZero)
            {
                target.GetGlobalNPC <NPCs.JoJoGlobalNPC>().affectedbyBtz = true;
                target.AddBuff(mod.BuffType("AffectedByBtZ"), 2);
            }
            if (projectile.ai[0] == 4f)
            {
                if (projectile.ai[1] == 1f)
                {
                    target.AddBuff(mod.BuffType("Zipped"), 180);
                }
                if (projectile.ai[1] == 2f)
                {
                    target.AddBuff(mod.BuffType("Zipped"), 240);
                }
                if (projectile.ai[1] == 3f)
                {
                    target.AddBuff(mod.BuffType("Zipped"), 360);
                }
                if (projectile.ai[1] == 4f)
                {
                    target.AddBuff(mod.BuffType("Zipped"), 480);
                }
            }
            if (projectile.ai[0] == 5f)
            {
                if (projectile.ai[1] == 1f)
                {
                    PlayerStands.KillerQueen.KillerQueenStandT1.savedTarget = target;
                }
                if (projectile.ai[1] == 2f)
                {
                    PlayerStands.KillerQueen.KillerQueenStandT2.savedTarget = target;
                }
                if (projectile.ai[1] == 3f)
                {
                    PlayerStands.KillerQueen.KillerQueenStandT3.savedTarget = target;
                }
                if (projectile.ai[1] == 4f)
                {
                    PlayerStands.KillerQueen.KillerQueenStandFinal.savedTarget = target;
                }
            }
            if (projectile.ai[0] == 6f)
            {
                JoJoGlobalNPC jojoNPC = target.GetGlobalNPC <JoJoGlobalNPC>();
                damage = (int)(damage * jojoNPC.kingCrimsonDonutMultiplier);
                jojoNPC.kingCrimsonDonutMultiplier += 0.06f;
            }
            if (projectile.ai[0] == 7f)
            {
                if (projectile.ai[1] == 1f)
                {
                    target.AddBuff(mod.BuffType("MissingOrgans"), 300);
                }
                if (projectile.ai[1] == 2f)
                {
                    target.AddBuff(mod.BuffType("MissingOrgans"), 360);
                }
                if (projectile.ai[1] == 3f)
                {
                    target.AddBuff(mod.BuffType("MissingOrgans"), 420);
                }
                if (projectile.ai[1] == 4f)
                {
                    target.AddBuff(mod.BuffType("MissingOrgans"), 480);
                }
            }
            if (projectile.ai[0] == 8f)
            {
                if (projectile.ai[1] == 1f)
                {
                    target.AddBuff(mod.BuffType("Old"), 540);
                }
                if (projectile.ai[1] == 2f)
                {
                    target.AddBuff(mod.BuffType("Old"), 660);
                }
                if (projectile.ai[1] == 3f)
                {
                    target.AddBuff(mod.BuffType("Old"), 780);
                }
                if (projectile.ai[1] == 4f)
                {
                    target.AddBuff(mod.BuffType("Old"), 900);
                }
            }
            if (projectile.ai[0] == 9f)
            {
                if (projectile.ai[1] == 1f && Main.rand.NextFloat(0, 101) >= 94)
                {
                    target.AddBuff(BuffID.Confused, 60 * 3);
                }
                if (projectile.ai[1] == 2f)
                {
                    target.AddBuff(BuffID.Confused, 60 * 4);
                }
                if (projectile.ai[1] == 3f)
                {
                    target.AddBuff(BuffID.Confused, 60 * 5);
                }
                if (projectile.ai[1] == 4f)
                {
                    target.AddBuff(BuffID.Confused, 60 * 6);
                }
            }
            if (projectile.ai[0] == 10f)
            {
                if (projectile.ai[1] == 1f && Main.rand.NextFloat(0, 101) >= 75)
                {
                    target.AddBuff(BuffID.Bleeding, 60 * 5);
                    player.armorPenetration += 5;
                }
                if (projectile.ai[1] == 2f)
                {
                    target.AddBuff(BuffID.Bleeding, 60 * 10);
                    player.armorPenetration += 10;
                }
                if (projectile.ai[1] == 3f)
                {
                    target.AddBuff(BuffID.Bleeding, 60 * 15);
                    player.armorPenetration += 15;
                }
                if (projectile.ai[1] == 4f)
                {
                    target.AddBuff(BuffID.Bleeding, 60 * 20);
                    player.armorPenetration += 20;
                }
            }

            if (mPlayer.destroyAmuletEquipped)
            {
                if (Main.rand.NextFloat(0, 101) >= 93)
                {
                    target.AddBuff(BuffID.OnFire, 60 * 3);
                }
            }
            if (mPlayer.greaterDestroyEquipped)
            {
                if (Main.rand.NextFloat(0, 101) >= 80)
                {
                    target.AddBuff(BuffID.CursedInferno, 60 * 6);
                }
            }
            if (mPlayer.awakenedAmuletEquipped)
            {
                if (Main.rand.NextFloat(0, 101) >= 80)
                {
                    target.AddBuff(mod.BuffType("Infected"), 60 * 9);
                }
            }
            if (mPlayer.crackedPearlEquipped)
            {
                if (Main.rand.NextFloat(0, 101) >= 60)
                {
                    target.AddBuff(mod.BuffType("Infected"), 10 * 60);
                }
            }
        }