Ejemplo n.º 1
0
        private void DrawBulletsParticles(SpriteBatch spriteBatch, bool allowPanelEntity = false)
        {
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(Main.LocalPlayer);

            // Draw子弹
            foreach (var bullet in clientModPlayer._bullets.ToArray())
            {
                if (bullet.IsRemoved)
                {
                    continue;
                }
                if ((bullet.Position.X < -108f || bullet.Position.Y < -62f ||
                     bullet.Position.X + bullet.Size.X > 432f || bullet.Position.Y + bullet.Size.Y > 316f) &&
                    (!allowPanelEntity || !bullet.IsPanelBullet))
                {
                    continue;
                }
                bullet.Draw(spriteBatch);
            }
            // Draw粒子
            foreach (var particle in clientModPlayer._particles.ToArray())
            {
                if (particle.IsRemoved)
                {
                    continue;
                }
                if ((particle.Position.X < 0f || particle.Position.Y < 0f ||
                     particle.Position.X + particle.Size.X > PanelSize.X || particle.Position.Y + particle.Size.Y > PanelSize.Y) &&
                    (!allowPanelEntity || !particle.IsPanelParticle))
                {
                    continue;
                }
                particle.Draw(spriteBatch);
            }
        }
Ejemplo n.º 2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            Player         clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);
            bool           Animationing    = StartAnimation && AnimationTimer >= 1 ? true : false;

            uiWidth  = 38;
            uiHeight = 50;
            NPC npc = Main.npc[clientModPlayer.CardGameNPCIndex];
            CardFightableNPC fightNPC = (CardFightableNPC)npc.modNPC;

            if (Animationing)
            {
                Texture2D t     = Main.itemTexture[inventoryItem.type];
                var       frame = Main.itemAnimations[inventoryItem.type] != null ? Main.itemAnimations[inventoryItem.type].GetFrame(Main.itemTexture[inventoryItem.type]) : Main.itemTexture[inventoryItem.type].Frame(1, 1, 0, 0);

                Main.spriteBatch.SafeEnd();
                Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.UIScaleMatrix);
                // Retrieve reference to shader
                var whiteBlur = GameShaders.Misc["Entrogic:WhiteBlur"];
                // Reset back to default value.
                whiteBlur.UseOpacity(0f);
                if (AnimationTimer > 15f)
                {
                    whiteBlur.UseOpacity(MathHelper.Min((AnimationTimer - 15f) / 14f, 1f));
                }
                whiteBlur.Apply(null);

                spriteBatch.Draw(t, AnimationPosition + fatherPosition, (Rectangle?)frame, Color.White);

                // As mentioned above, be sure not to forget this step.
                Main.spriteBatch.SafeEnd();
                Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, null, null, null, Main.UIScaleMatrix);
            }
        }
Ejemplo n.º 3
0
        public void ActiveAnimation()
        {
            StartAnimation = true;
            AnimationTimer = 0;

            Player           clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer   clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);
            NPC              npc             = Main.npc[clientModPlayer.CardGameNPCIndex];
            CardFightableNPC fightNPC        = (CardFightableNPC)npc.modNPC;
            Item             item            = new Item();
            // 命名空间的第一个字符串即为Mod内部名(当然乱命名也没法了)
            Mod currentCardMod = ModLoader.GetMod(fightNPC.currentCard.GetType().FullName.Split('.')[0]);

            // 通过类名寻找相应物品
            item.SetDefaults(currentCardMod.GetItem(fightNPC.currentCard.GetType().Name).item.type);
            inventoryItem = item;
            //foreach (var card in Entrogic.ModItems)
            //{
            //    // 通过命名空间寻找相应卡牌
            //    if (card.GetType().FullName == fightNPC.currentCard.GetType().FullName)
            //    {
            //        Item item = new Item();
            //        item.SetDefaults(card.item.type);
            //        inventoryItem = item;
            //    }
            //}
        }
