Inheritance: MonoBehaviour
Example #1
0
    protected override Projectile CreateProjectile(int chargeInd, Transform seek) {
        if(chargeInd == 0) {
            if(mLastClone) {
                //detonate
                if(mLastClone.state == (int)Projectile.State.Active || mLastClone.state == (int)Projectile.State.Seek) {
                    if(mLastClone.stats)
                        mLastClone.stats.curHP = 0;
                    else
                        mLastClone.state = (int)Projectile.State.Dying;

                    mLastClone = null;
                    activeGO.SetActive(false);
                }
                return null;
            }
            else {
                mLastClone = base.CreateProjectile(chargeInd, seek);

                activeGO.SetActive(mLastClone != null);

                return mLastClone;
            }
        }

        return base.CreateProjectile(chargeInd, seek);
    }
Example #2
0
		public void CreateFromPositions()
		{
			var projectileFromPositions = new Projectile(Vector3D.Zero, Vector3D.UnitX,
				new PhysicalEntity3D());
			Assert.AreEqual(projectileFromPositions.Position, Vector3D.Zero);
			Assert.AreEqual(projectileFromPositions.Orientation, new Quaternion(-0.5f, 0.5f, 0.5f, 0.5f));
		}
Example #3
0
        public override IEnumerable<TickTimer> Main()
        {
            StartCooldown(EvalTag(PowerKeys.CooldownTime));
            UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));
            int numProjectiles = Rune_B > 0 ? (int)ScriptFormula(4) : 1;
            for (int n = 0; n < numProjectiles; ++n)
            {
                if (Rune_B > 0)
                    yield return WaitSeconds(ScriptFormula(17));

                var proj = new Projectile(this,
                                          RuneSelect(107011, 107030, 107035, 107223, 107265, 107114),
                                          User.Position);
                proj.Position.Z += 3f;
                proj.OnCollision = (hit) =>
                {
                    // TODO: fix positioning of hit actors. possibly increase model scale? 
                    SpawnEffect(RuneSelect(112327, 112338, 112327, 112345, 112347, 112311), proj.Position);

                    proj.Destroy();

                    if (Rune_E > 0 && Rand.NextDouble() < ScriptFormula(11))
                        hit.PlayEffectGroup(107163);

                    if (Rune_A > 0)
                        WeaponDamage(hit, ScriptFormula(2), DamageType.Fire);
                    else
                        WeaponDamage(hit, ScriptFormula(0), DamageType.Poison);
                };
                proj.Launch(TargetPosition, 1f);
            }
        }
Example #4
0
    public Projectile GetProjectile(Projectile.ProjectileType projectile)
    {
        Projectile p;
        switch (projectile) {
        default:
            p = _projectiles.GetItem ();
            if (p == null) {
                p = Instantiate (_default);
            }
            break;

        case Projectile.ProjectileType.Artillery:
            p = _pArtillery.GetItem ();
            if (p == null) {
                p = Instantiate (_defaultArtillery);
            }
            break;

        case Projectile.ProjectileType.HomingMissile:
            p = _pMissile.GetItem ();
            if (p == null) {
                p = Instantiate (_defaultHomingMissile);
            }
            break;
        }

        p.transform.parent = transform.parent;
        p.gameObject.SetActive (true);
        return p;
    }
    public static bool Defeats(Projectile p1, Projectile p2)
    {
        ProjectileType type1 = p1.type;
        ProjectileType type2 = p2.type;

        return p1.caster != p2.caster && Defeats(type1, type2);
    }
Example #6
0
            public Player(WurmsGame parent, Texture2D tex, Vector2 pos)
                : base(parent, pos)
            {
                this._worldPosition = pos;
                this._sprite = new Sprite(tex, this._parent._spriteBatch, this._worldPosition);
                this._inputEnabled = true;
                this._inputToggles = new Dictionary<string, bool>();
                this._inputToggles["move_left"] = true;
                this._inputToggles["move_right"] = true;
                this._inputToggles["jump"] = true;
                this._applyGravity = true;
                this._keyboardState = Keyboard.GetState();
                this._mouseState = Mouse.GetState();
                this._projectiles = new Dictionary<string, Projectile>();

                this._bulletAmmo = 10;
                this._rocketAmmo = 5;
                this._nextBullet = 0;
                this._nextRocket = 0;
                this._currentWeaponType = "BULLETS";

                for (int i = 0; i < this._bulletAmmo; i++)
                {
                    this._projectiles["BULLETS_" + i] = new Projectile(this._parent, this._parent.Content.Load<Texture2D>("Bullet"), new Vector2(-100.0f, -100.0f), 3, 5);
                }
                for (int i = 0; i < this._rocketAmmo; i++)
                {
                    this._projectiles["ROCKETS" + i]  = new Projectile(this._parent, this._parent.Content.Load<Texture2D>("Rocket"), new Vector2(-200.0f, -100.0f), 5, 3);
                }
                this._nextProjectile = this._projectiles["BULLETS_0"];
            }
Example #7
0
    protected override Projectile CreateProjectile(int chargeInd, Transform seek) {
        if(chargeInd == starLargeIndex) {
            if(mLastLargeStar && !mLastLargeStar.isReleased) {
                mLastLargeStar.Release();
                mLastLargeStar = null;
            }

            string type = charges[chargeInd].projType;
            if(!string.IsNullOrEmpty(type)) {
                Vector3 _pt = starLargeAttach.position, _dir = dir;

                _pt.z = 0.0f;

                if(angle != 0.0f) {
                    _dir = Quaternion.Euler(new Vector3(0, 0, Mathf.Sign(_dir.x)*angle))*_dir;
                }

                mLastLargeStar = Projectile.Create(projGroup, type, _pt, _dir, seek);
                if(mLastLargeStar) {
                    mCurProjCount++;
                    mLastLargeStar.releaseCallback += OnProjRelease;
                }
            }

            return mLastLargeStar;
        }
        else {
            return base.CreateProjectile(chargeInd, seek);
        }
    }
	public override void Draw(SpriteBatch sb, Projectile p) {
		Vector2 pc = p.position+new Vector2(p.width/2f,p.height/2f);
		
		if (fired) {
			sb.End();
			sb.Begin(SpriteSortMode.Immediate,BlendState.Additive);
			
			foreach (Spark spark in sparks) spark.Draw(sb,p,this);
			for (int i = 0; i < sparks.Count; i++) if (sparks[i].dead) sparks.RemoveAt(i--);
			
			sb.End();
			sb.Begin();
			
			if (sparks.Count == 0) p.Kill();
		} else {
			fired = true;
			
			int r, g, b;
			Color c;
			float degrees;
			
			byte[] bytes = BitConverter.GetBytes(seed);
			Random rnd = new Random();
			
			degrees = (float)(rnd.NextDouble()*360d);
			HsvToRgb(bytes[0]*360f/255f,bytes[1]/255f,1f,out r,out g,out b);
			c = new Color(r,g,b);
			for (int i = 0; i < 20; i++) sparks.Add(new MySpark(pc,Util.Vector((float)(1.5f+rnd.NextDouble()*.75f),360f/20f*i+degrees),c,80+rnd.Next(40)));
			
			degrees = (float)(rnd.NextDouble()*360d);
			HsvToRgb(bytes[2]*360f/255f,bytes[3]/255f,1f,out r,out g,out b);
			c = new Color(r,g,b);
			for (int i = 0; i < 40; i++) sparks.Add(new MySpark(pc,Util.Vector((float)(3f+rnd.NextDouble()*1.5f),360f/40f*i+degrees),c,80+rnd.Next(40)));
		}
	}
Example #9
0
 public void hurt(Projectile p)
 {
     base.blinkRed();
     health -= p.giveDamage();
     if(health <= 0)
         die(this.gameObject);
 }
 public Projectile Get(Projectile prefab)
 {
     Projectile p = CachePool<Projectile>.Instance.GetObjectOfType (prefab.GetType ().Name);
     if (p == null)
         p = Instantiate<Projectile> (prefab);
     return p;
 }
Example #11
0
 public static void Spawn(Projectile prefab, Vector3 pos,Vector2 force, Transform target)
 {
     Projectile t = Instantiate(prefab);
     t.transform.position = pos;
     t.GetComponent<Rigidbody2D>().AddForce(force);
     t.target = target;
 }
Example #12
0
        protected override void LoadContent(ContentManager theContentManager, GraphicsDevice theGraphicsDevice)
        {
            mPShipSprite = new PShip();
            mProjectileSprite = new Projectile();

            //Initialize and add the background images to the Scrolling background. You can change the
            //scroll area by passing in a different Viewport. The images will then scale and scroll within
            //that given Viewport.
            mScrollingBackground = new VerticallyScrollingBackground(theGraphicsDevice.Viewport);
            mScrollingBackground.AddBackground("Background1");
            mScrollingBackground.AddBackground("Background2");
            mScrollingBackground.AddBackground("Background3");
            mScrollingBackground.AddBackground("Background4");
            mScrollingBackground.AddBackground("Background5");
            mScrollingBackground.AddBackground("Background6");
            mScrollingBackground.AddBackground("Background7");
            mScrollingBackground.AddBackground("Background8");
            mScrollingBackground.AddBackground("Background9");

            //Load the content for the Scrolling background
            mScrollingBackground.LoadContent(theContentManager);

            mProjectileSprite.LoadContent(theContentManager);
            mPShipSprite.LoadContent(theContentManager);
        }
Example #13
0
    void Start()
    {
        m_projectile = GetComponent<Projectile>();
        m_rigidbody = GetComponent<Rigidbody>();

        m_rigidbody.velocity = transform.forward * ShotSpeed;
    }
Example #14
0
		public void ProjectileAndAsteroidDisposedOnCollision()
		{
			var projectile = new Projectile(new Vector2D(0.5f, 0.55f), 0);
			interactionLogic.CreateAsteroidsAtPosition(Vector2D.Half, 1, 1);
			AdvanceTimeAndUpdateEntities();
			Assert.IsFalse(projectile.IsActive);
		}
Example #15
0
    // Returns true on collision with a given bullet (regardless of owner)
    public new bool CheckProjectile(Projectile Bullet)
    {
        // Fast check: ignore all projectiles too far from the ship
        Vector2 turretBulletPos = Bullet.ProjectileSprite.GetPosition() - Position;
        if(turretBulletPos.magnitude > Sprite.GetGeometrySize().x)
            return false;

        // Second check: axis-align the bullet relative to the center of the ship

        // What is the rotation of the ship around the X-axis?
        float Theta = 0.0f;

        // Rotate (re-orient) the bullet position so that it is in the same coordinate-system
        // as the turret: using axis-alligned object transformation for simplified math
        // Essentially we are applying the reverse rotation, relative to the ship's rotational origin, so that
        // when we do the trivial "point in box" check, this is all axis-aligned
        Vector2 AlignedPos;
        AlignedPos.x = turretBulletPos.x * Mathf.Cos(-Theta) - turretBulletPos.y * Mathf.Sin(-Theta);
        AlignedPos.y = turretBulletPos.y * Mathf.Cos(-Theta) + turretBulletPos.x * Mathf.Sin(-Theta);

        // Get real-world turret size (note: turret position is the center of the volume, hence the div by 2)
        Vector2 turretSize = Sprite.GetGeometrySize();
        turretSize /= 2.0f;

        // Point-in-box check
        if(AlignedPos.x > -turretSize.x && AlignedPos.x < turretSize.x && AlignedPos.y < turretSize.y && AlignedPos.y > -turretSize.y)
            return true;
        else
            return false;
    }
Example #16
0
    void OnGUI()
    {
        MainWindowWidth = position.width;
        MainWindowHeight = position.height;
        GameObject selectedGameObject = Selection.activeGameObject;
        if (selectedGameObject == null)
        {
            Debug.LogWarning("No gameObject is selected.");
            return;
        }
        //Attach Projectile script button
        if (selectedGameObject.GetComponent<Projectile>() == null)
        {
            Rect newAIScriptButton = new Rect(0, 0, MainWindowWidth - 10, 30);
            if (GUI.Button(newAIScriptButton, "Attach Projectile script"))
            {
                selectedGameObject.AddComponent<Projectile>();
            }
            return;
        }
        Projectile = selectedGameObject.GetComponent<Projectile>();

        if (GUILayout.Button("Save object"))
        {
            EditorUtility.SetDirty(Projectile);
        }

        ScrollPosition = EditorGUILayout.BeginScrollView(ScrollPosition, false, true, null);
        EditProjectileObject();
        EditorGUILayout.EndScrollView();
    }
Example #17
0
		public void CreateProjectileAndAddMissile()
		{
			projectileOwner = new MockActor(Vector3D.Zero, 0);
			projectileTarget = new MockActor(Vector3D.Zero, 0);
			var missile = new MockMissile();
			projectile = new Projectile(projectileOwner, projectileTarget, missile);
			Assert.AreEqual(missile, projectile.GetFirstChildOfType<MockMissile>());
		}
Example #18
0
	public virtual void HitByProjectile(Projectile projectile, Vector3 hitPoint, Vector3 hitNormal, out bool isRicocheted) {
		isRicocheted = true;
		Vector3 linearVelocity = projectile.LinearVelocity;
		if (linearVelocity.magnitude >= minRicochetVelocity) {
			ApplyRicochetParticleEffect(hitPoint, hitNormal, linearVelocity);
		}
		ApplyRicochetSoundEffect(hitPoint, linearVelocity);
	}
Example #19
0
 public void ProjectileAndAsteroidDisposedOnCollision()
 {
     var projectile = new Projectile(Vector2D.Half, 0);
     EntitiesRunner.Current.GetEntitiesOfType<Projectile>().Add(projectile);
     interactionLogic.CreateAsteroidsAtPosition(Vector2D.Half, 1, 1);
     AdvanceTimeAndUpdateEntities(1.0f);
     Assert.IsFalse(projectile.IsActive);
 }
Example #20
0
 public void ProjectileDeath(Projectile projectile)
 {
     projectile.gameObject.SetActive(false);
     _aliveProjectiles[projectile.ID].Remove(projectile);
     _aliveProjectileCount--;
     _deadProjectiles[projectile.ID].Add(projectile);
     _deadProjectileCount++;
 }
