Example #1
0
 public override bool performToolAction(Tool t)
 {
     if (this.heldObject != null && t != null && !(t is MeleeWeapon) && t.isHeavyHitter())
     {
         this.heldObject.performRemoveAction(this.tileLocation, Game1.currentLocation);
         this.heldObject = null;
         Game1.playSound("axchop");
         return(false);
     }
     if (this.isGate && t != null && (t.GetType() == typeof(Axe) || t is Pickaxe))
     {
         Game1.playSound("axchop");
         Game1.createObjectDebris(325, (int)this.tileLocation.X, (int)this.tileLocation.Y, Game1.player.uniqueMultiplayerID, Game1.player.currentLocation);
         Game1.currentLocation.objects.Remove(this.tileLocation);
         Game1.createRadialDebris(Game1.currentLocation, 12, (int)this.tileLocation.X, (int)this.tileLocation.Y, 6, false, -1, false, -1);
         Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(12, new Vector2(this.tileLocation.X * (float)Game1.tileSize, this.tileLocation.Y * (float)Game1.tileSize), Color.White, 8, Game1.random.NextDouble() < 0.5, 50f, 0, -1, -1f, -1, 0));
     }
     if ((this.whichType == 1 || this.whichType == 5) && (t == null || t.GetType() == typeof(Axe)))
     {
         Game1.playSound("axchop");
         Game1.currentLocation.objects.Remove(this.tileLocation);
         for (int i = 0; i < 4; i++)
         {
             Game1.currentLocation.temporarySprites.Add(new CosmeticDebris(this.fenceTexture, new Vector2(this.tileLocation.X * (float)Game1.tileSize + (float)(Game1.tileSize / 2), this.tileLocation.Y * (float)Game1.tileSize + (float)(Game1.tileSize / 2)), (float)Game1.random.Next(-5, 5) / 100f, (float)Game1.random.Next(-Game1.tileSize, Game1.tileSize) / 30f, (float)Game1.random.Next(-800, -100) / 100f, (int)((this.tileLocation.Y + 1f) * (float)Game1.tileSize), new Rectangle(32 + Game1.random.Next(2) * 16 / 2, 96 + Game1.random.Next(2) * 16 / 2, 8, 8), Color.White, (Game1.soundBank != null) ? Game1.soundBank.GetCue("shiny4") : null, null, 0, 200));
         }
         Game1.createRadialDebris(Game1.currentLocation, 12, (int)this.tileLocation.X, (int)this.tileLocation.Y, 6, false, -1, false, -1);
         Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(12, new Vector2(this.tileLocation.X * (float)Game1.tileSize, this.tileLocation.Y * (float)Game1.tileSize), Color.White, 8, Game1.random.NextDouble() < 0.5, 50f, 0, -1, -1f, -1, 0));
         if (this.maxHealth - this.health < 0.5f)
         {
             int num = this.whichType;
             if (num != 1)
             {
                 if (num == 5)
                 {
                     Game1.currentLocation.debris.Add(new Debris(new Object(298, 1, false, -1, 0), this.tileLocation * (float)Game1.tileSize + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2))));
                 }
             }
             else
             {
                 Game1.currentLocation.debris.Add(new Debris(new Object(322, 1, false, -1, 0), this.tileLocation * (float)Game1.tileSize + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2))));
             }
         }
     }
     else if ((this.whichType == 2 || this.whichType == 3) && (t == null || t.GetType() == typeof(Pickaxe)))
     {
         Game1.playSound("hammer");
         Game1.currentLocation.objects.Remove(this.tileLocation);
         for (int j = 0; j < 4; j++)
         {
             Game1.currentLocation.temporarySprites.Add(new CosmeticDebris(this.fenceTexture, new Vector2(this.tileLocation.X * (float)Game1.tileSize + (float)(Game1.tileSize / 2), this.tileLocation.Y * (float)Game1.tileSize + (float)(Game1.tileSize / 2)), (float)Game1.random.Next(-5, 5) / 100f, (float)Game1.random.Next(-Game1.tileSize, Game1.tileSize) / 30f, (float)Game1.random.Next(-800, -100) / 100f, (int)((this.tileLocation.Y + 1f) * (float)Game1.tileSize), new Rectangle(32 + Game1.random.Next(2) * 16 / 2, 96 + Game1.random.Next(2) * 16 / 2, 8, 8), Color.White, (Game1.soundBank != null) ? Game1.soundBank.GetCue("shiny4") : null, null, 0, 200));
         }
         Game1.createRadialDebris(Game1.currentLocation, 14, (int)this.tileLocation.X, (int)this.tileLocation.Y, 6, false, -1, false, -1);
         Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(12, new Vector2(this.tileLocation.X * (float)Game1.tileSize, this.tileLocation.Y * (float)Game1.tileSize), Color.White, 8, Game1.random.NextDouble() < 0.5, 50f, 0, -1, -1f, -1, 0));
         if (this.maxHealth - this.health < 0.5f)
         {
             int num = this.whichType;
             if (num != 2)
             {
                 if (num == 3)
                 {
                     Game1.currentLocation.debris.Add(new Debris(new Object(324, 1, false, -1, 0), this.tileLocation * (float)Game1.tileSize + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2))));
                 }
             }
             else
             {
                 Game1.currentLocation.debris.Add(new Debris(new Object(323, 1, false, -1, 0), this.tileLocation * (float)Game1.tileSize + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2))));
             }
         }
     }
     return(false);
 }