Ejemplo n.º 4
0
        public override void ClickEvent()
        {
            if (Main.dedServ || StartAnimation)
            {
                return;
            }
            Player         clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);

            if (clientModPlayer.CardGameNPCIndex == -1)
            {
                return;
            }
            NPC npc = Main.npc[clientModPlayer.CardGameNPCIndex];
            CardFightableNPC fightNPC = (CardFightableNPC)npc.modNPC;

            if (!PlayerTurn || clientModPlayer.CardGameLeftCard <= 0)
            {
                return;
            }
            clientModPlayer.CardGameLeftCard--;
            //Clicked = true;
            StartAnimation = true;
            AnimationTimer = 0;
        }
Ejemplo n.º 5
0
        public void Update()
        {
            if (Main.dedServ)
            {
                return;
            }
            Player         clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);

            if (clientModPlayer.CardGameNPCIndex == -1)
            {
                return;
            }
            NPC npc = Main.npc[clientModPlayer.CardGameNPCIndex];

            if (StartAnimation)
            {
                Vector2 TargetPosition = new Vector2(274f, 90f);
                AnimationTimer++;
                if (AnimationTimer <= 15f)
                {
                    AnimationPosition = (TargetPosition - uiPosition) / 15f * AnimationTimer + uiPosition;
                }
                else if (AnimationTimer >= 30f)
                {
                    // 出击
                    // 我不想再改代码了,所以这里直接消失掉吧
                    StartAnimation = false;
                }
            }
        }
Ejemplo n.º 6
0
        public void StartGame()
        {
            Player           clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer   clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);
            NPC              npc             = Main.npc[clientModPlayer.CardGameNPCIndex];
            CardFightableNPC fightNPC        = (CardFightableNPC)npc.modNPC;

            clientModPlayer.CardGamePlayerHealth = clientModPlayer.CardGamePlayerMaxHealth;
            clientModPlayer.CardGameActive       = true;
            clientModPlayer.CardGaming           = true;
            fightNPC.CardGameHealth = fightNPC.CardGameHealthMax;
            fightNPC.CardGaming     = true;
            Main.npcChatText        = "";

            PlayerTurnOver = false;
            clientModPlayer.CardGamePlayerTurn = true;
            IsUseBiggerTexture = true;
            clientModPlayer._bullets.Clear();
            clientModPlayer._particles.Clear();
            clientModPlayer.CardGameLeftCard = 1;
            //List<int> buffer = new List<int>();
            //foreach (int card in clientModPlayer.CardType)
            //    buffer.Add(card);
            //for (int i = 0; i < clientModPlayer.CardGameType.Length; i++)
            //{
            //    int chosed = Main.rand.Next(0, buffer.Count);
            //    clientModPlayer.CardGameType[i] = buffer[chosed];
            //    buffer.RemoveAt(chosed);
            //}

            Main.PlaySound(Entrogic.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CGChangeTurn"));
            TimerCountdown = 0;
            AnimationTimer = 0;
            TurnText       = Language.GetTextValue("Mods.Entrogic.Common.PlayerTurn");
        }
Ejemplo n.º 7
0
        // As a modder, you could also opt to make these overrides also sealed. Up to the modder
        public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat)
        {
            add  += EntrogicPlayer.ModPlayer(player).arcaneDamageAdd;
            mult *= EntrogicPlayer.ModPlayer(player).arcaneDamageMult;

            // 收取25%的魔法伤害加成
            add  += player.magicDamage * 0.25f;
            mult *= MathHelper.Max(player.magicDamageMult * 0.25f, 1f);
        }