Example #21
0
 private Projectile CreateProjectile(Projectile projectilePrefab)
 {
     GameObject projectileObject = (GameObject)GameObject.Instantiate(projectilePrefab.gameObject);
     projectileObject.transform.parent = this.transform;
     Projectile newProjectile = projectileObject.GetComponent<Projectile>();
     newProjectile.TriggerOnDeath += ProjectileDeath;
     return newProjectile;
 }
Example #22
0
    protected override void OnProjRelease(EntityBase ent) {
        if(mLastClone == ent) {
            mLastClone = null;
            activeGO.SetActive(false);
        }

        base.OnProjRelease(ent);
    }
Example #23
0
 public void init(CharacterClass parent, GameObject target, Projectile projectile, int abilityNum, float angularVelocity)
 {
     this.target = target;
     this.projectile = projectile;
     this.parent = parent;
     this.abilityNum = abilityNum;
     this.angularVelocity = Mathf.PI * angularVelocity / 180;
 }
        public static void AI(Projectile projectile)
        {
            projectile.modProjectile?.AI();

            foreach (var hook in HookAI)
            {
                hook(projectile);
            }
        }
Example #25
0
    private void ProjectileCollided(Projectile oProjectile, GameObject oHitObject)
    {
        oHitObject.SetActive(false);

        oProjectile.OnProjectileHit -= ProjectileCollided;
        oProjectile.OnProjectileExpired -= ProjectileExpired;

        oProjectile.gameObject.SetActive(false);
    }
Example #26
0
 public void ProjectileHit(Projectile projectile)
 {
     // hit everything in the target radius
     Collider[] objs = Physics.OverlapSphere(projectile.transform.position, damageRadius, targetMask);
     foreach(Collider obj in objs) {
         obj.SendMessageUpwards("GotHit", this);
     }
     Destroy(projectile.gameObject);
 }
Example #27
0
 static Stack<Projectile> GetPool( Projectile prefab )
 {
     Stack<Projectile> pool;
     if( !projectilePools.TryGetValue( prefab.gameObject, out pool ) ) {
         pool = CreatePool( prefab );
         projectilePools.Add( prefab.gameObject, pool );
     }
     return pool;
 }
    public override void ProjectileHit(Projectile projectile)
    {
        base.ProjectileHit(projectile);

        projectile.OnHit();
        HP -= projectile.Damage;
        if (HP <= 0)
            Explode();
    }
Example #29
0
 public override bool Shoot( TimeSpan gameTime, Projectile shot )
 {
     Projectile rightShot = shot.TriplerClone( gameTime );
     Projectile leftShot = shot.TriplerClone( gameTime );
     rightShot.Angle += 45;
     leftShot.Angle -= 45;
     Game.QueueEntity( shot, rightShot, leftShot );
     return true;
 }
 protected override void OnStartAction()
 {
     currentTarget = currentStateMachine.enemy.currentTarget.transform.position;
     projectile = currentStateMachine.enemy.projectile1;
     Debug.Log ("StartAction Set");
     if(fireMethod == null){
         Debug.LogError("No FireMode attached");
     }
 }
Example #31
0
        // localai0 : 0 when spawned, 1 when otherNPC spawned.
        // ai0 = npc number of other NPC
        // ai1 = charge time for gun.
        // ai2 = used for frame??
        // ai3 =
        public override void AI()
        {
            int     otherNPC           = -1;
            Vector2 offsetFromOtherNPC = Vector2.Zero;

            if (npc.localAI[0] == 0f && Main.netMode != 1)
            {
                npc.localAI[0] = 1f;
                int newNPC = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("GreenFinTrapper"), npc.whoAmI, 0f, 0f, 0f, 0f, 255);
                npc.ai[0]     = (float)newNPC;
                npc.netUpdate = true;
            }
            int otherNPCCheck = (int)npc.ai[0];

            if (Main.npc[otherNPCCheck].active && Main.npc[otherNPCCheck].type == mod.NPCType("GreenFinTrapper"))
            {
                if (npc.timeLeft < 60)
                {
                    npc.timeLeft = 60;
                }
                otherNPC           = otherNPCCheck;
                offsetFromOtherNPC = Vector2.UnitY * -10f;
            }

            // If otherNPC exists, do this
            if (otherNPC != -1)
            {
                NPC nPC7 = Main.npc[otherNPC];
                npc.velocity        = Vector2.Zero;
                npc.position        = nPC7.Center;
                npc.position.X      = npc.position.X - (float)(npc.width / 2);
                npc.position.Y      = npc.position.Y - (float)(npc.height / 2);
                npc.position       += offsetFromOtherNPC;
                npc.gfxOffY         = nPC7.gfxOffY;
                npc.direction       = nPC7.direction;
                npc.spriteDirection = nPC7.spriteDirection;
                npc.timeLeft        = nPC7.timeLeft;
                npc.velocity        = nPC7.velocity;
                npc.target          = nPC7.target;
                if (npc.ai[1] < 60f)
                {
                    npc.ai[1] += 1f;
                }
                if (npc.justHit)
                {
                    npc.ai[1] = -30f;
                }
                int   projectileType   = Terraria.ID.ProjectileID.RayGunnerLaser;// 438;
                int   projectileDamage = 30;
                float scaleFactor20    = 7f;
                if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
                {
                    Vector2 vectorToPlayer           = Main.player[npc.target].Center - npc.Center;
                    Vector2 vectorToPlayerNormalized = Vector2.Normalize(vectorToPlayer);
                    float   num1547 = vectorToPlayer.Length();
                    float   num1548 = 700f;

                    if (num1547 < num1548)
                    {
                        if (npc.ai[1] == 60f && Math.Sign(vectorToPlayer.X) == npc.direction)
                        {
                            npc.ai[1] = -60f;
                            Vector2 center12  = Main.player[npc.target].Center;
                            Vector2 value26   = npc.Center - Vector2.UnitY * 4f;
                            Vector2 vector188 = center12 - value26;
                            vector188.X += (float)Main.rand.Next(-50, 51);
                            vector188.Y += (float)Main.rand.Next(-50, 51);
                            vector188.X *= (float)Main.rand.Next(80, 121) * 0.01f;
                            vector188.Y *= (float)Main.rand.Next(80, 121) * 0.01f;
                            vector188.Normalize();
                            if (float.IsNaN(vector188.X) || float.IsNaN(vector188.Y))
                            {
                                vector188 = -Vector2.UnitY;
                            }
                            vector188 *= scaleFactor20;
                            Projectile.NewProjectile(value26.X, value26.Y, vector188.X, vector188.Y, projectileType, projectileDamage, 0f, Main.myPlayer, 0f, 0f);
                            npc.netUpdate = true;
                        }
                        else
                        {
                            float oldAI2 = npc.ai[2];
                            npc.velocity.X = npc.velocity.X * 0.5f;
                            npc.ai[2]      = 3f;
                            if (Math.Abs(vectorToPlayerNormalized.Y) > Math.Abs(vectorToPlayerNormalized.X) * 2f)
                            {
                                if (vectorToPlayerNormalized.Y > 0f)
                                {
                                    npc.ai[2] = 1f;
                                }
                                else
                                {
                                    npc.ai[2] = 5f;
                                }
                            }
                            else if (Math.Abs(vectorToPlayerNormalized.X) > Math.Abs(vectorToPlayerNormalized.Y) * 2f)
                            {
                                npc.ai[2] = 3f;
                            }
                            else if (vectorToPlayerNormalized.Y > 0f)
                            {
                                npc.ai[2] = 2f;
                            }
                            else
                            {
                                npc.ai[2] = 4f;
                            }
                            if (npc.ai[2] != oldAI2)
                            {
                                npc.netUpdate = true;
                            }
                        }
                    }
                }
            }
            else
            {
                // This code is called when Bottom is dead. Top is transformed into a new NPC.
                npc.Transform(mod.NPCType("Kakamora2"));
                return;
            }
        }
Example #32
0
 // Start is called before the first frame update
 void Start()
 {
     projectile = GetComponent <Projectile>();
     projectile.ValuesGotSet.AddListener(UpdateValues);
 }
Example #33
0
        public override void AI()
        {
            npc.ai[0]++;
            npc.TargetClosest(true);
            npcCenter = new Vector2(npc.position.X + npc.width / 2, npc.position.Y + npc.height / 2);

            Player player = Main.player[npc.target];

            PlayerAngle = (float)Math.Atan2(player.position.Y - npc.position.Y,
                                            player.position.X - npc.position.X);
            #region default pattern
            if (npc.ai[0] < 720)
            {
                if(npc.ai[0] == 1 || npc.ai[0]%120 == 0 || Vector2.Distance(player.position - npc.position, Vector2.Zero) > 400f)
                {
                    oldPosition = new Vector2(player.position.X + Random(), player.position.Y + Random());

                    TargetAngle = (float)Math.Atan2(oldPosition.Y - npc.position.Y,
                                                    oldPosition.X - npc.position.X);

                    npc.velocity.X = Distance(null, TargetAngle, 4f).X;
                    npc.velocity.Y = Distance(null, TargetAngle, 4f).Y;

                    npc.rotation = TargetAngle;

                    if (npc.position.Y > player.position.Y)
                        npc.velocity.Y--;
                }
            }
            #endregion
            if(npc.ai[0] > 720)
            {
                #region sweep
                if (npc.ai[0] == 780)
                {
                    choose = Main.rand.Next(1, 2);
                }
                if (choose == 1)
                {
                    Start.X = player.position.X - 256;
                    Start.Y = player.position.Y - 448;

                    End.X = player.position.X + 256;
                    End.Y = Start.Y;

                    sweep = true;
                    choose = 0;
                }
                if (Depreciate > 0 && sweep)
                {
                    Depreciate--;
                    Point = (Time - Depreciate) / Time;
                    npc.position = Vector2.Lerp(Start, End, Point);

                    npc.rotation = radians * 90;
                    if (Depreciate % 8 == 0)
                    {
                        int attack = Projectile.NewProjectile(npc.position + new Vector2(npc.width / 2, npc.height / 2 + 32), Vector2.Zero, 134, 12 + Main.rand.Next(-2, 8), 2f, player.whoAmI, 0f, 0f);
                        Projectile proj = Main.projectile[attack];
                        proj.velocity.X += Distance(null, npc.rotation, 4f).X;
                        proj.velocity.Y += Distance(null, npc.rotation, 4f).Y;
                        proj.friendly = false;
                        proj.hostile = true;
                    }
                }
                else if (Depreciate == 0)
                {
                    sweep = false;
                    npc.ai[0] = 0;
                    Depreciate = Time;

                    npc.position = new Vector2(player.position.X + Random(), player.position.Y + Random());
                }
                #endregion
                #region spin
                if (choose == 2)
                {
                    oldPosition.X = player.position.X - npc.width / 2;
                    oldPosition.Y = player.position.Y - 384;
                    spinAttack = true;
                    choose = 0;
                }
                if (spinAttack)
                {
                    npc.position = oldPosition;

                    degrees += radians * 15;
                    npc.rotation = degrees;
                    if (degrees >= radians * 360)
                        degrees = radians;
                    if (degrees >= radians * 45f && degrees <= radians * 146.25f)
                    {
                        int attack = Projectile.NewProjectile(npc.position + new Vector2(npc.width/2, npc.height/2 + 32), Vector2.Zero, 134, 20, 2f, player.whoAmI, 0f, 0f);
                        Projectile proj = Main.projectile[attack];
                        proj.velocity.X += Distance(null, npc.rotation, 4f).X;
                        proj.velocity.Y += Distance(null, npc.rotation, 4f).Y;
                        proj.friendly = false;
                        proj.hostile = true;
                    }
                    ticks++;
                    if (ticks > 300)
                    {
                        spinAttack = false;
                        degrees = radians;
                        npc.rotation = PlayerAngle;
                        ticks = 0;
                        npc.ai[0] = 0;

                        npc.position = new Vector2(player.position.X + Random(), player.position.Y + Random());
                    }
                }
                #endregion
            }
            #region magno clone sequence
            if (!pupsSpawned && Main.rand.Next(0, 1200) == 0)
            {
                for (int k = 0; k < 4; k++)
                {
                    pups = NPC.NewNPC((int)npcCenter.X + Main.rand.Next(-npc.width, npc.width), (int)npcCenter.Y, mod.NPCType("m_diggerhead"));
                    NetMessage.SendData(23, -1, -1, null, pups, 0f, 0f, 0f, 0, 0, 0);
                    pupsSpawned = true;
                }
            }
            if (pupsSpawned)
            {
                Main.npc[pups].realLife = Main.npc[pups].whoAmI;
                if (!Main.npc[pups].active)
                {
                    pupsSpawned = false;
                    magnoClone = true;
                }
            }
            if (magnoClone)
            {
                clone = NPC.NewNPC((int)npcCenter.X, (int)npcCenter.Y + 128, mod.NPCType("m_mimic"));
                Main.npc[clone].color = Color.Gold;
                Main.npc[clone].scale = 0.6f;
                timeLeft = 600;
                magnoClone = false;
            }
            if(timeLeft > 0)
                timeLeft--;
            if (timeLeft < 60)
            {
            /*  degrees += radians * 11.25f;
                Main.npc[clone].rotation = degrees;
                Main.npc[clone].scale++;
                Main.npc[clone].velocity = Vector2.Zero;
            */
                if (timeLeft == 0)
                {
                    Main.npc[clone].active = false;
                    timeLeft = 600;
                }
            }
            #endregion
        }
