Example #1
0
 private void WorldGen_AddUpAlignmentCounts(On.Terraria.WorldGen.orig_AddUpAlignmentCounts orig, bool clearCounts)
 {
     int[] tileCounts = WorldGen.tileCounts;
     if (clearCounts)
     {
         OriginWorld.totalDefiled2 = 0;
         OriginWorld.totalRiven2   = 0;
     }
     OriginWorld.totalDefiled2 += tileCounts[MC.TileType <Defiled_Stone>()] + tileCounts[MC.TileType <Defiled_Grass>()] + tileCounts[MC.TileType <Defiled_Sand>()] + tileCounts[MC.TileType <Defiled_Ice>()];
     OriginWorld.totalDefiled2 += tileCounts[MC.TileType <Tiles.Riven.Riven_Flesh>()];
     orig(clearCounts);
 }
Example #2
0
        private void MineDamage(orig_MinePower orig, int minePower, ref int damage)
        {
            ModTile modTile = MC.GetModTile(Main.tile[Player.tileTargetX, Player.tileTargetY].type);

            if (modTile is null)
            {
                damage += minePower;
            }
            else if (modTile is IComplexMineDamageTile damageTile)
            {
                damageTile.MinePower(Player.tileTargetX, Player.tileTargetY, minePower, ref damage);
            }
            else
            {
                damage += ((int)(minePower / modTile.mineResist));
            }
        }