Ejemplo n.º 8
0
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "\n原版及本Mod的凝胶类召唤物只占0.75个召唤位\n所有生物系列卡牌费用为1\n无摔落伤害";
            // 无摔落伤害
            player.noFallDmg = true;
            // 所有生物系列卡牌费用为1
            EntrogicPlayer ePlayer = EntrogicPlayer.ModPlayer(player);

            for (int a = 0; a < ePlayer.CardHandCost.Length; a++)
            {
                if (ePlayer.CardHandType[a] != 0)
                {
                    Item item = new Item();
                    item.SetDefaults(ePlayer.CardHandType[a]);
                    ModCard card = (ModCard)item.modItem;
                    if (card.series == CardSeriesID.Organism)
                    {
                        ePlayer.CardHandCost[a] = Math.Min(1, ePlayer.CardHandCost[a]);
                    }
                }
            }
            for (int a = 0; a < ePlayer.CardReadyCost.Length; a++)
            {
                if (ePlayer.CardReadyType[a] != 0)
                {
                    Item item = new Item();
                    item.SetDefaults(ePlayer.CardReadyType[a]);
                    ModCard card = (ModCard)item.modItem;
                    if (card.series == CardSeriesID.Organism)
                    {
                        ePlayer.CardReadyCost[a] = Math.Min(1, ePlayer.CardReadyCost[a]);
                    }
                }
            }
            // 凝胶类召唤物只占0.75个召唤位
            float[] i = new float[1001];
            foreach (Projectile proj in Main.projectile)
            {
                if (proj.minion && proj.active && proj.owner == player.whoAmI && proj.minionSlots > 0.75f && (proj.type == ProjectileID.BabySlime /* || proj.type == ProjectileType<Projectiles.衰落魔像.Stoneslime>()*/))
                {
                    i[proj.whoAmI] = proj.minionSlots;
                }
            }
            float MoreMinionSlots = 0;

            foreach (Projectile proj in Main.projectile)
            {
                if (i[proj.whoAmI] != 0)
                {
                    MoreMinionSlots += i[proj.whoAmI] - 0.75f;
                }
            }
            player.maxMinions += (int)MoreMinionSlots;
        }
Ejemplo n.º 9
0
        public override void ClickEvent()
        {
            Player         clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);

            if (clientModPlayer.CardGamePlayerTurn)
            {
                Entrogic.Instance.CardGameUI.PlayerTurnOver = true;
                Main.PlaySound(SoundID.MenuTick);
            }
        }
Ejemplo n.º 10
0
 public void UpdateSlots(int index = -1)
 {
     if (index != -1)
     {
         Grid[index].inventoryItem.SetDefaults(EntrogicPlayer.ModPlayer(Main.LocalPlayer).CardType[index]);
     }
     for (int i = 0; i < Grid.Count; i++)
     {
         Grid[i].inventoryItem.SetDefaults(EntrogicPlayer.ModPlayer(Main.LocalPlayer).CardType[i]);
     }
 }
Ejemplo n.º 11
0
        public override void CardGameAttack(Player attackPlayer, NPC attackNPC, Vector2 playerDrawPosition, Vector2 NPCDrawPosition, Vector2 panelPos)
        {
            EntrogicPlayer           clientModPlayer = EntrogicPlayer.ModPlayer(attackPlayer);
            ExplodingPineappleBullet bullet          = new ExplodingPineappleBullet(NPCDrawPosition + new Vector2(0, -10f))
            {
                Velocity   = new Vector2(0f, -16f),
                Position   = playerDrawPosition + new Vector2(-10f, -6f),
                UIPosition = panelPos
            };

            clientModPlayer._bullets.Add(bullet);
        }
Ejemplo n.º 12
0
        public override void OnSecondButtonClicked(ref bool shop)
        {
            if (Main.dedServ)
            {
                return;
            }
            Player         clienPlayer     = Main.LocalPlayer;
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(clienPlayer);

            clientModPlayer.CardGameNPCIndex = npc.whoAmI;
            StartAttacking();
        }