Example #34
0
        private void DoAttacks()
        {
            Player player = Main.player[npc.target];

            if (npc.life < npc.lifeMax / 2)
            {
                isDashing = false;

                if ((AttackTimer == 120 || AttackTimer == 145 || AttackTimer == 160))
                {
                    if (EternalWorld.hellMode)
                    {
                        for (int i = 0; i < 12; i++)
                        {
                            NPC.NewNPC((int)npc.Center.X - 20, (int)npc.Center.Y, ModContent.NPCType <Arkling>());
                        }
                    }
                    else
                    {
                    }
                }
                if ((AttackTimer == 185 || AttackTimer == 200 || AttackTimer == 225))
                {
                    Vector2 direction = Main.player[npc.target].Center - npc.Center;
                    direction.Normalize();
                    direction.X *= 8.5f;
                    direction.Y *= 8.5f;

                    int amountOfProjectiles = 2;
                    for (int i = 0; i < amountOfProjectiles; ++i)
                    {
                        float A = (float)Main.rand.Next(-200, 200) * 0.01f;
                        float B = (float)Main.rand.Next(-200, 200) * 0.01f;
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            Main.PlaySound(SoundID.DD2_LightningAuraZap, npc.position);
                        }
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X + A, direction.Y + B, ModContent.ProjectileType <ArkEnergyHostile>(), npc.damage / 2, 1, Main.myPlayer, 0, 0);
                    }
                }
                else if (AttackTimer == 250)
                {
                    AttackTimer = 0;
                }
            }
            if (npc.life < npc.lifeMax / 3)
            {
                if (AttackTimer == 50 || AttackTimer == 65 || AttackTimer == 70 || AttackTimer == 85 || AttackTimer == 90 || AttackTimer == 105 || AttackTimer == 115 || AttackTimer == 130)
                {
                    Vector2 direction = Main.player[npc.target].Center - npc.Center;
                    direction.Normalize();
                    direction.X *= 8.5f;
                    direction.Y *= 8.5f;

                    int amountOfProjectiles = 2;
                    for (int i = 0; i < amountOfProjectiles; ++i)
                    {
                        float A      = (float)Main.rand.Next(-200, 200) * 0.01f;
                        float B      = (float)Main.rand.Next(-200, 200) * 0.01f;
                        int   damage = Main.expertMode ? 110 : 220;
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            Main.PlaySound(SoundID.Item8, npc.position);
                        }
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X + A, direction.Y + B, ModContent.ProjectileType <ArkArrowHostile>(), damage, 1, Main.myPlayer, 0, 0);
                    }
                }
                if ((AttackTimer == 115 || AttackTimer == 120 || AttackTimer == 125))
                {
                    Vector2 direction = Main.player[npc.target].Center - npc.Center;
                    direction.Normalize();
                    direction.X *= 8.5f;
                    direction.Y *= 8.5f;

                    int amountOfProjectiles = 4;
                    for (int i = 0; i < amountOfProjectiles; ++i)
                    {
                        float A = (float)Main.rand.Next(-200, 200) * 0.01f;
                        float B = (float)Main.rand.Next(-200, 200) * 0.01f;
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            Main.PlaySound(SoundID.DD2_LightningAuraZap, npc.position);
                        }
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X + A, direction.Y + B, ModContent.ProjectileType <ArkEnergyHostile>(), npc.damage / 2, 1, Main.myPlayer, 0, 0);
                    }
                }
                else if (AttackTimer == 250)
                {
                    Projectile.NewProjectile(npc.position.X + 80, npc.position.Y + 80, -12, 0, ModContent.ProjectileType <ArkEnergyHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(npc.position.X + 80, npc.position.Y + 80, 12, 0, ModContent.ProjectileType <ArkEnergyHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(npc.position.X + 80, npc.position.Y + 80, 0, 12, ModContent.ProjectileType <ArkEnergyHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(npc.position.X + 80, npc.position.Y + 80, 0, -12, ModContent.ProjectileType <ArkEnergyHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);

                    AttackTimer = 0;
                }
            }
            else
            {
                if ((AttackTimer == 100 || AttackTimer == 150 || AttackTimer == 175))
                {
                    Projectile.NewProjectile(npc.position.X + 80, npc.position.Y + 80, -12, 0, ModContent.ProjectileType <ArkArrowHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(npc.position.X + 80, npc.position.Y + 80, 12, 0, ModContent.ProjectileType <ArkArrowHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(npc.position.X + 80, npc.position.Y + 80, 0, 12, ModContent.ProjectileType <ArkArrowHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(npc.position.X + 80, npc.position.Y + 80, 0, -12, ModContent.ProjectileType <ArkArrowHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(npc.position.X + 40, npc.position.Y + 40, -8, -8, ModContent.ProjectileType <ArkArrowHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(npc.position.X + 40, npc.position.Y + 40, 8, -8, ModContent.ProjectileType <ArkArrowHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(npc.position.X + 40, npc.position.Y + 40, -8, 8, ModContent.ProjectileType <ArkArrowHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(npc.position.X + 40, npc.position.Y + 40, 8, 8, ModContent.ProjectileType <ArkArrowHostile>(), npc.damage, 0, Main.myPlayer, 0f, 0f);

                    Vector2 direction = Main.player[npc.target].Center - npc.Center;
                    direction.Normalize();
                    direction.X *= 8.5f;
                    direction.Y *= 8.5f;

                    int amountOfProjectiles = 1;
                    for (int i = 0; i < amountOfProjectiles; ++i)
                    {
                        float A = (float)Main.rand.Next(-200, 200) * 0.01f;
                        float B = (float)Main.rand.Next(-200, 200) * 0.01f;
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            Main.PlaySound(SoundID.DD2_LightningAuraZap, npc.position);
                        }
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X + A, direction.Y + B, ModContent.ProjectileType <ArkEnergyHostile>(), npc.damage / 2, 1, Main.myPlayer, 0, 0);
                    }
                }
                if (AttackTimer == 300)
                {
                    isDashing = true;
                }
                else if (AttackTimer == 475)
                {
                    isDashing   = false;
                    AttackTimer = 0;
                }
            }
        }
Example #35
0
 public override void Kill(int timeLeft)
 {
     Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X * -0.2f, projectile.velocity.Y * -0.2f, mod.ProjectileType("FlameBoom"), projectile.damage, 0f, projectile.owner, 0f, 0f);
     Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 34);
 }
Example #36
0
    /// <summary>
    /// Lance une salve
    /// </summary>
    /// <param name="salvo">Salve à lancer</param>
    public void Shoot(Salvo salvo)
    {
        currentTimeBeforeNextSalvo = currentShootParameters.GetTimeBewteenSalvos;
        currentShootParameters.IncreaseSalvoIndex();

        shootedPositions = new List <List <Vector3> >();

        #region Calculate Directions
        PoolingManager poolManager           = GameManager.gameManager.PoolManager;
        Projectile     shootProjectilePrefab = poolManager.GetProjectile(salvo.GetProjectileType, PoolInteractionType.PeekFromPool);
        bool           isBoulder             = shootProjectilePrefab.IsBoulder;

        List <Vector3> allShootDirections = isBoulder ? GetAllShootPositions(salvo) : GetAllShootDirections(salvo);
        float          projectilesSpacing = salvo.GetProjectilesSpacing;
        foreach (Vector3 direction in allShootDirections)
        {
            List <Vector3>      thisShootedPos       = new List <Vector3>();
            /**/ List <Vector3> allPossiblePositions = CirclePositionsGenerator.GetAllPositionsInCircle(salvo.GetProjectileParameters.GetCurrentProjectileSize, projectilesSpacing, salvo.GetImprecisionParameter);
            for (int i = 0; i < salvo.GetNumberOfProjectiles; i++)
            {
                Projectile shootProjectile = poolManager.GetProjectile(salvo.GetProjectileType, PoolInteractionType.GetFromPool);
                shootProjectile.transform.position = transform.position;
                shootProjectile.transform.rotation = Quaternion.identity;

                if (relatedShip != null)
                {
                    shootProjectile.SetSource(relatedShip);
                }
                else if (relatedTurret != null)
                {
                    shootProjectile.SetSource(relatedTurret);
                }

                if (isBoulder)
                {
                    //List<Vector3> allPossiblePositions

                    //Vector3 modifiedPosition = direction + new Vector3(Random.Range(-salvo.GetImprecisionParameter, salvo.GetImprecisionParameter), 0, Random.Range(-salvo.GetImprecisionParameter, salvo.GetImprecisionParameter));
                    /**/
                    int     randomIndex      = Random.Range(0, allPossiblePositions.Count);
                    Vector3 modifiedPosition = direction + allPossiblePositions[randomIndex] + new Vector3(Random.Range(-projectilesSpacing / 2, projectilesSpacing / 2), 0, Random.Range(-projectilesSpacing / 2, projectilesSpacing / 2));
                    allPossiblePositions.RemoveAt(randomIndex);
                    /**/
                    shootProjectile.ShootProjectile(salvo.GetProjectileParameters, transform.position, modifiedPosition);

                    thisShootedPos.Add(modifiedPosition);
                }
                else
                {
                    Vector3 modifiedDirection = Quaternion.Euler(0, Random.Range(-salvo.GetImprecisionParameter, salvo.GetImprecisionParameter), 0) * direction;
                    shootProjectile.ShootProjectile(salvo.GetProjectileParameters, modifiedDirection, GameManager.gameManager.Player.GetShipVelocity);
                }

                shootProjectile.SetProjectileTag(currentShootParameters.GetProjectileTag);

                #region Special Parameters
                if (projectileSpecialParameters != null)
                {
                    shootProjectile.SetProjectileSpecialParameters(
                        new ProjectileSpecialParameters(
                            new ShipSpeedModifier(projectileSpecialParameters.GetSpeedModifier),
                            new ProjectilePiercingParameters(projectileSpecialParameters.GetPiercingParameters),
                            new ProjectileSkeweringParameters(projectileSpecialParameters.GetSkeweringParameters),
                            projectileSpecialParameters.GetExplosionParameters,
                            new SmokeZoneParameters(projectileSpecialParameters.GetSmokeZoneParameters),
                            new SlowingZoneParameters(projectileSpecialParameters.GetSlowingZoneParameters)
                            ));
                    shootProjectile.GetProjectileSpecialParameters.GetSkeweringParameters.SetSourceProjectile(shootProjectile);
                }
                #endregion

                if (allPossiblePositions.Count == 0 && isBoulder)
                {
                    Debug.LogWarning("couldn't shoot all boulders");
                    break;
                }
            }
            shootedPositions.Add(thisShootedPos);
        }
        #endregion

        #region Feedback
        if (shootParticleSystem != null)
        {
            //ParticleSystem.EmitParams parameters = shootParticleSystem.emission.;
            //if (shootParticleSystem.isPlaying)
            //{
            //Debug.Log("ui");
            //shootParticleSystem.Stop();
            //shootParticleSystem.Play();
            //shootParticleSystem.Emit(8);
            //waitingTimeToRelaunchShootEffect = 0.05f;

            /*}
             * else
             *  shootParticleSystem.Play();*/
            shootParticleSystem.Emit(2);
        }

        if (currentShootParameters.GetProjectileTag == AttackTag.Player)
        {
            Vibration.Vibrate(shootVibrationDuration);
            GameManager.gameManager.ScrshkManager.StartScreenshake(shootShakeParameters);
        }

        if (shootAudioSource != null)
        {
            shootAudioSource.PlaySound(currentShootParameters.GetShootSound);
        }
        #endregion

        if (currentShootParameters.GetCurrentSalvoIndex > 1)
        {
            ContinueLaunchedPreview(salvo);
        }
    }
Example #37
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            //to fix tail disapearing meme
            float slotsUsed = 0;

            Main.projectile.Where(x => x.active && x.owner == player.whoAmI && x.minionSlots > 0).ToList().ForEach(x => { slotsUsed += x.minionSlots; });

            if (player.maxMinions - slotsUsed < 1)
            {
                return(false);
            }

            int headCheck = -1;
            int tailCheck = -1;

            for (int i = 0; i < 1000; i++)
            {
                Projectile proj = Main.projectile[i];
                if (proj.active && proj.owner == player.whoAmI)
                {
                    if (headCheck == -1 && proj.type == mod.ProjectileType("EaterHead"))
                    {
                        headCheck = i;
                    }
                    if (tailCheck == -1 && proj.type == mod.ProjectileType("EaterTail"))
                    {
                        tailCheck = i;
                    }
                    if (headCheck != -1 && tailCheck != -1)
                    {
                        break;
                    }
                }
            }

            //initial spawn
            if (headCheck == -1 && tailCheck == -1)
            {
                int current = Projectile.NewProjectile(position.X, position.Y, 0, 0, mod.ProjectileType("EaterHead"), damage, knockBack, player.whoAmI, 0f, 0f);

                int previous = 0;

                for (int i = 0; i < 4; i++)
                {
                    current  = Projectile.NewProjectile(position.X, position.Y, 0, 0, mod.ProjectileType("EaterBody"), damage, knockBack, player.whoAmI, current, 0f);
                    previous = current;
                }

                current = Projectile.NewProjectile(position.X, position.Y, 0, 0, mod.ProjectileType("EaterTail"), damage, knockBack, player.whoAmI, current, 0f);

                Main.projectile[previous].localAI[1] = current;
                Main.projectile[previous].netUpdate  = true;
            }
            //spawn more body segments
            else
            {
                int previous = (int)Main.projectile[tailCheck].ai[0];
                int current  = 0;

                for (int i = 0; i < 4; i++)
                {
                    current = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("EaterBody"), damage, knockBack, player.whoAmI,
                                                       Projectile.GetByUUID(Main.myPlayer, previous), 0f);

                    previous = current;
                }

                Main.projectile[current].localAI[1] = tailCheck;

                Main.projectile[tailCheck].ai[0]     = current;
                Main.projectile[tailCheck].netUpdate = true;
                Main.projectile[tailCheck].ai[1]     = 1f;
            }

            return(false);
        }
Example #38
0
        public override void AI()
        {
            projectile.frame = 1;
            Main.player[projectile.owner].UpdateMaxTurrets();
            projectile.velocity.Y = 5;
            for (int i = 0; i < 200; i++)
            {
                target    = Main.npc[i];
                distanceX = Math.Abs(Main.npc[i].Center.X - projectile.Center.X);
                distanceY = projectile.Center.Y - Main.npc[i].Center.Y;
                Point origin = target.Center.ToTileCoordinates();
                Point point;
                if (distanceX < maxDistanceX && distanceY > minimumHeight && !target.friendly && target.active && !target.immortal && !target.dontTakeDamage && !WorldUtils.Find(origin, Searches.Chain(new Searches.Down(12), new GenCondition[]
                {
                    new Conditions.IsSolid()
                }), out point))
                {
                    foundTarget = true;
                    validTarget = Main.npc[i];
                    if (validTarget.Center.X > projectile.Center.X)
                    {
                        rocketDirection = 1;
                    }
                    else
                    {
                        rocketDirection = -1;
                    }
                }
            }
            timer++;
            if (foundTarget && timer > ReloadTime)
            {
                playAttackFrame = true;
                if (Main.netMode != 1)
                {
                    Projectile.NewProjectile(projectile.Center.X + (16 * secondShot), projectile.Center.Y - 30, 0, 0, mod.ProjectileType("SentryAntiAir"), projectile.damage, projectile.knockBack, Main.myPlayer, validTarget.Center.Y, rocketDirection);
                }

                secondShot *= -1;

                timer = 0;
            }


            if (playAttackFrame)
            {
                attackFrameCounter++;
                if (secondShot == 1)
                {
                    projectile.frame = 0;
                }
                else
                {
                    projectile.frame = 2;
                }

                if (attackFrameCounter > attackFrameTime)
                {
                    playAttackFrame = false;
                }
            }
            else
            {
                attackFrameCounter = 0;
            }

            foundTarget = false;
        }
Example #39
0
        public override void AI()
        {
            Projectile P = projectile;
            Player     O = Main.player[P.owner];

            Item I = O.inventory[O.selectedItem];

            MPlayer     mp = O.GetModPlayer <MPlayer>();
            MGlobalItem mi = I.GetGlobalItem <MGlobalItem>();

            float MY = Main.mouseY + Main.screenPosition.Y;
            float MX = Main.mouseX + Main.screenPosition.X;

            if (O.gravDir == -1f)
            {
                MY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
            }
            Vector2 oPos = O.RotatedRelativePoint(O.MountedCenter, true);

            P.scale = ((float)mi.seekerCharge / (float)MGlobalItem.seekerMaxCharge) * (0.25f + (0.75f * ((float)(mi.numSeekerTargets + 1) / 6f)));
            float targetrotation = (float)Math.Atan2((MY - oPos.Y), (MX - oPos.X));

            P.rotation     += 0.5f * P.direction;
            O.itemTime      = 2;
            O.itemAnimation = 2;

            int range  = I.width + 4;
            int width  = (I.width / 2) - (P.width / 2);
            int height = (I.height / 2) - (P.height / 2);

            if (negateUseTime < I.useTime - 2)
            {
                negateUseTime++;
            }

            Vector2 iPos = O.itemLocation;

            P.friendly = false;
            P.damage   = 0;
            P.position = new Vector2(iPos.X + (float)Math.Cos(targetrotation) * range + width, iPos.Y + (float)Math.Sin(targetrotation) * range + height);
            P.alpha    = 0;
            if (P.velocity.X < 0)
            {
                P.direction = -1;
            }
            else
            {
                P.direction = 1;
            }
            P.spriteDirection = P.direction;
            O.direction       = P.direction;

            O.heldProj     = P.whoAmI;
            O.itemRotation = (float)Math.Atan2((MY - oPos.Y) * O.direction, (MX - oPos.X) * O.direction) - O.fullRotation;

            P.position -= P.velocity;
            P.timeLeft  = 60;
            if (O.whoAmI == Main.myPlayer)
            {
                if (mi.seekerCharge == 10)
                {
                    soundInstance = Main.PlaySound(SoundLoader.customSoundType, (int)oPos.X, (int)oPos.Y, mod.GetSoundSlot(SoundType.Custom, "Sounds/ChargeStartup_Seeker"));
                }
            }
            if (mi.seekerCharge >= MGlobalItem.seekerMaxCharge)
            {
                if (dustDelay <= mi.numSeekerTargets)
                {
                    int dust = Dust.NewDust(P.position + P.velocity, P.width, P.height, 63, 0, 0, 100, Color.Cyan, 2.0f);
                    Main.dust[dust].noGravity = true;
                    dustDelay = 5;
                }
            }
            dustDelay = Math.Max(dustDelay - 1, 0);
            Lighting.AddLight(P.Center, (LightColor.R / 255f) * P.scale, (LightColor.G / 255f) * P.scale, (LightColor.B / 255f) * P.scale);
            if (O.controlUseItem && !mp.ballstate && !mp.shineActive && !O.dead && !O.noItems)
            {
                if (P.owner == Main.myPlayer)
                {
                    P.velocity = targetrotation.ToRotationVector2() * O.inventory[O.selectedItem].shootSpeed;
                }
            }
            else
            {
                if (mi.seekerCharge >= MGlobalItem.seekerMaxCharge)
                {
                    O.itemTime      = I.useTime;
                    O.itemAnimation = I.useAnimation;
                }
                else
                {
                    O.itemTime      = I.useTime - negateUseTime;
                    O.itemAnimation = I.useAnimation - negateUseTime;
                }
                if (O.whoAmI == Main.myPlayer)
                {
                    if (soundInstance != null)
                    {
                        soundInstance.Stop(true);
                    }
                    soundPlayed = false;
                }
                P.Kill();
            }
        }
Example #40
0
 public override bool?CanBeHitByProjectile(Projectile projectile)
 {
     return(CanBeHitByPlayer(Main.player[projectile.owner]));
 }
        public override bool PreDraw(ref Color lightColor)
        {
            Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
            int num156 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; //ypos of lower right corner of sprite to draw
            int y3 = num156 * Projectile.frame; //ypos of upper left corner of sprite to draw
            Rectangle rectangle = new Rectangle(0, y3, texture2D13.Width, num156);
            Vector2 origin2 = rectangle.Size() / 2f;

            SpriteEffects effects = Projectile.spriteDirection < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
            float rotationOffset = MathHelper.ToRadians(45) * Projectile.spriteDirection;
            if (Projectile.spriteDirection < 0)
                rotationOffset += MathHelper.Pi;

            Color color26 = SwordColor;
            color26 *= Projectile.Opacity;
            color26.A = 20;

            for (float i = 0; i < ProjectileID.Sets.TrailCacheLength[Projectile.type]; i += 0.25f)
            {
                Color color27 = color26 * 0.5f;
                float fade = (float)(ProjectileID.Sets.TrailCacheLength[Projectile.type] - i) / ProjectileID.Sets.TrailCacheLength[Projectile.type];
                color27 *= fade * fade;
                int max0 = (int)i - 1;//Math.Max((int)i - 1, 0);
                if (max0 < 0)
                    continue;
                float num165 = Projectile.oldRot[max0] + rotationOffset;
                Vector2 center = Vector2.Lerp(Projectile.oldPos[(int)i], Projectile.oldPos[max0], 1 - i % 1);
                center += Projectile.Size / 2;
                Main.EntitySpriteDraw(texture2D13, center - Main.screenPosition + new Vector2(0, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color27, num165, origin2, Projectile.scale, effects, 0);
            }

            //float scale = Projectile.scale * (Main.mouseTextColor / 200f - 0.35f) * 0.3f + 1f;
            Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, Projectile.rotation + rotationOffset, origin2, Projectile.scale * 1.2f, effects, 0);

            Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), Projectile.GetAlpha(lightColor), Projectile.rotation + rotationOffset, origin2, Projectile.scale, effects, 0);
            return false;
        }
        public override void AI()
        {
            const int startup = 100;

            if (Projectile.localAI[0] == 0)
            {
                Projectile.localAI[0] = 1;
                Projectile.localAI[1] = Projectile.velocity.Length() / startup;

                Projectile.hide = false;
                Projectile.rotation = 2f * Main.rand.NextFloat(MathHelper.TwoPi) * (Main.rand.NextBool() ? -1 : 1);
                Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]);
            }

            if (++dustTimer == 15)
            {
                MakeDust();
                SoundEngine.PlaySound(SoundID.Item71, Projectile.Center);
            }

            if (Projectile.ai[0] == -1) //fly forward
            {
                if (++Projectile.localAI[0] <= startup)
                {
                    Projectile.velocity = (Projectile.velocity.Length() - Projectile.localAI[1]) * Vector2.Normalize(Projectile.velocity);

                    Projectile.rotation = MathHelper.Lerp(Projectile.rotation, Projectile.ai[1] > 0 ? 0 : MathHelper.Pi, 0.05f);
                    Projectile.spriteDirection = (int)Projectile.ai[1];

                    if (Projectile.localAI[0] == startup)
                        SoundEngine.PlaySound(SoundID.Item71, Projectile.Center);
                }
                else
                {
                    Projectile.velocity = 36f * Projectile.ai[1] * Vector2.UnitX;
                    Projectile.rotation = Projectile.velocity.ToRotation();
                }
            }
            else //hover around mothron
            {
                NPC npc = FargoSoulsUtil.NPCExists(Projectile.ai[0], NPCID.Mothron);
                if (npc == null || (npc.ai[0] < 3f && dustTimer > 15))
                {
                    Projectile.Kill();
                    return;
                }
                else
                {
                    Projectile.timeLeft++;

                    const float rotationPerTick = MathHelper.TwoPi / 60f;

                    Projectile.spriteDirection = Math.Sign(Projectile.ai[1]);
                    Projectile.ai[1] += rotationPerTick * Projectile.spriteDirection;
                    Projectile.rotation = Projectile.ai[1];

                    float distance = 120;
                    if (Projectile.spriteDirection < 0)
                        distance *= 2;
                    Projectile.Center = npc.Center + distance * Projectile.ai[1].ToRotationVector2();

                    if (npc.ai[0] < 4f)
                        Projectile.alpha -= 4;
                }
            }

            Projectile.alpha -= 4;
            if (Projectile.alpha < 0)
                Projectile.alpha = 0;
        }