Example #2
0
        public override bool performToolAction(Tool t, GameLocation location)
        {
            if (heldObject.Value != null && t != null && !(t is MeleeWeapon) && t.isHeavyHitter())
            {
                Object value = heldObject.Value;
                heldObject.Value.performRemoveAction(tileLocation, location);
                heldObject.Value = null;
                Game1.createItemDebris(value.getOne(), base.TileLocation * 64f, -1);
                location.playSound("axchop");
                return(false);
            }
            if ((bool)isGate && t != null && (t is Axe || t is Pickaxe))
            {
                location.playSound("axchop");
                Game1.createObjectDebris(325, (int)tileLocation.X, (int)tileLocation.Y, Game1.player.UniqueMultiplayerID, Game1.player.currentLocation);
                location.objects.Remove(tileLocation);
                Game1.createRadialDebris(location, 12, (int)tileLocation.X, (int)tileLocation.Y, 6, resource: false);
                Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(12, new Vector2(tileLocation.X * 64f, tileLocation.Y * 64f), Color.White, 8, Game1.random.NextDouble() < 0.5, 50f));
            }
            if (((int)whichType == 1 || (int)whichType == 5) && (t == null || t is Axe))
            {
                location.playSound("axchop");
                location.objects.Remove(tileLocation);
                for (int i = 0; i < 4; i++)
                {
                    location.temporarySprites.Add(new CosmeticDebris(fenceTexture.Value, new Vector2(tileLocation.X * 64f + 32f, tileLocation.Y * 64f + 32f), (float)Game1.random.Next(-5, 5) / 100f, (float)Game1.random.Next(-64, 64) / 30f, (float)Game1.random.Next(-800, -100) / 100f, (int)((tileLocation.Y + 1f) * 64f), new Rectangle(32 + Game1.random.Next(2) * 16 / 2, 96 + Game1.random.Next(2) * 16 / 2, 8, 8), Color.White, (Game1.soundBank != null) ? Game1.soundBank.GetCue("shiny4") : null, null, 0, 200));
                }
                Game1.createRadialDebris(location, 12, (int)tileLocation.X, (int)tileLocation.Y, 6, resource: false);
                Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(12, new Vector2(tileLocation.X * 64f, tileLocation.Y * 64f), Color.White, 8, Game1.random.NextDouble() < 0.5, 50f));
                if ((float)maxHealth - (float)health < 0.5f)
                {
                    switch ((int)whichType)
                    {
                    case 1:
                        location.debris.Add(new Debris(new Object(322, 1), tileLocation.Value * 64f + new Vector2(32f, 32f)));
                        break;

                    case 5:
                        location.debris.Add(new Debris(new Object(298, 1), tileLocation.Value * 64f + new Vector2(32f, 32f)));
                        break;
                    }
                }
            }
            else if (((int)whichType == 2 || (int)whichType == 3) && (t == null || t is Pickaxe))
            {
                location.playSound("hammer");
                location.objects.Remove(tileLocation);
                for (int j = 0; j < 4; j++)
                {
                    location.temporarySprites.Add(new CosmeticDebris(fenceTexture.Value, new Vector2(tileLocation.X * 64f + 32f, tileLocation.Y * 64f + 32f), (float)Game1.random.Next(-5, 5) / 100f, (float)Game1.random.Next(-64, 64) / 30f, (float)Game1.random.Next(-800, -100) / 100f, (int)((tileLocation.Y + 1f) * 64f), new Rectangle(32 + Game1.random.Next(2) * 16 / 2, 96 + Game1.random.Next(2) * 16 / 2, 8, 8), Color.White, (Game1.soundBank != null) ? Game1.soundBank.GetCue("shiny4") : null, null, 0, 200));
                }
                Game1.createRadialDebris(location, 14, (int)tileLocation.X, (int)tileLocation.Y, 6, resource: false);
                Game1.multiplayer.broadcastSprites(location, new TemporaryAnimatedSprite(12, new Vector2(tileLocation.X * 64f, tileLocation.Y * 64f), Color.White, 8, Game1.random.NextDouble() < 0.5, 50f));
                if ((float)maxHealth - (float)health < 0.5f)
                {
                    switch ((int)whichType)
                    {
                    case 2:
                        location.debris.Add(new Debris(new Object(323, 1), tileLocation.Value * 64f + new Vector2(32f, 32f)));
                        break;

                    case 3:
                        location.debris.Add(new Debris(new Object(324, 1), tileLocation.Value * 64f + new Vector2(32f, 32f)));
                        break;
                    }
                }
            }
            return(false);
        }