Exemplo n.º 1
0
 public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
 {
     if (effect != 0f && proj.melee)
     {
         QwertyMethods.PokeNPC(player, target, proj.GetGlobalProjectile <MagicBonusOnProj>().magicBoost *player.magicDamage, magic: true);
     }
 }
Exemplo n.º 2
0
 public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit)
 {
     if (effect != 0f && item.melee)
     {
         QwertyMethods.PokeNPC(player, target, damage * effect, magic: true);
     }
 }
Exemplo n.º 3
0
        public override void PostItemCheck()
        {
            if (!player.inventory[player.selectedItem].IsAir)
            {
                Point origin = player.Bottom.ToTileCoordinates();
                Point point;
                Item  item = player.inventory[player.selectedItem];
                //Main.NewText(player.itemAnimation  + " / " + player.itemAnimationMax);

                if (item.useStyle == 101)
                {
                    if (Main.mouseRight && Main.myPlayer == item.owner && !hasRightClicked)
                    {
                        if (WorldUtils.Find(origin, Searches.Chain(new Searches.Down(3), new GenCondition[]
                        {
                            new Conditions.IsSolid()
                        }), out point))
                        {
                            player.itemAnimation = player.itemAnimationMax;
                            player.velocity.Y    = -10 - player.jumpSpeedBoost;
                            uppercut             = true;
                            slam = false;
                        }
                        else
                        {
                            player.velocity.Y = 10;
                            slam     = true;
                            uppercut = false;
                        }
                    }
                    float shift = 0f;
                    if (player.itemAnimation > 0 && uppercut || slam)
                    {
                        if (slam)
                        {
                            //Main.NewText("Slamming");
                            player.bodyFrame.Y = player.bodyFrame.Height * 4;
                            shift = (float)Math.PI / 2;

                            if (player.velocity.Y != 0)
                            {
                                player.itemAnimation = 2;
                            }
                            else
                            {
                                player.itemAnimation = 0;
                                slam = false;
                            }
                        }
                        else if (uppercut)
                        {
                            shift = (float)Math.PI / 2 * ((float)player.itemAnimation / (float)player.itemAnimationMax) - (float)Math.PI / 4;

                            if (player.itemAnimation < player.itemAnimationMax * .5f)
                            {
                                player.bodyFrame.Y = player.bodyFrame.Height * 2;
                            }
                            else if (player.itemAnimation < player.itemAnimationMax * .25f)
                            {
                                player.bodyFrame.Y = player.bodyFrame.Height * 3;
                            }
                            else
                            {
                                player.bodyFrame.Y = player.bodyFrame.Height * 4;
                            }
                            if (player.itemAnimation < 2)
                            {
                                player.itemAnimation = 2;
                            }
                            if (player.velocity.Y >= 0)
                            {
                                player.itemAnimation = 0;
                                uppercut             = false;
                            }
                        }
                    }
                    else
                    {
                        if (player.itemAnimation < player.itemAnimationMax * .25f)
                        {
                            shift = (float)Math.PI / -4 * ((player.itemAnimation) / (player.itemAnimationMax * .25f));
                        }
                        else if (player.itemAnimation < player.itemAnimationMax * .75f)
                        {
                            shift = (float)Math.PI / -2 * (1 - (player.itemAnimation - (player.itemAnimationMax * .25f)) / (player.itemAnimationMax * .5f)) + (float)Math.PI / 4;
                        }
                        else
                        {
                            shift = (float)Math.PI / 4 * (1 - (player.itemAnimation - (player.itemAnimationMax * .75f)) / (player.itemAnimationMax * .25f));
                        }
                        if (player.itemAnimation < player.itemAnimationMax * .15f)
                        {
                            player.bodyFrame.Y = player.bodyFrame.Height * 3;
                        }
                        else if (player.itemAnimation < player.itemAnimationMax * .35f)
                        {
                            player.bodyFrame.Y = player.bodyFrame.Height * 2;
                        }
                        else if (player.itemAnimation < player.itemAnimationMax * .65f)
                        {
                            player.bodyFrame.Y = player.bodyFrame.Height * 3;
                        }
                        else if (player.itemAnimation < player.itemAnimationMax * .85f)
                        {
                            player.bodyFrame.Y = player.bodyFrame.Height * 4;
                        }
                        else
                        {
                            player.bodyFrame.Y = player.bodyFrame.Height * 3;
                        }
                    }
                    if (Main.mouseRight && Main.myPlayer == item.owner && !slam && !uppercut)
                    {
                        player.itemAnimation = 0;
                    }

                    player.itemRotation = (float)Math.PI / -4 + player.direction * ((float)Math.PI / 2 + shift);
                    //Main.NewText(MathHelper.ToDegrees(player.itemRotation));

                    Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f;
                    if (player.direction != 1)
                    {
                        vector24.X = (float)player.bodyFrame.Width - vector24.X;
                    }
                    if (player.gravDir != 1f)
                    {
                        vector24.Y = (float)player.bodyFrame.Height - vector24.Y;
                    }
                    vector24           -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f;
                    player.itemLocation = player.position + vector24;

                    float swordLength = new Vector2(Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height).Length();
                    swordLength *= item.scale;
                    for (int n = 0; n < Main.npc.Length; n++)
                    {
                        localNPCImmunity[n]--;
                        if (Main.npc[n].active && !Main.npc[n].dontTakeDamage && (!Main.npc[n].friendly || (Main.npc[n].type == 22 && player.killGuide) || (Main.npc[n].type == 54 && player.killClothier)) && player.itemAnimation > 0 && localNPCImmunity[n] <= 0 && Collision.CheckAABBvLineCollision(Main.npc[n].position, Main.npc[n].Size, player.itemLocation, player.itemLocation + QwertyMethods.PolarVector(swordLength, player.itemRotation - (float)Math.PI / 4)))
                        {
                            localNPCImmunity[n] = item.useAnimation / 3;
                            int damageBeforeVariance = item.damage;
                            if (item.melee)
                            {
                                damageBeforeVariance = (int)((float)item.damage * player.meleeDamage);
                            }
                            if (item.ranged)
                            {
                                damageBeforeVariance = (int)((float)item.damage * player.rangedDamage);
                            }
                            if (item.magic)
                            {
                                damageBeforeVariance = (int)((float)item.damage * player.magicDamage);
                            }
                            if (item.summon)
                            {
                                damageBeforeVariance = (int)((float)item.damage * player.minionDamage);
                            }
                            if (item.thrown)
                            {
                                damageBeforeVariance = (int)((float)item.damage * player.thrownDamage);
                            }
                            if (slam || uppercut)
                            {
                                damageBeforeVariance *= 2;
                            }
                            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(3), new GenCondition[]
                            {
                                new Conditions.IsSolid()
                            }), out point) && player.GetModPlayer <SkywardHiltEffect>().effect&& player.grappling[0] == -1)
                            {
                                damageBeforeVariance *= 2;
                            }
                            //////////////////////

                            Projectile p = QwertyMethods.PokeNPC(player, Main.npc[n], damageBeforeVariance, item.knockBack, true);
                            if (item.type == mod.ItemType("EtimsSword"))
                            {
                                p.GetGlobalProjectile <Etims>().effect = true;
                            }
                        }
                    }
                    hasRightClicked = (Main.mouseRight && Main.myPlayer == item.owner);
                }
            }
        }