Example #43
0
 public virtual void ProjectileHit(Projectile projectile, Entity target)
 {
 }
Example #44
0
        public override void AI()
        {
            if (projectile.timeLeft < 30)
            {
                projectile.alpha += 10;
            }
            // 核心代码部分

            // 如果玩家仍然在控制弹幕
            if (Main.player[projectile.owner].channel)
            {
                // 获取弹幕持有者
                Player player = Main.player[projectile.owner];

                // 从玩家到达鼠标位置的单位向量
                Vector2 unit = Vector2.Normalize(Main.MouseWorld - player.Center);
                // 随机角度
                float rotaion = unit.ToRotation();
                // 调整玩家转向以及手持物品的转动方向
                player.direction    = Main.MouseWorld.X < player.Center.X ? -1 : 1;
                player.itemRotation = (float)Math.Atan2(rotaion.ToRotationVector2().Y *player.direction,
                                                        rotaion.ToRotationVector2().X *player.direction);
                player.itemTime      = 2;
                player.itemAnimation = 2;
                // 从弹幕到达鼠标位置的单位向量
                Vector2 unit2 = Vector2.Normalize(Main.MouseWorld - projectile.Center);
                // 让弹幕缓慢朝鼠标方向移动
                if (Vector2.Distance(projectile.Center, Main.MouseWorld) < 5)
                {
                    projectile.velocity *= 0;
                    projectile.Center    = Main.MouseWorld;
                }
                else
                {
                    projectile.velocity = unit2 * 5;
                }
            }
            else
            {
                // 如果玩家放弃吟唱就慢慢消失
                if (projectile.timeLeft > 30)
                {
                    projectile.timeLeft = 30;
                }
                // 返回函数这样就不会执行下面的攻击代码
                return;
            }

            // 累加帧计时器
            projectile.frameCounter++;
            // 当计时器经过了7帧
            if (projectile.frameCounter % 7 == 0)
            {
                // 重置计时器
                projectile.frameCounter = 0;
                // 选择下一帧动画
                // 让弹幕的帧与等于与5进行模运算,也就是除以5的余数
                projectile.frame++;
                projectile.frame %= 5;
            }

            NPC target = null;
            // 最大寻敌距离
            float distanceMax = 400f;

            foreach (NPC npc in Main.npc)
            {
                // 如果npc活着且敌对
                if (npc.active && !npc.friendly && npc.type != NPCID.TargetDummy &&
                    Collision.CanHit(projectile.Center, 1, 1, npc.position, npc.width, npc.height))
                {
                    // 计算距离
                    float currentDistance = Vector2.Distance(npc.Center, projectile.Center);
                    // 如果npc距离比当前最大距离小
                    if (currentDistance < distanceMax)
                    {
                        // 就把最大距离设置为npc和玩家的距离
                        // 并且暂时选取这个npc为距离最近npc
                        distanceMax = currentDistance;
                        target      = npc;
                    }
                }
            }
            baseRot += 0.15f;
            // 如果找到符合条件的npc, 并且符合开火间隔(一秒6次)
            if (target != null && projectile.timeLeft % 10 < 1)
            {
                Vector2 toTarget = target.Center - projectile.Center;
                toTarget.Normalize();
                toTarget *= 6f;

                toTarget = toTarget.RotatedBy(baseRot);
                for (int i = 0; i < 3; i++)
                {
                    toTarget = toTarget.RotatedBy(MathHelper.Pi / 1.5f);
                    // 我调整了一下发射位置,这样射线看起来更像从磁球中间射出来的
                    Projectile.NewProjectile(projectile.Center + projectile.velocity * 4f,
                                             toTarget, ProjectileID.LightBeam, 100, 5f, projectile.owner, target.whoAmI);
                }
            }
        }
