Example #1
0
        public override void PostAI(Projectile projectile)
        {
            SGAprojectile modeproj = projectile.GetGlobalProjectile <SGAprojectile>();

            if (projectile.owner < 255 && Main.player[projectile.owner].active && projectile.friendly && !projectile.hostile)
            {
                if (!modeproj.stackedattack)
                {
                    Main.player[projectile.owner].GetModPlayer <SGAPlayer>().StackAttack(ref projectile.damage, projectile);
                }
            }
            modeproj.stackedattack = true;

            if (shortlightning > 0)
            {
                for (int i = 0; i < Math.Min(shortlightning, projectile.oldPos.Length); i++)
                {
                    projectile.oldPos[i].X = projectile.position.X;
                    projectile.oldPos[i].Y = projectile.position.Y;
                }
            }
            if (projectile.modProjectile != null)
            {
                Player projowner = Main.player[projectile.owner];
                if (projectile.modProjectile.mod == SGAmod.Instance && projowner.active && projowner.heldProj == projectile.whoAmI)
                {
                    projectile.Opacity = MathHelper.Clamp(projowner.stealth, 0.1f, 1f) * Math.Min(projectile.modProjectile is ClipWeaponReloading sub ? (float)projectile.timeLeft / 20f : 1f, 1f);
                }
            }
        }