Ejemplo n.º 13
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            Player         clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);
            bool           Animationing    = StartAnimation && AnimationTimer >= 1 ? true : false;

            uiWidth  = 38;
            uiHeight = 50;
            float alpha = 0.36f;

            if (!Animationing && ModHelper.MouseInRectangle(uiRectangle) && inventoryItem.type != ItemID.None && inventoryItem != null)
            {
                if (PlayerTurn && clientModPlayer.CardGameLeftCard > 0)
                {
                    Main.hoverItemName = $"{inventoryItem.Name}\n点击以使用";
                    alpha = 1f;
                }
            }
            // 没有UI贴图
            //spriteBatch.Draw(ModContent.GetTexture("Entrogic/UI/Cards/HelpGrid"), finalUIPosition, uiColor);
            if (!Animationing && inventoryItem.type != ItemID.None && inventoryItem != null)
            {
                Texture2D t     = Main.itemTexture[inventoryItem.type];
                var       frame = Main.itemAnimations[inventoryItem.type] != null ? Main.itemAnimations[inventoryItem.type].GetFrame(Main.itemTexture[inventoryItem.type]) : Main.itemTexture[inventoryItem.type].Frame(1, 1, 0, 0);
                spriteBatch.Draw(t, finalUIPosition, (Rectangle?)frame, Color.White * alpha);
            }

            if (Animationing)
            {
                Texture2D t     = Main.itemTexture[inventoryItem.type];
                var       frame = Main.itemAnimations[inventoryItem.type] != null ? Main.itemAnimations[inventoryItem.type].GetFrame(Main.itemTexture[inventoryItem.type]) : Main.itemTexture[inventoryItem.type].Frame(1, 1, 0, 0);

                Main.spriteBatch.End();
                Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.UIScaleMatrix);
                // Retrieve reference to shader
                var whiteBlur = GameShaders.Misc["Entrogic:WhiteBlur"];
                // Reset back to default value.
                whiteBlur.UseOpacity(0f);
                if (AnimationTimer > 15f)
                {
                    whiteBlur.UseOpacity(MathHelper.Min((AnimationTimer - 15f) / 8f, 1f));
                }
                whiteBlur.Apply(null);

                spriteBatch.Draw(t, AnimationPosition + fatherPosition, (Rectangle?)frame, Color.White);

                // As mentioned above, be sure not to forget this step.
                Main.spriteBatch.End();
                Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, null, null, null, Main.UIScaleMatrix);
            }
        }
Ejemplo n.º 14
0
 public override void CardGameAttack(Player attackPlayer, NPC attackNPC, Vector2 playerDrawPosition, Vector2 NPCDrawPosition, Vector2 panelPos)
 {
     for (int i = -2; i <= 2; i++)
     {
         EntrogicPlayer  clientModPlayer = EntrogicPlayer.ModPlayer(attackPlayer);
         CardFightBullet bullet          = new FallenStar(NPCDrawPosition + new Vector2(0, -10f))
         {
             Velocity   = Vector2.Zero,
             Center     = playerDrawPosition + new Vector2(0f, -6f) + new Vector2(i * 55f, 0f),
             UIPosition = panelPos
         };
         clientModPlayer._bullets.Add(bullet);
     }
 }
Ejemplo n.º 15
0
 public override void CardGameAttack(Player attackPlayer, NPC attackNPC, Vector2 playerDrawPosition, Vector2 NPCDrawPosition, Vector2 panelPos)
 {
     for (int i = 0; i < 3; i++)
     {
         EntrogicPlayer  clientModPlayer = EntrogicPlayer.ModPlayer(attackPlayer);
         CardFightBullet bullet          = new ArcaneMissleBullet(NPCDrawPosition + new Vector2(0, -10f), i * 0.2f)
         {
             Velocity   = new Vector2(Main.rand.Next(-8, 9) + (Main.rand.NextBool(2) ? 6f : -6f), Main.rand.Next(-8, 9) + (Main.rand.NextBool(2) ? 6f : -6f)),
             Position   = playerDrawPosition + new Vector2(0F, -6F),
             UIPosition = panelPos
         };
         clientModPlayer._bullets.Add(bullet);
     }
     base.CardGameAttack(attackPlayer, attackNPC, playerDrawPosition, NPCDrawPosition, panelPos);
 }
Ejemplo n.º 16
0
        public override void CardGameAttack(Player attackPlayer, NPC attackNPC, Vector2 playerDrawPosition, Vector2 NPCDrawPosition, Vector2 panelPos)
        {
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(attackPlayer);

            for (float rad = 0f; rad <= MathHelper.TwoPi; rad += MathHelper.TwoPi / 6f)
            {
                DarkFlame bullet = new DarkFlame(NPCDrawPosition + new Vector2(0, -10f))
                {
                    Velocity   = new Vector2(0f, -1f),
                    Position   = playerDrawPosition + new Vector2(-10f, -6f) + (rad + MathHelper.TwoPi / 6f).ToRotationVector2() * 30f,
                    UIPosition = panelPos
                };
                clientModPlayer._bullets.Add(bullet);
            }
        }