Example #45
0
        public override void Kill(int timeLeft)
        {
            if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("DesertEmperorSetBuff")))
            {
                int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("FlaskWasp"), projectile.damage * 2, 1.5f, projectile.owner);
                int b = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("FlaskWasp"), projectile.damage * 2, 1.5f, projectile.owner);
            }
            Player  player    = Main.player[projectile.owner];
            MPlayer modPlayer = (MPlayer)player.GetModPlayer(mod, "MPlayer");

            Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 107);
            Gore.NewGore(projectile.position, -projectile.oldVelocity * 0.2f, 704, 1f);
            Gore.NewGore(projectile.position, -projectile.oldVelocity * 0.2f, 705, 1f);

            if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("BrassChipBuff")))
            {
                for (int i = 0; i < 5; i++)
                {
                    Vector2 vector2  = new Vector2(player.position.X + 75f * (float)Math.Cos(12), player.position.Y + 1075f * (float)Math.Sin(12));
                    Vector2 Velocity = Helper.VelocityToPoint(vector2, Helper.RandomPointInArea(new Vector2(projectile.Center.X - 10, projectile.Center.Y - 10), new Vector2(projectile.Center.X + 20, projectile.Center.Y + 20)), 24);
                    int     a        = Projectile.NewProjectile(vector2.X, vector2.Y, Velocity.X, Velocity.Y, 134, projectile.damage, 1f);
                    Main.projectile[a].friendly = true;
                }
            }
            if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("ChaosElementBuff")))
            {
                int num220 = Main.rand.Next(3, 6);
                for (int num221 = 0; num221 < num220; num221++)
                {
                    Vector2 value17 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                    value17.Normalize();
                    value17 *= Main.rand.Next(10, 201) * 0.01f;
                    Projectile.NewProjectile(projectile.position.X, projectile.position.Y, value17.X, value17.Y, mod.ProjectileType("Shatter1"), projectile.damage, 1f, projectile.owner, 0f, Main.rand.Next(-45, 1));
                }
            }

            if (!modPlayer.pyro && !modPlayer.nitro)
            {
                if (projectile.owner == Main.myPlayer)
                {
                    int num220 = Main.rand.Next(3, 6);
                    for (int num221 = 0; num221 < num220; num221++)
                    {
                        Vector2 value17 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
                        value17.Normalize();
                        value17 *= Main.rand.Next(10, 201) * 0.01f;
                        Projectile.NewProjectile(projectile.position.X, projectile.position.Y, value17.X, value17.Y, mod.ProjectileType("PoisonCloudPro"), projectile.damage, 1f, projectile.owner, 0f, Main.rand.Next(-45, 1));
                    }
                }
            }
            if (projectile.owner == Main.myPlayer)
            {
                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("PyroBuff")) && !modPlayer.nitro)
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1.5f, projectile.owner);
                    Main.projectile[a].scale = 1.5f;
                }
                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("ChemikazeBuff")) && !modPlayer.nitro)
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1.25f, projectile.owner);
                    Main.projectile[a].scale = 1.25f;
                    int b = Projectile.NewProjectile(projectile.position.X + 32, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X - 32, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 32, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 32, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                }
                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("CrossBlastBuff")) && !modPlayer.nitro)
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1.25f, projectile.owner);
                    Main.projectile[a].scale = 1.25f;
                    int b = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 30, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 30, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int f = Projectile.NewProjectile(projectile.position.X + 50, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 0.7f, projectile.owner);
                    Main.projectile[f].scale = 0.7f;
                    int g = Projectile.NewProjectile(projectile.position.X - 50, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 0.7f, projectile.owner);
                    Main.projectile[g].scale = 0.7f;
                    int h = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 50, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 0.7f, projectile.owner);
                    Main.projectile[h].scale = 0.7f;
                    int i = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 50, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 0.7f, projectile.owner);
                    Main.projectile[i].scale = 0.7f;
                    int j = Projectile.NewProjectile(projectile.position.X + 70, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 0.5f, projectile.owner);
                    Main.projectile[j].scale = 0.8f;
                    int k = Projectile.NewProjectile(projectile.position.X - 70, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 0.5f, projectile.owner);
                    Main.projectile[k].scale = 0.8f;
                    int l = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 70, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 0.5f, projectile.owner);
                    Main.projectile[l].scale = 0.8f;
                    int m = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 70, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 0.5f, projectile.owner);
                    Main.projectile[m].scale = 0.8f;
                }
                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("RoundBlastBuff")) && !modPlayer.nitro)
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int a = Projectile.NewProjectile(projectile.position.X + 60, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int b = Projectile.NewProjectile(projectile.position.X - 60, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 60, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 60, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X + 40, projectile.position.Y + 40, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int f = Projectile.NewProjectile(projectile.position.X - 40, projectile.position.Y + 40, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int g = Projectile.NewProjectile(projectile.position.X + 40, projectile.position.Y - 40, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int h = Projectile.NewProjectile(projectile.position.X - 40, projectile.position.Y - 40, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("SquareBlastBuff")) && !modPlayer.nitro)
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int a = Projectile.NewProjectile(projectile.position.X + 70, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int b = Projectile.NewProjectile(projectile.position.X - 70, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 70, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 70, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X + 70, projectile.position.Y + 70, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int f = Projectile.NewProjectile(projectile.position.X - 70, projectile.position.Y + 70, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int g = Projectile.NewProjectile(projectile.position.X + 70, projectile.position.Y - 70, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    int h = Projectile.NewProjectile(projectile.position.X - 70, projectile.position.Y - 70, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("NitroBuff")) && !modPlayer.pyro)
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 100);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("ReinforcedBurstBuff")) && !modPlayer.pyro)
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 100);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    int b = Projectile.NewProjectile(projectile.position.X + 50, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X - 50, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("LinearBurstBuff")) && !modPlayer.pyro)
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 100);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    int b = Projectile.NewProjectile(projectile.position.X + 50, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X - 50, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X + 100, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X - 100, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("NitroBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("PyroBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 42);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1.5f, projectile.owner);
                    Main.projectile[a].scale = 1.5f;
                    int b = Projectile.NewProjectile(projectile.position.X + 20, projectile.position.Y, +5, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X - 20, projectile.position.Y, -5, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("ReinforcedBurstBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("PyroBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 42);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1.5f, projectile.owner);
                    Main.projectile[a].scale = 1.5f;
                    int b = Projectile.NewProjectile(projectile.position.X + 10, projectile.position.Y - 10, +6, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X - 10, projectile.position.Y - 10, -6, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X + 40, projectile.position.Y + 10, +4, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X - 40, projectile.position.Y + 10, -4, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("LinearBurstBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("PyroBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 42);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1.5f, projectile.owner);
                    Main.projectile[a].scale = 1.5f;
                    int b = Projectile.NewProjectile(projectile.position.X + 10, projectile.position.Y - 15, +6, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X - 10, projectile.position.Y - 15, -6, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X + 40, projectile.position.Y, +5, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X - 40, projectile.position.Y, -5, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                    int f = Projectile.NewProjectile(projectile.position.X + 70, projectile.position.Y + 15, +4, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                    int g = Projectile.NewProjectile(projectile.position.X - 70, projectile.position.Y + 15, -4, 0, mod.ProjectileType("PoisonSkull"), projectile.damage, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("RoundBlastBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("NitroBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int z = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1.5f, projectile.owner);
                    Main.projectile[z].scale = 1.25f;
                    int a = Projectile.NewProjectile(projectile.position.X + 25, projectile.position.Y, 4, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int b = Projectile.NewProjectile(projectile.position.X - 25, projectile.position.Y, -4, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 25, 0, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 25, 0, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X + 20, projectile.position.Y + 20, 4, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[e].scale = 0.8f;
                    int f = Projectile.NewProjectile(projectile.position.X - 20, projectile.position.Y + 20, -4, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[f].scale = 0.8f;
                    int g = Projectile.NewProjectile(projectile.position.X + 20, projectile.position.Y - 20, 4, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[g].scale = 0.8f;
                    int h = Projectile.NewProjectile(projectile.position.X - 20, projectile.position.Y - 20, -4, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[h].scale = 0.8f;
                }


                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("RoundBlastBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("ReinforcedBurstBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int z = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1.5f, projectile.owner);
                    Main.projectile[z].scale = 1.25f;
                    int a = Projectile.NewProjectile(projectile.position.X + 65, projectile.position.Y, 3, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int b = Projectile.NewProjectile(projectile.position.X - 65, projectile.position.Y, -3, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 35, 0, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 35, 0, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X + 50, projectile.position.Y + 20, 0, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[e].scale = 1.2f;
                    int f = Projectile.NewProjectile(projectile.position.X - 50, projectile.position.Y + 20, 0, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[f].scale = 1.2f;
                    int g = Projectile.NewProjectile(projectile.position.X + 50, projectile.position.Y - 20, 0, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[g].scale = 1.2f;
                    int h = Projectile.NewProjectile(projectile.position.X - 50, projectile.position.Y - 20, 0, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[h].scale = 1.2f;
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("RoundBlastBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("LinearBurstBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int z = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1.5f, projectile.owner);
                    Main.projectile[z].scale = 1.25f;
                    int a = Projectile.NewProjectile(projectile.position.X + 65, projectile.position.Y, 3, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int b = Projectile.NewProjectile(projectile.position.X - 65, projectile.position.Y, -3, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 35, 0, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 35, 0, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X + 50, projectile.position.Y + 20, 0, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[e].scale = 0.8f;
                    int f = Projectile.NewProjectile(projectile.position.X - 50, projectile.position.Y + 20, 0, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[f].scale = 0.8f;
                    int g = Projectile.NewProjectile(projectile.position.X + 50, projectile.position.Y - 20, 0, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[g].scale = 0.8f;
                    int h = Projectile.NewProjectile(projectile.position.X - 50, projectile.position.Y - 20, 0, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[h].scale = 0.8f;
                    int i = Projectile.NewProjectile(projectile.position.X + 80, projectile.position.Y + 20, 0, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[i].scale = 0.6f;
                    int k = Projectile.NewProjectile(projectile.position.X - 80, projectile.position.Y + 20, 0, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[k].scale = 0.6f;
                    int l = Projectile.NewProjectile(projectile.position.X + 80, projectile.position.Y - 20, 0, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[l].scale = 0.6f;
                    int m = Projectile.NewProjectile(projectile.position.X - 80, projectile.position.Y - 20, 0, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[m].scale = 0.6f;
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("SquareBlastBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("NitroBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[d].scale = 1.5f;
                    int e = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y + 30, 3, 3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    int f = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y + 30, -3, 3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    int g = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y - 30, 3, -3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    int h = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y - 30, -3, -3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                }


                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("SquareBlastBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("ReinforcedBurstBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[d].scale = 1.5f;
                    int e = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y + 30, 2, 3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[e].scale = 0.75f;
                    int f = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y + 30, -2, 3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[f].scale = 0.75f;
                    int g = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y - 30, 2, -3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[g].scale = 0.75f;
                    int h = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y - 30, -2, -3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[h].scale = 0.75f;
                    int i = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y + 30, 3, 2, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[i].scale = 0.75f;
                    int j = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y + 30, -3, 2, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[j].scale = 0.75f;
                    int k = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y - 30, 3, -2, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[k].scale = 0.75f;
                    int l = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y - 30, -3, -2, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[l].scale = 0.75f;
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("SquareBlastBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("LinearBurstBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 0, mod.ProjectileType("PoisonBlast"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[d].scale = 1.5f;
                    int e = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y + 30, 2, 4, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[e].scale = 0.65f;
                    int f = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y + 30, -2, 4, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[f].scale = 0.65f;
                    int g = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y - 30, 2, -4, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[g].scale = 0.65f;
                    int h = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y - 30, -2, -4, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[h].scale = 0.65f;
                    int i = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y + 30, 4, 2, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[i].scale = 0.65f;
                    int j = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y + 30, -4, 2, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[j].scale = 0.65f;
                    int k = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y - 30, 4, -2, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[k].scale = 0.65f;
                    int l = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y - 30, -4, -2, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[l].scale = 0.65f;
                    int m = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y + 30, 3, 3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[m].scale = 0.7f;
                    int n = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y + 30, -3, 3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[n].scale = 0.7f;
                    int o = Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y - 30, 3, -3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[o].scale = 0.7f;
                    int p = Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y - 30, -3, -3, mod.ProjectileType("PoisonSkull"), projectile.damage * 2, 1f, projectile.owner);
                    Main.projectile[p].scale = 0.7f;
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("NitroBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("ChemikazeBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 100);
                    Projectile.NewProjectile(projectile.position.X - 30, projectile.position.Y, -2, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    Projectile.NewProjectile(projectile.position.X + 30, projectile.position.Y, +2, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("ReinforcedBurstBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("ChemikazeBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 100);
                    Projectile.NewProjectile(projectile.position.X - 40, projectile.position.Y, -2, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    Projectile.NewProjectile(projectile.position.X + 40, projectile.position.Y, +2, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    Projectile.NewProjectile(projectile.position.X - 60, projectile.position.Y, -3, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    Projectile.NewProjectile(projectile.position.X + 60, projectile.position.Y, +3, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("LinearBurstBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("ChemikazeBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 100);
                    Projectile.NewProjectile(projectile.position.X - 40, projectile.position.Y, -2, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    Projectile.NewProjectile(projectile.position.X + 40, projectile.position.Y, +2, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    Projectile.NewProjectile(projectile.position.X - 60, projectile.position.Y, -3, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    Projectile.NewProjectile(projectile.position.X + 60, projectile.position.Y, +3, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    Projectile.NewProjectile(projectile.position.X - 80, projectile.position.Y, -4, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                    Projectile.NewProjectile(projectile.position.X + 80, projectile.position.Y, +4, 0, mod.ProjectileType("PoisonBurst"), projectile.damage, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("CrossBlastBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("NitroBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 4, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int b = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, -4, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X + 60, projectile.position.Y, -4, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int f = Projectile.NewProjectile(projectile.position.X - 60, projectile.position.Y, 4, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int g = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 60, 0, -4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int h = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 60, 0, 4, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("CrossBlastBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("ReinforcedBurstBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 6, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int b = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, -6, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 6, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, -6, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X + 60, projectile.position.Y, -6, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int f = Projectile.NewProjectile(projectile.position.X - 60, projectile.position.Y, 6, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int g = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 60, 0, -6, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int h = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 60, 0, 6, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                }

                if (Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("CrossBlastBuff")) && Main.player[Main.myPlayer].buffType.Contains(mod.BuffType("LinearBurstBuff")))
                {
                    Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62);
                    int a = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 8, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int b = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, -8, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int c = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, 8, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int d = Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0, -8, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int e = Projectile.NewProjectile(projectile.position.X + 60, projectile.position.Y, -8, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int f = Projectile.NewProjectile(projectile.position.X - 60, projectile.position.Y, 8, 0, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int g = Projectile.NewProjectile(projectile.position.X, projectile.position.Y + 60, 0, -8, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                    int h = Projectile.NewProjectile(projectile.position.X, projectile.position.Y - 60, 0, 8, mod.ProjectileType("PoisonSkullburst"), projectile.damage * 1, 1f, projectile.owner);
                }
            }
        }
        public override void AI()
        {
            projectile.ai[0]      += 1;
            projectile.ai[1]      += 1;
            projectile.localAI[0] += 1;

            if (projectile.ai[0] < -1000)
            {
                return;
            }

            Player player = Main.player[projectile.owner];

            if (!player.channel || player.dead)
            {
                projectile.ai[0] = -10000;
            }
            else
            {
                projectile.timeLeft = 250;
                Vector2 mousePos = Main.MouseWorld;
                player.itemTime      = 60;
                player.itemAnimation = 60;

                if (projectile.owner == Main.myPlayer)
                {
                    Vector2 diff = mousePos - projectile.Center;
                    if (diff.Length() > 1800 || projectile.ai[1] > 1200)
                    {
                        if (!player.CheckMana(player.HeldItem, 8, true))
                        {
                            projectile.ai[0]     = -10000;
                            projectile.netUpdate = true;
                            return;
                        }



                        if (projectile.localAI[0] > 1000)
                        {
                            projectile.extraUpdates = (int)MathHelper.Clamp(projectile.extraUpdates + 1, 10, 40);
                            projectile.numUpdates   = projectile.extraUpdates;
                        }
                        diff.Normalize();
                        projectile.direction = Main.MouseWorld.X > player.position.X ? 1 : -1;
                        Vector2 randAng = Main.rand.NextVector2CircularEdge(1500f, 1500f);
                        projectile.Center   = mousePos + randAng;
                        projectile.velocity = Vector2.Normalize(mousePos - projectile.Center) * (projectile.velocity.Length());
                        there            = Main.MouseWorld;
                        projectile.ai[1] = 0;

                        Vector2 dir = (there - player.Center);
                        player.ChangeDir(dir.X > 0 ? 1 : -1);
                        player.itemRotation = dir.ToRotation() - (player.direction < 0 ? MathHelper.Pi : 0);

                        for (int i = 0; i < projectile.oldPos.Length; i += 1)                        //dumb hack to get the trails to not appear at 0,0
                        {
                            projectile.oldPos[i] = projectile.position;
                        }
                        projectile.netUpdate = true;
                    }
                }


                if (there != default)
                {
                    if (Vector2.Dot(Vector2.Normalize(there - projectile.Center), Vector2.Normalize(projectile.velocity)) < -0.9f)
                    {
                        projectile.ai[1] = 1000;
                        there            = default;
                        NoiseGenerator noise = new NoiseGenerator(projectile.whoAmI);
                        noise.Amplitude = 5;
                        noise.Frequency = 0.5;
                        for (float i = 0; i < 1f; i += 1f / 5f)
                        {
                            Vector2 there2 = (projectile.velocity); there.Normalize(); there2 = there2.RotatedBy(i * MathHelper.TwoPi);
                            int     prog   = Projectile.NewProjectile(projectile.Center, Vector2.Normalize(there2) * (2f + (float)noise.Noise((int)(i * 80), (int)projectile.ai[0])) * 5f, ProjectileID.HallowStar, (int)((1f - Main.player[projectile.owner].manaSickReduction) / 5f), projectile.knockBack / 10f, projectile.owner);
                            Main.projectile[prog].timeLeft             = 20 + (int)(noise.Noise((int)(i * 40), (int)projectile.ai[0] + 800) * 40);
                            Main.projectile[prog].alpha                = 150;
                            Main.projectile[prog].localNPCHitCooldown  = -1;
                            Main.projectile[prog].penetrate            = 2;
                            Main.projectile[prog].usesLocalNPCImmunity = true;
                            Main.projectile[prog].netUpdate            = true;
                        }
                    }
                }
            }
        }
Example #47
0
        public override void AttackEffects(Player player, int type, Vector2 position, Vector2 shootTo, float speedX, float speedY, int damage, float knockBack, float speed)
        {
            Projectile proj = Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY) * 2f, type, damage, knockBack, player.whoAmI);

            proj.extraUpdates = 2;
        }
 public override void OnHitNPCWithProj(Projectile proj, NPC target, int damage, float knockback, bool crit)
 {
     OnHitEither(target, damage, knockback, crit);
 }
Example #49
0
        public override void AI()
        {
            AITimer++;

            if ((Main.netMode == NetmodeID.MultiplayerClient || Main.netMode == NetmodeID.Server) && SelectHoverMP == 1)
            {
                Random = Main.rand.Next(PlayerCount().Count);
                SelectHoverMP++;
            }

            Player player = Main.player[Random];

            #region Difficulty modification

            if (UnderEightyHealth)
            {
                SpeedAdd       = 1f;
                npc.damage     = 60;
                SSDelay        = 15;
                ShieldDuration = 220;
                HoverCooldown  = 350;
            }

            if (UnderFiftyHealth)
            {
                MinionCount    = 3;
                SpeedAdd       = 2f;
                npc.damage     = 65;
                ShieldDuration = 230;
                HoverCooldown  = 300;
            }

            if (UnderThirtyHealth)
            {
                MinionCount    = 4;
                SpeedAdd       = 4f;
                npc.damage     = 70;
                SSDelay        = 10;
                ShieldDuration = 240;
                ShieldLife     = 2;
                HoverCooldown  = 200;
            }

            if (Main.expertMode && UnderThirtyHealth)
            {
                MinionCount    = 6;
                npc.damage     = 80;
                SSDelay        = 8;
                ShieldDuration = 250;
                ShieldLife     = 3;
                HoverCooldown  = 120;
            }

            #endregion

            #region DisappearanceManager

            npc.TargetClosest(true);

            if (!player.active || player.dead)
            {
                npc.TargetClosest(false);
                player = Main.player[npc.target];
                if (!player.active || player.dead)
                {
                    npc.velocity = new Vector2(0f, -10f);

                    if (npc.timeLeft > 10)
                    {
                        npc.timeLeft = 10;
                    }

                    return;
                }
            }

            #endregion

            #region Fail prevention

            if (AIStage > 4)
            {
                AIStage = STAGE_HOVER;
            }

            if (AITimer > 550)
            {
                AITimer = 0;
            }

            if (SSDone > 10)
            {
                SSDone = 6;
            }

            #endregion

            #region Hovering

            if (AIStage == STAGE_HOVER)
            {
                npc.dontTakeDamage = false;
                //Y Hovering

                if (Main.player[npc.target].position.Y != npc.position.Y + HoverDistance.Y)
                {
                    YHoverTimer++;

                    if (YHoverTimer > 10)
                    {
                        //Thanks UncleDanny and Thorium  team for this <3
                        if (Main.player[npc.target].position.Y < npc.position.Y + HoverDistance.Y)
                        {
                            npc.velocity.Y -= npc.velocity.Y > 0f ? 1f : 0.15f;
                        }

                        if (Main.player[npc.target].position.Y > npc.position.Y + HoverDistance.Y)
                        {
                            npc.velocity.Y += npc.velocity.Y < 0f ? 1f : 0.15f;
                        }
                    }
                }
                else
                {
                    npc.velocity.Y = 0;
                    YHoverTimer    = 0;
                }

                if (Vector2.Distance(new Vector2(player.Center.X, 0), new Vector2(npc.Center.X, 0)) != HoverDistance.X)
                {
                    XHoverTimer++;
                    if (XHoverTimer > 30)
                    {
                        npc.velocity.X = 2.5f * npc.direction + SpeedAdd * npc.direction;
                    }
                }
                else
                {
                    npc.velocity.X = 0;
                    XHoverTimer    = 0;
                }

                if (AITimer >= HoverCooldown)
                {
                    AdvanceStage(true, true);
                    ResetValues(false);
                    SelectHoverMP = 2;
                }

                if (AITimer <= 100)
                {
                    //Shield code here.
                }

                npc.netUpdate = true;
            }

            #endregion // Starts at 0 ticks.

            #region Slam || MP compatible

            if (AIStage == STAGE_SLAM)
            {
                Slam();
            }

            #endregion

            #region Shield || Regen stage.

            if (AIStage == STAGE_SHIELD)
            {
                if (AITimer > 0)
                {
                    if (AITimer == 1)
                    {
                        SoundHelper.PlayCustomSound("Sounds/ShipShield", npc.Center, 2.5f);
                    }
                    if (AITimer % 20 == 0)
                    {
                        RandomShieldLines();
                    }

                    npc.velocity.Y = -1f;

                    for (int k = 0; k < 10; k++)
                    {
                        if (Deg <= 360)
                        {
                            Deg++;

                            float
                                CPosX = npc.Center.X +
                                        ShieldDistance *
                                        (float)Math
                                        .Cos(Deg);     //To find the circumference you use formula: x = cX + r * cos(angle), where the x is the coordinate, cX is the center of the circle by X and r is radius.
                            float CPosY = npc.Center.Y + 16f + ShieldDistance * (float)Math.Sin(Deg);

                            for (int i = 0; i < 10; i++)
                            {
                                Dust dust = Main.dust[Dust.NewDust(new Vector2(CPosX, CPosY), 1, 1, 56)];
                                dust.noGravity = true;
                            }
                        }
                    }

                    if (Deg == 360)
                    {
                        Deg = 0;
                    }
                    npc.netUpdate = true;

                    if (Vector2.Distance(player.Center, npc.Center) <= ShieldDistance)
                    {
                        player.Hurt(
                            PlayerDeathReason.ByCustomReason(
                                player.name + "has been cut in half by the Frieza Force Shield"), 40, 1);
                        Dust dust = Main.dust[
                            Dust.NewDust(player.Center, player.width, player.height, 56)]; //need to pick a new dust
                        dust.noGravity = true;

                        if (player.position.X > npc.Center.X && player.Center.Y < npc.Center.Y) //4th qudrant
                        {
                            player.velocity = new Vector2(16f, 16f);
                        }
                        else if (player.position.X < npc.Center.X && player.Center.Y < npc.Center.Y) //3rd quadrant
                        {
                            player.velocity = new Vector2(-16f, 16f);
                        }
                        else if (player.position.X < npc.Center.X && player.Center.Y > npc.Center.Y) //2nd quadrant
                        {
                            player.velocity = new Vector2(-16f, -16f);
                        }
                        else if (player.position.X > npc.Center.X && player.Center.Y > npc.Center.Y) //1st quadrant
                        {
                            player.velocity = new Vector2(16f, -16f);
                        }
                    }

                    for (int i = 0; i <= Main.maxProjectiles; i++)
                    {
                        Projectile projectile = Main.projectile[i];

                        if (Vector2.Distance(projectile.Center, npc.Center) <= ShieldDistance && projectile.active)
                        {
                            projectile.velocity *= -1f;

                            for (int j = 0; j < 20; j++)
                            {
                                Dust dust = Main.dust[
                                    Dust.NewDust(projectile.position, projectile.width, projectile.height, 211)];
                                dust.noGravity = true;
                            }

                            projectile.hostile  = true;
                            projectile.friendly = false;

                            if (projectile.Center.X > player.Center.X * 0.5f
                                ) //Reference goes to Fargo for voring his epic code.
                            {
                                projectile.direction       = 1;
                                projectile.spriteDirection = 1;
                            }
                            else
                            {
                                projectile.direction       = -1;
                                projectile.spriteDirection = -1;
                            }

                            projectile.netUpdate = true;
                            npc.netUpdate        = true;
                        }
                        else if (Vector2.Distance(projectile.position, npc.Center) <= 6 * 16f)
                        {
                            projectile.Kill();
                            Dust dust = Main.dust[
                                Dust.NewDust(projectile.position, projectile.width, projectile.height, 211)];
                            dust.noGravity = true;
                        }
                    }
                }

                if (npc.life <= npc.lifeMax)
                {
                    npc.life += ShieldLife;
                }
                npc.netUpdate = true;

                if (AITimer >= ShieldDuration)
                {
                    AdvanceStage(true, true);
                    ResetValues(false);
                }
            }

            #endregion

            #region Minions

            if (AIStage == STAGE_MINION)
            {
                npc.velocity = new Vector2(0, -2f);
                if (AITimer == 0)
                {
                    TileX = (int)(npc.position.X + Main.rand.NextFloat(-7f * 16, 6f * 16));
                    TileY = (int)(npc.position.Y + Main.rand.NextFloat(-7f * 16, 6f * 16));
                    SummonFFMinions();
                    SummonSaibamen();
                }

                npc.netUpdate = true;

                if (AITimer == 60)
                {
                    ResetValues(false);
                    AdvanceStage(true, true);
                }
            }

            #endregion

            #region Hyper Stage

            if (AIStage == STAGE_HYPER)
            {
                npc.noTileCollide = true;

                if (HyperSlamsDone <= 4)
                {
                    npc.dontTakeDamage = true;
                    if (AITimer < 300)
                    {
                        DoChargeDust();
                        npc.dontTakeDamage = true;
                        npc.velocity       = new Vector2(0, -0.3f);
                        npc.netUpdate      = true;
                    }

                    if (AITimer > 300 && HyperPosition == Vector2.Zero)
                    {
                        npc.dontTakeDamage = false;
                        npc.netUpdate      = true;
                        npc.velocity       = Vector2.Zero;
                        if (AITimer == 301)
                        {
                            CircularDust(30, npc, 133, 10f, 1);
                            ChooseHyperPosition();
                        }

                        npc.netUpdate = true;
                    }

                    if (AITimer > 320 && HyperPosition != Vector2.Zero && npc.velocity == Vector2.Zero)
                    {
                        npc.dontTakeDamage = false;
                        DoLineDust();
                        npc.netUpdate = true;
                    }

                    if (AITimer == 310 && HyperPosition != Vector2.Zero)
                    {
                        npc.dontTakeDamage = false;
                        TeleportRight();
                        HyperSlamsDone++;
                        npc.netUpdate = true;
                    }

                    if (AITimer >= 350 && HyperPosition != Vector2.Zero)
                    {
                        HorizontalSlam();
                    }
                    npc.netUpdate = true;
                }
                else
                {
                    HorizontalSlamTimer = 0;
                    npc.dontTakeDamage  = false;
                    HyperSlamsDone      = 0;
                    AITimer             = 0;
                    ResetStage();
                    npc.netUpdate = true;
                }
            }

            #endregion

            #region Warp Stage

            if (AIStage == STAGE_WARP)
            {
                Warp();
            }

            #endregion
        }
        public override void AI()
        {
            // Gets the Player and Target Vector
            npc.TargetClosest(true);
            Player  player = Main.player[npc.target];
            Vector2 target = npc.HasPlayerTarget ? player.Center : Main.npc[npc.target].Center;

            // Ensures that the NPC is not rotated
            npc.rotation  = 0.0f;
            npc.netAlways = true;
            npc.TargetClosest(true);
            // Ensures NPC Life is not greater than its max life
            if (npc.life >= npc.lifeMax)
            {
                npc.life = npc.lifeMax;
            }
            // Handles Despawning
            if (npc.target < 0 || npc.target == 500 || player.dead || !player.active)
            {
                npc.TargetClosest(false);
                npc.direction  = 1;
                npc.velocity.Y = npc.velocity.Y - 0.1f;
                if (npc.timeLeft > 20)
                {
                    npc.timeLeft = 20;
                    return;
                }
            }
            // Increment AI
            ai++;
            // Movement
            npc.ai[0] = (float)ai * 1f;
            int distance = (int)Vector2.Distance(target, npc.Center);

            if ((double)npc.ai[0] < 300)
            {
                frame = 0;
                MoveTowards(npc, target, (float)(distance > 300 ? 13f : 7f), 30f);
                npc.netUpdate = true;
            }
            else if ((double)npc.ai[0] >= 300 && (double)npc.ai[0] < 450.0)
            {
                stunned     = true;
                frame       = 1;
                npc.defense = 1;
                npc.damage  = 1000;
                MoveTowards(npc, target, (float)(distance > 300 ? 13f : 7f), 30f);
                npc.netUpdate = true;
            }
            else if ((double)npc.ai[0] >= 450.0)
            {
                frame       = 0;
                stunned     = false;
                npc.damage  = 350;
                npc.defense = 100;
                if (!fastSpeed)
                {
                    fastSpeed = true;
                }
                else
                {
                    if ((double)npc.ai[0] % 50 == 0)
                    {
                        float   speed     = 12f;
                        Vector2 vector    = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
                        float   x         = player.position.X + (float)(player.width / 2) - vector.X;
                        float   y         = player.position.Y + (float)(player.height / 2) - vector.Y;
                        float   distance2 = (float)Math.Sqrt(x * x + y * y);
                        float   factor    = speed / distance2;
                        npc.velocity.X = x * factor;
                        npc.velocity.Y = y * factor;
                    }
                }
                npc.netUpdate = true;
            }
            // Attack
            if ((double)npc.ai[0] % (Main.expertMode ? 10 : 15) == 0 && !fastSpeed)
            {
                attackTimer++;
                if (attackTimer <= 2)
                {
                    frame          = 2;
                    npc.velocity.X = 1f;
                    npc.velocity.Y = 1f;
                    Vector2 shootPos = npc.Center;
                    float   accuracy = 5f * (npc.life / npc.lifeMax);
                    Vector2 shootVel = target - shootPos + new Vector2(Main.rand.NextFloat(-accuracy, accuracy), Main.rand.NextFloat(-accuracy, accuracy));
                    shootVel.Normalize();
                    shootVel *= 14.5F;
                    for (int i = 0; i < (Main.expertMode ? 5 : 3); i++)
                    {
                        Projectile.NewProjectile(shootPos.X + (float)(-100 * npc.direction) + (float)Main.rand.Next(-40, 41), shootPos.Y - (float)Main.rand.Next(-50, 40), shootVel.X, shootVel.Y, mod.ProjectileType("MightOfTheUnderworldProjectile"), npc.damage / 3, 5f);
                    }
                }
                else
                {
                    attackTimer = 0;
                }
            }



            if ((double)npc.ai[0] >= 650.0)
            {
                ai        = 0;
                npc.alpha = 0;
                npc.ai[2] = 0;
                fastSpeed = false;
            }
        }
Example #51
0
    private static void PlayerOnItemCheck_CheckFishingBobber_PickAndConsumeBait(On.Terraria.Player.orig_ItemCheck_CheckFishingBobber_PickAndConsumeBait orig, Player player, Projectile bobber, out bool pullTheBobber, out int baitTypeUsed)
    {
        pullTheBobber = false;
        baitTypeUsed  = 0;
        int foundBaitSlot = -1;

        for (int i = 54; i < 58; i++)
        {
            Item item = player.inventory[i];
            if (item.stack > 0 && item.bait > 0)
            {
                foundBaitSlot = i;
                break;
            }
        }

        if (foundBaitSlot == -1)
        {
            for (int i = 0; i < 50; i++)
            {
                Item item = player.inventory[i];
                if (item.stack > 0 && item.bait > 0)
                {
                    foundBaitSlot = i;
                    break;
                }
            }
        }

        // found bait in player inventory
        if (foundBaitSlot > -1)
        {
            Item  bait = player.inventory[foundBaitSlot];
            bool  flag = false;
            float num2 = 1f + bait.bait / 6f;
            if (num2 < 1f)
            {
                num2 = 1f;
            }

            if (player.accTackleBox)
            {
                num2 += 1f;
            }

            if (Main.rand.NextFloat() * num2 < 1f)
            {
                flag = true;
            }

            if (bobber.localAI[1] == -1f)
            {
                flag = true;
            }

            if (bobber.localAI[1] > 0f)
            {
                Item fishedItem = new Item();
                fishedItem.SetDefaults((int)bobber.localAI[1]);
                if (fishedItem.rare < ItemRarityID.White)
                {
                    flag = false;
                }
            }

            baitTypeUsed = bait.type;
            if (baitTypeUsed == 2673)
            {
                flag = true;
            }

            if (CombinedHooks.CanConsumeBait(player, bait) ?? flag)
            {
                if (bait.type is 4361 or 4362)
                {
                    NPC.LadyBugKilled(player.Center, bait.type == 4362);
                }

                bait.stack--;
                if (bait.stack <= 0)
                {
                    bait.SetDefaults();
                }
            }

            pullTheBobber = true;
        }
        else
        {
            foreach (FishingBelt belt in GetFishingBelts(player))
            {
                ItemStorage storage = belt.GetItemStorage();
                for (int i = 0; i < storage.Count; i++)
                {
                    Item bait = storage[i];
                    if (bait.IsAir || bait.bait <= 0)
                    {
                        continue;
                    }

                    bool  useBait = false;
                    float num2    = 1f + bait.bait / 6f;
                    if (num2 < 1f)
                    {
                        num2 = 1f;
                    }

                    if (player.accTackleBox)
                    {
                        num2 += 1f;
                    }

                    if (Main.rand.NextFloat() * num2 < 1f)
                    {
                        useBait = true;
                    }

                    if (bobber.localAI[1] == -1f)
                    {
                        useBait = true;
                    }

                    if (bobber.localAI[1] > 0f)
                    {
                        Item fishedItem = new Item();
                        fishedItem.SetDefaults((int)bobber.localAI[1]);
                        if (fishedItem.rare < ItemRarityID.White)
                        {
                            useBait = false;
                        }
                    }

                    baitTypeUsed = bait.type;
                    if (baitTypeUsed == 2673)
                    {
                        useBait = true;
                    }

                    if (CombinedHooks.CanConsumeBait(player, bait) ?? useBait)
                    {
                        if (bait.type is 4361 or 4362)
                        {
                            NPC.LadyBugKilled(player.Center, bait.type == 4362);
                        }

                        belt.GetItemStorage().ModifyStackSize(player, i, -1);
                    }

                    pullTheBobber = true;
                }
            }
        }
    }
Example #52
0
        public override void AI()
        {
            Vector2 vector2 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
            float   xDir    = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector2.X;
            float   yDir    = (float)(Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 120) - vector2.Y;
            float   length  = (float)Math.Sqrt(xDir * xDir + yDir * yDir);

            if (npc.life < npc.lifeMax / 2)
            {
                Phase = 1;
                if (!phase2Init)
                {
                    AttackTimer = 0;
                    for (int i = 0; i < 25; i++)
                    {
                        Vector2 position = npc.Center + Vector2.UnitX.RotatedBy(MathHelper.ToRadians(360f / 25 * i)) * 15;
                        Dust    dust     = Dust.NewDustPerfect(npc.position, ModContent.DustType <ArkEnergy>());
                        dust.noGravity = true;
                        dust.velocity  = Vector2.Normalize(position - npc.Center) * 4;
                        dust.noLight   = false;
                        dust.fadeIn    = 1f;
                    }
                    Main.PlaySound(SoundID.DD2_SkeletonSummoned, npc.position);
                    phase2Init = true;
                }
            }
            if (npc.life < npc.lifeMax / 3)
            {
                Phase = 2;
                if (!phase3Init)
                {
                    AttackTimer = 0;
                    for (int i = 0; i < 25; i++)
                    {
                        Vector2 position = npc.Center + Vector2.UnitX.RotatedBy(MathHelper.ToRadians(360f / 25 * i)) * 15;
                        Dust    dust     = Dust.NewDustPerfect(npc.position, ModContent.DustType <SpiritArkWisp>());
                        dust.noGravity = true;
                        dust.velocity  = Vector2.Normalize(position - npc.Center) * 4;
                        dust.noLight   = false;
                        dust.fadeIn    = 1f;
                    }
                    Main.NewText("A barrier starts forming around the Ark of Imperious", 0, 168, 79);
                    phase3Init = true;
                }
            }

            AttackTimer++;

            if (Phase == 1)
            {
                if (!justSpawnedCircle)
                {
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <AoICircle>(), npc.damage, 0, 0, 0f, npc.whoAmI);
                    justSpawnedCircle = true;
                }
            }
            DoAttacks();

            if (Phase == 2)
            {
                int maxDist;

                if (Main.expertMode)
                {
                    maxDist = 1000;
                }
                else if (EternalWorld.hellMode)
                {
                    maxDist = 900;
                }
                else
                {
                    maxDist = 2000;
                }

                // ripped from another mod, credit to the person who wrote this
                for (int i = 0; i < 120; i++)
                {
                    double  angle  = Main.rand.NextDouble() * 2d * Math.PI;
                    Vector2 offset = new Vector2((float)Math.Sin(angle) * maxDist, (float)Math.Cos(angle) * maxDist);
                    Dust    dust   = Main.dust[Dust.NewDust(npc.Center + offset, 0, 0, ModContent.DustType <ArkEnergy>(), 0, 0, 100)];
                    dust.noGravity = true;
                }
                for (int i = 0; i < Main.player.Length; i++)
                {
                    Player player = Main.player[i];
                    if (player.active && !player.dead && Vector2.Distance(player.Center, npc.Center) > maxDist)
                    {
                        Vector2 toTarget = new Vector2(npc.Center.X - player.Center.X, npc.Center.Y - player.Center.Y);
                        toTarget.Normalize();
                        float speed = Vector2.Distance(player.Center, npc.Center) > maxDist + 500 ? 1f : 0.5f;
                        player.velocity += toTarget * 0.5f;

                        player.dashDelay    = 2;
                        player.grappling[0] = -1;
                        player.grapCount    = 0;
                        for (int p = 0; p < Main.projectile.Length; p++)
                        {
                            if (Main.projectile[p].active && Main.projectile[p].owner == player.whoAmI && Main.projectile[p].aiStyle == 7)
                            {
                                Main.projectile[p].Kill();
                            }
                        }
                    }
                }
                int maxdusts = 6;
                for (int i = 0; i < maxdusts; i++)
                {
                    float   dustDistance = 200;
                    float   dustSpeed    = 8;
                    Vector2 offset       = Vector2.UnitX.RotateRandom(MathHelper.Pi) * dustDistance;
                    Vector2 velocity     = -offset.SafeNormalize(-Vector2.UnitY) * dustSpeed;
                    Dust    vortex       = Dust.NewDustPerfect(new Vector2(npc.Center.X, npc.Center.Y) + offset, ModContent.DustType <ArkEnergy>(), velocity, 0, default(Color), 1.5f);
                    vortex.noGravity = true;
                }
            }
        }
Example #53
0
        public override void AI()
        {
            Player      player    = Main.player[projectile.owner];
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            if (player.dead)
            {
                modPlayer.BigBrainMinion = false;
            }
            if (modPlayer.BigBrainMinion)
            {
                projectile.timeLeft = 2;
            }

            projectile.frameCounter++;
            if (projectile.frameCounter >= 8)
            {
                projectile.frameCounter = 0;
                projectile.frame        = (projectile.frame + 1) % 12;
            }

            projectile.ai[0] += 0.4f;
            projectile.alpha  = (int)(Math.Cos(projectile.ai[0] * MathHelper.TwoPi / 180) * 60) + 60;

            if (projectile.minionSlots <= 6) //projectile scale increases with minion slots consumed, caps at 6 slots
            {
                projectile.scale = 0.75f + projectile.minionSlots / 12;
            }
            else
            {
                projectile.scale = 1.25f;
            }

            bool targetting            = false; //targetting code, prioritize targetted npcs, then look for closest if none is found
            NPC  targetnpc             = null;
            NPC  minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC;

            if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object)this, false))
            {
                Vector2 distancetotarget = minionAttackTargetNpc.Center - projectile.Center;
                if (distancetotarget.Length() < 1500)
                {
                    targetnpc  = minionAttackTargetNpc;
                    targetting = true;
                }
            }
            else if (!targetting)
            {
                float distancemax = 1500;
                for (int index = 0; index < 200; ++index)
                {
                    if (Main.npc[index].CanBeChasedBy((object)this, false))
                    {
                        Vector2 distancetotarget = Main.npc[index].Center - projectile.Center;
                        if (distancetotarget.Length() < distancemax)
                        {
                            distancemax = distancetotarget.Length();
                            targetnpc   = Main.npc[index];
                            targetting  = true;
                        }
                    }
                }
            }

            if (targetting)
            {
                projectile.localAI[0]++;
                if (projectile.localAI[0] > 7)
                {
                    Vector2 spawnpos = targetnpc.Center + Main.rand.NextVector2CircularEdge(150, 150);
                    Main.PlaySound(SoundID.Item, (int)spawnpos.X, (int)spawnpos.Y, 104, 0.5f, -0.2f);
                    Vector2 totarget = Vector2.Normalize(targetnpc.Center - spawnpos);
                    int     p        = Projectile.NewProjectile(spawnpos, totarget * 12, mod.ProjectileType("BigBrainIllusion"), (int)(projectile.damage * projectile.scale), projectile.knockBack, projectile.owner); //damage directly proportional to projectile scale, change later???
                    if (p < 1000)
                    {
                        Main.projectile[p].scale     = projectile.scale * 0.75f;
                        Main.projectile[p].netUpdate = true; //sync because randomized spawn position
                    }
                    projectile.localAI[0] = 0;
                }
            }

            projectile.Center = player.Center + new Vector2(0, (200 + projectile.alpha) * projectile.scale).RotatedBy(projectile.ai[1] + projectile.ai[0] / MathHelper.TwoPi);
        }
Example #54
0
        public override void AI()
        {
            if (body == -1)
            {
                int npcID = BaseAI.GetNPC(npc.Center, mod.NPCType("Zero"), 1000, null);
                if (npcID >= 0)
                {
                    body = npcID;
                }
            }

            if (body == -1)
            {
                return;
            }

            NPC zero = Main.npc[body];

            if (zero == null || zero.life <= 0 || !zero.active || zero.type != mod.NPCType("Zero"))
            {
                npc.active = false; return;
            }

            for (int m = npc.oldPos.Length - 1; m > 0; m--)
            {
                npc.oldPos[m] = npc.oldPos[m - 1];
            }
            npc.oldPos[0] = npc.position;

            int probeNumber = ((Zero)zero.modNPC).WeaponCount;

            if (rotValue == -1f)
            {
                rotValue = npc.ai[0] % probeNumber * ((float)Math.PI * 2f / probeNumber);
            }
            rotValue += Main.expertMode ? .05f : 0f;
            while (rotValue > (float)Math.PI * 2f)
            {
                rotValue -= (float)Math.PI * 2f;
            }
            npc.Center = BaseUtility.RotateVector(zero.Center, zero.Center + new Vector2(((Zero)zero.modNPC).Distance, 0f), rotValue);

            if (Main.netMode != 1)
            {
                npc.ai[2]++;
            }

            Player player = Main.player[zero.target];

            int aiTimerFire = Main.expertMode ? 120 : 180;

            if (zero.ai[0] > 0 && Main.netMode != 1)
            {
                npc.active    = false;
                npc.netUpdate = true;
            }

            if (Main.netMode != 1)
            {
                npc.ai[2]++;
            }

            if (npc.ai[2] == aiTimerFire)
            {
                npc.ai[2] = 0;
                if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, player.width, player.height))
                {
                    float   spread = 45f * 0.0174f;
                    Vector2 dir    = Vector2.Normalize(player.Center - npc.Center);
                    dir *= 14f;
                    float  baseSpeed  = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y));
                    double startAngle = Math.Atan2(dir.X, dir.Y) - .1d;
                    double deltaAngle = spread / 6f;
                    for (int i = 0; i < Main.rand.Next(4); i++)
                    {
                        double offsetAngle = startAngle + (deltaAngle * i);
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), mod.ProjType("Static"), (int)(npc.damage / 1.5f), 5, Main.myPlayer);
                    }
                }
            }

            Vector2 vector2     = new Vector2(npc.position.X + (npc.width * 0.5f), npc.position.Y + (npc.height * 0.5f));
            float   num1        = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector2.X;
            float   num2        = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector2.Y;
            float   NewRotation = (float)Math.Atan2(num2, num1) - 1.57f;

            npc.rotation = MathHelper.Lerp(npc.rotation, NewRotation, 1f / 30f);
        }
Example #55
0
        public override bool PreDraw(SpriteBatch sb, Color lightColor)
        {
            Projectile    P             = projectile;
            SpriteEffects spriteEffects = SpriteEffects.None;

            if (P.spriteDirection == -1)
            {
                spriteEffects = SpriteEffects.FlipHorizontally;
            }
            Color     color25 = Lighting.GetColor((int)P.Center.X / 16, (int)P.Center.Y / 16);
            Vector2   pos     = P.Center + Vector2.UnitY * P.gfxOffY - Main.screenPosition;
            Texture2D tex     = Main.projectileTexture[P.type];
            Texture2D tex2    = mod.GetTexture("Projectiles/missiles/NebulaMissileImpact2");
            Color     alpha4  = P.GetAlpha(color25);
            Vector2   origin8 = new Vector2((float)tex.Width, (float)tex.Height) / 2f;

            Color color57 = alpha4 * 0.8f;

            color57.A /= 2;
            Color color58 = Color.Lerp(alpha4, Color.Black, 0.5f);

            color58.A = alpha4.A;
            float num274 = 0.95f + (P.rotation * 0.75f).ToRotationVector2().Y * 0.1f;

            color58 *= num274;
            float scale13 = 0.6f + P.scale * 0.6f * num274;

            float   dist  = Math.Max(radius, 1);
            Vector2 diff2 = Vector2.Normalize(P.Center - basePosition);

            if (float.IsNaN(diff2.X) || float.IsNaN(diff2.Y))
            {
                diff2 = -Vector2.UnitY;
            }

            float spin2 = spin + (float)Math.PI / 2;

            int k = 1;

            for (float i = 0f; i < dist; i += 1f + (30f * (i / dist)))
            {
                SpriteEffects se = SpriteEffects.None;
                if (k == -1)
                {
                    se = SpriteEffects.FlipHorizontally;
                }

                Vector2 pos1 = basePosition + spin2.ToRotationVector2() * i;
                Vector2 pos2 = basePosition + diff2 * i;

                Vector2 fPos = Vector2.Lerp(pos1, pos2, i / dist) - Main.screenPosition;

                float rot = ((float)Math.PI * 2f / dist) * i;
                sb.Draw(tex2, fPos, null, alpha4, rot + P.rotation * k, origin8, MathHelper.Lerp(0.1f, P.scale, (i / dist)), se, 0f);
                k *= -1;
            }

            sb.Draw(tex2, basePosition - Main.screenPosition, null, alpha4, -P.rotation, origin8, P.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);


            sb.Draw(tex2, pos, null, color58, -P.rotation + 0.35f, origin8, scale13, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
            sb.Draw(tex2, pos, null, alpha4, -P.rotation, origin8, P.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
            sb.Draw(tex, pos, null, color57, -P.rotation * 0.7f, origin8, P.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
            sb.Draw(tex2, pos, null, alpha4 * 0.8f, P.rotation * 0.5f, origin8, P.scale * 0.9f, spriteEffects, 0f);
            alpha4.A = 0;

            sb.Draw(tex, pos, null, alpha4, P.rotation, origin8, P.scale, spriteEffects, 0f);

            return(false);
        }
Example #56
0
 public override void Kill(int timeLeft)
 {
     Projectile.NewProjectile(projectile.position, Vector2.Zero, mod.ProjectileType("GEScorpion"), 1, 0f, Main.myPlayer);
     Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire);
 }
 public JetBrickPrimTrail(Projectile projectile)
 {
     Entity     = projectile;
     EntityType = projectile.type;
     DrawType   = PrimTrailManager.DrawProjectile;
 }
Example #58
0
 public override void Kill(int timeLeft)
 {
     int kek = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -4f, mod.ProjectileType("BloodBoltB"), projectile.damage, 1f, projectile.owner);
 }
        public static void Init()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("The Sequencer", "sequencer");

            gun.idleAnimation  = "sequencer1_idle";
            gun.shootAnimation = "sequencer1_fire";
            Game.Items.Rename("outdated_gun_mods:the_sequencer", "spapi:the_sequencer");
            SequencerController controller = gun.gameObject.AddComponent <SequencerController>();

            GunExt.SetShortDescription(gun, "Change Your Mind");
            GunExt.SetLongDescription(gun, "A worn gun with an enchanted chamber. It's enchantment makes the gun change it's mood (as well as projectiles) very quickly. Like after every shot.\n\nThis gun was once worn by a famous gungeoneer and handcrafted " +
                                      "by him too. At first it was a normal gun, but a gunjurer accidentaly threw a magical spell on the chamber, enchanting it with the elements.");
            GunExt.SetupSprite(gun, null, "sequencer1_idle_001", 8);
            GunExt.SetAnimationFPS(gun, gun.shootAnimation, 16);
            GunExt.SetAnimationFPS(gun, gun.reloadAnimation, 16);
            GunExt.AddProjectileModuleFrom(gun, "klobb", true, false);
            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.SemiAutomatic;
            gun.DefaultModule.cooldownTime  = 0.50f;
            gun.DefaultModule.angleVariance = 0;
            //setting up fire proj.
            Projectile fireProjectile = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(56) as Gun).DefaultModule.projectiles[0]);

            fireProjectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(fireProjectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(fireProjectile);
            fireProjectile.transform.parent = gun.barrelOffset;
            fireProjectile.baseData.damage  = 20f;
            fireProjectile.baseData.force  /= 2f;
            fireProjectile.baseData.range   = 9999;
            fireProjectile.DefaultTintColor = Color.red;
            fireProjectile.HasDefaultTint   = true;
            fireProjectile.AppliesFire      = true;
            fireProjectile.FireApplyChance  = 100;
            fireProjectile.fireEffect       = (PickupObjectDatabase.GetById(295) as BulletStatusEffectItem).FireModifierEffect;
            fireProjectile.damageTypes      = CoreDamageTypes.Fire;
            fireProjectile.name             = "Sequencer_FireProjectile";
            SequencerController.replacementProjectiles.Add(fireProjectile);
            //setting up poison proj;
            Projectile poisonProjectile = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(56) as Gun).DefaultModule.projectiles[0]);

            poisonProjectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(poisonProjectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(poisonProjectile);
            poisonProjectile.transform.parent  = gun.barrelOffset;
            poisonProjectile.baseData.damage   = 20f;
            poisonProjectile.baseData.force   /= 2f;
            poisonProjectile.baseData.range    = 9999;
            poisonProjectile.DefaultTintColor  = Color.green;
            poisonProjectile.HasDefaultTint    = true;
            poisonProjectile.AppliesPoison     = true;
            poisonProjectile.PoisonApplyChance = 100;
            poisonProjectile.healthEffect      = (PickupObjectDatabase.GetById(204) as BulletStatusEffectItem).HealthModifierEffect;
            poisonProjectile.damageTypes       = CoreDamageTypes.Poison;
            poisonProjectile.name = "Sequencer_PoisonProjectile";
            SequencerController.replacementProjectiles.Add(poisonProjectile);
            //setting up electric proj;
            Projectile electricProjectile = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(56) as Gun).DefaultModule.projectiles[0]);

            electricProjectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(electricProjectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(electricProjectile);
            electricProjectile.transform.parent = gun.barrelOffset;
            electricProjectile.baseData.damage  = 28f;
            electricProjectile.baseData.force  /= 2f;
            electricProjectile.baseData.range   = 9999;
            electricProjectile.DefaultTintColor = Color.blue;
            electricProjectile.HasDefaultTint   = true;
            ComplexProjectileModifier chainBullets   = PickupObjectDatabase.GetById(298) as ComplexProjectileModifier;
            ChainLightningModifier    orAddComponent = electricProjectile.gameObject.GetOrAddComponent <ChainLightningModifier>();

            orAddComponent.LinkVFXPrefab       = chainBullets.ChainLightningVFX;
            orAddComponent.damageTypes         = chainBullets.ChainLightningDamageTypes;
            orAddComponent.maximumLinkDistance = chainBullets.ChainLightningMaxLinkDistance;
            orAddComponent.damagePerHit        = chainBullets.ChainLightningDamagePerHit;
            orAddComponent.damageCooldown      = chainBullets.ChainLightningDamageCooldown;
            if (chainBullets.ChainLightningDispersalParticles != null)
            {
                orAddComponent.UsesDispersalParticles        = true;
                orAddComponent.DispersalParticleSystemPrefab = chainBullets.ChainLightningDispersalParticles;
                orAddComponent.DispersalDensity      = chainBullets.ChainLightningDispersalDensity;
                orAddComponent.DispersalMinCoherency = chainBullets.ChainLightningDispersalMinCoherence;
                orAddComponent.DispersalMaxCoherency = chainBullets.ChainLightningDispersalMaxCoherence;
            }
            else
            {
                orAddComponent.UsesDispersalParticles = false;
            }
            electricProjectile.OnDestruction += controller.AddElectricGoop;
            electricProjectile.damageTypes    = CoreDamageTypes.Electric;
            electricProjectile.name           = "Sequencer_ElectricProjectile";
            SequencerController.replacementProjectiles.Add(electricProjectile);
            gun.reloadTime = 1f;
            gun.DefaultModule.numberOfShotsInClip = 3;
            gun.DefaultModule.ammoType            = GameUIAmmoType.AmmoType.CUSTOM;
            gun.SetBaseMaxAmmo(200);
            gun.DefaultModule.projectiles = new List <Projectile> {
                fireProjectile
            };
            gun.quality = PickupObject.ItemQuality.S;
            gun.encounterTrackable.EncounterGuid = "sequencer_gun";
            gun.gunClass = GunClass.PISTOL;
            gun.barrelOffset.transform.localPosition = new Vector3(1.15f, 0.45f, 0f);
            ETGMod.Databases.Items.Add(gun, null, "ANY");
            gun.AddToBlacksmithShop();
            gun.RemovePeskyQuestionmark();
            gun.PlaceItemInAmmonomiconAfterItemById(341);
        }
Example #60
0
        public override Color?GetAlpha(Color lightColor)
        {
            Projectile P = projectile;

            return(new Color(255 - P.alpha, 255 - P.alpha, 255 - P.alpha, 255 - P.alpha));
        }