Example #2
0
        public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            SGAPlayer sgaplayer = player.GetModPlayer <SGAPlayer>();

            if ((item.useAmmo == AmmoID.Gel) && player.GetModPlayer <SGAPlayer>().FridgeflameCanister)
            {
                int probg = Projectile.NewProjectile(position.X + (int)(speedX * 2f), position.Y + (int)(speedY * 2f), speedX, speedY, mod.ProjectileType("IceFlames"), damage / 2, knockBack, player.whoAmI);
                Main.projectile[probg].ranged   = item.ranged;
                Main.projectile[probg].magic    = item.magic;
                Main.projectile[probg].friendly = true;
                Main.projectile[probg].hostile  = false;
                Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedByRandom(MathHelper.ToRadians(15));
                Main.projectile[probg].velocity.X = perturbedSpeed.X * 0.6f;
                Main.projectile[probg].velocity.Y = perturbedSpeed.Y * 0.6f;
                Main.projectile[probg].owner      = player.whoAmI;
                SGAprojectile modeproj = Main.projectile[probg].GetGlobalProjectile <SGAprojectile>();
                modeproj.myplayer = player;
                IdgProjectile.Sync(probg);
            }
            return(true);
        }
		public override bool PreAI(Projectile projectile)
		{
		SGAprojectile modeproj=projectile.GetGlobalProjectile<SGAprojectile>();

			if (modeproj.inttime == false)
			{
				if (projectile.friendly)
				{
					Player owner = Main.player[projectile.owner];
					if (owner != null)
					{
						SGAPlayer sgaply = owner.SGAPly();
						if (sgaply.acidSet.Item2 && (projectile.Throwing().thrown || projectile.thrown))
						{
							acid = true;
						}
						if (sgaply.enchantedShieldPolish)
						{
							if (projectile.modProjectile != null && projectile.modProjectile is IShieldBashProjectile)
							{
								projectile.magic = true;
							}
						}
					}
				}
			}



			if (projectile.modProjectile!=null){

		/*if ((projectile.modProjectile).GetType().Name=="JackpotRocket"){
		projectile.velocity.Y+=0.1f;
		projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; 
		}*/

	}

			/*if (Main.player[projectile.owner]!=null);
			ply=Main.player[projectile.owner];
			if (Main.npc[projectile.owner]!=null);
			npc=Main.npc[projectile.owner];
			if (npc!=null && modeproj.inttime==true){
			if (modeproj.raindown==true && projectile.position.Y>modeproj.splithere.Y && projectile.velocity.Y>0){
			projectile.timeLeft=-1;

			}
			if (modeproj.splittingcoins==true){
			if ((projectile.position.Y>modeproj.splithere.Y && projectile.velocity.Y>0) || (projectile.position.Y<modeproj.splithere.Y && projectile.velocity.Y<0)){
			SgaLib.Shattershots(projectile.position,projectile.position+new Vector2(-100,0),new Vector2(0,0),projectile.type,projectile.damage,projectile.velocity.Length(),0,1,true,0,true,projectile.timeLeft);
			SgaLib.Shattershots(projectile.position,projectile.position+new Vector2(100,0),new Vector2(0,0),projectile.type,projectile.damage,projectile.velocity.Length(),0,1,true,0,true,projectile.timeLeft);
			//projectile.position=new Vector2(0,-900);
			projectile.timeLeft=-1;
		}}

			}*/
			if (projectile.type == 181 || projectile.type == ProjectileID.GiantBee)
			{
				if (Main.player[projectile.owner] != null)
				{
					Player ply = Main.player[projectile.owner];
					if (ply != null)
					{
						SGAPlayer modplayer = ply.GetModPlayer<SGAPlayer>();
						if (ply != null)
						{
							if (modplayer.beefield > 0)
							{
								//modeproj.enhancedbees == true
								if (modplayer.beefieldtoggle > 0)
								{
									if (projectile.velocity.Length() > 20)
									{
										projectile.velocity.Normalize();
										projectile.velocity = projectile.velocity * 0.98f;
									}
									else
									{
										projectile.velocity = projectile.velocity * 1.15f;
									}
								}
							}
						}
					}
				}
			}
		modeproj.inttime=true;
		return true;
		}
        public override void PostAI(Projectile projectile)
		{
			SGAprojectile modeproj = projectile.GetGlobalProjectile<SGAprojectile>();
				modeproj.damageReduceTime -= 1;			
			if (modeproj.damageReduce >= 0f)
            {

				if (damageReduceTime < 1)
				{
					modeproj.damageReduce /= 2f;
					if (modeproj.damageReduce < 1)
						modeproj.damageReduce = 1f;
				}
			}


			Player owner = Main.player[projectile.owner];
			if (owner != null)
			{
			SGAPlayer sgaply= owner.SGAPly();

				if (projectile.sentry && sgaply.bustlingFungus.Item1)
                {
					fungalAura += 1;
					if (fungalAura == 180)
                    {
						int proj = Projectile.NewProjectile(projectile.Center,Vector2.Zero,ModContent.ProjectileType<Items.Accessories.BungalHealingAura>(),0,0,projectile.owner,0,projectile.whoAmI+1);
						//Main.projectile[proj].ai[1] = projectile.whoAmI + 1;
					}
					if (projectile.velocity.Length() > 0.25)
                    {
						fungalAura = 0;
					}

                }
                else
                {
					fungalAura = 0;
				}


				if (projectile.melee)
				{


					//Main.NewText("test " + projectile.coldDamage);

					if (sgaply.glacialStone)
					{
						if (!owner.frostBurn && projectile.friendly && !projectile.hostile && !projectile.noEnchantments && Main.rand.Next(2 * (1 + projectile.extraUpdates)) == 0)
						{
							int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, projectile.velocity.X * 0.2f + (float)(projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, default(Color), 2f);
							Main.dust[num].noGravity = true;
							Main.dust[num].velocity *= 0.7f;
							Main.dust[num].velocity.Y -= 0.5f;
						}
						projectile.coldDamage = true;

					}

					sgaply.FlaskEffects(new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height), projectile.velocity);
				}
			}

			if (embued)
			{
				int dust = Dust.NewDust(projectile.position,projectile.width, projectile.height, DustID.AncientLight, 0f, 0f, 100, default(Color), 1f);
				Main.dust[dust].noGravity = true;
				Main.dust[dust].fadeIn = 0.6f;
				Main.dust[dust].velocity = projectile.velocity*Main.rand.NextFloat(0.25f,0.80f);
				Main.dust[dust].color = Main.hslToRgb(((float)(Main.GlobalTime / 3)+(float)projectile.whoAmI*7.16237f) % 1f, 0.9f, 0.65f);
			}

			if (acid)
            {
				if (Main.rand.Next(0, 3) == 1)
				{
					int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, ModContent.DustType<Dusts.AcidDust>());
					Main.dust[dust].scale = 0.75f;
					Main.dust[dust].noGravity = true;
					Main.dust[dust].velocity = projectile.velocity * (float)(Main.rand.Next(60, 100) * 0.01f);
				}
			}

			//SGAprojectile modeproj = projectile.GetGlobalProjectile<SGAprojectile>();
			if (projectile.owner < 255 && Main.player[projectile.owner].active && projectile.friendly && !projectile.hostile)
			{
				if (!modeproj.stackedattack)
				{
					owner.GetModPlayer<SGAPlayer>().StackAttack(ref projectile.damage, projectile);
				}
			}
			modeproj.stackedattack = true;

			if (shortlightning > 0)
			{

				for (int i = 0; i < Math.Min(shortlightning, projectile.oldPos.Length); i++)
				{
					projectile.oldPos[i].X = projectile.position.X;
					projectile.oldPos[i].Y = projectile.position.Y;
				}

			}
			if (projectile.modProjectile != null)
			{
				Player projowner = Main.player[projectile.owner];
				if (projectile.modProjectile.mod == SGAmod.Instance && projowner.active && projowner.heldProj == projectile.whoAmI)
				{
					projectile.Opacity = MathHelper.Clamp(projowner.stealth, 0.1f, 1f)*Math.Min(projectile.modProjectile is ClipWeaponReloading sub ? (float)projectile.timeLeft/20f : 1f,1f);
				}
			}
		}
        public void DoModifies(NPC npc, Player player, Projectile projectile, Item item, ref int sourcedamage, ref float knockback, ref bool crit)
        {
            SGAPlayer moddedplayer = player.GetModPlayer <SGAPlayer>();
            int       damage       = (int)(sourcedamage * damagemul);

            Projectile held = null;

            if (projectile != null)
            {
                float resist = npc.SGANPCs().pierceResist;
                if ((projectile.penetrate < 0 || projectile.penetrate > 3) && resist < 1)
                {
                    damage       = (int)(damage * resist);
                    sourcedamage = damage;
                }


                if (crit && moddedplayer.molotovLimit > 0 && projectile.Throwing().thrown)
                {
                    crit = (Main.rand.Next(10) == 0);
                }

                if (player != null && player.heldProj >= 0)
                {
                    held = Main.projectile[player.heldProj];
                }

                if (projectile.trap)
                {
                    damage += (int)(sourcedamage * (player.SGAPly().TrapDamageMul - 1f));
                }
            }

            DoApoco(npc, projectile, player, item, ref damage, ref knockback, ref crit);

            if (moddedplayer != null)
            {
                if (moddedplayer.acidSet.Item1)
                {
                    reducedDefense += (npc.poisoned ? 5 : 0) + (npc.venom ? 5 : 0) + (acidburn ? 5 : 0);
                }
            }

            damage += (int)(Math.Min(npc.defense, reducedDefense) / 2);

            if (Gourged)
            {
                damage += npc.defense / 4;
            }
            if (Sodden)
            {
                damage += (int)((float)sourcedamage * 0.33f);
            }

            if (moddedplayer != null)
            {
                if (moddedplayer.PrimordialSkull)
                {
                    if (npc.HasBuff(BuffID.OnFire))
                    {
                        damage += (int)(sourcedamage * 0.25);
                    }
                }

                if (npc.HasBuff(BuffID.Midas))
                {
                    damage += (int)(sourcedamage * 0.15f);
                }
            }

            if (item != null)
            {
                if (item.pick + item.axe + item.hammer > 0)
                {
                    if (player.HasBuff(ModContent.BuffType <TooltimePotionBuff>()))
                    {
                        knockback += 50f;
                    }
                }
            }

            if (projectile != null)
            {
                SGAprojectile modeproj   = projectile.GetGlobalProjectile <SGAprojectile>();
                Player        P          = Main.player[projectile.owner];
                bool          trapdamage = false;
                if (projectile.trap)
                {
                    trapdamage = true;
                }

                if (trapdamage)
                {
                    float totaldamage = 0f;
                    //damage += (int)((npc.defense * moddedplayer.TrapDamageAP) / 2.00);
                    totaldamage += moddedplayer.TrapDamageAP;
                    if (moddedplayer.JaggedWoodenSpike)
                    {
                        totaldamage += 0.4f;
                        //damage += (int)((npc.defense*0.4)/2.00);
                    }
                    if (moddedplayer.JuryRiggedSpikeBuckler)
                    {
                        //damage += (int)(damage * 0.1);
                        totaldamage += 0.1f;
                        //damage += (int)((npc.defense * 0.1) / 2.00);
                    }
                    totaldamage = Math.Min(totaldamage, 1f);
                    if (moddedplayer.GoldenCog)
                    {
                        npc.life = npc.life - (int)(damage * 0.10);
                        if (Main.netMode == 2)
                        {
                            NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0);
                        }
                    }
                    damage += (int)((npc.defense * totaldamage) / 2.00);
                }

                if (moddedplayer.beefield > 0 && (projectile.type == ProjectileID.Bee || projectile.type == ProjectileID.GiantBee))
                {
                    damage += (int)(Math.Min(moddedplayer.beedamagemul, 10f + (moddedplayer.beedamagemul / 50f)) * 1.5f);
                }

                if (modeproj.myplayer != null)
                {
                    P = modeproj.myplayer;
                }

                if (P != null)
                {
                    if (moddedplayer.CirnoWings == true && projectile.coldDamage)
                    {
                        damage += (int)((float)sourcedamage * 0.20f);
                    }
                }
            }

            if (moddedplayer.MisterCreeperset && item != null)
            {
                if (item.shoot < 1 && item.melee)
                {
                    if (player.velocity.Y > 1)
                    {
                        crit = true;
                    }
                }
            }

            if (moddedplayer.Blazewyrmset)
            {
                if (npc.HasBuff(mod.BuffType("ThermalBlaze")) && ((item != null && item.melee) || (projectile != null && projectile.melee)))
                {
                    damage += (int)(sourcedamage * 0.20f);
                }
            }

            if (moddedplayer.alkalescentHeart)
            {
                damage += (int)(sourcedamage * (0f + (npc.HasBuff(ModContent.BuffType <AcidBurn>()) ? 0.15f : (npc.HasBuff(BuffID.Venom) ? 0.10f : (npc.HasBuff(BuffID.Poisoned) ? 0.05f : 0)))));
            }

            SGAPlayer sgaply = player.SGAPly();

            if (sgaply.snakeEyes.Item1)
            {
                bool falsecrit = crit;
                if (!crit && Main.rand.Next(100) == 0)
                {
                    CombatText.NewText(npc.Hitbox, Color.Red, "False Crit", false, false);
                    falsecrit = true;
                }
                sgaply.snakeEyes.Item2 = falsecrit ? 0 : Math.Min(sgaply.snakeEyes.Item2 + 1, 100);
                damage += (int)(sourcedamage * (0f + (sgaply.snakeEyes.Item2 / 100f)));
            }

            if ((Main.netMode < 1 || SGAmod.SkillRun > 1) && SGAmod.SkillRun > 0)
            {
                if (sgaply.skillMananger == null)
                {
                    return;
                }

                if (item != null)
                {
                    sgaply.skillMananger.OnEnemyDamage(ref damage, ref crit, ref knockback, item, null);
                }
                if (projectile != null)
                {
                    sgaply.skillMananger.OnEnemyDamage(ref damage, ref crit, ref knockback, null, projectile);
                }
            }

            if (petrified)
            {
                if (player != null && (item?.pick > 0 || (projectile != null && player.heldProj >= 0 && player.heldProj == projectile.whoAmI && player.HeldItem.pick > 0)))
                {
                    damage = (int)(damage * 3f);
                    crit   = true;
                    Main.PlaySound(SoundID.Tink, (int)npc.Center.X, (int)npc.Center.Y, 0, 1, 0.25f);
                }
                else
                {
                    damage = (int)(damage * 0.25f);
                }
            }

            DoModifiesLateEvent?.Invoke(npc, player, projectile, item, ref sourcedamage, ref damage, ref knockback, ref crit);

            LifeSteal(npc, player, ref damage, ref knockback, ref crit);
            OnCrit(npc, projectile, player, item, ref damage, ref knockback, ref crit);

            sourcedamage = damage;
        }