Ejemplo n.º 17
0
 public override void ClickEvent()
 {
     if (ModHelper.ControlShift && inventoryItem.type != ItemID.None)
     {
         if (!Main.LocalPlayer.ItemSpace(inventoryItem))
         {
             return;
         }
         Main.LocalPlayer.PutItemInInventory(inventoryItem.type);
         inventoryItem = new Item();
         EntrogicPlayer.ModPlayer(Main.LocalPlayer).CardType[Index] = inventoryItem.type;
         Main.PlaySound(SoundID.Grab, -1, -1, 1, 1f, 0.0f);
         return;
     }
     RightClickEvent();
 }
Ejemplo n.º 18
0
        public override void GameAI(float Duration, Vector2 PanelPosition)
        {
            Player         clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);

            if (Duration >= 3.2f && Main.rand.NextBool(3))
            {
                MushroomBullet bullet = new MushroomBullet()
                {
                    Velocity   = new Vector2(0f, Main.rand.NextFloat(1f, 3f)),
                    Position   = new Vector2(Main.rand.Next((int)PlaygroundSize.X), -50f),
                    UIPosition = PanelPosition
                };
                clientModPlayer._bullets.Add(bullet);
            }
        }
Ejemplo n.º 19
0
        public override void GameAI(float Duration, Vector2 PanelPosition)
        {
            Player         clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);

            if (Duration >= 2.6f && !Cannoned)
            {
                MushroomCannon cannon = new MushroomCannon()
                {
                    Velocity   = new Vector2(0f, 1.7f),
                    Center     = new Vector2(PlaygroundSize.X / 2f, -60),
                    UIPosition = PanelPosition
                };
                clientModPlayer._bullets.Add(cannon);
                Cannoned = true;
            }
        }
Ejemplo n.º 20
0
        public override void Update(GameTime gameTime, Player attackPlayer, NPC attackNPC)
        {
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(attackPlayer);

            LifeSpan     = 0.5f;
            _previousKey = _currentKey;
            _currentKey  = Keyboard.GetState();
            Velocity     = Vector2.Zero;
            SetKey(_currentKey, _previousKey);
            SetWalk();

            if (ImmuneTime <= 0f)
            {
                foreach (var bullet in clientModPlayer._bullets)
                {
                    if (bullet == this)
                    {
                        continue;
                    }

                    if (!bullet.IsFriendly && bullet.GetDamage(bullet.Damage) > 0 && Hitbox.Intersects(bullet.Hitbox))
                    {
                        Main.PlaySound(Entrogic.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/CGHurt"));
                        clientModPlayer.CardGamePlayerHealth -= bullet.GetDamage(bullet.Damage);
                        ImmuneTime = 1f;
                        break;
                    }
                }
            }
            ImmuneTime -= (float)gameTime.ElapsedGameTime.TotalSeconds;
            ImmuneTime  = Math.Max(ImmuneTime, 0f);
            if (clientModPlayer.CardGamePlayerTurn)
            {
                IsRemoved = true;                                     // 玩家局就不需要你了
            }
            base.Update(gameTime, attackPlayer, attackNPC);

            Position.X = Math.Max(Position.X, 0);
            Position.X = Math.Min(Position.X, PlaygroundSize.X - _texture.Width);
            Position.Y = Math.Max(Position.Y, 0);
            Position.Y = Math.Min(Position.Y, PlaygroundSize.Y - _texture.Height);
            clientModPlayer.CardGamePlayerCenter = Center;
        }
Ejemplo n.º 21
0
 public override void RightClickEvent()
 {
     if (!AllowPutin(inventoryItem, Main.mouseItem, Index))
     {
         return;
     }
     base.RightClickEvent();
     if (Main.mouseItem.type != ItemID.None && inventoryItem.type != ItemID.None && Main.mouseItem.stack == 1)
     {
         Item mouItem = Main.mouseItem;
         Main.mouseItem = inventoryItem;
         inventoryItem  = mouItem;
     }
     if (Main.mouseLeft && Main.mouseLeftRelease && EntrogicPlayer.ModPlayer(Main.LocalPlayer).CardType[Index] != inventoryItem.type)
     {
         Main.PlaySound(SoundID.Grab, -1, -1, 1, 1f, 0.0f);
     }
     EntrogicPlayer.ModPlayer(Main.LocalPlayer).CardType[Index] = inventoryItem.type;
 }
Ejemplo n.º 22
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            int       frameHeight = buttonImage.Height / 3;
            Rectangle frame       = new Rectangle(0, 0, buttonImage.Width, frameHeight);

            uiHeight = frameHeight;
            Player         clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);

            if (ModHelper.MouseInRectangle(uiRectangle) && clientModPlayer.CardGamePlayerTurn)
            {
                Main.hoverItemName = "确认";
                frame = new Rectangle(0, 1 * frameHeight, buttonImage.Width, frameHeight);
            }
            if (!clientModPlayer.CardGamePlayerTurn)
            {
                frame = new Rectangle(0, 2 * frameHeight, buttonImage.Width, frameHeight);
            }
            spriteBatch.Draw(buttonImage, finalUIPosition, (Rectangle?)frame, uiColor);
        }