Example #6
0
        public override bool PreAI(Projectile projectile)
        {
            SGAprojectile modeproj = projectile.GetGlobalProjectile <SGAprojectile>();



            if (projectile.modProjectile != null)
            {
                /*if ((projectile.modProjectile).GetType().Name=="JackpotRocket"){
                 * projectile.velocity.Y+=0.1f;
                 * projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
                 * }*/
            }

            /*if (Main.player[projectile.owner]!=null);
             * ply=Main.player[projectile.owner];
             * if (Main.npc[projectile.owner]!=null);
             * npc=Main.npc[projectile.owner];
             * if (npc!=null && modeproj.inttime==true){
             * if (modeproj.raindown==true && projectile.position.Y>modeproj.splithere.Y && projectile.velocity.Y>0){
             * projectile.timeLeft=-1;
             *
             * }
             * if (modeproj.splittingcoins==true){
             * if ((projectile.position.Y>modeproj.splithere.Y && projectile.velocity.Y>0) || (projectile.position.Y<modeproj.splithere.Y && projectile.velocity.Y<0)){
             * SgaLib.Shattershots(projectile.position,projectile.position+new Vector2(-100,0),new Vector2(0,0),projectile.type,projectile.damage,projectile.velocity.Length(),0,1,true,0,true,projectile.timeLeft);
             * SgaLib.Shattershots(projectile.position,projectile.position+new Vector2(100,0),new Vector2(0,0),projectile.type,projectile.damage,projectile.velocity.Length(),0,1,true,0,true,projectile.timeLeft);
             * //projectile.position=new Vector2(0,-900);
             * projectile.timeLeft=-1;
             * }}
             *
             * }*/
            if (Main.player[projectile.owner] != null)
            {
                Player ply = Main.player[projectile.owner];
                if (ply != null)
                {
                    SGAPlayer modplayer = ply.GetModPlayer <SGAPlayer>();
                    if (ply != null)
                    {
                        if (modplayer.beefield > 0)
                        {
                            //modeproj.enhancedbees == true
                            if ((projectile.type == 181 || projectile.type == ProjectileID.GiantBee) && modplayer.beefieldtoggle > 0)
                            {
                                if (projectile.velocity.Length() > 20)
                                {
                                    projectile.velocity.Normalize();
                                    projectile.velocity = projectile.velocity * 0.98f;
                                }
                                else
                                {
                                    projectile.velocity = projectile.velocity * 1.15f;
                                }
                            }
                        }
                    }
                }
            }
            modeproj.inttime = true;
            return(true);
        }