Ejemplo n.º 23
0
        public override bool HaveDrawCard(Player player, int number, int a, ref int type, ref int cost)
        {
            NPC   target      = null;
            float distanceMax = 128000f;

            foreach (NPC npc in Main.npc)
            {
                if (npc.active && !npc.friendly)
                {
                    // 计算与玩家的距离
                    float currentDistance = Vector2.Distance(npc.Center, Main.MouseWorld);
                    if (currentDistance < distanceMax)
                    {
                        distanceMax = currentDistance;
                        target      = npc;
                    }
                }
            }
            Item i = new Item();

            i.SetDefaults(type);
            ModCard        card    = (ModCard)i.modItem;
            EntrogicPlayer ePlayer = EntrogicPlayer.ModPlayer(player);
            float          power   = 1f;

            if (ePlayer.GetHoldItem() != null)
            {
                power = ePlayer.GetHoldItem().shootSpeed * 0.8f;
            }
            if (target != null)
            {
                Vector2 vec = (target.Center - player.Center).ToRotation().ToRotationVector2() * i.shootSpeed;
                card.AttackEffects(player, i.shoot, player.Center, target.Center, vec.X, vec.Y, player.GetWeaponDamage(i), player.GetWeaponKnockback(i, 0.5f), i.shootSpeed + power);
            }
            else
            {
                card.AttackEffects(player, i.shoot, player.Center, player.Center, Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-10f, 10f), player.GetWeaponDamage(i), player.GetWeaponKnockback(i, 0.5f), i.shootSpeed + power);
            }
            return(true);
        }
Ejemplo n.º 24
0
        public void Update()
        {
            if (Main.dedServ)
            {
                return;
            }
            Player         clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);

            if (clientModPlayer.CardGameNPCIndex == -1)
            {
                return;
            }
            NPC npc = Main.npc[clientModPlayer.CardGameNPCIndex];
            CardFightableNPC fightNPC = (CardFightableNPC)npc.modNPC;

            if (StartAnimation)
            {
                Vector2 TargetPosition = new Vector2(274f, 252f);
                AnimationTimer++;
                if (AnimationTimer <= 15f)
                {
                    AnimationPosition = (TargetPosition - uiPosition) / 15f * AnimationTimer + uiPosition;
                }
                else if (AnimationTimer >= 25f)
                {
                    // 出击
                    if (inventoryItem.modItem is ModCard)
                    {
                        ModCard card         = (ModCard)inventoryItem.modItem;
                        Vector2 drawPosition = new Vector2(274f, 314f) + new Vector2(17f, 28f); // 元件在UI中的位置
                        drawPosition = CardGameUI.ToPlaygroundPos(drawPosition);
                        card.CardGameAttack(clientPlayer, npc, drawPosition, new Vector2(292f, 64f), PanelPos);

                        clientModPlayer.CardGameType[Index] = 0;
                    }
                    StartAnimation = false;
                }
            }
        }
Ejemplo n.º 25
0
        public override void UpdateMusic(ref int music, ref MusicPriority priority)
        {
            Player player = Main.LocalPlayer;

            if (Main.myPlayer == -1 || Main.gameMenu || !player.active)
            {
                return;
            }
            EntrogicPlayer modPlayer  = EntrogicPlayer.ModPlayer(player);
            bool           magicStorm = EntrogicWorld.magicStorm;

            if (magicStorm && player.ZoneOverworldHeight)
            {
                music    = GetSoundSlot(SoundType.Music, "Sounds/Music/MagicStorm");
                priority = MusicPriority.Environment;
            }
            //if (modPlayer.CardGaming)
            //{
            //    music = GetSoundSlot(SoundType.Music, "Sounds/Music/Toby Fox - Rude Buster");
            //    priority = MusicPriority.BossHigh;
            //}
        }
Ejemplo n.º 26
0
        public override bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            EntrogicItem   eItem   = item.GetGlobalItem <EntrogicItem>();
            EntrogicPlayer ePlayer = EntrogicPlayer.ModPlayer(player);

            if (eItem.glove && attackCardRemainingTimes > 0 && mCard != null && card != null)
            {
                Vector2 vec        = (Main.MouseWorld - player.Center).ToRotation().ToRotationVector2() * (card.shootSpeed + item.shootSpeed);
                int     Tdamage    = player.GetWeaponDamage(card) + damage;
                float   TknockBack = player.GetWeaponKnockback(card, card.knockBack) + knockBack;
                int     Tshoot     = card.shoot;
                if (((ModCard)item.modItem).ModifyGloveShootCard(player, ref position, ref vec.X, ref vec.Y, ref Tshoot, ref Tdamage, ref TknockBack))
                {
                    for (int i = 0; i < ((ModCard)item.modItem).ShootCardTimes(player); i++)
                    {
                        mCard.AttackEffects(player, Tshoot, position, Main.MouseWorld, vec.X, vec.Y, Tdamage, TknockBack, card.shootSpeed + item.shootSpeed);
                        attackCardRemainingTimes -= ((ModCard)item.modItem).AttackCardRemainingTimesReduce(player);
                        if (attackCardRemainingTimes <= 0 && CEntrogicCardConfig.Instance.AutoUseCard)
                        {
                            for (int index = 0; index < ePlayer.CardHandType.Length; index++)
                            {
                                int handCard = ePlayer.CardHandType[index];
                                if (handCard == card.type)
                                {
                                    Entrogic.Instance.CardUI.Grid[index].UseThisCard();
                                    return(false);
                                }
                            }
                        }
                        if (itemSound != null)
                        {
                            Main.PlaySound(itemSound, position);
                        }
                    }
                }
                return(false);
            }
            return(true);
        }
Ejemplo n.º 27
0
        private void QuitGame()
        {
            if (Main.dedServ)
            {
                return;
            }
            Player         clientPlayer    = Main.LocalPlayer;
            EntrogicPlayer clientModPlayer = EntrogicPlayer.ModPlayer(clientPlayer);

            if (clientModPlayer.CardGameNPCIndex == -1)
            {
                goto IL_BackToDefault;
            }
            NPC npc = Main.npc[clientModPlayer.CardGameNPCIndex];

            if (npc.type != NPCID.None && npc.modNPC is CardFightableNPC) // 表示此ModNPC属于CardFightableNPC
            {
                CardFightableNPC fightNPC = (CardFightableNPC)npc.modNPC;

                fightNPC.CardGaming = false;
            }
IL_BackToDefault:
            // 一切都要回到初始状态
            clientModPlayer.CardGaming         = false;
            clientModPlayer.CardGameActive     = false;
            clientModPlayer.CardGameNPCIndex   = -1;
            clientModPlayer.CardGamePlayerTurn = true;
            Array.Clear(clientModPlayer.CardGameType, 0, clientModPlayer.CardGameType.Length);
            AnimationTimer     = 0;
            TimerCountdown     = 60;
            TurnTextColor      = Color.White;
            TurnText           = " ";
            Deathing           = 0;
            DeathTimer         = 0;
            IsUseBiggerTexture = false;
        }
Ejemplo n.º 28
0
 public override void GetWeaponKnockback(Player player, ref float knockback)
 {
     // Adds knockback bonuses
     knockback += EntrogicPlayer.ModPlayer(player).arcaneKnockback;
 }
Ejemplo n.º 29
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            Player         player         = Main.LocalPlayer;
            EntrogicPlayer entrogicPlayer = EntrogicPlayer.ModPlayer(player);

            bool Active = false;

            if (player.inventory[player.selectedItem] != null && player.inventory[player.selectedItem].type != ItemID.None)
            {
                if (player.inventory[player.selectedItem].GetGlobalItem <EntrogicItem>().glove)
                {
                    Active = true;
                }
            }
            if (Main.mouseItem != null && Main.mouseItem.type != ItemID.None)
            {
                if (Main.mouseItem.GetGlobalItem <EntrogicItem>().glove)
                {
                    Active = true;
                }
            }
            if (!Active)
            {
                return;
            }

            #region 实时调整位置
            statPoint = new Vector2(Main.screenWidth * 0.5f, Main.screenHeight * 0.8f);
            Vector2 grave = new Vector2(48f, 30f);
            Graveyard.Left.Pixels      = statPoint.X + 220f - grave.X * 0.5f;
            Graveyard.Top.Pixels       = statPoint.Y - grave.Y * 0.5f;
            GraveyardDelay.Left.Pixels = statPoint.X + 220f - grave.X * 0.5f;
            GraveyardDelay.Top.Pixels  = statPoint.Y - grave.Y * 0.5f;
            Vector2 libraries = new Vector2(38f, 32f);
            Libraries.Left.Pixels = statPoint.X - 220f - libraries.X * 0.5f;
            Libraries.Top.Pixels  = statPoint.Y - libraries.Y * 1.2f;
            Vector2 pass = new Vector2(32f, 30f);
            Pass.Left.Pixels      = statPoint.X - 220f - pass.X * 0.5f;
            Pass.Top.Pixels       = statPoint.Y + pass.Y * 0.2f;
            PassDelay.Left.Pixels = statPoint.X - 220f - pass.X * 0.5f;
            PassDelay.Top.Pixels  = statPoint.Y + pass.Y * 0.2f;
            Vector2 bar = new Vector2(346f, 22f);
            Bar.Left.Pixels     = statPoint.X - bar.X / 2f;
            Bar.Top.Pixels      = statPoint.Y - bar.Y / 2f - (CEntrogicCardConfig.Instance.HandSlotSpecial ? 0f : 50f);
            BarFull.Left.Pixels = Bar.Left.Pixels;
            BarFull.Top.Pixels  = Bar.Top.Pixels;
            for (int i = 0; i >= -(ManaCrystal.Length - 1); i--)
            {
                Vector2 crystal = new Vector2(20f, 20f);
                float   posX    = statPoint.X + 150f + (crystal.X * 0.5f + 15) * i;
                float   posY    = statPoint.Y + 52f - crystal.Y * 0.5f;
                int     num     = Math.Abs(i);
                ManaCrystal[num].position    = new Vector2(posX, posY);
                ManaCrystal[num].Left.Pixels = posX;
                ManaCrystal[num].Top.Pixels  = posY;
            }
            for (int i = 0; i < Grid.Count; i++)
            {
                Vector2 grid = new Vector2(66f, 66f);
                float   posX = statPoint.X - 200f + 2f + grid.X * i;
                float   posY = statPoint.Y - grid.Y * 0.5f;
                if (CEntrogicCardConfig.Instance.HandSlotSpecial)
                {
                    Vector2 screenCenter = new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f;

                    switch (i)
                    {
                    case 0:
                    case 2:
                    case 3:
                    case 5:
                    {
                        posX = screenCenter.X + ((i + 1) % 3 != 0 ? -grid.X - 10 : grid.X + 10) - grid.X / 2f;
                        posY = screenCenter.Y + (i <= 2 ? -50 : 50) - grid.Y / 2f;
                    }
                    break;

                    case 1:
                    case 4:
                    {
                        posX = screenCenter.X - grid.X / 2f;
                        posY = screenCenter.Y + (i <= 2 ? -72 : 72) - grid.Y / 2f;
                    }
                    break;
                    }
                }
                Grid[i].position    = new Vector2(posX, posY);
                Grid[i].Left.Pixels = posX;
                Grid[i].Top.Pixels  = posY;
                Append(Grid[i]);
            }
            #endregion

            base.Draw(spriteBatch);
        }
Ejemplo n.º 30
0
 public override void Update(Player player, ref int buffIndex)
 {
     EntrogicPlayer.ModPlayer(player).arcaneDamageAdd += 0.6f;
 }